From 019f702e24d2d1d6ecf53d71f87776a83db96608 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 29 Aug 2023 16:43:25 -0700 Subject: Wave intrinsics. (#3164) * Wave intrinsics. * scalar intrinsics. --------- Co-authored-by: Yong He --- source/slang/slang-check-expr.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-check-expr.cpp') diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index 43db85e3b..e6d1049a0 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -14,7 +14,7 @@ #include "slang-ast-natural-layout.h" #include "slang-lookup.h" - +#include "slang-lookup-spirv.h" #include "slang-ast-print.h" namespace Slang @@ -3969,7 +3969,17 @@ namespace Slang // Then see if it's an opcode (for OpSpecialize) if(!enumValue) enumValue = spirvInfo->opcodes.lookup(operand.token.getContent()); - + if (inst.opcode.knownValue == SpvOpExtInst) + { + if (!enumValue) + { + GLSLstd450 val; + if (lookupGLSLstd450(operand.token.getContent(), val)) + { + enumValue = (SpvWord)val; + } + } + } if(!enumValue) { failed = true; @@ -3980,6 +3990,19 @@ namespace Slang operand.knownValue = *enumValue; operand.wrapInId = needsIdWrapper; } + else if (operand.flavor == SPIRVAsmOperand::BuiltinVar) + { + operand.type = CheckProperType(operand.type); + auto builtinVarKind = spirvInfo->allEnums.lookup( + SPIRVCoreGrammarInfo::QualifiedEnumName{spirvInfo->operandKinds.lookup(UnownedStringSlice("BuiltIn")).value(), operand.token.getContent()}); + if (!builtinVarKind) + { + failed = true; + getSink()->diagnose(operand.token, Diagnostics::spirvUnableToResolveName, operand.token.getContent()); + return; + } + operand.knownValue = builtinVarKind.value(); + } if(operand.bitwiseOrWith.getCount() && operand.flavor != SPIRVAsmOperand::Literal && operand.flavor != SPIRVAsmOperand::NamedValue) -- cgit v1.2.3