diff options
author | Courtney Goeltzenleuchter <[email protected]> | 2013-11-13 14:02:12 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2014-01-20 11:29:42 -0800 |
commit | a9c73fb778a41b422a811c67b4aba806d4dfb7c8 (patch) | |
tree | 1ee48d66f17021d2c33030a0e1d93caa10b89e87 /src/mesa/main/attrib.c | |
parent | 1f59e963b40a260d3087f83799de0a6fb0941d07 (diff) |
mesa: Update gl_scissor_attrib to support ARB_viewport_array
Update Mesa and drivers to access updated gl_scissor_attrib.
Now have an enable bitfield and array of gl_scissor_rects.
Drivers have been updated to the new scissor enable state
attribute (gl_context.scissor.EnableFlags) but still treat it
as a single boolean which is okay as mesa will only use
bit 0 when communicating with a driver that does not support
ARB_viewport_array.
v2 (idr): Rebase fixes.
v3 (idr): Small code formatting fix suggsted by Ken.
Signed-off-by: Courtney Goeltzenleuchter <[email protected]>
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main/attrib.c')
-rw-r--r-- | src/mesa/main/attrib.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 30c815d67f0..f571f9fc7f0 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -112,7 +112,7 @@ struct gl_enable_attrib GLboolean PolygonSmooth; GLboolean PolygonStipple; GLboolean RescaleNormals; - GLboolean Scissor; + GLbitfield Scissor; GLboolean Stencil; GLboolean StencilTwoSide; /* GL_EXT_stencil_two_side */ GLboolean MultisampleEnabled; /* GL_ARB_multisample */ @@ -354,7 +354,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->PolygonSmooth = ctx->Polygon.SmoothFlag; attr->PolygonStipple = ctx->Polygon.StippleFlag; attr->RescaleNormals = ctx->Transform.RescaleNormals; - attr->Scissor = ctx->Scissor.Enabled; + attr->Scissor = ctx->Scissor.EnableFlags; attr->Stencil = ctx->Stencil.Enabled; attr->StencilTwoSide = ctx->Stencil.TestTwoSide; attr->MultisampleEnabled = ctx->Multisample.Enabled; @@ -658,7 +658,13 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable) GL_POLYGON_SMOOTH); TEST_AND_UPDATE(ctx->Polygon.StippleFlag, enable->PolygonStipple, GL_POLYGON_STIPPLE); - TEST_AND_UPDATE(ctx->Scissor.Enabled, enable->Scissor, GL_SCISSOR_TEST); + if (ctx->Scissor.EnableFlags != enable->Scissor) { + unsigned i; + + for (i = 0; i < ctx->Const.MaxViewports; i++) { + _mesa_set_enablei(ctx, GL_SCISSOR_TEST, i, (enable->Scissor >> i) & 1); + } + } TEST_AND_UPDATE(ctx->Stencil.Enabled, enable->Stencil, GL_STENCIL_TEST); if (ctx->Extensions.EXT_stencil_two_side) { TEST_AND_UPDATE(ctx->Stencil.TestTwoSide, enable->StencilTwoSide, GL_STENCIL_TEST_TWO_SIDE_EXT); @@ -1264,9 +1270,13 @@ _mesa_PopAttrib(void) { const struct gl_scissor_attrib *scissor; scissor = (const struct gl_scissor_attrib *) attr->data; - _mesa_Scissor(scissor->X, scissor->Y, - scissor->Width, scissor->Height); - _mesa_set_enable(ctx, GL_SCISSOR_TEST, scissor->Enabled); + _mesa_set_scissor(ctx, + 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); + } break; case GL_STENCIL_BUFFER_BIT: |