Mesa (master): ac/nir: Fix TCS output LDS offsets.

Bas Nieuwenhuizen bnieuwenhuizen at kemper.freedesktop.org
Fri Jan 19 00:57:24 UTC 2018


Module: Mesa
Branch: master
Commit: 4a9fd90e1e7ebbb8015d964474d476093ed9c3a4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a9fd90e1e7ebbb8015d964474d476093ed9c3a4

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Fri Jan 19 01:20:12 2018 +0100

ac/nir: Fix TCS output LDS offsets.

When a channel was not set we also did not increase the LDS address,
while that obviously should happen.

The output loading code was inadvertently fixed which resulted in a
mismatch causing the SaschaWillems tessellation demo to result
in corrupt rendering.

Fixes: 7898eb9a60 "ac: rework load_tcs_{inputs,outputs}"
Reviewed-by: Dave Airlie <airlied at redhat.com>

---

 src/amd/common/ac_nir_to_llvm.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index cd400376a0..0bebfea972 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -2968,16 +2968,17 @@ store_tcs_output(struct ac_shader_abi *abi,
 			continue;
 		LLVMValueRef value = ac_llvm_extract_elem(&ctx->ac, src, chan - component);
 
-		if (store_lds || is_tess_factor)
-			ac_lds_store(&ctx->ac, dw_addr, value);
+		if (store_lds || is_tess_factor) {
+			LLVMValueRef dw_addr_chan =
+				LLVMBuildAdd(ctx->builder, dw_addr,
+				                           LLVMConstInt(ctx->ac.i32, chan, false), "");
+			ac_lds_store(&ctx->ac, dw_addr_chan, value);
+		}
 
 		if (!is_tess_factor && writemask != 0xF)
 			ac_build_buffer_store_dword(&ctx->ac, ctx->hs_ring_tess_offchip, value, 1,
 						    buf_addr, ctx->oc_lds,
 						    4 * (base + chan), 1, 0, true, false);
-
-		dw_addr = LLVMBuildAdd(ctx->builder, dw_addr,
-				       ctx->ac.i32_1, "");
 	}
 
 	if (writemask == 0xF) {




More information about the mesa-commit mailing list