diff options
| author | Yong He <yonghe@outlook.com> | 2023-08-24 16:32:33 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-24 16:32:33 -0700 |
| commit | 0470ea05a42d6c3f35d81a433fefdd440500cdbd (patch) | |
| tree | 25feb7bfd539013bfa64d8ff7698262932e39110 /source/slang/slang-ir-any-value-marshalling.cpp | |
| parent | c515bf9edf0ceefa9a0c9b36626ea7c8f72ce36f (diff) | |
Misc. SPIRV Fixes, Part 2. (#3147)
* Misc. SPIRV Fixes, Part 2.
* Fix up.
* Fix.
* Add system smenatic values.
* 16 bit int and floats, matrix/vector reshape, bool ops.
* Fix.
* Fix.
* Allow push constant entry point params.
* entrypoint params.
* swizzleSet and swizzledStore.
* packoffset.
* string hash.
* Fix.
* Matrix arithmetics.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-any-value-marshalling.cpp')
| -rw-r--r-- | source/slang/slang-ir-any-value-marshalling.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/source/slang/slang-ir-any-value-marshalling.cpp b/source/slang/slang-ir-any-value-marshalling.cpp index ed7818dbf..200f8bc55 100644 --- a/source/slang/slang-ir-any-value-marshalling.cpp +++ b/source/slang/slang-ir-any-value-marshalling.cpp @@ -241,7 +241,6 @@ namespace Slang { case kIROp_IntType: case kIROp_FloatType: - case kIROp_BoolType: #if SLANG_PTR_IS_32 case kIROp_IntPtrType: #endif @@ -260,6 +259,23 @@ namespace Slang advanceOffset(4); break; } + case kIROp_BoolType: + { + ensureOffsetAt4ByteBoundary(); + if (fieldOffset < static_cast<uint32_t>(anyValInfo->fieldKeys.getCount())) + { + auto srcVal = builder->emitLoad(concreteVar); + IRInst* args[] = {srcVal, builder->getIntValue(builder->getUIntType(), 1), builder->getIntValue(builder->getUIntType(), 0) }; + auto dstVal = builder->emitIntrinsicInst(builder->getUIntType(), kIROp_Select, 3, args); + auto dstAddr = builder->emitFieldAddress( + uintPtrType, + anyValueVar, + anyValInfo->fieldKeys[fieldOffset]); + builder->emitStore(dstAddr, dstVal); + } + advanceOffset(4); + break; + } case kIROp_UIntType: #if SLANG_PTR_IS_32 case kIROp_UIntPtrType: @@ -416,7 +432,6 @@ namespace Slang { case kIROp_IntType: case kIROp_FloatType: - case kIROp_BoolType: { ensureOffsetAt4ByteBoundary(); if (fieldOffset < static_cast<uint32_t>(anyValInfo->fieldKeys.getCount())) @@ -432,6 +447,22 @@ namespace Slang advanceOffset(4); break; } + case kIROp_BoolType: + { + ensureOffsetAt4ByteBoundary(); + if (fieldOffset < static_cast<uint32_t>(anyValInfo->fieldKeys.getCount())) + { + auto srcAddr = builder->emitFieldAddress( + uintPtrType, + anyValueVar, + anyValInfo->fieldKeys[fieldOffset]); + auto srcVal = builder->emitLoad(srcAddr); + srcVal = builder->emitNeq(srcVal, builder->getIntValue(builder->getUIntType(), 0)); + builder->emitStore(concreteVar, srcVal); + } + advanceOffset(4); + break; + } case kIROp_UIntType: { ensureOffsetAt4ByteBoundary(); |
