st/mesa: simplify initialization of light_twoside
authorMarek Olšák <maraeo@gmail.com>
Fri, 27 Jan 2012 23:59:13 +0000 (00:59 +0100)
committerMarek Olšák <maraeo@gmail.com>
Mon, 30 Jan 2012 23:54:34 +0000 (00:54 +0100)
Core Mesa does this for us, see update_two_size in state.c.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/state_tracker/st_atom_rasterizer.c

index 25799bf2bd51e3ead64749084367f8d1e5e59b67..204f505a69f9ea4578b02c5da50e6a2a9e355016 100644 (file)
@@ -90,28 +90,10 @@ static void update_raster_state( struct st_context *st )
    if (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION_EXT)
       raster->flatshade_first = 1;
 
-   /* _NEW_LIGHT | _NEW_PROGRAM
-    *
-    * Back-face colors can come from traditional lighting (when
-    * GL_LIGHT_MODEL_TWO_SIDE is set) or from vertex programs/shaders (when
-    * GL_VERTEX_PROGRAM_TWO_SIDE is set).  Note the logic here.
-    */
-   if (ctx->VertexProgram._Current) {
-      if (ctx->VertexProgram._Enabled ||
-          (ctx->Shader.CurrentVertexProgram &&
-           ctx->Shader.CurrentVertexProgram->LinkStatus)) {
-         /* user-defined vertex program or shader */
-         raster->light_twoside = ctx->VertexProgram.TwoSideEnabled;
-      }
-      else {
-         /* TNL-generated program */
-         raster->light_twoside = ctx->Light.Enabled && ctx->Light.Model.TwoSide;
-      }
-   }
-   else if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) {
-      raster->light_twoside = 1;
-   }
+   /* _NEW_LIGHT | _NEW_PROGRAM */
+   raster->light_twoside = ctx->VertexProgram._TwoSideEnabled;
 
+   /*_NEW_LIGHT | _NEW_BUFFERS */
    raster->clamp_vertex_color = !st->clamp_vert_color_in_shader &&
                                 ctx->Light._ClampVertexColor;