OpenGL2: Reduce glsl shader count by using a uniform to disable textures.
This commit is contained in:
parent
7ae49cc237
commit
3846c115e6
7 changed files with 147 additions and 154 deletions
|
@ -2208,7 +2208,6 @@ static void CollapseStagesToLightall(shaderStage_t *diffuse,
|
|||
//ri.Printf(PRINT_ALL, ", deluxemap");
|
||||
diffuse->bundle[TB_DELUXEMAP] = lightmap->bundle[0];
|
||||
diffuse->bundle[TB_DELUXEMAP].image[0] = tr.deluxemaps[shader.lightmapIndex];
|
||||
defs |= LIGHTDEF_USE_DELUXEMAP;
|
||||
}
|
||||
|
||||
if (r_normalMapping->integer)
|
||||
|
@ -2525,8 +2524,6 @@ static qboolean CollapseStagesToGLSL(void)
|
|||
{
|
||||
pStage->glslShaderGroup = tr.lightallShader;
|
||||
pStage->glslShaderIndex = LIGHTDEF_USE_LIGHTMAP;
|
||||
if (r_deluxeMapping->integer && tr.worldDeluxeMapping)
|
||||
pStage->glslShaderIndex |= LIGHTDEF_USE_DELUXEMAP;
|
||||
pStage->bundle[TB_LIGHTMAP] = pStage->bundle[TB_DIFFUSEMAP];
|
||||
pStage->bundle[TB_DIFFUSEMAP].image[0] = tr.whiteImage;
|
||||
pStage->bundle[TB_DIFFUSEMAP].isLightmap = qfalse;
|
||||
|
@ -2559,7 +2556,7 @@ static qboolean CollapseStagesToGLSL(void)
|
|||
}
|
||||
}
|
||||
|
||||
// insert default normal and specular textures if necessary
|
||||
// insert default material info if needed
|
||||
for (i = 0; i < MAX_SHADER_STAGES; i++)
|
||||
{
|
||||
shaderStage_t *pStage = &stages[i];
|
||||
|
@ -2573,14 +2570,8 @@ static qboolean CollapseStagesToGLSL(void)
|
|||
if ((pStage->glslShaderIndex & LIGHTDEF_LIGHTTYPE_MASK) == 0)
|
||||
continue;
|
||||
|
||||
if (!pStage->bundle[TB_NORMALMAP].image[0] && r_normalMapping->integer)
|
||||
{
|
||||
pStage->bundle[TB_NORMALMAP].image[0] = tr.greyImage;
|
||||
}
|
||||
|
||||
if (!pStage->bundle[TB_SPECULARMAP].image[0] && r_specularMapping->integer)
|
||||
{
|
||||
pStage->bundle[TB_SPECULARMAP].image[0] = tr.whiteImage;
|
||||
if (!pStage->materialInfo[0])
|
||||
pStage->materialInfo[0] = r_baseSpecular->value;
|
||||
if (!pStage->materialInfo[1])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue