diff options
| author | Yong He <yonghe@outlook.com> | 2023-11-21 17:22:41 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-21 17:22:41 -0800 |
| commit | 5af36cf4ca7a81d91fb03cdf39e40b6b4175fa2d (patch) | |
| tree | d52737e72f83c760724827691c67d0f03b9c71ea /source/slang/slang-intrinsic-expand.cpp | |
| parent | 383c0ef172fb19b3b9c7270fb6429ce19fd1b332 (diff) | |
Add SPIRV intrinsics for texture footprint query. (#3345)
* Add SPIRV intrinsics for texture footprint query.
* Cleanup.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-intrinsic-expand.cpp')
| -rw-r--r-- | source/slang/slang-intrinsic-expand.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/source/slang/slang-intrinsic-expand.cpp b/source/slang/slang-intrinsic-expand.cpp index d65fdf8bb..b96c2657d 100644 --- a/source/slang/slang-intrinsic-expand.cpp +++ b/source/slang/slang-intrinsic-expand.cpp @@ -818,8 +818,28 @@ const char* IntrinsicExpandContext::_emitSpecial(const char* cursor) if (vectorSize <= 4) m_writer->emitChar(swizzleNames[vectorSize - 1]); } + break; + } + case '!': + { + // Emit a literal directly without any prefix/postfix/casts. + Index argIndex = parseNat() + m_argIndexOffset; + SLANG_RELEASE_ASSERT((0 <= argIndex) && (argIndex < m_argCount)); + auto arg = m_args[argIndex]; + if (auto intLit = as<IRIntLit>(arg.get())) + { + m_writer->emitInt64(intLit->getValue()); + } + else if (auto stringLit = as<IRStringLit>(arg.get())) + { + m_writer->emit(stringLit->getStringSlice()); + } + else + { + SLANG_UNEXPECTED("unexpected literal argument in intrinsic call."); + } + break; } - break; default: SLANG_UNEXPECTED("bad format in intrinsic definition"); |
