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

Author: Dave Airlie <[email protected]>
Date:   Mon Feb  5 08:42:52 2018 +1000

r600: overhaul buffer resource query.

This cleans up and fixes the previous fix even more.

Buffers from textures start at max const,
buffers from buffers/images come in from the 168 offset.

This fixes a bunch of:
KHR-GL45.shader_storage_buffer_object*

Reviewed-by: Roland Scheidegger <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>

---

 src/gallium/drivers/r600/r600_shader.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 4aaa3621d7..d14514574e 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -7010,7 +7010,7 @@ static int do_vtx_fetch_inst(struct r600_shader_ctx *ctx, 
boolean src_requires_l
        return 0;
 }
 
-static int r600_do_buffer_txq(struct r600_shader_ctx *ctx, int reg_idx, int 
offset)
+static int r600_do_buffer_txq(struct r600_shader_ctx *ctx, int reg_idx, int 
offset, int eg_buffer_base)
 {
        struct tgsi_full_instruction *inst = 
&ctx->parse.FullToken.FullInstruction;
        int r;
@@ -7036,7 +7036,7 @@ static int r600_do_buffer_txq(struct r600_shader_ctx 
*ctx, int reg_idx, int offs
                struct r600_bytecode_vtx vtx;
                memset(&vtx, 0, sizeof(vtx));
                vtx.op = FETCH_OP_GET_BUFFER_RESINFO;
-               vtx.buffer_id = id + R600_MAX_CONST_BUFFERS;
+               vtx.buffer_id = id + eg_buffer_base;
                vtx.fetch_type = SQ_VTX_FETCH_NO_INDEX_OFFSET;
                vtx.src_gpr = 0;
                vtx.mega_fetch_count = 16; /* no idea here really... */
@@ -7110,7 +7110,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
                if (inst->Instruction.Opcode == TGSI_OPCODE_TXQ) {
                        if (ctx->bc->chip_class < EVERGREEN)
                                ctx->shader->uses_tex_buffers = true;
-                       return r600_do_buffer_txq(ctx, 1, 0);
+                       return r600_do_buffer_txq(ctx, 1, 0, 
R600_MAX_CONST_BUFFERS);
                }
                else if (inst->Instruction.Opcode == TGSI_OPCODE_TXF) {
                        if (ctx->bc->chip_class < EVERGREEN)
@@ -8854,10 +8854,11 @@ static int tgsi_resq(struct r600_shader_ctx *ctx)
            (inst->Src[0].Register.File == TGSI_FILE_IMAGE && 
inst->Memory.Texture == TGSI_TEXTURE_BUFFER)) {
                if (ctx->bc->chip_class < EVERGREEN)
                        ctx->shader->uses_tex_buffers = true;
-               unsigned offset = 0;
-               if (inst->Src[0].Register.File == TGSI_FILE_IMAGE)
-                       offset += R600_IMAGE_REAL_RESOURCE_OFFSET - 
R600_MAX_CONST_BUFFERS + ctx->shader->image_size_const_offset;
-               return r600_do_buffer_txq(ctx, 0, offset);
+               unsigned eg_buffer_base = 0;
+               eg_buffer_base = R600_IMAGE_REAL_RESOURCE_OFFSET;
+               if (inst->Src[0].Register.File == TGSI_FILE_BUFFER)
+                       eg_buffer_base += ctx->info.file_count[TGSI_FILE_IMAGE];
+               return r600_do_buffer_txq(ctx, 0, 
ctx->shader->image_size_const_offset, eg_buffer_base);
        }
 
        if (inst->Memory.Texture == TGSI_TEXTURE_CUBE_ARRAY &&

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

Reply via email to