Mesa (master): mesa: fix fallback texture for cube map array

Roland Scheidegger sroland at kemper.freedesktop.org
Fri Aug 29 23:18:04 UTC 2014


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

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Thu Aug 28 15:54:52 2014 +0200

mesa: fix fallback texture for cube map array

mesa was creating a cube map array texture with just one layer, which is
not legal. This caused an assertion failure when using that texture later
in llvmpipe (when enabling cube map arrays) since it verifies the number
of layers in the view is divisible by 6 (the sampling code might well crash
randomly otherwise) with piglit glsl-resource-not-bound CubeArray -fbo -auto.

v2: use appropriately sized texel array...

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com> (v1)

---

 src/mesa/main/texobj.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 2a82c2d..923cf60 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -772,18 +772,21 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
 {
    if (!ctx->Shared->FallbackTex[tex]) {
       /* create fallback texture now */
-      const GLsizei width = 1, height = 1, depth = 1;
-      GLubyte texel[4];
+      const GLsizei width = 1, height = 1;
+      GLsizei depth = 1;
+      GLubyte texel[24];
       struct gl_texture_object *texObj;
       struct gl_texture_image *texImage;
       mesa_format texFormat;
       GLuint dims, face, numFaces = 1;
       GLenum target;
 
-      texel[0] =
-      texel[1] =
-      texel[2] = 0x0;
-      texel[3] = 0xff;
+      for (face = 0; face < 6; face++) {
+         texel[4*face + 0] =
+         texel[4*face + 1] =
+         texel[4*face + 2] = 0x0;
+         texel[4*face + 3] = 0xff;
+      }
 
       switch (tex) {
       case TEXTURE_2D_ARRAY_INDEX:
@@ -822,6 +825,7 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
       case TEXTURE_CUBE_ARRAY_INDEX:
          dims = 3;
          target = GL_TEXTURE_CUBE_MAP_ARRAY;
+         depth = 6;
          break;
       case TEXTURE_EXTERNAL_INDEX:
          dims = 2;




More information about the mesa-commit mailing list