]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
r_shadow_deferred now checks for r_shadow_gloss 0 and does not use the
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 29 Mar 2011 23:15:08 +0000 (23:15 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 29 Mar 2011 23:15:08 +0000 (23:15 +0000)
second color attachment if so, giving a modest speed boost for testing
but deferred is still way too slow for practical use even with this...

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10983 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
r_shadow.c
shader_glsl.h

index 1a775d392d23112491c6a50f5f37117c3fef9601..d5e82c56a515cdeac5e44212e3d5fe056b321f26 100644 (file)
@@ -2888,7 +2888,7 @@ void R_SetupShader_DeferredLight(const rtlight_t *rtlight)
                permutation |= SHADERPERMUTATION_CUBEFILTER;
        if (diffusescale > 0)
                permutation |= SHADERPERMUTATION_DIFFUSE;
-       if (specularscale > 0)
+       if (specularscale > 0 && r_shadow_gloss.integer > 0)
                permutation |= SHADERPERMUTATION_SPECULAR | SHADERPERMUTATION_DIFFUSE;
        if (r_shadow_usingshadowmap2d)
        {
index a1dc9969c3e232ae810ab26a5965f92a41c97327..0afa3b3cd489d03c2f2d5756dcd97f23e20b2185 100644 (file)
@@ -2287,7 +2287,10 @@ void R_Shadow_RenderMode_DrawDeferredLight(qboolean stenciltest, qboolean shadow
        // only draw light where this geometry was already rendered AND the
        // stencil is 128 (values other than this mean shadow)
        R_SetStencil(stenciltest, 255, GL_KEEP, GL_KEEP, GL_KEEP, GL_EQUAL, 128, 255);
-       R_Mesh_SetRenderTargets(r_shadow_prepasslightingdiffusespecularfbo, r_shadow_prepassgeometrydepthtexture, r_shadow_prepasslightingdiffusetexture, r_shadow_prepasslightingspeculartexture, NULL, NULL);
+       if (rsurface.rtlight->specularscale > 0 && r_shadow_gloss.integer > 0)
+               R_Mesh_SetRenderTargets(r_shadow_prepasslightingdiffusespecularfbo, r_shadow_prepassgeometrydepthtexture, r_shadow_prepasslightingdiffusetexture, r_shadow_prepasslightingspeculartexture, NULL, NULL);
+       else
+               R_Mesh_SetRenderTargets(r_shadow_prepasslightingdiffusefbo, r_shadow_prepassgeometrydepthtexture, r_shadow_prepasslightingdiffusetexture, NULL, NULL, NULL);
 
        r_shadow_usingshadowmap2d = shadowmapping;
 
index fd94cbcced980d4b44223b8f7a64fa77efb7cdad..65a70d9ef0d87ecac1a3408c26782b9592aa493c 100644 (file)
 "      fade *= ShadowMapCompare(CubeVector);\n"
 "#endif\n"
 "\n"
-"#ifdef USEDIFFUSE\n"
-"      gl_FragData[0] = vec4((DeferredColor_Ambient + DeferredColor_Diffuse * diffuse) * fade, 1.0);\n"
-"#else\n"
-"      gl_FragData[0] = vec4(DeferredColor_Ambient * fade, 1.0);\n"
-"#endif\n"
 "#ifdef USESPECULAR\n"
+"      gl_FragData[0] = vec4((DeferredColor_Ambient + DeferredColor_Diffuse * diffuse) * fade, 1.0);\n"
 "      gl_FragData[1] = vec4(DeferredColor_Specular * (specular * fade), 1.0);\n"
-"#else\n"
-"      gl_FragData[1] = vec4(0.0, 0.0, 0.0, 1.0);\n"
-"#endif\n"
-"\n"
 "# ifdef USECUBEFILTER\n"
 "      vec3 cubecolor = dp_textureCube(Texture_Cube, CubeVector).rgb;\n"
 "      gl_FragData[0].rgb *= cubecolor;\n"
 "      gl_FragData[1].rgb *= cubecolor;\n"
 "# endif\n"
+"#else\n"
+"# ifdef USEDIFFUSE\n"
+"      gl_FragColor = vec4((DeferredColor_Ambient + DeferredColor_Diffuse * diffuse) * fade, 1.0);\n"
+"# else\n"
+"      gl_FragColor = vec4(DeferredColor_Ambient * fade, 1.0);\n"
+"# endif\n"
+"# ifdef USECUBEFILTER\n"
+"      vec3 cubecolor = dp_textureCube(Texture_Cube, CubeVector).rgb;\n"
+"      gl_FragColor.rgb *= cubecolor;\n"
+"# endif\n"
+"#endif\n"
+"      \n"
 "}\n"
 "#endif // FRAGMENT_SHADER\n"
 "#else // !MODE_DEFERREDLIGHTSOURCE\n"