mesa/texgetimage: fix missing stencil check
authorDave Airlie <airlied@redhat.com>
Sun, 23 Aug 2015 23:52:12 +0000 (09:52 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 26 Aug 2015 00:22:09 +0000 (10:22 +1000)
GetTexImage can read to stencil8 but only from
a stencil or depthstencil textures.

This fixes a bunch of failures in CTS
GL33-CTS.gtf32.GL3Tests.packed_pixels

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/main/texgetimage.c

index 3c1e166ffa1322a9298e2145389f44bba4b3fa19..f62553dac24843700bcd5191bedd9ac0e075379e 100644 (file)
@@ -1213,6 +1213,13 @@ getteximage_error_check(struct gl_context *ctx,
                   "%s(format=GL_STENCIL_INDEX)", caller);
       return true;
    }
+   else if (_mesa_is_stencil_format(format)
+           && !_mesa_is_depthstencil_format(baseFormat)
+           && !_mesa_is_stencil_format(baseFormat)) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "%s(format mismatch)", caller);
+      return true;
+   }
    else if (_mesa_is_ycbcr_format(format)
             && !_mesa_is_ycbcr_format(baseFormat)) {
       _mesa_error(ctx, GL_INVALID_OPERATION,