swrast: Don't do Z24S8 drawpixels fast-paths with Z32_X24S8 input data.
authorEric Anholt <eric@anholt.net>
Sat, 3 Dec 2011 01:32:53 +0000 (17:32 -0800)
committerEric Anholt <eric@anholt.net>
Wed, 14 Dec 2011 21:17:45 +0000 (13:17 -0800)
The cool part was that in the "fbo-depthstencil -drawpixels
GL_DEPTH24_STENCIL8 32F_24_8_REV" testcase, the shifting happened to
end up with a value awfully close to the expected value, except for
every other pixel being 0 (the stencil value, shifted away to
nothing).

Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/swrast/s_drawpix.c

index b6c433753afa679075f45b7674ebbc1634971c86..7259881c19aff05bbc46f028769a67b071299fdb 100644 (file)
@@ -625,7 +625,8 @@ draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
                                   GL_DEPTH_STENCIL_EXT, type, i, 0);
 
          if (ctx->Depth.Mask) {
-            if (!scaleOrBias && ctx->DrawBuffer->Visual.depthBits == 24) {
+            if (!scaleOrBias && ctx->DrawBuffer->Visual.depthBits == 24 &&
+               type == GL_UNSIGNED_INT_24_8) {
                /* fast path 24-bit zbuffer */
                GLuint zValues[MAX_WIDTH];
                GLint j;
@@ -639,7 +640,8 @@ draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
                else
                   depthRb->PutRow(ctx, depthRb, width, x, y + i, zValues,NULL);
             }
-            else if (!scaleOrBias && ctx->DrawBuffer->Visual.depthBits == 16) {
+            else if (!scaleOrBias && ctx->DrawBuffer->Visual.depthBits == 16 &&
+                    type == GL_UNSIGNED_INT_24_8) {
                /* fast path 16-bit zbuffer */
                GLushort zValues[MAX_WIDTH];
                GLint j;