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.
This commit is contained in:
Bill Currie 2012-02-17 18:57:13 +09:00
parent 447ff2f2f5
commit ef37ed39a9
14 changed files with 196 additions and 198 deletions

View file

@ -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

View file

@ -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

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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);
}

View file

@ -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)
{

View file

@ -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);

View file

@ -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

View file

@ -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;

View file

@ -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;