ac/radeonsi: pass type to load_tess_varyings()
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 20 Feb 2018 23:09:18 +0000 (10:09 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 21 Feb 2018 22:31:00 +0000 (09:31 +1100)
We need this to be able to load 64bit varyings.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_nir_to_llvm.c
src/amd/common/ac_shader_abi.h
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_shader_internal.h

index 2460e105f7a2f2bb005166403f6254f773327865..213306322dd602764bb715684a924a31c304ea93 100644 (file)
@@ -2885,6 +2885,7 @@ get_dw_address(struct radv_shader_context *ctx,
 
 static LLVMValueRef
 load_tcs_varyings(struct ac_shader_abi *abi,
+                 LLVMTypeRef type,
                  LLVMValueRef vertex_index,
                  LLVMValueRef indir_index,
                  unsigned const_index,
@@ -3008,6 +3009,7 @@ store_tcs_output(struct ac_shader_abi *abi,
 
 static LLVMValueRef
 load_tes_input(struct ac_shader_abi *abi,
+              LLVMTypeRef type,
               LLVMValueRef vertex_index,
               LLVMValueRef param_index,
               unsigned const_index,
@@ -3146,12 +3148,21 @@ static LLVMValueRef load_tess_varyings(struct ac_nir_context *ctx,
                         false, NULL, is_patch ? NULL : &vertex_index,
                         &const_index, &indir_index);
 
-       result = ctx->abi->load_tess_varyings(ctx->abi, vertex_index, indir_index,
+       LLVMTypeRef dest_type = get_def_type(ctx, &instr->dest.ssa);
+
+       LLVMTypeRef src_component_type;
+       if (LLVMGetTypeKind(dest_type) == LLVMVectorTypeKind)
+               src_component_type = LLVMGetElementType(dest_type);
+       else
+               src_component_type = dest_type;
+
+       result = ctx->abi->load_tess_varyings(ctx->abi, src_component_type,
+                                             vertex_index, indir_index,
                                              const_index, location, driver_location,
                                              instr->variables[0]->var->data.location_frac,
                                              instr->num_components,
                                              is_patch, is_compact, load_inputs);
-       return LLVMBuildBitCast(ctx->ac.builder, result, get_def_type(ctx, &instr->dest.ssa), "");
+       return LLVMBuildBitCast(ctx->ac.builder, result, dest_type, "");
 }
 
 static LLVMValueRef visit_load_var(struct ac_nir_context *ctx,
index 62b8b7a5dc470ca11d498ecf2e0ca4e26b1ff374..10d41ef9971b61642591c09299cd07bb97fc48cf 100644 (file)
@@ -96,6 +96,7 @@ struct ac_shader_abi {
                                    LLVMTypeRef type);
 
        LLVMValueRef (*load_tess_varyings)(struct ac_shader_abi *abi,
+                                          LLVMTypeRef type,
                                           LLVMValueRef vertex_index,
                                           LLVMValueRef param_index,
                                           unsigned const_index,
index 1f2338ad6d0143379bbe40af9e0167e49b68836e..2d98f93e543ee89f69475fb9a3aab2e3c7bacdf0 100644 (file)
@@ -1215,6 +1215,7 @@ static LLVMValueRef fetch_input_tcs(
 }
 
 static LLVMValueRef si_nir_load_tcs_varyings(struct ac_shader_abi *abi,
+                                            LLVMTypeRef type,
                                             LLVMValueRef vertex_index,
                                             LLVMValueRef param_index,
                                             unsigned const_index,
@@ -1316,6 +1317,7 @@ static LLVMValueRef fetch_input_tes(
 }
 
 LLVMValueRef si_nir_load_input_tes(struct ac_shader_abi *abi,
+                                  LLVMTypeRef type,
                                   LLVMValueRef vertex_index,
                                   LLVMValueRef param_index,
                                   unsigned const_index,
index 571df5597709ce6c4be2978f76389d85c73d386d..42a1b9f107cccdbc6cbc088f345696b668db8f97 100644 (file)
@@ -268,6 +268,7 @@ LLVMValueRef si_llvm_emit_fetch(struct lp_build_tgsi_context *bld_base,
                                unsigned swizzle);
 
 LLVMValueRef si_nir_load_input_tes(struct ac_shader_abi *abi,
+                                  LLVMTypeRef type,
                                   LLVMValueRef vertex_index,
                                   LLVMValueRef param_index,
                                   unsigned const_index,