Mesa (master): mesa/texgetimage: fix missing stencil check

Dave Airlie airlied at kemper.freedesktop.org
Wed Aug 26 00:22:45 UTC 2015


Module: Mesa
Branch: master
Commit: c1452983b44cc8ee238b8c7e2cfca1105c707487
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1452983b44cc8ee238b8c7e2cfca1105c707487

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Aug 24 09:52:12 2015 +1000

mesa/texgetimage: fix missing stencil check

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 at amd.com>
Cc: "11.0" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/mesa/main/texgetimage.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 3c1e166..f62553d 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -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,




More information about the mesa-commit mailing list