Don't load external GLSL files by default

External GLSL should probably only be used for development testing,
not released products. The GLSL files are tied to the code, and the
code changes some what often.

Fixes using OpenArena 0.8.8 which has incompatible GLSL files in a pk3.
This commit is contained in:
Zack Middleton 2014-07-25 23:34:29 -05:00
parent 3d01543e2c
commit 75cce50a9c
3 changed files with 16 additions and 4 deletions

View file

@ -400,24 +400,30 @@ static int GLSL_LoadGPUShaderText(const char *name, const char *fallback,
Com_sprintf(filename, sizeof(filename), "glsl/%s_fp.glsl", name);
}
ri.Printf(PRINT_DEVELOPER, "...loading '%s'\n", filename);
size = ri.FS_ReadFile(filename, (void **)&buffer);
if ( r_externalGLSL->integer ) {
size = ri.FS_ReadFile(filename, (void **)&buffer);
} else {
size = 0;
buffer = NULL;
}
if(!buffer)
{
if (fallback)
{
ri.Printf(PRINT_DEVELOPER, "couldn't load, using fallback\n");
ri.Printf(PRINT_DEVELOPER, "...loading built-in '%s'\n", filename);
shaderText = fallback;
size = strlen(shaderText);
}
else
{
ri.Printf(PRINT_DEVELOPER, "couldn't load!\n");
ri.Printf(PRINT_DEVELOPER, "couldn't load '%s'\n", filename);
return 0;
}
}
else
{
ri.Printf(PRINT_DEVELOPER, "...loading '%s'\n", filename);
shaderText = buffer;
}

View file

@ -108,6 +108,8 @@ cvar_t *r_mergeLeafSurfaces;
cvar_t *r_cameraExposure;
cvar_t *r_externalGLSL;
cvar_t *r_hdr;
cvar_t *r_floatLightmap;
cvar_t *r_postProcess;
@ -1164,6 +1166,8 @@ void R_Register( void )
r_greyscale = ri.Cvar_Get("r_greyscale", "0", CVAR_ARCHIVE | CVAR_LATCH);
ri.Cvar_CheckRange(r_greyscale, 0, 1, qfalse);
r_externalGLSL = ri.Cvar_Get( "r_externalGLSL", "0", CVAR_LATCH );
r_hdr = ri.Cvar_Get( "r_hdr", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_floatLightmap = ri.Cvar_Get( "r_floatLightmap", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_postProcess = ri.Cvar_Get( "r_postProcess", "1", CVAR_ARCHIVE );

View file

@ -1765,6 +1765,8 @@ extern cvar_t *r_anaglyphMode;
extern cvar_t *r_mergeMultidraws;
extern cvar_t *r_mergeLeafSurfaces;
extern cvar_t *r_externalGLSL;
extern cvar_t *r_hdr;
extern cvar_t *r_floatLightmap;
extern cvar_t *r_postProcess;