summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-expr.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-08-29 16:43:25 -0700
committerGitHub <noreply@github.com>2023-08-29 16:43:25 -0700
commit019f702e24d2d1d6ecf53d71f87776a83db96608 (patch)
treefc75001b121794b51d60a19d48b15f95797932a4 /source/slang/slang-check-expr.cpp
parentf3ecf978a07b02681a4d70a9d83991e6661bf753 (diff)
Wave intrinsics. (#3164)
* Wave intrinsics. * scalar intrinsics. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-check-expr.cpp')
-rw-r--r--source/slang/slang-check-expr.cpp27
1 files changed, 25 insertions, 2 deletions
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)