radeon/llvm: add support to fetch temps as vectors
authorChristian König <deathsimple@vodafone.de>
Sun, 12 Aug 2012 18:06:21 +0000 (20:06 +0200)
committerChristian König <deathsimple@vodafone.de>
Wed, 15 Aug 2012 20:13:19 +0000 (22:13 +0200)
Necessary for texture fetches with temp regs as source on SI.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c

index 641d27745c3066723a72c1e156dd111eebf9c75e..04469e28759f02d9bf286214e145fa21e736d5fa 100644 (file)
@@ -159,11 +159,21 @@ emit_fetch_temporary(
 {
        struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base);
        LLVMBuilderRef builder = bld_base->base.gallivm->builder;
+       if (swizzle == ~0) {
+               LLVMValueRef values[TGSI_NUM_CHANNELS] = {};
+               unsigned chan;
+               for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
+                       values[chan] = emit_fetch_temporary(bld_base, reg, type, chan);
+               }
+               return lp_build_gather_values(bld_base->base.gallivm, values,
+                                               TGSI_NUM_CHANNELS);
+       }
+
        if (reg->Register.Indirect) {
                LLVMValueRef array_index = emit_array_index(bld, reg, swizzle);
                LLVMValueRef ptr = LLVMBuildGEP(builder, bld->temps_array, &array_index,
                                                1, "");
-       return LLVMBuildLoad(builder, ptr, "");
+               return LLVMBuildLoad(builder, ptr, "");
        } else {
                LLVMValueRef temp_ptr;
                temp_ptr = lp_get_temp_ptr_soa(bld, reg->Register.Index, swizzle);