From: divverent Date: Mon, 28 May 2007 21:01:55 +0000 (+0000) Subject: make degrading shaders actually WORK X-Git-Tag: xonotic-v0.1.0preview~3081 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5952e59aa2abf22985fceb3b8903c6c8a99fde9b;p=xonotic%2Fdarkplaces.git make degrading shaders actually WORK git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7379 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index fb2fc698..ccbf2b28 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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)