[Mesa-dev] [PATCH 3/5] ac/radv: cleanup some tcs output values access

Dave Airlie airlied at gmail.com
Tue Feb 20 01:25:38 UTC 2018


From: Dave Airlie <airlied at redhat.com>

Just consolidates some code to make it easier to change.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/amd/common/ac_nir_to_llvm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index d0394d3..611bde4 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -383,6 +383,12 @@ get_tcs_out_patch_stride(struct radv_shader_context *ctx)
 }
 
 static LLVMValueRef
+get_tcs_out_vertex_stride(struct radv_shader_context *ctx)
+{
+	return unpack_param(&ctx->ac, ctx->tcs_out_layout, 13, 8);
+}
+
+static LLVMValueRef
 get_tcs_out_patch0_offset(struct radv_shader_context *ctx)
 {
 	return LLVMBuildMul(ctx->ac.builder,
@@ -2897,7 +2903,7 @@ load_tcs_varyings(struct ac_shader_abi *abi,
 		dw_addr = get_tcs_in_current_patch_offset(ctx);
 	} else {
 		if (!is_patch) {
-			stride = unpack_param(&ctx->ac, ctx->tcs_out_layout, 13, 8);
+			stride = get_tcs_out_vertex_stride(ctx);
 			dw_addr = get_tcs_out_current_patch_offset(ctx);
 		} else {
 			dw_addr = get_tcs_out_current_patch_data_offset(ctx);
@@ -2953,7 +2959,7 @@ store_tcs_output(struct ac_shader_abi *abi,
 	}
 
 	if (!is_patch) {
-		stride = unpack_param(&ctx->ac, ctx->tcs_out_layout, 13, 8);
+		stride = get_tcs_out_vertex_stride(ctx);
 		dw_addr = get_tcs_out_current_patch_offset(ctx);
 	} else {
 		dw_addr = get_tcs_out_current_patch_data_offset(ctx);
-- 
2.9.5



More information about the mesa-dev mailing list