gallium/radeon: expose emit_fetch
authorMarek Olšák <marek.olsak@amd.com>
Tue, 3 Mar 2015 14:11:27 +0000 (15:11 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 22 Jul 2015 22:59:31 +0000 (00:59 +0200)
Radeonsi will use this.

src/gallium/drivers/radeon/radeon_llvm.h
src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c

index c50eb6914be90365497219e1b13117ecc019d6e5..ef09ead9774c3f2b1cc74d8b1cd25d85a6229bd6 100644 (file)
@@ -215,6 +215,11 @@ radeon_llvm_emit_fetch_double(struct lp_build_tgsi_context *bld_base,
 LLVMValueRef radeon_llvm_saturate(struct lp_build_tgsi_context *bld_base,
                                   LLVMValueRef value);
 
+LLVMValueRef radeon_llvm_emit_fetch(struct lp_build_tgsi_context *bld_base,
+                                   const struct tgsi_full_src_register *reg,
+                                   enum tgsi_opcode_type type,
+                                   unsigned swizzle);
+
 void radeon_llvm_emit_store(
        struct lp_build_tgsi_context * bld_base,
        const struct tgsi_full_instruction * inst,
index 5bc93d7aa0e6cd90bb16504d1ad7636f8b952b52..39bbdb67778b3e1c72bd06e9a3eeefc96391837a 100644 (file)
@@ -109,13 +109,6 @@ emit_array_index(
        return LLVMBuildAdd(gallivm->builder, addr, lp_build_const_int32(gallivm, offset), "");
 }
 
-static LLVMValueRef
-emit_fetch(
-       struct lp_build_tgsi_context *bld_base,
-       const struct tgsi_full_src_register *reg,
-       enum tgsi_opcode_type type,
-       unsigned swizzle);
-
 LLVMValueRef
 radeon_llvm_emit_fetch_double(
        struct lp_build_tgsi_context *bld_base,
@@ -158,7 +151,7 @@ emit_array_fetch(
 
        for (i = 0; i < size; ++i) {
                tmp_reg.Register.Index = i + range.First;
-               LLVMValueRef temp = emit_fetch(bld_base, &tmp_reg, type, swizzle);
+               LLVMValueRef temp = radeon_llvm_emit_fetch(bld_base, &tmp_reg, type, swizzle);
                result = LLVMBuildInsertElement(builder, result, temp,
                        lp_build_const_int32(gallivm, i), "");
        }
@@ -172,12 +165,10 @@ static bool uses_temp_indirect_addressing(
        return (bld->indirect_files & (1 << TGSI_FILE_TEMPORARY));
 }
 
-static LLVMValueRef
-emit_fetch(
-       struct lp_build_tgsi_context *bld_base,
-       const struct tgsi_full_src_register *reg,
-       enum tgsi_opcode_type type,
-       unsigned swizzle)
+LLVMValueRef radeon_llvm_emit_fetch(struct lp_build_tgsi_context *bld_base,
+                                   const struct tgsi_full_src_register *reg,
+                                   enum tgsi_opcode_type type,
+                                   unsigned swizzle)
 {
        struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base);
        struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base);
@@ -188,7 +179,7 @@ emit_fetch(
                LLVMValueRef values[TGSI_NUM_CHANNELS];
                unsigned chan;
                for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
-                       values[chan] = emit_fetch(bld_base, reg, type, chan);
+                       values[chan] = radeon_llvm_emit_fetch(bld_base, reg, type, chan);
                }
                return lp_build_gather_values(bld_base->base.gallivm, values,
                                              TGSI_NUM_CHANNELS);
@@ -1546,10 +1537,10 @@ void radeon_llvm_context_init(struct radeon_llvm_context * ctx)
        bld_base->emit_declaration = emit_declaration;
        bld_base->emit_immediate = emit_immediate;
 
-       bld_base->emit_fetch_funcs[TGSI_FILE_IMMEDIATE] = emit_fetch;
-       bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = emit_fetch;
-       bld_base->emit_fetch_funcs[TGSI_FILE_TEMPORARY] = emit_fetch;
-       bld_base->emit_fetch_funcs[TGSI_FILE_OUTPUT] = emit_fetch;
+       bld_base->emit_fetch_funcs[TGSI_FILE_IMMEDIATE] = radeon_llvm_emit_fetch;
+       bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = radeon_llvm_emit_fetch;
+       bld_base->emit_fetch_funcs[TGSI_FILE_TEMPORARY] = radeon_llvm_emit_fetch;
+       bld_base->emit_fetch_funcs[TGSI_FILE_OUTPUT] = radeon_llvm_emit_fetch;
        bld_base->emit_fetch_funcs[TGSI_FILE_SYSTEM_VALUE] = fetch_system_value;
 
        /* Allocate outputs */