mesa: Restore all the scissor rectangles in _mesa_PopAttrib
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 8 Jan 2014 03:06:59 +0000 (19:06 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 20 Jan 2014 19:31:59 +0000 (11:31 -0800)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/attrib.c

index f55433ea65fa49c7e65a4a4559b7ab511694e128..db659ad8dc8ccdf718fa52572ebd55f225960e8a 100644 (file)
@@ -1269,15 +1269,19 @@ _mesa_PopAttrib(void)
            break;
          case GL_SCISSOR_BIT:
             {
+               unsigned i;
                const struct gl_scissor_attrib *scissor;
                scissor = (const struct gl_scissor_attrib *) attr->data;
-               _mesa_set_scissor(ctx, 0,
-                                 scissor->ScissorArray[0].X,
-                                 scissor->ScissorArray[0].Y,
-                                 scissor->ScissorArray[0].Width,
-                                 scissor->ScissorArray[0].Height);
-               _mesa_set_enable(ctx, GL_SCISSOR_TEST, scissor->EnableFlags & 1);
 
+               for (i = 0; i < ctx->Const.MaxViewports; i++) {
+                  _mesa_set_scissor(ctx, i,
+                                    scissor->ScissorArray[i].X,
+                                    scissor->ScissorArray[i].Y,
+                                    scissor->ScissorArray[i].Width,
+                                    scissor->ScissorArray[i].Height);
+                  _mesa_set_enablei(ctx, GL_SCISSOR_TEST, i,
+                                    (scissor->EnableFlags >> i) & 1);
+               }
             }
             break;
          case GL_STENCIL_BUFFER_BIT: