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

Author: Ilia Mirkin <[email protected]>
Date:   Mon Aug  3 02:13:33 2015 -0400

freedreno/a4xx: add cube map array support

Signed-off-by: Ilia Mirkin <[email protected]>

---

 src/gallium/drivers/freedreno/a4xx/fd4_texture.c     |    4 ++--
 src/gallium/drivers/freedreno/freedreno_resource.c   |    1 -
 src/gallium/drivers/freedreno/freedreno_screen.c     |    2 +-
 src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c |   11 +++++++++++
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c 
b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
index d2bc5fe..213b29c 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c
@@ -187,9 +187,9 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct 
pipe_resource *prsc,
                        A4XX_TEX_CONST_3_LAYERSZ(rsc->layer_size);
                break;
        case PIPE_TEXTURE_CUBE:
-       case PIPE_TEXTURE_CUBE_ARRAY:  /* ?? not sure about _CUBE_ARRAY */
+       case PIPE_TEXTURE_CUBE_ARRAY:
                so->texconst3 =
-                       A4XX_TEX_CONST_3_DEPTH(1) |
+                       A4XX_TEX_CONST_3_DEPTH(prsc->array_size / 6) |
                        A4XX_TEX_CONST_3_LAYERSZ(rsc->layer_size);
                break;
        case PIPE_TEXTURE_3D:
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c 
b/src/gallium/drivers/freedreno/freedreno_resource.c
index 709ad4e..800aaa8 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -459,7 +459,6 @@ fd_resource_create(struct pipe_screen *pscreen,
        if (is_a4xx(fd_screen(pscreen))) {
                switch (tmpl->target) {
                case PIPE_TEXTURE_3D:
-                       /* TODO 3D_ARRAY? */
                        rsc->layer_first = false;
                        break;
                default:
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
b/src/gallium/drivers/freedreno/freedreno_screen.c
index 0a20605..ef1a2e7 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -163,7 +163,6 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
        case PIPE_CAP_TEXTURE_MULTISAMPLE:
        case PIPE_CAP_TEXTURE_BARRIER:
        case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
-       case PIPE_CAP_CUBE_MAP_ARRAY:
        case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
        case PIPE_CAP_START_INSTANCE:
        case PIPE_CAP_COMPUTE:
@@ -195,6 +194,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
                return is_a3xx(screen);
 
        case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
+       case PIPE_CAP_CUBE_MAP_ARRAY:
                return is_a4xx(screen);
 
        case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c 
b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index 0ab3345..13c395f 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -1636,6 +1636,11 @@ emit_tex(struct ir3_compile *ctx, nir_tex_instr *tex)
                        coord[i] = ir3_SHL_B(b, coord[i], 0, lod, 0);
        }
 
+       /* the array coord for cube arrays needs 0.5 added to it */
+       if (tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE && tex->is_array &&
+               opc != OPC_ISAML)
+               coord[3] = ir3_ADD_F(b, coord[3], 0, create_immed(b, fui(0.5)), 
0);
+
        /*
         * lay out the first argument in the proper order:
         *  - actual coordinates first
@@ -1759,6 +1764,12 @@ emit_tex_txs(struct ir3_compile *ctx, nir_tex_instr *tex)
 
        tex_info(tex, &flags, &coords);
 
+       /* Actually we want the number of dimensions, not coordinates. This
+        * distinction only matters for cubes.
+        */
+       if (tex->sampler_dim == GLSL_SAMPLER_DIM_CUBE)
+               coords = 2;
+
        dst = get_dst(ctx, &tex->dest, 4);
 
        compile_assert(ctx, tex->num_srcs == 1);

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to