summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorjarcherNV <jarcher@nvidia.com>2025-04-02 01:46:52 -0700
committerGitHub <noreply@github.com>2025-04-02 08:46:52 +0000
commit5c111ebef679c994047df95bbdf90181ccb2d067 (patch)
tree60ab2f331973768f6be7f9ff9ff3ac8720f13be5 /source
parent3ebfe7f7c91a9ca356a6940b8878f1fc926be6aa (diff)
Use correct syntax for WGSL array transpiling (#6693)
Fixes issue #6533 This patch updates handling of Array and ConstantBuffer types for WGSL transpiling, giving correct syntax for arrays of buffers in WGSL.
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-emit-wgsl.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/slang/slang-emit-wgsl.cpp b/source/slang/slang-emit-wgsl.cpp
index 227c6cf75..8a3a3cc01 100644
--- a/source/slang/slang-emit-wgsl.cpp
+++ b/source/slang/slang-emit-wgsl.cpp
@@ -656,6 +656,11 @@ void WGSLSourceEmitter::emitSimpleTypeImpl(IRType* type)
m_writer->emit(">");
return;
}
+ case kIROp_ConstantBufferType:
+ {
+ emitType((IRType*)type->getOperand(0));
+ return;
+ }
default:
break;
}
@@ -772,6 +777,13 @@ void WGSLSourceEmitter::emitVarKeywordImpl(IRType* type, IRInst* varDecl)
m_writer->emit("<workgroup>");
}
else if (
+ type->getOp() == kIROp_ArrayType &&
+ type->getOperand(0)->getOp() == kIROp_ConstantBufferType)
+ {
+ // Arrays of constant buffers should use the uniform keyword.
+ m_writer->emit("<uniform>");
+ }
+ else if (
type->getOp() == kIROp_HLSLRWStructuredBufferType ||
type->getOp() == kIROp_HLSLRasterizerOrderedStructuredBufferType ||
type->getOp() == kIROp_HLSLRWByteAddressBufferType)