cvar_t r_shadow_glsl_offsetmapping = {0, "r_shadow_glsl_offsetmapping", "0"};
cvar_t r_shadow_glsl_offsetmapping_scale = {0, "r_shadow_glsl_offsetmapping_scale", "-0.04"};
cvar_t r_shadow_glsl_offsetmapping_bias = {0, "r_shadow_glsl_offsetmapping_bias", "0.04"};
-cvar_t r_shadow_glsl_geforcefxlowquality = {0, "r_shadow_glsl_geforcefxlowquality", "1"};
+cvar_t r_shadow_glsl_usehalffloat = {0, "r_shadow_glsl_usehalffloat", "0"};
cvar_t r_shadow_glsl_surfacenormalize = {0, "r_shadow_glsl_surfacenormalize", "1"};
cvar_t gl_ext_stenciltwoside = {0, "gl_ext_stenciltwoside", "1"};
cvar_t r_editlights = {0, "r_editlights", "0"};
void r_shadow_start(void)
{
int i;
- // if not a GeForce FX, turn off the lowquality cvar
- if (strncmp(gl_renderer, "GeForce FX ", strlen("GeForce FX ")))
- Cvar_SetValue("r_shadow_glsl_geforcefxlowquality", 0);
+ // use half float math where available (speed gain on NVIDIA GFFX and GF6)
+ if (gl_support_half_float)
+ Cvar_SetValue("r_shadow_glsl_usehalffloat", 1);
// allocate vertex processing arrays
numcubemaps = 0;
r_shadow_attenuation2dtexture = NULL;
"r_shadow_glsl_offsetmapping : enables Offset Mapping bumpmap enhancement\n"
"r_shadow_glsl_offsetmapping_scale : controls depth of Offset Mapping\n"
"r_shadow_glsl_offsetmapping_bias : should be negative half of scale\n"
-"r_shadow_glsl_geforcefxlowquality : use lower quality lighting\n"
+"r_shadow_glsl_usehalffloat : use lower quality lighting\n"
"r_shadow_glsl_surfacenormalize : makes bumpmapping slightly higher quality\n"
"r_shadow_scissor : use scissor optimization\n"
"r_shadow_shadow_polygonfactor : nudge shadow volumes closer/further\n"
Cvar_RegisterVariable(&r_shadow_glsl_offsetmapping);
Cvar_RegisterVariable(&r_shadow_glsl_offsetmapping_scale);
Cvar_RegisterVariable(&r_shadow_glsl_offsetmapping_bias);
- Cvar_RegisterVariable(&r_shadow_glsl_geforcefxlowquality);
+ Cvar_RegisterVariable(&r_shadow_glsl_usehalffloat);
Cvar_RegisterVariable(&r_shadow_glsl_surfacenormalize);
Cvar_RegisterVariable(&gl_ext_stenciltwoside);
if (gamemode == GAME_TENEBRAE)
r_shadow_lightpermutation |= SHADERPERMUTATION_OFFSETMAPPING;
if (r_shadow_glsl_surfacenormalize.integer && r_shadow_program_light[r_shadow_lightpermutation | SHADERPERMUTATION_SURFACENORMALIZE])
r_shadow_lightpermutation |= SHADERPERMUTATION_SURFACENORMALIZE;
- if (r_shadow_glsl_geforcefxlowquality.integer && r_shadow_program_light[r_shadow_lightpermutation | SHADERPERMUTATION_GEFORCEFX])
+ if (r_shadow_glsl_usehalffloat.integer && r_shadow_program_light[r_shadow_lightpermutation | SHADERPERMUTATION_GEFORCEFX])
r_shadow_lightpermutation |= SHADERPERMUTATION_GEFORCEFX;
r_shadow_lightprog = r_shadow_program_light[r_shadow_lightpermutation];
qglUseProgramObjectARB(r_shadow_lightprog);CHECKGLERROR
int gl_support_vertex_shader = false;
// GL_ARB_fragment_shader
int gl_support_fragment_shader = false;
+// GL_NV_half_float
+int gl_support_half_float = false;
// LordHavoc: if window is hidden, don't update screen
qboolean vid_hidden = true;
// COMMANDLINEOPTION: GL: -noshaderobjects disables GL_ARB_shader_objects (required for vertex shader and fragment shader)
// COMMANDLINEOPTION: GL: -noshadinglanguage100 disables GL_ARB_shading_language_100 (required for vertex shader and fragment shader)
-// COMMANDLINEOPTION: GL: -novertexshader disables GL_ARB_vertex_shader (currently unused, allows vertex shader effects)
-// COMMANDLINEOPTION: GL: -nofragmentshader disables GL_ARB_fragment_shader (currently unused, allows pixel shader effects)
+// COMMANDLINEOPTION: GL: -novertexshader disables GL_ARB_vertex_shader (allows vertex shader effects)
+// COMMANDLINEOPTION: GL: -nofragmentshader disables GL_ARB_fragment_shader (allows pixel shader effects, can improve per pixel lighting performance and capabilities)
if ((gl_support_shader_objects = GL_CheckExtension("GL_ARB_shader_objects", shaderobjectsfuncs, "-noshaderobjects", false)))
if ((gl_support_shading_language_100 = GL_CheckExtension("GL_ARB_shading_language_100", NULL, "-noshadinglanguage100", false)))
if ((gl_support_vertex_shader = GL_CheckExtension("GL_ARB_vertex_shader", vertexshaderfuncs, "-novertexshader", false)))
gl_support_fragment_shader = GL_CheckExtension("GL_ARB_fragment_shader", NULL, "-nofragmentshader", false);
+
+// COMMANDLINEOPTION: GL: -nohalffloat disables GL_NV_half_float extension
+ gl_support_half_float = GL_CheckExtension("GL_NV_half_float", NULL, "-nohalffloat", false);
}
qboolean vid_vertexarrays_are_var = false;