meta: Fix temporary image type for float depth/stencil.
authorEric Anholt <eric@anholt.net>
Thu, 30 May 2013 17:06:49 +0000 (10:06 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 3 Jun 2013 20:47:19 +0000 (13:47 -0700)
Fixes assertion failure in piglit copyteximage.

Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/drivers/common/meta.c

index 1ab603a10344dfb37d82bf1f1daef8c96dee18da..1250bd35c8f2eca633fc9f46c61a4b8177d6c8a6 100644 (file)
@@ -3764,10 +3764,20 @@ get_temp_image_type(struct gl_context *ctx, gl_format format)
             return datatype;
          return GL_FLOAT;
       }
-   case GL_DEPTH_COMPONENT:
-      return GL_UNSIGNED_INT;
-   case GL_DEPTH_STENCIL:
-      return GL_UNSIGNED_INT_24_8;
+   case GL_DEPTH_COMPONENT: {
+      GLenum datatype = _mesa_get_format_datatype(format);
+      if (datatype == GL_FLOAT)
+         return GL_FLOAT;
+      else
+         return GL_UNSIGNED_INT;
+   }
+   case GL_DEPTH_STENCIL: {
+      GLenum datatype = _mesa_get_format_datatype(format);
+      if (datatype == GL_FLOAT)
+         return GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
+      else
+         return GL_UNSIGNED_INT_24_8;
+   }
    default:
       _mesa_problem(ctx, "Unexpected format %d in get_temp_image_type()",
                    baseFormat);