diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2020-09-23 12:24:16 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-23 12:24:16 -0700 |
| commit | 3d063a7024e54340b6fed2af964ea2790056a3e3 (patch) | |
| tree | b4121db26366312bbcdecacb6f0ca668d7886466 | |
| parent | a5b0cde056af9e97824a9aaca6773bfd879a7934 (diff) | |
Fix a bug around byte-address buffer loads of vectors (#1557)
This problem is only visible when
* using `RWByteAddressBuffer.Load<V>`,
* when `V` is `vector<T,N>`,
* and `V` is a non-32-bit type
In such a case, the Slang compiler generates output HLSL like:
someBuffer.Load<vector<T,N>>(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<T>` 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).
| -rw-r--r-- | source/slang/slang-emit-c-like.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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; |
