diff options
author | Marek Olšák <[email protected]> | 2017-09-05 19:52:23 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-09-07 13:00:07 +0200 |
commit | 07fe10c75d0f099c1a4f6b5e41c65ed46f30223e (patch) | |
tree | 0909fed72baa3c35e731b8beaecfb1bf5e985a30 /src/gallium/drivers/radeonsi/si_shader.c | |
parent | 89bf8668c2864bd5573fb72dedcac270ebcd2c07 (diff) |
radeonsi: don't read tcs_out_lds_layout.vertex_size from an SGPR
TCS outputs are usually not written to LDS, so no stats here.
Tested-by: Dieter Nützel <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_shader.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 96ba907a082..9117aec5b77 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -326,6 +326,23 @@ get_tcs_out_patch_stride(struct si_shader_context *ctx) return unpack_param(ctx, ctx->param_tcs_out_lds_layout, 0, 13); } +static unsigned get_tcs_out_vertex_dw_stride_constant(struct si_shader_context *ctx) +{ + assert(ctx->type == PIPE_SHADER_TESS_CTRL); + + if (ctx->shader->key.mono.u.ff_tcs_inputs_to_copy) + return util_last_bit64(ctx->shader->key.mono.u.ff_tcs_inputs_to_copy) * 4; + + return util_last_bit64(ctx->shader->selector->outputs_written) * 4; +} + +static LLVMValueRef get_tcs_out_vertex_dw_stride(struct si_shader_context *ctx) +{ + unsigned stride = get_tcs_out_vertex_dw_stride_constant(ctx); + + return LLVMConstInt(ctx->i32, stride, 0); +} + static LLVMValueRef get_tcs_out_patch0_offset(struct si_shader_context *ctx) { @@ -1086,7 +1103,7 @@ static LLVMValueRef fetch_output_tcs( LLVMValueRef dw_addr, stride; if (reg->Register.Dimension) { - stride = unpack_param(ctx, ctx->param_tcs_out_lds_layout, 13, 8); + stride = get_tcs_out_vertex_dw_stride(ctx); dw_addr = get_tcs_out_current_patch_offset(ctx); dw_addr = get_dw_address(ctx, NULL, reg, stride, dw_addr); } else { @@ -1139,7 +1156,7 @@ static void store_output_tcs(struct lp_build_tgsi_context *bld_base, } if (reg->Register.Dimension) { - stride = unpack_param(ctx, ctx->param_tcs_out_lds_layout, 13, 8); + stride = get_tcs_out_vertex_dw_stride(ctx); dw_addr = get_tcs_out_current_patch_offset(ctx); dw_addr = get_dw_address(ctx, reg, NULL, stride, dw_addr); skip_lds_store = !sh_info->reads_pervertex_outputs; |