From 3d063a7024e54340b6fed2af964ea2790056a3e3 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Wed, 23 Sep 2020 12:24:16 -0700 Subject: Fix a bug around byte-address buffer loads of vectors (#1557) This problem is only visible when * using `RWByteAddressBuffer.Load`, * when `V` is `vector`, * and `V` is a non-32-bit type In such a case, the Slang compiler generates output HLSL like: someBuffer.Load>(someOffset); and dxc balks because it fails to parse the `>>` as closing the generics, and instead parses it as a shift operator. The solution here is simple: add a space before the closing `>` when emitting a `.Load` operation. Note that this change does not come with a test fix *yet* because writing the test case exposed a more complicated issue with GLSL codegen for this same scenario. This change includes the simple single-byte fix, to unblock users while we work on a fix for the GLSL case (and that fix will include the test coverage). --- source/slang/slang-emit-c-like.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp index 1a424306a..9322c30bd 100644 --- a/source/slang/slang-emit-c-like.cpp +++ b/source/slang/slang-emit-c-like.cpp @@ -2399,7 +2399,7 @@ void CLikeSourceEmitter::defaultEmitInstExpr(IRInst* inst, const EmitOpInfo& inO emitOperand(inst->getOperand(0), getInfo(EmitOp::General)); m_writer->emit(").Load<"); emitType(inst->getDataType()); - m_writer->emit(">("); + m_writer->emit(" >("); emitOperand(inst->getOperand(1), getInfo(EmitOp::General)); m_writer->emit(")"); break; -- cgit v1.2.3