Mesa (gallium-0.1): gallium: fix two-sided lighting test in state tracker

Brian Paul brianp at kemper.freedesktop.org
Thu Dec 18 23:12:54 UTC 2008


Module: Mesa
Branch: gallium-0.1
Commit: 78a204f507f966d12ecd3931a51a85763c66ddb3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=78a204f507f966d12ecd3931a51a85763c66ddb3

Author: Brian Paul <brian.paul at tungstengraphics.com>
Date:   Thu Dec 18 16:00:20 2008 -0700

gallium: fix two-sided lighting test in state tracker

This fixes two-sided lighting for vertex shaders.

---

 src/mesa/state_tracker/st_atom_rasterizer.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index 5eef4eb..ea76487 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -107,12 +107,15 @@ static void update_raster_state( struct st_context *st )
    /* _NEW_LIGHT | _NEW_PROGRAM
     *
     * Back-face colors can come from traditional lighting (when
-    * GL_LIGHT_MODEL_TWO_SIDE is set) or from vertex programs (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) {
-         /* user-defined program */
+      if (ctx->VertexProgram._Enabled ||
+          (ctx->Shader.CurrentProgram &&
+           ctx->Shader.CurrentProgram->VertexProgram &&
+           ctx->Shader.CurrentProgram->LinkStatus)) {
+         /* user-defined vertex program or shader */
          raster->light_twoside = ctx->VertexProgram.TwoSideEnabled;
       }
       else {




More information about the mesa-commit mailing list