[Mesa-dev] [PATCH] mesa: fix GetTexImage for 1D array depth textures

Dave Airlie airlied at gmail.com
Tue Sep 30 16:24:15 PDT 2014


From: Dave Airlie <airlied at redhat.com>

While running piglit in virgl, I hit an assert in intel driver.

"qemu-system-x86_64: intel_tex.c:219: intel_map_texture_image: Assertion `tex_image->TexObject->Target != 0x8C18 || h == 1' failed."

Thanks to Eric and Ken for pointing me in the right direction,

Fix the get_tex_depth to do the same fixup as get_tex_rgba does
for 1D array textures.

Signed-off-by: Dave Airlie <airlied at redhat.com>
Cc: mesa-stable at lists.freedesktop.org
---
 src/mesa/main/texgetimage.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 2c54e4a..5d392ae 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -78,8 +78,8 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
               struct gl_texture_image *texImage)
 {
    const GLint width = texImage->Width;
-   const GLint height = texImage->Height;
-   const GLint depth = texImage->Depth;
+   GLint height = texImage->Height;
+   GLint depth = texImage->Depth;
    GLint img, row;
    GLfloat *depthRow = malloc(width * sizeof(GLfloat));
 
@@ -88,6 +88,10 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
       return;
    }
 
+   if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
+      depth = height;
+      height = 1;
+   }
    for (img = 0; img < depth; img++) {
       GLubyte *srcMap;
       GLint srcRowStride;
-- 
1.9.3



More information about the mesa-dev mailing list