diff options
| author | Theresa Foley <10618364+tangent-vector@users.noreply.github.com> | 2023-07-10 17:48:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-10 17:48:51 -0700 |
| commit | d9c57e613f2dacd221d9c46c10395cf373a8fcaf (patch) | |
| tree | 2aba66f2ec361cf9066c53d6eef7ee5e77f213ed /source/slang/slang-intrinsic-expand.cpp | |
| parent | e4d7def727f75cee3f8fdfe6f286da2b8114b329 (diff) | |
Add support for texture footprint queries (#2970)
Diffstat (limited to 'source/slang/slang-intrinsic-expand.cpp')
| -rw-r--r-- | source/slang/slang-intrinsic-expand.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/slang/slang-intrinsic-expand.cpp b/source/slang/slang-intrinsic-expand.cpp index fd1a4e4d5..3b551f844 100644 --- a/source/slang/slang-intrinsic-expand.cpp +++ b/source/slang/slang-intrinsic-expand.cpp @@ -813,6 +813,29 @@ const char* IntrinsicExpandContext::_emitSpecial(const char* cursor) } break; + case '*': + { + // An escape like `$*3` indicates that all arguments + // from index 3 (in this example) and up should be + // emitted as comma-separated expressions. + // + // We therefore expect the next byte to be a digit: + // + SLANG_RELEASE_ASSERT(*cursor >= '0' && *cursor <= '9'); + Index firstArgIndex = (*cursor++) - '0' + m_argIndexOffset; + SLANG_RELEASE_ASSERT(m_argCount > firstArgIndex); + + for (Index argIndex = firstArgIndex; argIndex < m_argCount; ++argIndex) + { + if (argIndex != firstArgIndex) + { + m_writer->emit(", "); + } + m_emitter->emitOperand(m_args[argIndex].get(), getInfo(EmitOp::General)); + } + } + break; + default: SLANG_UNEXPECTED("bad format in intrinsic definition"); break; |
