summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/common
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-09-10 15:41:52 -0600
committerBrian Paul <brianp@vmware.com>2009-09-10 15:41:52 -0600
commitd9dc4cb0e4f578da9e50c9d1ba6fd9c22ea2fca6 (patch)
treeb414384522f41d5d422bfe09de3126eb9755594f /src/mesa/drivers/common
parent8c37a4c8fd133f3cddc6798a0834038730acc213 (diff)
parent4b1cbfcbe66161a7b56d56cd9e2c35ce49b3a91d (diff)
Merge branch 'mesa_7_6_branch'
Diffstat (limited to 'src/mesa/drivers/common')
-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 276e981a94..0b9781027e 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -1522,6 +1522,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
@@ -1656,6 +1658,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);