ac/radv: cleanup some tcs output values access
authorDave Airlie <airlied@redhat.com>
Mon, 19 Feb 2018 06:19:07 +0000 (06:19 +0000)
committerDave Airlie <airlied@redhat.com>
Wed, 21 Feb 2018 00:01:23 +0000 (00:01 +0000)
Just consolidates some code to make it easier to change.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_nir_to_llvm.c

index 88b1abd2ae34033b46e101a3247d1d1e855d0d32..ec4dd098ed135b8153f8acd778a28a532d39fd61 100644 (file)
@@ -382,6 +382,12 @@ get_tcs_out_patch_stride(struct radv_shader_context *ctx)
        return unpack_param(&ctx->ac, ctx->tcs_out_layout, 0, 13);
 }
 
+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)
 {
@@ -2899,7 +2905,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);
@@ -2955,7 +2961,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);