diff options
| author | Yong He <yonghe@outlook.com> | 2022-09-15 14:22:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-15 14:22:59 -0700 |
| commit | a6032446c6bf7f64d1e201bf438a4c7605a3dbb4 (patch) | |
| tree | a95267c52155e13699ff9aab38ab68353d76939e /source/slang/slang-emit-spirv.cpp | |
| parent | 05f9aaf6a4ef246dcf89b00000a8e59e90c47662 (diff) | |
Language feature: pointer sized int types. (#2401)
* Language feature: pointer sized int types.
* Fix.
* small change to test.
* Fix stdlib.
* Fix.
* Fix.
* Add typedef for `size_t` in stdlib.
* Fix test.
* Add `intptr_t::size` constant.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
| -rw-r--r-- | source/slang/slang-emit-spirv.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index fa0d92512..96ba89c55 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -708,7 +708,14 @@ struct SPIRVEmitContext return result; SpvWord valWord; memcpy(&valWord, &val, sizeof(SpvWord)); - if (type->getOp() == kIROp_Int64Type || type->getOp() == kIROp_UInt64Type) + switch (type->getOp()) + { + case kIROp_Int64Type: + case kIROp_UInt64Type: +#if SLANG_PTR_IS_64 + case kIROp_PtrType: + case kIROp_UIntPtrType: +#endif { SpvWord valHighWord; memcpy(&valHighWord, (char*)(&val) + 4, sizeof(SpvWord)); @@ -720,8 +727,9 @@ struct SPIRVEmitContext kResultID, valWord, valHighWord); + break; } - else + default: { result = emitInst( getSection(SpvLogicalSectionID::Constants), @@ -730,6 +738,8 @@ struct SPIRVEmitContext type, kResultID, valWord); + break; + } } m_spvIntConstants[key] = result; return result; @@ -1722,6 +1732,8 @@ struct SPIRVEmitContext { case BaseType::Int64: case BaseType::UInt64: + case BaseType::IntPtr: + case BaseType::UIntPtr: return emitInst( getSection(SpvLogicalSectionID::Constants), inst, |
