From 82589d3ffd71f3d4b1dee08b058cd89702a3d7cd Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Tue, 20 Aug 2019 12:45:32 +0200 Subject: [PATCH] radeonsi/nir: Don't add const offset to indirect MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/gallium/drivers/radeonsi/si_shader.c | 25 ++++++------------------ 1 file 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. */ -- 2.30.2