aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-05-01 19:15:32 -0600
committerBrian Paul <[email protected]>2013-05-02 09:03:14 -0600
commitaa782f260d09bbc10db039340358b3518e8a5a38 (patch)
tree7cf9f44b6eb9375981adac0219ff10140d792324 /src/mesa
parent16296cc843ef82dd0a7e345b377fbc4535f9e519 (diff)
mesa: fix save_ShadeModel() logic and add new comments
This removes the test for _mesa_inside_dlist_begin_end(). If ctx->Driver.CurrentSavePrimitive==PRIM_UNKNOWN (the initial value), _mesa_inside_dlist_begin_end() will, confusingly, return TRUE. So we didn't set the ctx->ListState.Current.ShadeModel value and it remained in its indeterminate state. This didn't effect correctness, but it defeated the intended optimization of dropping redundant glShadeModel() state changes in order to coalesce sequences of drawing commands. Verified with new piglit gl-1.0-dlist-shademodel test. Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/dlist.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index bc0c92a278a..3071a37e14b 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -3771,15 +3771,16 @@ save_ShadeModel(GLenum mode)
CALL_ShadeModel(ctx->Exec, (mode));
}
+ /* Don't compile this call if it's a no-op.
+ * By avoiding this state change we have a better chance of
+ * coalescing subsequent drawing commands into one batch.
+ */
if (ctx->ListState.Current.ShadeModel == mode)
return;
SAVE_FLUSH_VERTICES(ctx);
- /* Only save the value if we know the statechange will take effect:
- */
- if (!_mesa_inside_dlist_begin_end(ctx))
- ctx->ListState.Current.ShadeModel = mode;
+ ctx->ListState.Current.ShadeModel = mode;
n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1);
if (n) {