diff options
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_setup.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/mesa/state_tracker/st_atom_setup.c b/src/mesa/state_tracker/st_atom_setup.c index 8b95ea958e..6ee96f6178 100644 --- a/src/mesa/state_tracker/st_atom_setup.c +++ b/src/mesa/state_tracker/st_atom_setup.c @@ -78,13 +78,19 @@ static void update_setup_state( struct st_context *st ) /* _NEW_POLYGON, _NEW_BUFFERS */ { - setup.front_winding = PIPE_WINDING_CW; - + if (ctx->Polygon.FrontFace == GL_CCW) + setup.front_winding = PIPE_WINDING_CCW; + else + setup.front_winding = PIPE_WINDING_CW; + + /* XXX + * I think the intention here is that user-created framebuffer objects + * use Y=0=TOP layout instead of OpenGL's normal Y=0=bottom layout. + * Flipping Y changes CW to CCW and vice-versa. + * But this is an implementation/driver-specific artifact - remove... + */ if (ctx->DrawBuffer && ctx->DrawBuffer->Name != 0) - setup.front_winding ^= PIPE_WINDING_BOTH; - - if (ctx->Polygon.FrontFace != GL_CCW) - setup.front_winding ^= PIPE_WINDING_BOTH; + setup.front_winding ^= PIPE_WINDING_BOTH; } /* _NEW_LIGHT @@ -92,14 +98,18 @@ static void update_setup_state( struct st_context *st ) if (ctx->Light.ShadeModel == GL_FLAT) setup.flatshade = 1; - /* _NEW_LIGHT + /* _NEW_LIGHT | _NEW_PROGRAM * - * Not sure about the light->enabled requirement - does this still - * apply?? + * Back-face colors can come from traditional lighting (when + * GL_LIGHT_MODEL_TWO_SIDE is set) or from vertex programs (when + * GL_VERTEX_PROGRAM_TWO_SIDE is set). Note the logic here. */ - if (ctx->Light.Enabled && - ctx->Light.Model.TwoSide) + if (ctx->VertexProgram._Enabled) { + setup.light_twoside = ctx->VertexProgram.TwoSideEnabled; + } + else if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) { setup.light_twoside = 1; + } /* _NEW_POLYGON */ |