diff options
author | Connor Abbott <[email protected]> | 2019-08-20 12:45:32 +0200 |
---|---|---|
committer | Connor Abbott <[email protected]> | 2019-08-23 11:05:31 +0200 |
commit | 82589d3ffd71f3d4b1dee08b058cd89702a3d7cd (patch) | |
tree | f930fc25e3b0d9e2091e99fd0069c4957a902755 | |
parent | 400db1852bda58f0559c5612fcc378695380425a (diff) |
radeonsi/nir: Don't add const offset to indirect
This is already done in get_deref_offset() in the common code. We were
adding it twice accidentally.
Fixes KHR-GL45.enhanced_layouts.varying_array_locations.
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 6f1ecaf44ed..8f6719bd35e 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1149,11 +1149,7 @@ static LLVMValueRef si_nir_load_tcs_varyings(struct ac_shader_abi *abi, } } - if (param_index) { - /* Add the constant index to the indirect index */ - param_index = LLVMBuildAdd(ctx->ac.builder, param_index, - LLVMConstInt(ctx->i32, const_index, 0), ""); - } else { + if (!param_index) { param_index = LLVMConstInt(ctx->i32, const_index, 0); } @@ -1244,11 +1240,7 @@ LLVMValueRef si_nir_load_input_tes(struct ac_shader_abi *abi, base = LLVMGetParam(ctx->main_fn, ctx->param_tcs_offchip_offset); - if (param_index) { - /* Add the constant index to the indirect index */ - param_index = LLVMBuildAdd(ctx->ac.builder, param_index, - LLVMConstInt(ctx->i32, const_index, 0), ""); - } else { + if (!param_index) { param_index = LLVMConstInt(ctx->i32, const_index, 0); } @@ -1407,14 +1399,9 @@ static void si_nir_store_output_tcs(struct ac_shader_abi *abi, driver_location = driver_location / 4; - if (param_index) { - /* Add the constant index to the indirect index */ - param_index = LLVMBuildAdd(ctx->ac.builder, param_index, - LLVMConstInt(ctx->i32, const_index, 0), ""); - } else { - if (const_index != 0) - param_index = LLVMConstInt(ctx->i32, const_index, 0); - } + bool is_const = !param_index; + if (!param_index) + param_index = LLVMConstInt(ctx->i32, const_index, 0); if (!is_patch) { stride = get_tcs_out_vertex_dw_stride(ctx); @@ -1438,7 +1425,7 @@ static void si_nir_store_output_tcs(struct ac_shader_abi *abi, skip_lds_store = !info->reads_perpatch_outputs; - if (!param_index) { + if (is_const && const_index == 0) { int name = info->output_semantic_name[driver_location]; /* Always write tess factors into LDS for the TCS epilog. */ |