]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
make degrading shaders actually WORK
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 28 May 2007 21:01:55 +0000 (21:01 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 28 May 2007 21:01:55 +0000 (21:01 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7379 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index fb2fc69839a76bcd46b30701e54ab5dfab358dd7..ccbf2b2841f2412d816c56b3590654ecbf32b2a7 100644 (file)
@@ -954,14 +954,14 @@ int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, fl
                {
                        // remove features until we find a valid permutation
                        unsigned int i;
-                       for (i = SHADERPERMUTATION_MASK;;i>>=1)
+                       for (i = (SHADERPERMUTATION_MAX >> 1);;i>>=1)
                        {
                                if (!i)
-                                       return 0; // utterly failed
+                                       return 0; // no bit left to clear
                                // reduce i more quickly whenever it would not remove any bits
-                               if (permutation < i)
+                               if (!(permutation & i))
                                        continue;
-                               permutation &= i;
+                               permutation &= ~i;
                                if (!r_glsl_permutations[permutation & SHADERPERMUTATION_MASK].compiled)
                                        R_GLSL_CompilePermutation(shaderfilename, permutation);
                                if (r_glsl_permutations[permutation & SHADERPERMUTATION_MASK].program)