summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-11-15 00:37:58 -0800
committerGitHub <noreply@github.com>2024-11-15 00:37:58 -0800
commit05903f708856a70d68bf41bbfb2b06620508dee0 (patch)
tree7255325656c16f02652c83f2c4111b29ba503913 /source/slang/slang-ir.cpp
parentf0bc4642a563e2318634b38a5a7ac2c3ddd68917 (diff)
Embed core module in wasm build. (#5569)
* Embed core module in wasm build. * format code * add uintptr_t case. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp58
1 files changed, 55 insertions, 3 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index 5e4db43b2..e7f82f5ad 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -5311,7 +5311,24 @@ IRInst* IRBuilder::emitSwizzle(
IRType* type,
IRInst* base,
UInt elementCount,
- UInt const* elementIndices)
+ uint64_t const* elementIndices)
+{
+ auto intType = getBasicType(BaseType::Int);
+
+ IRInst* irElementIndices[4];
+ for (UInt ii = 0; ii < elementCount; ++ii)
+ {
+ irElementIndices[ii] = getIntValue(intType, elementIndices[ii]);
+ }
+
+ return emitSwizzle(type, base, elementCount, irElementIndices);
+}
+
+IRInst* IRBuilder::emitSwizzle(
+ IRType* type,
+ IRInst* base,
+ UInt elementCount,
+ uint32_t const* elementIndices)
{
auto intType = getBasicType(BaseType::Int);
@@ -5380,7 +5397,25 @@ IRInst* IRBuilder::emitSwizzleSet(
IRInst* base,
IRInst* source,
UInt elementCount,
- UInt const* elementIndices)
+ uint32_t const* elementIndices)
+{
+ auto intType = getBasicType(BaseType::Int);
+
+ IRInst* irElementIndices[4];
+ for (UInt ii = 0; ii < elementCount; ++ii)
+ {
+ irElementIndices[ii] = getIntValue(intType, elementIndices[ii]);
+ }
+
+ return emitSwizzleSet(type, base, source, elementCount, irElementIndices);
+}
+
+IRInst* IRBuilder::emitSwizzleSet(
+ IRType* type,
+ IRInst* base,
+ IRInst* source,
+ UInt elementCount,
+ uint64_t const* elementIndices)
{
auto intType = getBasicType(BaseType::Int);
@@ -5419,7 +5454,24 @@ IRInst* IRBuilder::emitSwizzledStore(
IRInst* dest,
IRInst* source,
UInt elementCount,
- UInt const* elementIndices)
+ uint32_t const* elementIndices)
+{
+ auto intType = getBasicType(BaseType::Int);
+
+ IRInst* irElementIndices[4];
+ for (UInt ii = 0; ii < elementCount; ++ii)
+ {
+ irElementIndices[ii] = getIntValue(intType, elementIndices[ii]);
+ }
+
+ return emitSwizzledStore(dest, source, elementCount, irElementIndices);
+}
+
+IRInst* IRBuilder::emitSwizzledStore(
+ IRInst* dest,
+ IRInst* source,
+ UInt elementCount,
+ uint64_t const* elementIndices)
{
auto intType = getBasicType(BaseType::Int);