[Mesa-dev] [PATCH] mesa/copyimage: make sure number of samples match.

Dave Airlie airlied at gmail.com
Tue May 3 06:11:55 UTC 2016


From: Dave Airlie <airlied at redhat.com>

This fixes
GL43-CTS.copy_image.samples_missmatch
which otherwise asserts in the radeonsi driver.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/mesa/main/copyimage.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/mesa/main/copyimage.c b/src/mesa/main/copyimage.c
index a0f1c69..63ce13a 100644
--- a/src/mesa/main/copyimage.c
+++ b/src/mesa/main/copyimage.c
@@ -552,12 +552,26 @@ _mesa_CopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel,
                             "dst"))
       return;
 
+   /* Section 18.3.2 (Copying Between Images) of the OpenGL 4.5 Core Profile
+    * spec says:
+    *
+    *    An INVALID_OPERATION error is generated if either object is a texture
+    *    and the texture is not complete, if the source and destination internal
+    *    formats are not compatible, or if the number of samples do not match.
+    */
    if (!copy_format_compatible(ctx, srcIntFormat, dstIntFormat)) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                   "glCopyImageSubData(internalFormat mismatch)");
       return;
    }
 
+   if (srcTexImage && dstTexImage &&
+       srcTexImage->NumSamples != dstTexImage->NumSamples) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glCopyImageSubData(number of samples mismatch)");
+      return;
+   }
+
    /* loop over 2D slices/faces/layers */
    for (i = 0; i < srcDepth; ++i) {
       int newSrcZ = srcZ + i;
-- 
2.5.5



More information about the mesa-dev mailing list