From d9c57e613f2dacd221d9c46c10395cf373a8fcaf Mon Sep 17 00:00:00 2001 From: Theresa Foley <10618364+tangent-vector@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:48:51 -0700 Subject: Add support for texture footprint queries (#2970) --- source/slang/slang-intrinsic-expand.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'source/slang/slang-intrinsic-expand.cpp') 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; -- cgit v1.2.3