r600g/llvm: fix txq for texture buffer
authorVincent Lejeune <vljn@ovi.com>
Tue, 21 May 2013 14:34:52 +0000 (16:34 +0200)
committerVincent Lejeune <vljn@ovi.com>
Wed, 2 Oct 2013 15:30:07 +0000 (17:30 +0200)
src/gallium/drivers/r600/r600_llvm.c
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/radeon/radeon_llvm.h

index 03a68e4648f453c233456dccd8c5cb870173ec4b..3fe6a81a5402f47567862666f6002e25011ca06f 100644 (file)
@@ -23,6 +23,8 @@
 #define CONSTANT_BUFFER_0_ADDR_SPACE 8
 #define CONSTANT_BUFFER_1_ADDR_SPACE (CONSTANT_BUFFER_0_ADDR_SPACE + R600_UCP_CONST_BUFFER)
 #define CONSTANT_TXQ_BUFFER (CONSTANT_BUFFER_0_ADDR_SPACE + R600_TXQ_CONST_BUFFER)
+#define LLVM_R600_BUFFER_INFO_CONST_BUFFER \
+       (CONSTANT_BUFFER_0_ADDR_SPACE + R600_BUFFER_INFO_CONST_BUFFER)
 
 static LLVMValueRef llvm_load_const_buffer(
        struct lp_build_tgsi_context * bld_base,
@@ -410,8 +412,11 @@ static void llvm_emit_tex(
        if (emit_data->inst->Texture.Texture == TGSI_TEXTURE_BUFFER) {
                switch (emit_data->inst->Instruction.Opcode) {
                case TGSI_OPCODE_TXQ: {
-                       LLVMValueRef offset = lp_build_const_int32(bld_base->base.gallivm, 1);
-                       LLVMValueRef cvecval = llvm_load_const_buffer(bld_base, offset, R600_BUFFER_INFO_CONST_BUFFER);
+                       struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base);
+                       ctx->uses_tex_buffers = true;
+                       LLVMValueRef offset = lp_build_const_int32(bld_base->base.gallivm, 0);
+                       LLVMValueRef cvecval = llvm_load_const_buffer(bld_base, offset,
+                               LLVM_R600_BUFFER_INFO_CONST_BUFFER);
                        emit_data->output[0] = cvecval;
                        return;
                }
index 80cdcd500f69cf0bcf33c5bfd64c434f6064645a..6ad7b2b079ea4937aea8f52dd67feba0f98697a7 100644 (file)
@@ -1112,6 +1112,7 @@ static int r600_shader_from_tgsi(struct r600_screen *rscreen,
                radeon_llvm_ctx.alpha_to_one = key.alpha_to_one;
                mod = r600_tgsi_llvm(&radeon_llvm_ctx, tokens);
                ctx.shader->has_txq_cube_array_z_comp = radeon_llvm_ctx.has_txq_cube_array_z_comp;
+               ctx.shader->uses_tex_buffers = radeon_llvm_ctx.uses_tex_buffers;
 
                if (r600_llvm_compile(mod, rscreen->b.family, ctx.bc, &use_kill, dump)) {
                        radeon_llvm_dispose(&radeon_llvm_ctx);
index 14a8c34700690d1eef9d43ef82fa38d889eb55ab..345ae706cf0b136f9a567e44acb78d0446790d3c 100644 (file)
@@ -67,6 +67,7 @@ struct radeon_llvm_context {
        unsigned fs_color_all;
        unsigned alpha_to_one;
        unsigned has_txq_cube_array_z_comp;
+       unsigned uses_tex_buffers;
 
        /*=== Front end configuration ===*/