aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-09-10 10:17:07 -0600
committerBrian Paul <[email protected]>2009-09-10 12:45:27 -0600
commitc5f8594aebac4b8ba972d09ab18dabd9cc47c8e9 (patch)
tree6ea468d6ef5ede6fc328d2a85f973be7b21a0faf /src/mesa
parent8398535331dae39ff5f52e94a69abdbf7507a343 (diff)
mesa: need to set all stencil bits to 0 before setting the 1 bits
Plus, check for pixel transfer stencil index/offset.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/common/meta.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 28e49b68983..47090ba297b 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1456,6 +1456,8 @@ _mesa_meta_draw_pixels(GLcontext *ctx,
}
else if (_mesa_is_stencil_format(format)) {
if (ctx->Extensions.ARB_fragment_program &&
+ ctx->Pixel.IndexShift == 0 &&
+ ctx->Pixel.IndexOffset == 0 &&
type == GL_UNSIGNED_BYTE) {
/* We'll store stencil as alpha. This only works for GLubyte
* image data because of how incoming values are mapped to alpha
@@ -1590,6 +1592,13 @@ _mesa_meta_draw_pixels(GLcontext *ctx,
_mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
_mesa_set_enable(ctx, GL_STENCIL_TEST, GL_TRUE);
+
+ /* set all stencil bits to 0 */
+ _mesa_StencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+ _mesa_StencilFunc(GL_ALWAYS, 0, 255);
+ _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ /* set stencil bits to 1 where needed */
_mesa_StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
_mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP);