meta: Use the DrawBuffer's stencil size
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 4 Mar 2010 01:20:27 +0000 (17:20 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Sat, 6 Mar 2010 00:04:59 +0000 (16:04 -0800)
Previously the code was erroneously using the stencil size of the
context instead of the stencil size of the DrawBuffer.  With FBOs
these may be different.  As a result, clearing the stencil buffer of
an FBO bound to a context that doesn't have stencil would fail.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/common/meta.c

index 8e229bbe388848662c50a858a422abda4bdbf31a..b97b760f1815da03e06705b28836100765e86d11 100644 (file)
@@ -1895,7 +1895,7 @@ _mesa_meta_DrawPixels(GLcontext *ctx,
       _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP);
       _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE);
 
-      for (bit = 0; bit < ctx->Visual.stencilBits; bit++) {
+      for (bit = 0; bit < ctx->DrawBuffer->Visual.stencilBits; bit++) {
          const GLuint mask = 1 << bit;
          if (mask & origStencilMask) {
             _mesa_StencilFunc(GL_ALWAYS, mask, mask);