]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rmain.c
turn off r_glsl if compilation of the lowest level fallback fails
[xonotic/darkplaces.git] / gl_rmain.c
index cd9404ba6272dab721ea5f78677122105360f1d9..5ce992d643668ea89922fb5aa398d03abe76f9ba 100644 (file)
@@ -983,7 +983,11 @@ int R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, fl
                        for (i = (SHADERPERMUTATION_MAX >> 1);;i>>=1)
                        {
                                if (!i)
+                               {
+                                       Con_Printf("OpenGL 2.0 shaders disabled - unable to find a working shader permutation fallback on this driver (set r_glsl 1 if you want to try again)\n");
+                                       Cvar_SetValueQuick(&r_glsl, 0);
                                        return 0; // no bit left to clear
+                               }
                                // reduce i more quickly whenever it would not remove any bits
                                if (!(permutation & i))
                                        continue;
@@ -3420,15 +3424,15 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t)
                t->specularscale = 0;
        }
 
-       t->currentpolygonfactor = r_refdef.polygonfactor;
-       t->currentpolygonoffset = r_refdef.polygonoffset;
+       t->currentpolygonfactor = r_refdef.polygonfactor + t->basepolygonfactor;
+       t->currentpolygonoffset = r_refdef.polygonoffset + t->basepolygonoffset;
        // submodels are biased to avoid z-fighting with world surfaces that they
        // may be exactly overlapping (avoids z-fighting artifacts on certain
        // doors and things in Quake maps)
        if (ent->model->brush.submodel)
        {
-               t->currentpolygonfactor = r_refdef.polygonfactor + r_polygonoffset_submodel_factor.value;
-               t->currentpolygonoffset = r_refdef.polygonoffset + r_polygonoffset_submodel_offset.value;
+               t->currentpolygonfactor += r_polygonoffset_submodel_factor.value;
+               t->currentpolygonoffset += r_polygonoffset_submodel_offset.value;
        }
 
        VectorClear(t->dlightcolor);