radeonsi: move the buffer descriptor to the end of the image descriptor
authorMarek Olšák <marek.olsak@amd.com>
Sun, 1 Feb 2015 15:58:08 +0000 (16:58 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 4 Feb 2015 13:34:13 +0000 (14:34 +0100)
This will allow supporting NULL textures.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_descriptors.c
src/gallium/drivers/radeonsi/si_pipe.h
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_state.c

index 573787a991ae6de86bbe756930aa392edbe207a4..15b4da1e8c1e80aa327d356b54306357114889e7 100644 (file)
@@ -1063,7 +1063,7 @@ static void si_invalidate_buffer(struct pipe_context *ctx, struct pipe_resource
        /* Texture buffers - update virtual addresses in sampler view descriptors. */
        LIST_FOR_EACH_ENTRY(view, &sctx->b.texture_buffers, list) {
                if (view->base.texture == buf) {
-                       si_desc_reset_buffer_offset(ctx, view->state, old_va, buf);
+                       si_desc_reset_buffer_offset(ctx, &view->state[4], old_va, buf);
                }
        }
        /* Texture buffers - update bindings. */
index b88f1542c5e35e9d3d7eacfe2cff6907fee82d6c..d2edcdf8ea7894c6c52b402074ba4024e6ff4932 100644 (file)
@@ -90,6 +90,8 @@ struct si_sampler_view {
        struct pipe_sampler_view        base;
        struct list_head                list;
        struct r600_resource            *resource;
+        /* [0..7] = image descriptor
+         * [4..7] = buffer descriptor */
        uint32_t                        state[8];
        uint32_t                        fmask_state[8];
 };
index 52f1fa4acae2b552446660a4d70d5bbcdafb573d..2c1dac928a2be88c006ac03c1123649c71165846 100644 (file)
@@ -1538,7 +1538,7 @@ static void tex_fetch_args(
                /* Bitcast and truncate v8i32 to v16i8. */
                LLVMValueRef res = si_shader_ctx->resources[sampler_index];
                res = LLVMBuildBitCast(gallivm->builder, res, v2i128, "");
-               res = LLVMBuildExtractElement(gallivm->builder, res, bld_base->uint_bld.zero, "");
+               res = LLVMBuildExtractElement(gallivm->builder, res, bld_base->uint_bld.one, "");
                res = LLVMBuildBitCast(gallivm->builder, res, v16i8, "");
 
                emit_data->dst_type = LLVMVectorType(bld_base->base.elem_type, 4);
@@ -2016,7 +2016,7 @@ static void txq_fetch_args(
                LLVMValueRef size = si_shader_ctx->resources[inst->Src[1].Register.Index];
                size = LLVMBuildBitCast(gallivm->builder, size, v8i32, "");
                size = LLVMBuildExtractElement(gallivm->builder, size,
-                                             lp_build_const_int32(gallivm, 2), "");
+                                             lp_build_const_int32(gallivm, 6), "");
                emit_data->args[0] = size;
                return;
        }
index 7086363b77ea8fbad0d4cf26aa728cfd0778a017..85954b74ea15b0b5b95f4192ac5cb31b1d6eb044 100644 (file)
@@ -2262,11 +2262,11 @@ static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx
                format = si_translate_buffer_dataformat(ctx->screen, desc, first_non_void);
                num_format = si_translate_buffer_numformat(ctx->screen, desc, first_non_void);
 
-               view->state[0] = va;
-               view->state[1] = S_008F04_BASE_ADDRESS_HI(va >> 32) |
+               view->state[4] = va;
+               view->state[5] = S_008F04_BASE_ADDRESS_HI(va >> 32) |
                                 S_008F04_STRIDE(stride);
-               view->state[2] = state->u.buf.last_element + 1 - state->u.buf.first_element;
-               view->state[3] = S_008F0C_DST_SEL_X(si_map_swizzle(desc->swizzle[0])) |
+               view->state[6] = state->u.buf.last_element + 1 - state->u.buf.first_element;
+               view->state[7] = S_008F0C_DST_SEL_X(si_map_swizzle(desc->swizzle[0])) |
                                 S_008F0C_DST_SEL_Y(si_map_swizzle(desc->swizzle[1])) |
                                 S_008F0C_DST_SEL_Z(si_map_swizzle(desc->swizzle[2])) |
                                 S_008F0C_DST_SEL_W(si_map_swizzle(desc->swizzle[3])) |