llvmpipe: implement support for cube map arrays
authorRoland Scheidegger <sroland@vmware.com>
Fri, 1 Aug 2014 21:50:35 +0000 (23:50 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Tue, 5 Aug 2014 02:13:17 +0000 (04:13 +0200)
This just covers the resource side of things, not the actual sampling.
Here things are trivial as cube map arrays are identical to 2d arrays in
all respects.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_state_sampler.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/llvmpipe/lp_texture.h

index e25d14e23c457b465ce2a99f60ac207433d5c645..e10a7630ed84f5a10dc9e67edadc34c18915e420 100644 (file)
@@ -347,7 +347,8 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
           target == PIPE_TEXTURE_2D_ARRAY ||
           target == PIPE_TEXTURE_RECT ||
           target == PIPE_TEXTURE_3D ||
-          target == PIPE_TEXTURE_CUBE);
+          target == PIPE_TEXTURE_CUBE ||
+          target == PIPE_TEXTURE_CUBE_ARRAY);
 
    if (sample_count > 1)
       return FALSE;
index d728e85dcb67ff8d588d3a4d50fb6365a0c1f4a7..e85c4ca9c3d04d91d660b12eb3218bf35615a88b 100644 (file)
@@ -844,7 +844,8 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
                   }
 
                   if (res->target == PIPE_TEXTURE_1D_ARRAY ||
-                      res->target == PIPE_TEXTURE_2D_ARRAY) {
+                      res->target == PIPE_TEXTURE_2D_ARRAY ||
+                      res->target == PIPE_TEXTURE_CUBE_ARRAY) {
                      /*
                       * For array textures, we don't have first_layer, instead
                       * adjust last_layer (stored as depth) plus the mip level offsets
@@ -856,6 +857,9 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
                         jit_tex->mip_offsets[j] += view->u.tex.first_layer *
                                                    lp_tex->img_stride[j];
                      }
+                     if (res->target == PIPE_TEXTURE_CUBE_ARRAY) {
+                        assert(jit_tex->depth % 6 == 0);
+                     }
                      assert(view->u.tex.first_layer <= view->u.tex.last_layer);
                      assert(view->u.tex.last_layer < res->array_size);
                   }
index a14a64f9a3d854190b24d473f1580e8a7597483f..0180e99fca0f0c528bef620eecc0927cf27052c4 100644 (file)
@@ -246,12 +246,16 @@ prepare_shader_sampling(
                   img_stride[j] = lp_tex->img_stride[j];
                }
                if (res->target == PIPE_TEXTURE_1D_ARRAY ||
-                   res->target == PIPE_TEXTURE_2D_ARRAY) {
+                   res->target == PIPE_TEXTURE_2D_ARRAY ||
+                   res->target == PIPE_TEXTURE_CUBE_ARRAY) {
                   num_layers = view->u.tex.last_layer - view->u.tex.first_layer + 1;
                   for (j = first_level; j <= last_level; j++) {
                      mip_offsets[j] += view->u.tex.first_layer *
                                        lp_tex->img_stride[j];
                   }
+                  if (res->target == PIPE_TEXTURE_CUBE_ARRAY) {
+                     assert(num_layers % 6 == 0);
+                  }
                   assert(view->u.tex.first_layer <= view->u.tex.last_layer);
                   assert(view->u.tex.last_layer < res->array_size);
                }
index ec9e024662d351ad807dc7ca9783b46d7a2d3db1..ba0e7f8b5b87c81683081e0e37945d98ff25a2ca 100644 (file)
@@ -137,7 +137,8 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
       else if (lpr->base.target == PIPE_TEXTURE_3D)
          num_slices = depth;
       else if (lpr->base.target == PIPE_TEXTURE_1D_ARRAY ||
-               lpr->base.target == PIPE_TEXTURE_2D_ARRAY)
+               lpr->base.target == PIPE_TEXTURE_2D_ARRAY ||
+               lpr->base.target == PIPE_TEXTURE_CUBE_ARRAY)
          num_slices = layers;
       else
          num_slices = 1;
index aa624b05ea4e92460a056737985e92569a1ee3c4..9fbd3a216483692ba780a464aca073e19dfe82cc 100644 (file)
@@ -144,6 +144,7 @@ llvmpipe_resource_is_texture(const struct pipe_resource *resource)
    case PIPE_TEXTURE_RECT:
    case PIPE_TEXTURE_3D:
    case PIPE_TEXTURE_CUBE:
+   case PIPE_TEXTURE_CUBE_ARRAY:
       return TRUE;
    default:
       assert(0);
@@ -165,6 +166,7 @@ llvmpipe_resource_is_1d(const struct pipe_resource *resource)
    case PIPE_TEXTURE_RECT:
    case PIPE_TEXTURE_3D:
    case PIPE_TEXTURE_CUBE:
+   case PIPE_TEXTURE_CUBE_ARRAY:
       return FALSE;
    default:
       assert(0);