meta: Restore all scissor state
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 9 Jan 2014 23:44:58 +0000 (15:44 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 20 Jan 2014 19:31:59 +0000 (11:31 -0800)
Previously the restore code would enable all scissor rectangles if any
scissor rectangles were enabled on entry to meta.  When there is only
one scissor rectangle, this is fine.  As soon as a driver supports
multiple viewports, this will be a problem.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/common/meta.c

index 9a8f7a5a2d53c956a3cac45a8340b16e6194de1f..3855536ad37eccbc5e262a6721c06eac412d6f92 100644 (file)
@@ -933,9 +933,17 @@ _mesa_meta_end(struct gl_context *ctx)
    }
 
    if (state & MESA_META_SCISSOR) {
-      _mesa_set_enable(ctx, GL_SCISSOR_TEST, save->Scissor.EnableFlags);
-      _mesa_Scissor(save->Scissor.ScissorArray[0].X, save->Scissor.ScissorArray[0].Y,
-                    save->Scissor.ScissorArray[0].Width, save->Scissor.ScissorArray[0].Height);
+      unsigned i;
+
+      for (i = 0; i < ctx->Const.MaxViewports; i++) {
+         _mesa_set_scissor(ctx, i,
+                           save->Scissor.ScissorArray[i].X,
+                           save->Scissor.ScissorArray[i].Y,
+                           save->Scissor.ScissorArray[i].Width,
+                           save->Scissor.ScissorArray[i].Height);
+         _mesa_set_enablei(ctx, GL_SCISSOR_TEST, i,
+                           (save->Scissor.EnableFlags >> i) & 1);
+      }
    }
 
    if (state & MESA_META_SHADER) {