Add r_glsl_precache cvar to force all glsl permutations to compile at startup. This can be slow on some drivers due to all the permutations involved, but probably handy for debugging, or for people worried about stutters.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5857 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
01d1ca73c1
commit
8023ceadc8
2 changed files with 22 additions and 1 deletions
|
@ -137,6 +137,7 @@ cvar_t vid_devicename = CVARFD ("vid_devicename", "", CVAR_ARCHIVE | CVAR_V
|
|||
cvar_t gl_shadeq1_name = CVARD ("gl_shadeq1_name", "*", "Rename all surfaces from quake1 bsps using this pattern for the purposes of shader names.");
|
||||
extern cvar_t r_vertexlight;
|
||||
extern cvar_t r_forceprogramify;
|
||||
extern cvar_t r_glsl_precache;
|
||||
extern cvar_t dpcompat_nopremulpics;
|
||||
#ifdef PSKMODELS
|
||||
cvar_t dpcompat_psa_ungroup = CVAR ("dpcompat_psa_ungroup", "0");
|
||||
|
@ -1058,6 +1059,7 @@ void Renderer_Init(void)
|
|||
Cvar_Register (&r_polygonoffset_stencil_offset, GLRENDEREROPTIONS);
|
||||
|
||||
Cvar_Register (&r_forceprogramify, GLRENDEREROPTIONS);
|
||||
Cvar_Register (&r_glsl_precache, GLRENDEREROPTIONS);
|
||||
#ifdef HAVE_LEGACY
|
||||
Cvar_Register (&dpcompat_nopremulpics, GLRENDEREROPTIONS);
|
||||
#endif
|
||||
|
|
|
@ -42,7 +42,10 @@ sh_config_t sh_config;
|
|||
//cvars that affect shader generation
|
||||
cvar_t r_vertexlight = CVARFD("r_vertexlight", "0", CVAR_SHADERSYSTEM, "Hack loaded shaders to remove detail pass and lightmap sampling for faster rendering.");
|
||||
cvar_t r_forceprogramify = CVARAFD("r_forceprogramify", "0", "dpcompat_makeshitup", CVAR_SHADERSYSTEM, "Reduce the shader to a single texture, and then make stuff up about its mother. The resulting fist fight results in more colour when you shine a light upon its face.\nSet to 2 to ignore 'depthfunc equal' and 'tcmod scale' in order to tolerate bizzare shaders made for a bizzare engine.\nBecause most shaders made for DP are by people who _clearly_ have no idea what the heck they're doing, you'll typically need the '2' setting.");
|
||||
#ifdef HAVE_LEGACY
|
||||
cvar_t dpcompat_nopremulpics = CVARFD("dpcompat_nopremulpics", "0", CVAR_SHADERSYSTEM, "By default FTE uses premultiplied alpha for hud/2d images, while DP does not (which results in halos with low-res content). Unfortunately DDS files would need to be recompressed, resulting in visible issues.");
|
||||
#endif
|
||||
cvar_t r_glsl_precache = CVARFD("r_glsl_precache", "0", CVAR_SHADERSYSTEM, "Force all relevant glsl permutations to load upfront.");
|
||||
|
||||
extern cvar_t r_glsl_offsetmapping_reliefmapping;
|
||||
extern cvar_t r_drawflat;
|
||||
|
@ -2014,7 +2017,23 @@ static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *scrip
|
|||
//ensure that permutation 0 works correctly as a fallback.
|
||||
//FIXME: add debug mode to compile all.
|
||||
prog->permu[0] = Shader_LoadPermutation(prog, 0);
|
||||
return !!prog->permu[0];
|
||||
if (!prog->permu[0])
|
||||
return false;
|
||||
|
||||
if (r_glsl_precache.ival)
|
||||
{
|
||||
for (p = prog->supportedpermutations; p > 0; )
|
||||
{
|
||||
if (p != (p&prog->supportedpermutations))
|
||||
p &= prog->supportedpermutations; //this permutation isn't active, skip to the next one
|
||||
else
|
||||
{
|
||||
prog->permu[p] = Shader_LoadPermutation(prog, p);
|
||||
p--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue