[Mesa-dev] [PATCH 31/35] meta: Enable cubemap array texture support to decompress_texture_image

Ian Romanick idr at freedesktop.org
Wed Jan 29 13:53:22 PST 2014


From: Ian Romanick <ian.d.romanick at intel.com>

Fixed piglit test getteximage-targets S3TC CUBE_ARRAY on systems that
don't have libtxc_dxtn installed.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/common/meta.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 500311d..5237f2f 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3879,7 +3879,8 @@ decompress_texture_image(struct gl_context *ctx,
 
    if (slice > 0) {
       assert(target == GL_TEXTURE_3D ||
-             target == GL_TEXTURE_2D_ARRAY);
+             target == GL_TEXTURE_2D_ARRAY ||
+             target == GL_TEXTURE_CUBE_MAP_ARRAY);
    }
 
    switch (target) {
@@ -3893,8 +3894,8 @@ decompress_texture_image(struct gl_context *ctx,
       return;
 
    case GL_TEXTURE_CUBE_MAP_ARRAY:
-      /* This target is just broken currently. */
-      return;
+      faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + (slice % 6);
+      break;
 
    case GL_TEXTURE_CUBE_MAP:
       faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face;
@@ -3943,7 +3944,7 @@ decompress_texture_image(struct gl_context *ctx,
       struct glsl_sampler *sampler;
 
       setup_vertex_objects(&decompress->ArrayObj, &decompress->VBO, true,
-                           2, 3, 0);
+                           2, 4, 0);
 
       /* Generate a relevant fragment shader program for the texture target */
       sampler = setup_texture_sampler(target, &decompress->samplers);
@@ -4095,8 +4096,7 @@ _mesa_meta_GetTexImage(struct gl_context *ctx,
     * unsigned, normalized values.  We could handle signed and unnormalized 
     * with floating point renderbuffers...
     */
-   if (texImage->TexObject->Target != GL_TEXTURE_CUBE_MAP_ARRAY
-       && _mesa_is_format_compressed(texImage->TexFormat) &&
+   if (_mesa_is_format_compressed(texImage->TexFormat) &&
        _mesa_get_format_datatype(texImage->TexFormat)
        == GL_UNSIGNED_NORMALIZED) {
       struct gl_texture_object *texObj = texImage->TexObject;
@@ -4105,7 +4105,8 @@ _mesa_meta_GetTexImage(struct gl_context *ctx,
       _mesa_unlock_texture(ctx, texObj);
       for (slice = 0; slice < texImage->Depth; slice++) {
          void *dst;
-         if (texImage->TexObject->Target == GL_TEXTURE_2D_ARRAY) {
+         if (texImage->TexObject->Target == GL_TEXTURE_2D_ARRAY
+             || texImage->TexObject->Target == GL_TEXTURE_CUBE_MAP_ARRAY) {
             /* Setup pixel packing.  SkipPixels and SkipRows will be applied
              * in the decompress_texture_image() function's call to
              * glReadPixels but we need to compute the dest slice's address
-- 
1.8.1.4



More information about the mesa-dev mailing list