unsigned int r_texture_gammaramps_serial;
//rtexture_t *r_texture_fogintensity;
+unsigned int r_queries[R_MAX_OCCLUSION_QUERIES];
+unsigned int r_numqueries;
+unsigned int r_maxqueries;
+
char r_qwskincache[MAX_SCOREBOARD][MAX_QPATH];
skinframe_t *r_qwskincache_skinframe[MAX_SCOREBOARD];
"uniform vec3 Gamma;\n"
"#endif\n"
"//uncomment these if you want to use them:\n"
-"// uniform vec4 UserVec1;\n"
+"uniform vec4 UserVec1;\n"
"// uniform vec4 UserVec2;\n"
"// uniform vec4 UserVec3;\n"
"// uniform vec4 UserVec4;\n"
"// uniform float ClientTime;\n"
-"// uniform vec2 PixelSize;\n"
-"// uniform vec2 LowerRightCorner;\n"
+"uniform vec2 PixelSize;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = texture2D(Texture_First, gl_TexCoord[0].xy);\n"
"#endif\n"
"\n"
"#ifdef USEPOSTPROCESSING\n"
-"// add your own postprocessing here or make your own ifdef for it\n"
+"// do r_glsl_dumpshader, edit glsl/default.glsl, and replace this by your own postprocessing if you want\n"
+"// this code does a blur with the radius specified in the first component of r_glsl_postprocess_uservec1 and blends it using the second component\n"
+" gl_FragColor += texture2D(Texture_First, gl_TexCoord[0].xy + PixelSize*UserVec1.x*vec2(-0.987688, -0.156434)) * UserVec1.y;\n"
+" gl_FragColor += texture2D(Texture_First, gl_TexCoord[0].xy + PixelSize*UserVec1.x*vec2(-0.156434, -0.891007)) * UserVec1.y;\n"
+" gl_FragColor += texture2D(Texture_First, gl_TexCoord[0].xy + PixelSize*UserVec1.x*vec2( 0.891007, -0.453990)) * UserVec1.y;\n"
+" gl_FragColor += texture2D(Texture_First, gl_TexCoord[0].xy + PixelSize*UserVec1.x*vec2( 0.707107, 0.707107)) * UserVec1.y;\n"
+" gl_FragColor += texture2D(Texture_First, gl_TexCoord[0].xy + PixelSize*UserVec1.x*vec2(-0.453990, 0.891007)) * UserVec1.y;\n"
+" gl_FragColor /= (1 + 5 * UserVec1.y);\n"
"#endif\n"
"\n"
"#ifdef USEGAMMARAMPS\n"
int loc_UserVec4;
int loc_ClientTime;
int loc_PixelSize;
- int loc_LowerRightCorner;
}
r_glsl_permutation_t;
}
else if (!strcmp(filename, "glsl/default.glsl"))
{
- shaderstring = Mem_Alloc(r_main_mempool, strlen(builtinshaderstring) + 1);
+ shaderstring = (char *) Mem_Alloc(r_main_mempool, strlen(builtinshaderstring) + 1);
memcpy(shaderstring, builtinshaderstring, strlen(builtinshaderstring) + 1);
}
return shaderstring;
}
-static void R_GLSL_CompilePermutation(shadermode_t mode, shaderpermutation_t permutation)
+static void R_GLSL_CompilePermutation(unsigned int mode, unsigned int permutation)
{
int i;
shadermodeinfo_t *modeinfo = shadermodeinfo + mode;
p->loc_UserVec4 = qglGetUniformLocationARB(p->program, "UserVec4");
p->loc_ClientTime = qglGetUniformLocationARB(p->program, "ClientTime");
p->loc_PixelSize = qglGetUniformLocationARB(p->program, "PixelSize");
- p->loc_LowerRightCorner = qglGetUniformLocationARB(p->program, "LowerRightCorner");
// initialize the samplers to refer to the texture units we use
if (p->loc_Texture_First >= 0) qglUniform1iARB(p->loc_Texture_First , GL20TU_FIRST);
if (p->loc_Texture_Second >= 0) qglUniform1iARB(p->loc_Texture_Second , GL20TU_SECOND);
void R_GLSL_Restart_f(void)
{
- shadermode_t mode;
- shaderpermutation_t permutation;
+ unsigned int mode;
+ unsigned int permutation;
for (mode = 0;mode < SHADERMODE_COUNT;mode++)
for (permutation = 0;permutation < SHADERPERMUTATION_LIMIT;permutation++)
if (r_glsl_permutations[mode][permutation].program)
Con_Printf("glsl/default.glsl written\n");
}
-void R_SetupShader_SetPermutation(shadermode_t mode, unsigned int permutation)
+void R_SetupShader_SetPermutation(unsigned int mode, unsigned int permutation)
{
r_glsl_permutation_t *perm = &r_glsl_permutations[mode][permutation];
if (r_glsl_permutation != perm)
// minimum features necessary to avoid wasting rendering time in the
// fragment shader on features that are not being used
unsigned int permutation = 0;
- shadermode_t mode = 0;
+ unsigned int mode = 0;
// TODO: implement geometry-shader based shadow volumes someday
if (r_glsl_offsetmapping.integer)
{
if (r_glsl_permutation->loc_SpecularScale >= 0) qglUniform1fARB(r_glsl_permutation->loc_SpecularScale, r_refdef.lightmapintensity * specularscale);
}
if (r_glsl_permutation->loc_TintColor >= 0) qglUniform4fARB(r_glsl_permutation->loc_TintColor, rsurface.texture->lightmapcolor[0], rsurface.texture->lightmapcolor[1], rsurface.texture->lightmapcolor[2], rsurface.texture->lightmapcolor[3]);
- if (r_glsl_permutation->loc_GlowScale >= 0) qglUniform1fARB(r_glsl_permutation->loc_GlowScale, r_hdr_glowintensity.value);
+ if (r_glsl_permutation->loc_GlowScale >= 0) qglUniform1fARB(r_glsl_permutation->loc_GlowScale, r_hdr_glowintensity.value);
// additive passes are only darkened by fog, not tinted
if (r_glsl_permutation->loc_FogColor >= 0)
{
#define SKINFRAME_HASH 1024
-struct
+typedef struct
{
int loadsequence; // incremented each level change
memexpandablearray_t array;
skinframe_t *hash[SKINFRAME_HASH];
}
-r_skinframe;
+r_skinframe_t;
+r_skinframe_t r_skinframe;
void R_SkinFrame_PrepareForPurge(void)
{
void gl_main_start(void)
{
+ r_numqueries = 0;
+ r_maxqueries = 0;
+ memset(r_queries, 0, sizeof(r_queries));
+
memset(r_qwskincache, 0, sizeof(r_qwskincache));
memset(r_qwskincache_skinframe, 0, sizeof(r_qwskincache_skinframe));
void gl_main_shutdown(void)
{
+ if (r_maxqueries)
+ qglDeleteQueriesARB(r_maxqueries, r_queries);
+
+ r_numqueries = 0;
+ r_maxqueries = 0;
+ memset(r_queries, 0, sizeof(r_queries));
+
memset(r_qwskincache, 0, sizeof(r_qwskincache));
memset(r_qwskincache_skinframe, 0, sizeof(r_qwskincache_skinframe));
Con_Printf("GL_VENDOR: %s\n", gl_vendor);
Con_Printf("GL_RENDERER: %s\n", gl_renderer);
Con_Printf("GL_VERSION: %s\n", gl_version);
- Con_Printf("GL_EXTENSIONS: %s\n", gl_extensions);
- Con_Printf("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions);
+ Con_DPrintf("GL_EXTENSIONS: %s\n", gl_extensions);
+ Con_DPrintf("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions);
VID_CheckExtensions();
qglUniform1fARB(r_glsl_permutation->loc_ClientTime, cl.time);
if (r_glsl_permutation->loc_PixelSize >= 0)
qglUniform2fARB(r_glsl_permutation->loc_PixelSize, 1.0/r_bloomstate.screentexturewidth, 1.0/r_bloomstate.screentextureheight);
- if (r_glsl_permutation->loc_LowerRightCorner >= 0)
- qglUniform2fARB(r_glsl_permutation->loc_LowerRightCorner, vid.width/r_bloomstate.screentexturewidth, vid.height/r_bloomstate.screentextureheight);
if (r_glsl_permutation->loc_UserVec1 >= 0)
{
float a=0, b=0, c=0, d=0;
Matrix4x4_CreateTranslate(&matrix, tcmod->parms[0] * r_refdef.scene.time, tcmod->parms[1] * r_refdef.scene.time, 0);
break;
case Q3TCMOD_PAGE: // poor man's animmap (to store animations into a single file, useful for HTTP downloaded textures)
- w = tcmod->parms[0];
- h = tcmod->parms[1];
+ w = (int) tcmod->parms[0];
+ h = (int) tcmod->parms[1];
f = r_refdef.scene.time / (tcmod->parms[2] * w * h);
f = f - floor(f);
- idx = floor(f * w * h);
+ idx = (int) floor(f * w * h);
Matrix4x4_CreateTranslate(&matrix, (idx % w) / tcmod->parms[0], (idx / w) / tcmod->parms[1], 0);
break;
case Q3TCMOD_STRETCH:
r_maxsurfacelist = model->num_surfaces;
if (r_surfacelist)
Mem_Free(r_surfacelist);
- r_surfacelist = Mem_Alloc(r_main_mempool, r_maxsurfacelist * sizeof(*r_surfacelist));
+ r_surfacelist = (msurface_t **) Mem_Alloc(r_main_mempool, r_maxsurfacelist * sizeof(*r_surfacelist));
}
RSurf_ActiveWorldEntity();
r_maxsurfacelist = model->num_surfaces;
if (r_surfacelist)
Mem_Free(r_surfacelist);
- r_surfacelist = Mem_Alloc(r_main_mempool, r_maxsurfacelist * sizeof(*r_surfacelist));
+ r_surfacelist = (msurface_t **) Mem_Alloc(r_main_mempool, r_maxsurfacelist * sizeof(*r_surfacelist));
}
// if the model is static it doesn't matter what value we give for