From 73635d84bf3527c6b3cbd8d5c139b10f888a2bd4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 2 Sep 2022 11:38:09 +0900 Subject: [PATCH] [renderer] Add stubs for Draw_FontString Draw_FontString is for font-based text rendering. Nothing is implemented at this stage. --- include/QF/GL/qf_draw.h | 1 + include/QF/GLSL/qf_draw.h | 1 + include/QF/Vulkan/qf_draw.h | 2 ++ include/QF/draw.h | 1 + include/QF/plugin/vid_render.h | 1 + libs/video/renderer/gl/gl_draw.c | 5 +++++ libs/video/renderer/glsl/glsl_draw.c | 5 +++++ libs/video/renderer/r_progs.c | 10 ++++++++++ libs/video/renderer/sw/draw.c | 5 +++++ libs/video/renderer/vid_render_gl.c | 1 + libs/video/renderer/vid_render_glsl.c | 1 + libs/video/renderer/vid_render_sw.c | 1 + libs/video/renderer/vid_render_vulkan.c | 7 +++++++ libs/video/renderer/vulkan/vulkan_draw.c | 5 +++++ 14 files changed, 46 insertions(+) diff --git a/include/QF/GL/qf_draw.h b/include/QF/GL/qf_draw.h index 9e2f4e8d6..30315e7b0 100644 --- a/include/QF/GL/qf_draw.h +++ b/include/QF/GL/qf_draw.h @@ -56,6 +56,7 @@ void gl_Draw_Picf (float x, float y, struct qpic_s *pic); void gl_Draw_SubPic(int x, int y, struct qpic_s *pic, int srcx, int srcy, int width, int height); void gl_Draw_AddFont (struct rfont_s *font); +void gl_Draw_FontString (int x, int y, const char *str); void GL_Set2D (void); void GL_Set2DScaled (void); diff --git a/include/QF/GLSL/qf_draw.h b/include/QF/GLSL/qf_draw.h index e38b39d92..ea9b3e5dc 100644 --- a/include/QF/GLSL/qf_draw.h +++ b/include/QF/GLSL/qf_draw.h @@ -56,6 +56,7 @@ void glsl_Draw_Picf (float x, float y, struct qpic_s *pic); void glsl_Draw_SubPic(int x, int y, struct qpic_s *pic, int srcx, int srcy, int width, int height); void glsl_Draw_AddFont (struct rfont_s *font); +void glsl_Draw_FontString (int x, int y, const char *str); void GLSL_Set2D (void); void GLSL_Set2DScaled (void); diff --git a/include/QF/Vulkan/qf_draw.h b/include/QF/Vulkan/qf_draw.h index e8a28e40f..8006d1007 100644 --- a/include/QF/Vulkan/qf_draw.h +++ b/include/QF/Vulkan/qf_draw.h @@ -73,6 +73,8 @@ void Vulkan_Draw_SubPic(int x, int y, struct qpic_s *pic, int srcx, int srcy, int width, int height, struct vulkan_ctx_s *ctx); void Vulkan_Draw_AddFont (struct rfont_s *font, struct vulkan_ctx_s *ctx); +void Vulkan_Draw_FontString (int x, int y, const char *str, + struct vulkan_ctx_s *ctx); void Vulkan_Set2D (struct vulkan_ctx_s *ctx); void Vulkan_Set2DScaled (struct vulkan_ctx_s *ctx); diff --git a/include/QF/draw.h b/include/QF/draw.h index 9e0bf654e..532ea7a54 100644 --- a/include/QF/draw.h +++ b/include/QF/draw.h @@ -246,6 +246,7 @@ void Draw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int h struct rfont_s; void Draw_AddFont (struct rfont_s *font); +void Draw_FontString (int x, int y, const char *str); ///@} diff --git a/include/QF/plugin/vid_render.h b/include/QF/plugin/vid_render.h index a8a6c418e..81365fbcd 100644 --- a/include/QF/plugin/vid_render.h +++ b/include/QF/plugin/vid_render.h @@ -105,6 +105,7 @@ typedef struct vid_render_funcs_s { void (*Draw_Picf) (float x, float y, qpic_t *pic); void (*Draw_SubPic) (int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height); void (*Draw_AddFont) (struct rfont_s *font); + void (*Draw_FontString) (int x, int y, const char *str); struct psystem_s *(*ParticleSystem) (void); diff --git a/libs/video/renderer/gl/gl_draw.c b/libs/video/renderer/gl/gl_draw.c index 084104165..a12cdf86c 100644 --- a/libs/video/renderer/gl/gl_draw.c +++ b/libs/video/renderer/gl/gl_draw.c @@ -1023,3 +1023,8 @@ void gl_Draw_AddFont (struct rfont_s *font) { } + +void +gl_Draw_FontString (int x, int y, const char *str) +{ +} diff --git a/libs/video/renderer/glsl/glsl_draw.c b/libs/video/renderer/glsl/glsl_draw.c index 707fcdcb8..dcd9b0fb7 100644 --- a/libs/video/renderer/glsl/glsl_draw.c +++ b/libs/video/renderer/glsl/glsl_draw.c @@ -846,3 +846,8 @@ void glsl_Draw_AddFont (struct rfont_s *font) { } + +void +glsl_Draw_FontString (int x, int y, const char *str) +{ +} diff --git a/libs/video/renderer/r_progs.c b/libs/video/renderer/r_progs.c index 387b2989e..b8ee72019 100644 --- a/libs/video/renderer/r_progs.c +++ b/libs/video/renderer/r_progs.c @@ -346,6 +346,15 @@ bi_Font_Load (progs_t *pr, void *_res) r_funcs->Draw_AddFont (font); } +static void +bi_Font_String (progs_t *pr, void *_res) +{ + int x = P_INT (pr, 0); + int y = P_INT (pr, 1); + const char *str = P_GSTRING (pr, 2); + r_funcs->Draw_FontString (x, y, str); +} + static const char * bi_draw_get_key (const void *p, void *unused) { @@ -397,6 +406,7 @@ static builtin_t builtins[] = { bi(Draw_Crosshair, 5, p(int), p(int), p(int), p(int)), bi(Font_Load, 3, p(string), p(int), p(ptr)), + bi(Font_String, 3, p(int), p(int), p(string)), {0} }; diff --git a/libs/video/renderer/sw/draw.c b/libs/video/renderer/sw/draw.c index 4a9ba34cc..671244755 100644 --- a/libs/video/renderer/sw/draw.c +++ b/libs/video/renderer/sw/draw.c @@ -979,3 +979,8 @@ void Draw_AddFont (struct rfont_s *font) { } + +void +Draw_FontString (int x, int y, const char *str) +{ +} diff --git a/libs/video/renderer/vid_render_gl.c b/libs/video/renderer/vid_render_gl.c index 3e165bdf7..ea8a10049 100644 --- a/libs/video/renderer/vid_render_gl.c +++ b/libs/video/renderer/vid_render_gl.c @@ -508,6 +508,7 @@ vid_render_funcs_t gl_vid_render_funcs = { gl_Draw_Picf, gl_Draw_SubPic, gl_Draw_AddFont, + gl_Draw_FontString, gl_ParticleSystem, gl_R_Init, diff --git a/libs/video/renderer/vid_render_glsl.c b/libs/video/renderer/vid_render_glsl.c index 12b0425eb..2ffb0cf22 100644 --- a/libs/video/renderer/vid_render_glsl.c +++ b/libs/video/renderer/vid_render_glsl.c @@ -452,6 +452,7 @@ vid_render_funcs_t glsl_vid_render_funcs = { glsl_Draw_Picf, glsl_Draw_SubPic, glsl_Draw_AddFont, + glsl_Draw_FontString, glsl_ParticleSystem, glsl_R_Init, diff --git a/libs/video/renderer/vid_render_sw.c b/libs/video/renderer/vid_render_sw.c index b9bb753d1..2dc9b8a42 100644 --- a/libs/video/renderer/vid_render_sw.c +++ b/libs/video/renderer/vid_render_sw.c @@ -472,6 +472,7 @@ vid_render_funcs_t sw_vid_render_funcs = { Draw_Picf, Draw_SubPic, Draw_AddFont, + Draw_FontString, sw_ParticleSystem, sw_R_Init, diff --git a/libs/video/renderer/vid_render_vulkan.c b/libs/video/renderer/vid_render_vulkan.c index 85033e9c7..6519f1740 100644 --- a/libs/video/renderer/vid_render_vulkan.c +++ b/libs/video/renderer/vid_render_vulkan.c @@ -267,6 +267,12 @@ vulkan_Draw_AddFont (struct rfont_s *font) Vulkan_Draw_AddFont (font, vulkan_ctx); } +static void +vulkan_Draw_FontString (int x, int y, const char *str) +{ + Vulkan_Draw_FontString (x, y, str, vulkan_ctx); +} + static void vulkan_begin_frame (void) { @@ -756,6 +762,7 @@ vid_render_funcs_t vulkan_vid_render_funcs = { vulkan_Draw_Picf, vulkan_Draw_SubPic, vulkan_Draw_AddFont, + vulkan_Draw_FontString, vulkan_ParticleSystem, vulkan_R_Init, diff --git a/libs/video/renderer/vulkan/vulkan_draw.c b/libs/video/renderer/vulkan/vulkan_draw.c index 29d93f65d..6b78a9b5d 100644 --- a/libs/video/renderer/vulkan/vulkan_draw.c +++ b/libs/video/renderer/vulkan/vulkan_draw.c @@ -972,3 +972,8 @@ Vulkan_Draw_AddFont (rfont_t *font, vulkan_ctx_t *ctx) dctx->font_tex = Vulkan_LoadTex (ctx, &tex, 0, "draw.font"); } } + +void +Vulkan_Draw_FontString (int x, int y, const char *str, vulkan_ctx_t *ctx) +{ +}