From ef37ed39a91f4a00998ecef6a12cc715dc052ca4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 17 Feb 2012 18:57:13 +0900 Subject: [PATCH] Clean up global symbols for the glsl renderer. Where possible, symbols have been made static, prefixed with glsl_/GLSL_ or moved into the code shared by all renderers. This will make doing plugins easier but done now for link testing. The moving was done via the gl commit. --- include/QF/GLSL/qf_textures.h | 31 ++++---- include/QF/GLSL/qf_vid.h | 8 +- libs/models/alias/glsl_model_alias.c | 6 +- libs/models/brush/glsl_model_brush.c | 8 +- libs/models/sprite/glsl_model_sprite.c | 8 +- libs/video/renderer/glsl/glsl_alias.c | 45 +++++------ libs/video/renderer/glsl/glsl_bsp.c | 96 ++++++++++++----------- libs/video/renderer/glsl/glsl_draw.c | 44 ++++++----- libs/video/renderer/glsl/glsl_lightmap.c | 12 +-- libs/video/renderer/glsl/glsl_main.c | 7 -- libs/video/renderer/glsl/glsl_particles.c | 42 +++++----- libs/video/renderer/glsl/glsl_sprite.c | 32 ++++---- libs/video/renderer/glsl/glsl_textures.c | 41 +++++----- libs/video/targets/vid_common_glsl.c | 14 ++-- 14 files changed, 196 insertions(+), 198 deletions(-) diff --git a/include/QF/GLSL/qf_textures.h b/include/QF/GLSL/qf_textures.h index 34779a30a..497fb0c7d 100644 --- a/include/QF/GLSL/qf_textures.h +++ b/include/QF/GLSL/qf_textures.h @@ -42,24 +42,21 @@ typedef struct subpic_s { const float size; ///< size factor for tex coords (mult) } subpic_t; -int GL_LoadQuakeTexture (const char *identifier, int width, int height, - byte *data); +int GLSL_LoadQuakeTexture (const char *identifier, int width, int height, + byte *data); struct texture_s; -int GL_LoadQuakeMipTex (const struct texture_s *tex); -int GL_LoadRGBTexture (const char *identifier, int width, int height, - byte *data); -void GL_ReleaseTexture (int tex); -void GL_TextureInit (void); +int GLSL_LoadQuakeMipTex (const struct texture_s *tex); +int GLSL_LoadRGBTexture (const char *identifier, int width, int height, + byte *data); +void GLSL_ReleaseTexture (int tex); +void GLSL_TextureInit (void); -scrap_t *GL_CreateScrap (int size, int format); -void GL_DestroyScrap (scrap_t *scrap); -void GL_ScrapClear (scrap_t *scrap); -int GL_ScrapTexture (scrap_t *scrap); -subpic_t *GL_ScrapSubpic (scrap_t *scrap, int width, int height); //XXX slow! -void GL_SubpicDelete (subpic_t *subpic); //XXX slow! -void GL_SubpicUpdate (subpic_t *subpic, byte *data); - -int GL_LoadTexture (const char *identifier, int width, int height, byte *data, - qboolean mipmap, qboolean alpha, int bytesperpixel); +scrap_t *GLSL_CreateScrap (int size, int format); +void GLSL_DestroyScrap (scrap_t *scrap); +void GLSL_ScrapClear (scrap_t *scrap); +int GLSL_ScrapTexture (scrap_t *scrap); +subpic_t *GLSL_ScrapSubpic (scrap_t *scrap, int width, int height); //XXX slow! +void GLSL_SubpicDelete (subpic_t *subpic); //XXX slow! +void GLSL_SubpicUpdate (subpic_t *subpic, byte *data); #endif//__QF_GLSL_textures_h diff --git a/include/QF/GLSL/qf_vid.h b/include/QF/GLSL/qf_vid.h index a710d24b6..32f5c4d7e 100644 --- a/include/QF/GLSL/qf_vid.h +++ b/include/QF/GLSL/qf_vid.h @@ -41,9 +41,9 @@ extern int glsl_palette; extern int glsl_colormap; void GL_EndRendering (void); -int GL_CompileShader (const char *name, const char *shader_src, int type); -int GL_LinkProgram (const char *name, int vert, int frag); -int GL_ResolveShaderParam (int program, shaderparam_t *param); -void GL_DumpAttribArrays (void); +int GLSL_CompileShader (const char *name, const char *shader_src, int type); +int GLSL_LinkProgram (const char *name, int vert, int frag); +int GLSL_ResolveShaderParam (int program, shaderparam_t *param); +void GLSL_DumpAttribArrays (void); #endif // __QF_GLSL_vid_h diff --git a/libs/models/alias/glsl_model_alias.c b/libs/models/alias/glsl_model_alias.c index 790290cdc..580cbe3fd 100644 --- a/libs/models/alias/glsl_model_alias.c +++ b/libs/models/alias/glsl_model_alias.c @@ -81,10 +81,10 @@ glsl_alias_clear (model_t *m) if (skins[i].type == ALIAS_SKIN_GROUP) { group = (maliasskingroup_t *) ((byte *) hdr + skins[i].skin); for (j = 0; j < group->numskins; j++) { - GL_ReleaseTexture (group->skindescs[j].texnum); + GLSL_ReleaseTexture (group->skindescs[j].texnum); } } else { - GL_ReleaseTexture (skins[i].texnum); + GLSL_ReleaseTexture (skins[i].texnum); } } @@ -111,7 +111,7 @@ Mod_LoadSkin (byte *skin, int skinsize, int snum, int gnum, qboolean group, name = va ("%s_%i_%i", loadmodel->name, snum, gnum); else name = va ("%s_%i", loadmodel->name, snum); - skindesc->texnum = GL_LoadQuakeTexture (name, w, h, tskin); + skindesc->texnum = GLSL_LoadQuakeTexture (name, w, h, tskin); free (tskin); return skin + skinsize; } diff --git a/libs/models/brush/glsl_model_brush.c b/libs/models/brush/glsl_model_brush.c index faf9ba07d..692491717 100644 --- a/libs/models/brush/glsl_model_brush.c +++ b/libs/models/brush/glsl_model_brush.c @@ -67,7 +67,7 @@ glsl_brush_clear (model_t *m) for (i = 0; i < m->numtextures; i++) { // NOTE: some maps (eg e1m2) have empty texture slots if (m->textures[i] && m->textures[i]->gl_texturenum) { - GL_ReleaseTexture (m->textures[i]->gl_texturenum); + GLSL_ReleaseTexture (m->textures[i]->gl_texturenum); m->textures[i]->gl_texturenum = 0; } } @@ -97,14 +97,14 @@ Mod_ProcessTexture (texture_t *tx) for (i = 0; i < 2; i++) { for (j = 0; j < 128; j++) memcpy (&data[j * 128], &tx_data[j * 256 + i * 128], 128); - tx->sky_tex[i] = GL_LoadQuakeTexture (tx->name, 128, 128, data); - // GL_LoadQuakeTexture () leaves the texture bound + tx->sky_tex[i] = GLSL_LoadQuakeTexture (tx->name, 128, 128, data); + // GLSL_LoadQuakeTexture () leaves the texture bound qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); qfglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); } tx->gl_texturenum = 0; } else { - tx->gl_texturenum = GL_LoadQuakeMipTex (tx); + tx->gl_texturenum = GLSL_LoadQuakeMipTex (tx); } } diff --git a/libs/models/sprite/glsl_model_sprite.c b/libs/models/sprite/glsl_model_sprite.c index cfb7d4229..42d5ca434 100644 --- a/libs/models/sprite/glsl_model_sprite.c +++ b/libs/models/sprite/glsl_model_sprite.c @@ -61,12 +61,12 @@ glsl_sprite_clear (model_t *m) for (i = 0; i < sprite->numframes; i++) { if (sprite->frames[i].type == SPR_SINGLE) { frame = sprite->frames[i].frameptr; - GL_ReleaseTexture (frame->gl_texturenum); + GLSL_ReleaseTexture (frame->gl_texturenum); } else { group = (mspritegroup_t *) sprite->frames[i].frameptr; for (j = 0; j < group->numframes; j++) { frame = group->frames[j]; - GL_ReleaseTexture (frame->gl_texturenum); + GLSL_ReleaseTexture (frame->gl_texturenum); } } } @@ -80,6 +80,6 @@ Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum) loadmodel->clear = glsl_sprite_clear; name = va ("%s_%i", loadmodel->name, framenum); pspriteframe->gl_texturenum = - GL_LoadQuakeTexture (name, pspriteframe->width, pspriteframe->height, - pspriteframe->pixels); + GLSL_LoadQuakeTexture (name, pspriteframe->width, pspriteframe->height, + pspriteframe->pixels); } diff --git a/libs/video/renderer/glsl/glsl_alias.c b/libs/video/renderer/glsl/glsl_alias.c index c91e74d96..15e5b8697 100644 --- a/libs/video/renderer/glsl/glsl_alias.c +++ b/libs/video/renderer/glsl/glsl_alias.c @@ -110,28 +110,29 @@ R_InitAlias (void) int vert; int frag; - vert = GL_CompileShader ("quakemdl.vert", quakemdl_vert, GL_VERTEX_SHADER); - frag = GL_CompileShader ("quakemdl.frag", quakemdl_frag, - GL_FRAGMENT_SHADER); - quake_mdl.program = GL_LinkProgram ("quakemdl", vert, frag); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.mvp_matrix); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.norm_matrix); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.skin_size); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.blend); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.colora); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.colorb); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.sta); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.stb); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.normala); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.normalb); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.vertexa); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.vertexb); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.colormap); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.skin); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.ambient); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.shadelight); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.lightvec); - GL_ResolveShaderParam (quake_mdl.program, &quake_mdl.fog); + vert = GLSL_CompileShader ("quakemdl.vert", quakemdl_vert, + GL_VERTEX_SHADER); + frag = GLSL_CompileShader ("quakemdl.frag", quakemdl_frag, + GL_FRAGMENT_SHADER); + quake_mdl.program = GLSL_LinkProgram ("quakemdl", vert, frag); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.mvp_matrix); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.norm_matrix); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.skin_size); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.blend); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.colora); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.colorb); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.sta); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.stb); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.normala); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.normalb); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.vertexa); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.vertexb); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.colormap); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.skin); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.ambient); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.shadelight); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.lightvec); + GLSL_ResolveShaderParam (quake_mdl.program, &quake_mdl.fog); } static void diff --git a/libs/video/renderer/glsl/glsl_bsp.c b/libs/video/renderer/glsl/glsl_bsp.c index 8282a860f..990dffd59 100644 --- a/libs/video/renderer/glsl/glsl_bsp.c +++ b/libs/video/renderer/glsl/glsl_bsp.c @@ -66,10 +66,10 @@ typedef struct { #define ALLOC_CHUNK 64 -instsurf_t *waterchain = NULL; -instsurf_t **waterchain_tail = &waterchain; -instsurf_t *sky_chain; -instsurf_t **sky_chain_tail = &sky_chain; +static instsurf_t *waterchain = NULL; +static instsurf_t **waterchain_tail = &waterchain; +static instsurf_t *sky_chain; +static instsurf_t **sky_chain_tail = &sky_chain; static texture_t **r_texture_chains; static int r_num_texture_chains; @@ -1225,52 +1225,54 @@ R_InitBsp (void) int vert; int frag; - vert = GL_CompileShader ("quakebsp.vert", quakebsp_vert, GL_VERTEX_SHADER); - frag = GL_CompileShader ("quakebsp.frag", quakebsp_frag, - GL_FRAGMENT_SHADER); - quake_bsp.program = GL_LinkProgram ("quakebsp", vert, frag); - GL_ResolveShaderParam (quake_bsp.program, &quake_bsp.mvp_matrix); - GL_ResolveShaderParam (quake_bsp.program, &quake_bsp.tlst); - GL_ResolveShaderParam (quake_bsp.program, &quake_bsp.vertex); - GL_ResolveShaderParam (quake_bsp.program, &quake_bsp.colormap); - GL_ResolveShaderParam (quake_bsp.program, &quake_bsp.texture); - GL_ResolveShaderParam (quake_bsp.program, &quake_bsp.lightmap); - GL_ResolveShaderParam (quake_bsp.program, &quake_bsp.color); - GL_ResolveShaderParam (quake_bsp.program, &quake_bsp.fog); + vert = GLSL_CompileShader ("quakebsp.vert", quakebsp_vert, + GL_VERTEX_SHADER); + frag = GLSL_CompileShader ("quakebsp.frag", quakebsp_frag, + GL_FRAGMENT_SHADER); + quake_bsp.program = GLSL_LinkProgram ("quakebsp", vert, frag); + GLSL_ResolveShaderParam (quake_bsp.program, &quake_bsp.mvp_matrix); + GLSL_ResolveShaderParam (quake_bsp.program, &quake_bsp.tlst); + GLSL_ResolveShaderParam (quake_bsp.program, &quake_bsp.vertex); + GLSL_ResolveShaderParam (quake_bsp.program, &quake_bsp.colormap); + GLSL_ResolveShaderParam (quake_bsp.program, &quake_bsp.texture); + GLSL_ResolveShaderParam (quake_bsp.program, &quake_bsp.lightmap); + GLSL_ResolveShaderParam (quake_bsp.program, &quake_bsp.color); + GLSL_ResolveShaderParam (quake_bsp.program, &quake_bsp.fog); - frag = GL_CompileShader ("quaketrb.frag", quaketurb_frag, - GL_FRAGMENT_SHADER); - quake_turb.program = GL_LinkProgram ("quaketrb", vert, frag); - GL_ResolveShaderParam (quake_turb.program, &quake_turb.mvp_matrix); - GL_ResolveShaderParam (quake_turb.program, &quake_turb.tlst); - GL_ResolveShaderParam (quake_turb.program, &quake_turb.vertex); - GL_ResolveShaderParam (quake_turb.program, &quake_turb.palette); - GL_ResolveShaderParam (quake_turb.program, &quake_turb.texture); - GL_ResolveShaderParam (quake_turb.program, &quake_turb.realtime); - GL_ResolveShaderParam (quake_turb.program, &quake_turb.color); - GL_ResolveShaderParam (quake_turb.program, &quake_turb.fog); + frag = GLSL_CompileShader ("quaketrb.frag", quaketurb_frag, + GL_FRAGMENT_SHADER); + quake_turb.program = GLSL_LinkProgram ("quaketrb", vert, frag); + GLSL_ResolveShaderParam (quake_turb.program, &quake_turb.mvp_matrix); + GLSL_ResolveShaderParam (quake_turb.program, &quake_turb.tlst); + GLSL_ResolveShaderParam (quake_turb.program, &quake_turb.vertex); + GLSL_ResolveShaderParam (quake_turb.program, &quake_turb.palette); + GLSL_ResolveShaderParam (quake_turb.program, &quake_turb.texture); + GLSL_ResolveShaderParam (quake_turb.program, &quake_turb.realtime); + GLSL_ResolveShaderParam (quake_turb.program, &quake_turb.color); + GLSL_ResolveShaderParam (quake_turb.program, &quake_turb.fog); - vert = GL_CompileShader ("quakesky.vert", quakesky_vert, GL_VERTEX_SHADER); - frag = GL_CompileShader ("quakeski.frag", quakeskyid_frag, - GL_FRAGMENT_SHADER); - quake_skyid.program = GL_LinkProgram ("quakeskyid", vert, frag); - GL_ResolveShaderParam (quake_skyid.program, &quake_skyid.mvp_matrix); - GL_ResolveShaderParam (quake_skyid.program, &quake_skyid.sky_matrix); - GL_ResolveShaderParam (quake_skyid.program, &quake_skyid.vertex); - GL_ResolveShaderParam (quake_skyid.program, &quake_skyid.palette); - GL_ResolveShaderParam (quake_skyid.program, &quake_skyid.solid); - GL_ResolveShaderParam (quake_skyid.program, &quake_skyid.trans); - GL_ResolveShaderParam (quake_skyid.program, &quake_skyid.realtime); - GL_ResolveShaderParam (quake_skyid.program, &quake_skyid.fog); + vert = GLSL_CompileShader ("quakesky.vert", quakesky_vert, + GL_VERTEX_SHADER); + frag = GLSL_CompileShader ("quakeski.frag", quakeskyid_frag, + GL_FRAGMENT_SHADER); + quake_skyid.program = GLSL_LinkProgram ("quakeskyid", vert, frag); + GLSL_ResolveShaderParam (quake_skyid.program, &quake_skyid.mvp_matrix); + GLSL_ResolveShaderParam (quake_skyid.program, &quake_skyid.sky_matrix); + GLSL_ResolveShaderParam (quake_skyid.program, &quake_skyid.vertex); + GLSL_ResolveShaderParam (quake_skyid.program, &quake_skyid.palette); + GLSL_ResolveShaderParam (quake_skyid.program, &quake_skyid.solid); + GLSL_ResolveShaderParam (quake_skyid.program, &quake_skyid.trans); + GLSL_ResolveShaderParam (quake_skyid.program, &quake_skyid.realtime); + GLSL_ResolveShaderParam (quake_skyid.program, &quake_skyid.fog); - frag = GL_CompileShader ("quakeskb.frag", quakeskybox_frag, - GL_FRAGMENT_SHADER); - quake_skybox.program = GL_LinkProgram ("quakeskybox", vert, frag); - GL_ResolveShaderParam (quake_skybox.program, &quake_skybox.mvp_matrix); - GL_ResolveShaderParam (quake_skybox.program, &quake_skybox.sky_matrix); - GL_ResolveShaderParam (quake_skybox.program, &quake_skybox.vertex); - GL_ResolveShaderParam (quake_skybox.program, &quake_skybox.sky); - GL_ResolveShaderParam (quake_skybox.program, &quake_skybox.fog); + frag = GLSL_CompileShader ("quakeskb.frag", quakeskybox_frag, + GL_FRAGMENT_SHADER); + quake_skybox.program = GLSL_LinkProgram ("quakeskybox", vert, frag); + GLSL_ResolveShaderParam (quake_skybox.program, &quake_skybox.mvp_matrix); + GLSL_ResolveShaderParam (quake_skybox.program, &quake_skybox.sky_matrix); + GLSL_ResolveShaderParam (quake_skybox.program, &quake_skybox.vertex); + GLSL_ResolveShaderParam (quake_skybox.program, &quake_skybox.sky); + GLSL_ResolveShaderParam (quake_skybox.program, &quake_skybox.fog); } static inline int diff --git a/libs/video/renderer/glsl/glsl_draw.c b/libs/video/renderer/glsl/glsl_draw.c index b77ad6130..911dfc0c2 100644 --- a/libs/video/renderer/glsl/glsl_draw.c +++ b/libs/video/renderer/glsl/glsl_draw.c @@ -136,7 +136,8 @@ make_glpic (const char *name, qpic_t *p) pic = malloc (sizeof (qpic_t) + sizeof (glpic_t)); *pic = *p; gl = (glpic_t *) pic->data; - gl->texnum = GL_LoadQuakeTexture (name, p->width, p->height, p->data); + gl->texnum = GLSL_LoadQuakeTexture (name, p->width, p->height, + p->data); } return pic; } @@ -146,7 +147,7 @@ pic_free (qpic_t *pic) { glpic_t *gl = (glpic_t *) pic->data; - GL_ReleaseTexture (gl->texnum); + GLSL_ReleaseTexture (gl->texnum); free (pic); } @@ -395,35 +396,38 @@ Draw_Init (void) crosshaircolor->callback (crosshaircolor); char_queue = dstring_new (); - vert = GL_CompileShader ("quaketxt.vert", quaketext_vert, GL_VERTEX_SHADER); - frag = GL_CompileShader ("quake2d.frag", quake2d_frag, GL_FRAGMENT_SHADER); - quake_text.program = GL_LinkProgram ("quaketxt", vert, frag); - GL_ResolveShaderParam (quake_text.program, &quake_text.charmap); - GL_ResolveShaderParam (quake_text.program, &quake_text.palette); - GL_ResolveShaderParam (quake_text.program, &quake_text.matrix); - GL_ResolveShaderParam (quake_text.program, &quake_text.vertex); - GL_ResolveShaderParam (quake_text.program, &quake_text.color); - GL_ResolveShaderParam (quake_text.program, &quake_text.dchar); + vert = GLSL_CompileShader ("quaketxt.vert", quaketext_vert, + GL_VERTEX_SHADER); + frag = GLSL_CompileShader ("quake2d.frag", quake2d_frag, + GL_FRAGMENT_SHADER); + quake_text.program = GLSL_LinkProgram ("quaketxt", vert, frag); + GLSL_ResolveShaderParam (quake_text.program, &quake_text.charmap); + GLSL_ResolveShaderParam (quake_text.program, &quake_text.palette); + GLSL_ResolveShaderParam (quake_text.program, &quake_text.matrix); + GLSL_ResolveShaderParam (quake_text.program, &quake_text.vertex); + GLSL_ResolveShaderParam (quake_text.program, &quake_text.color); + GLSL_ResolveShaderParam (quake_text.program, &quake_text.dchar); - vert = GL_CompileShader ("quakeico.vert", quakeicon_vert, GL_VERTEX_SHADER); - quake_icon.program = GL_LinkProgram ("quakeico", vert, frag); - GL_ResolveShaderParam (quake_icon.program, &quake_icon.icon); - GL_ResolveShaderParam (quake_icon.program, &quake_icon.palette); - GL_ResolveShaderParam (quake_icon.program, &quake_icon.matrix); - GL_ResolveShaderParam (quake_icon.program, &quake_icon.vertex); - GL_ResolveShaderParam (quake_icon.program, &quake_icon.color); + vert = GLSL_CompileShader ("quakeico.vert", quakeicon_vert, + GL_VERTEX_SHADER); + quake_icon.program = GLSL_LinkProgram ("quakeico", vert, frag); + GLSL_ResolveShaderParam (quake_icon.program, &quake_icon.icon); + GLSL_ResolveShaderParam (quake_icon.program, &quake_icon.palette); + GLSL_ResolveShaderParam (quake_icon.program, &quake_icon.matrix); + GLSL_ResolveShaderParam (quake_icon.program, &quake_icon.vertex); + GLSL_ResolveShaderParam (quake_icon.program, &quake_icon.color); draw_chars = W_GetLumpName ("conchars"); for (i = 0; i < 256 * 64; i++) if (draw_chars[i] == 0) draw_chars[i] = 255; // proper transparent color - char_texture = GL_LoadQuakeTexture ("conchars", 128, 128, draw_chars); + char_texture = GLSL_LoadQuakeTexture ("conchars", 128, 128, draw_chars); pic = (qpic_t *) QFS_LoadFile ("gfx/conback.lmp", 0); if (pic) { SwapPic (pic); - conback_texture = GL_LoadQuakeTexture ("conback", + conback_texture = GLSL_LoadQuakeTexture ("conback", pic->width, pic->height, pic->data); free (pic); diff --git a/libs/video/renderer/glsl/glsl_lightmap.c b/libs/video/renderer/glsl/glsl_lightmap.c index d1401c906..b514de74a 100644 --- a/libs/video/renderer/glsl/glsl_lightmap.c +++ b/libs/video/renderer/glsl/glsl_lightmap.c @@ -140,7 +140,7 @@ R_BuildLightMap_1 (msurface_t *surf) memset (blocklights, 0, size * sizeof (blocklights[0])); if (!r_worldentity.model->lightdata) { // because we by-pass the inversion, "no light" = "full bright" - GL_SubpicUpdate (surf->lightpic, (byte *) blocklights); + GLSL_SubpicUpdate (surf->lightpic, (byte *) blocklights); return; } @@ -173,7 +173,7 @@ R_BuildLightMap_1 (msurface_t *surf) *out++ = t; } - GL_SubpicUpdate (surf->lightpic, (byte *) blocklights); + GLSL_SubpicUpdate (surf->lightpic, (byte *) blocklights); } static void @@ -182,7 +182,7 @@ create_surf_lightmap (msurface_t *surf) int smax, tmax; smax = (surf->extents[0] >> 4) + 1; tmax = (surf->extents[1] >> 4) + 1; - surf->lightpic = GL_ScrapSubpic (light_scrap, smax, tmax); + surf->lightpic = GLSL_ScrapSubpic (light_scrap, smax, tmax); if (!surf->lightpic) Sys_Error ("FIXME taniwha is being lazy"); if (smax > bl_extents[0]) @@ -199,10 +199,10 @@ R_BuildLightmaps (model_t **models, int num_models) //FIXME RGB support if (!light_scrap) { - light_scrap = GL_CreateScrap (2048, GL_LUMINANCE); + light_scrap = GLSL_CreateScrap (2048, GL_LUMINANCE); light_data = malloc (BLOCK_SIZE * MAX_LIGHTMAPS); } else { - GL_ScrapClear (light_scrap); + GLSL_ScrapClear (light_scrap); memset (light_data, 0, BLOCK_SIZE * MAX_LIGHTMAPS); } R_BuildLightMap = R_BuildLightMap_1; @@ -249,5 +249,5 @@ R_BuildLightmaps (model_t **models, int num_models) int R_LightmapTexture (void) { - return GL_ScrapTexture (light_scrap); + return GLSL_ScrapTexture (light_scrap); } diff --git a/libs/video/renderer/glsl/glsl_main.c b/libs/video/renderer/glsl/glsl_main.c index 67c96ce86..965046162 100644 --- a/libs/video/renderer/glsl/glsl_main.c +++ b/libs/video/renderer/glsl/glsl_main.c @@ -282,13 +282,6 @@ R_LineGraph (int x, int y, int *h_vals, int count) { } -VISIBLE int -GL_LoadTexture (const char *identifier, int width, int height, byte *data, - qboolean mipmap, qboolean alpha, int bytesperpixel) -{ - return 0; -} - VISIBLE void R_ClearState (void) { diff --git a/libs/video/renderer/glsl/glsl_particles.c b/libs/video/renderer/glsl/glsl_particles.c index 62fd0b61d..f9ac33e9c 100644 --- a/libs/video/renderer/glsl/glsl_particles.c +++ b/libs/video/renderer/glsl/glsl_particles.c @@ -220,28 +220,28 @@ R_InitParticles (void) qfglGetFloatv (GL_ALIASED_POINT_SIZE_RANGE, v); Sys_MaskPrintf (SYS_GLSL, "point size: %g - %g\n", v[0], v[1]); - vert = GL_CompileShader ("quakepnt.vert", quakepoint_vert, - GL_VERTEX_SHADER); - frag = GL_CompileShader ("quakepnt.frag", quakepoint_frag, - GL_FRAGMENT_SHADER); - quake_point.program = GL_LinkProgram ("quakepoint", vert, frag); - GL_ResolveShaderParam (quake_point.program, &quake_point.mvp_matrix); - GL_ResolveShaderParam (quake_point.program, &quake_point.vertex); - GL_ResolveShaderParam (quake_point.program, &quake_point.palette); - GL_ResolveShaderParam (quake_point.program, &quake_point.color); - GL_ResolveShaderParam (quake_point.program, &quake_point.fog); + vert = GLSL_CompileShader ("quakepnt.vert", quakepoint_vert, + GL_VERTEX_SHADER); + frag = GLSL_CompileShader ("quakepnt.frag", quakepoint_frag, + GL_FRAGMENT_SHADER); + quake_point.program = GLSL_LinkProgram ("quakepoint", vert, frag); + GLSL_ResolveShaderParam (quake_point.program, &quake_point.mvp_matrix); + GLSL_ResolveShaderParam (quake_point.program, &quake_point.vertex); + GLSL_ResolveShaderParam (quake_point.program, &quake_point.palette); + GLSL_ResolveShaderParam (quake_point.program, &quake_point.color); + GLSL_ResolveShaderParam (quake_point.program, &quake_point.fog); - vert = GL_CompileShader ("quakepar.vert", quakepart_vert, - GL_VERTEX_SHADER); - frag = GL_CompileShader ("quakepar.frag", quakepart_frag, - GL_FRAGMENT_SHADER); - quake_part.program = GL_LinkProgram ("quakepart", vert, frag); - GL_ResolveShaderParam (quake_part.program, &quake_part.mvp_matrix); - GL_ResolveShaderParam (quake_part.program, &quake_part.st); - GL_ResolveShaderParam (quake_part.program, &quake_part.vertex); - GL_ResolveShaderParam (quake_part.program, &quake_part.color); - GL_ResolveShaderParam (quake_part.program, &quake_part.texture); - GL_ResolveShaderParam (quake_part.program, &quake_part.fog); + vert = GLSL_CompileShader ("quakepar.vert", quakepart_vert, + GL_VERTEX_SHADER); + frag = GLSL_CompileShader ("quakepar.frag", quakepart_frag, + GL_FRAGMENT_SHADER); + quake_part.program = GLSL_LinkProgram ("quakepart", vert, frag); + GLSL_ResolveShaderParam (quake_part.program, &quake_part.mvp_matrix); + GLSL_ResolveShaderParam (quake_part.program, &quake_part.st); + GLSL_ResolveShaderParam (quake_part.program, &quake_part.vertex); + GLSL_ResolveShaderParam (quake_part.program, &quake_part.color); + GLSL_ResolveShaderParam (quake_part.program, &quake_part.texture); + GLSL_ResolveShaderParam (quake_part.program, &quake_part.fog); memset (data, 0, sizeof (data)); qfglGenTextures (1, &part_tex); diff --git a/libs/video/renderer/glsl/glsl_sprite.c b/libs/video/renderer/glsl/glsl_sprite.c index 0341576d8..bff43a61b 100644 --- a/libs/video/renderer/glsl/glsl_sprite.c +++ b/libs/video/renderer/glsl/glsl_sprite.c @@ -97,22 +97,22 @@ R_InitSprites (void) { int frag, vert; - vert = GL_CompileShader ("quakespr.vert", quakesprite_vert, - GL_VERTEX_SHADER); - frag = GL_CompileShader ("quakespr.frag", quakesprite_frag, - GL_FRAGMENT_SHADER); - quake_sprite.program = GL_LinkProgram ("quakespr", vert, frag); - GL_ResolveShaderParam (quake_sprite.program, &quake_sprite.spritea); - GL_ResolveShaderParam (quake_sprite.program, &quake_sprite.spriteb); - GL_ResolveShaderParam (quake_sprite.program, &quake_sprite.palette); - GL_ResolveShaderParam (quake_sprite.program, &quake_sprite.matrix); - GL_ResolveShaderParam (quake_sprite.program, &quake_sprite.vertexa); - GL_ResolveShaderParam (quake_sprite.program, &quake_sprite.vertexb); - GL_ResolveShaderParam (quake_sprite.program, &quake_sprite.colora); - GL_ResolveShaderParam (quake_sprite.program, &quake_sprite.colorb); - GL_ResolveShaderParam (quake_sprite.program, &quake_sprite.uvab); - GL_ResolveShaderParam (quake_sprite.program, &quake_sprite.blend); - GL_ResolveShaderParam (quake_sprite.program, &quake_sprite.fog); + vert = GLSL_CompileShader ("quakespr.vert", quakesprite_vert, + GL_VERTEX_SHADER); + frag = GLSL_CompileShader ("quakespr.frag", quakesprite_frag, + GL_FRAGMENT_SHADER); + quake_sprite.program = GLSL_LinkProgram ("quakespr", vert, frag); + GLSL_ResolveShaderParam (quake_sprite.program, &quake_sprite.spritea); + GLSL_ResolveShaderParam (quake_sprite.program, &quake_sprite.spriteb); + GLSL_ResolveShaderParam (quake_sprite.program, &quake_sprite.palette); + GLSL_ResolveShaderParam (quake_sprite.program, &quake_sprite.matrix); + GLSL_ResolveShaderParam (quake_sprite.program, &quake_sprite.vertexa); + GLSL_ResolveShaderParam (quake_sprite.program, &quake_sprite.vertexb); + GLSL_ResolveShaderParam (quake_sprite.program, &quake_sprite.colora); + GLSL_ResolveShaderParam (quake_sprite.program, &quake_sprite.colorb); + GLSL_ResolveShaderParam (quake_sprite.program, &quake_sprite.uvab); + GLSL_ResolveShaderParam (quake_sprite.program, &quake_sprite.blend); + GLSL_ResolveShaderParam (quake_sprite.program, &quake_sprite.fog); } static void diff --git a/libs/video/renderer/glsl/glsl_textures.c b/libs/video/renderer/glsl/glsl_textures.c index 6c2c165c2..1a1cc96bb 100644 --- a/libs/video/renderer/glsl/glsl_textures.c +++ b/libs/video/renderer/glsl/glsl_textures.c @@ -66,7 +66,8 @@ static scrap_t *scrap_list; static int max_tex_size; int -GL_LoadQuakeTexture (const char *identifier, int width, int height, byte *data) +GLSL_LoadQuakeTexture (const char *identifier, int width, int height, + byte *data) { GLuint tnum; @@ -84,7 +85,7 @@ GL_LoadQuakeTexture (const char *identifier, int width, int height, byte *data) } static void -GL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight, +GLSL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight, unsigned char *out, int outwidth, int outheight) { // Improvements here should be mirrored in build_skin_8 in gl_skin.c @@ -106,7 +107,7 @@ GL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight, } static void -GL_Mipmap8BitTexture (const byte *src, unsigned width, unsigned height, +GLSL_Mipmap8BitTexture (const byte *src, unsigned width, unsigned height, byte *mip) { unsigned mw = width >> 1; @@ -124,7 +125,7 @@ GL_Mipmap8BitTexture (const byte *src, unsigned width, unsigned height, } int -GL_LoadQuakeMipTex (const texture_t *tex) +GLSL_LoadQuakeMipTex (const texture_t *tex) { unsigned swidth, sheight; GLuint tnum; @@ -164,7 +165,7 @@ GL_LoadQuakeMipTex (const texture_t *tex) w = max (w >> lod, 1); h = max (h >> lod, 1); - GL_Resample8BitTexture (data + tex->offsets[lod], w, h, + GLSL_Resample8BitTexture (data + tex->offsets[lod], w, h, buffer, swidth, sheight); scaled = buffer; } else { @@ -179,7 +180,7 @@ GL_LoadQuakeMipTex (const texture_t *tex) byte *mip = mipmap; while (swidth > 1 || sheight > 1) { // scaled holds the source of the last lod uploaded - GL_Mipmap8BitTexture (scaled, swidth, sheight, mip); + GLSL_Mipmap8BitTexture (scaled, swidth, sheight, mip); swidth >>= 1; sheight >>= 1; swidth = max (swidth, 1); @@ -198,7 +199,7 @@ GL_LoadQuakeMipTex (const texture_t *tex) } int -GL_LoadRGBTexture (const char *identifier, int width, int height, byte *data) +GLSL_LoadRGBTexture (const char *identifier, int width, int height, byte *data) { GLuint tnum; @@ -216,7 +217,7 @@ GL_LoadRGBTexture (const char *identifier, int width, int height, byte *data) } void -GL_ReleaseTexture (int tex) +GLSL_ReleaseTexture (int tex) { GLuint tnum = tex; qfglDeleteTextures (1, &tnum); @@ -248,7 +249,7 @@ glsl_scraps_f (void) } void -GL_TextureInit (void) +GLSL_TextureInit (void) { qfglGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_tex_size); Sys_MaskPrintf (SYS_GLSL, "max texture size: %d\n", max_tex_size); @@ -257,7 +258,7 @@ GL_TextureInit (void) } scrap_t * -GL_CreateScrap (int size, int format) +GLSL_CreateScrap (int size, int format) { int i; int bpp; @@ -314,7 +315,7 @@ GL_CreateScrap (int size, int format) } void -GL_ScrapClear (scrap_t *scrap) +GLSL_ScrapClear (scrap_t *scrap) { vrect_t *t; subpic_t *sp; @@ -339,7 +340,7 @@ GL_ScrapClear (scrap_t *scrap) } void -GL_DestroyScrap (scrap_t *scrap) +GLSL_DestroyScrap (scrap_t *scrap) { scrap_t **s; @@ -349,20 +350,20 @@ GL_DestroyScrap (scrap_t *scrap) break; } } - GL_ScrapClear (scrap); + GLSL_ScrapClear (scrap); VRect_Delete (scrap->free_rects); - GL_ReleaseTexture (scrap->tnum); + GLSL_ReleaseTexture (scrap->tnum); free (scrap); } int -GL_ScrapTexture (scrap_t *scrap) +GLSL_ScrapTexture (scrap_t *scrap) { return scrap->tnum; } subpic_t * -GL_ScrapSubpic (scrap_t *scrap, int width, int height) +GLSL_ScrapSubpic (scrap_t *scrap, int width, int height) { int i, w, h; vrect_t **t, **best; @@ -419,7 +420,7 @@ GL_ScrapSubpic (scrap_t *scrap, int width, int height) } void -GL_SubpicDelete (subpic_t *subpic) +GLSL_SubpicDelete (subpic_t *subpic) { scrap_t *scrap = (scrap_t *) subpic->scrap; vrect_t *rect = (vrect_t *) subpic->rect; @@ -431,14 +432,14 @@ GL_SubpicDelete (subpic_t *subpic) if (*sp == subpic) break; if (*sp != subpic) - Sys_Error ("GL_ScrapDelSubpic: broken subpic"); + Sys_Error ("GLSL_ScrapDelSubpic: broken subpic"); *sp = (subpic_t *) subpic->next; free (subpic); for (t = &scrap->rects; *t; t = &(*t)->next) if (*t == rect) break; if (*t != rect) - Sys_Error ("GL_ScrapDelSubpic: broken subpic"); + Sys_Error ("GLSL_ScrapDelSubpic: broken subpic"); *t = rect->next; do { @@ -460,7 +461,7 @@ GL_SubpicDelete (subpic_t *subpic) } void -GL_SubpicUpdate (subpic_t *subpic, byte *data) +GLSL_SubpicUpdate (subpic_t *subpic, byte *data) { scrap_t *scrap = (scrap_t *) subpic->scrap; vrect_t *rect = (vrect_t *) subpic->rect; diff --git a/libs/video/targets/vid_common_glsl.c b/libs/video/targets/vid_common_glsl.c index 21e14d0e2..9a8438577 100644 --- a/libs/video/targets/vid_common_glsl.c +++ b/libs/video/targets/vid_common_glsl.c @@ -67,7 +67,7 @@ VISIBLE float gldepthmin, gldepthmax; VISIBLE qboolean is8bit = false; static void -GL_Common_Init_Cvars (void) +GLSL_Common_Init_Cvars (void) { } @@ -152,9 +152,9 @@ GL_Init_Common (void) { GLF_FindFunctions (); - GL_Common_Init_Cvars (); + GLSL_Common_Init_Cvars (); - GL_TextureInit (); + GLSL_TextureInit (); qfglClearColor (0, 0, 0, 0); @@ -194,7 +194,7 @@ D_EndDirectRect (int x, int y, int width, int height) } int -GL_CompileShader (const char *name, const char *shader_src, int type) +GLSL_CompileShader (const char *name, const char *shader_src, int type) { const char *src[1]; int shader; @@ -317,7 +317,7 @@ dump_program (const char *name, int program) } int -GL_LinkProgram (const char *name, int vert, int frag) +GLSL_LinkProgram (const char *name, int vert, int frag) { int program; int linked; @@ -349,7 +349,7 @@ GL_LinkProgram (const char *name, int vert, int frag) } int -GL_ResolveShaderParam (int program, shaderparam_t *param) +GLSL_ResolveShaderParam (int program, shaderparam_t *param) { if (param->uniform) { param->location = qfglGetUniformLocation (program, param->name); @@ -368,7 +368,7 @@ GL_ResolveShaderParam (int program, shaderparam_t *param) } void -GL_DumpAttribArrays (void) +GLSL_DumpAttribArrays (void) { GLint max = 0; GLint ind;