summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-parser.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-02-23 19:05:23 -0800
committerGitHub <noreply@github.com>2024-02-23 19:05:23 -0800
commita1827ee5e9b8088b23db3fa688b7bd62b7bbe9ac (patch)
treeeab251421b70f2ee64a0e420e270ed6295bd2987 /source/slang/slang-parser.cpp
parent401d8cdb12ae69aeb216c80c9bb90240d8359649 (diff)
SPIRV Fixes. (#3622)
* Use SpvSourceLanguageSlang enum. * Fix spirv entrypoint interface. * Cleanup. * Add error on unknown spirv opcode. * Fix CI. * Fix.
Diffstat (limited to 'source/slang/slang-parser.cpp')
-rw-r--r--source/slang/slang-parser.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp
index f2aff32ea..7ce710469 100644
--- a/source/slang/slang-parser.cpp
+++ b/source/slang/slang-parser.cpp
@@ -7221,6 +7221,23 @@ namespace Slang
break;
}
}
+
+ if (ret.opcode.flavor == SPIRVAsmOperand::Flavor::NamedValue
+ && ret.opcode.knownValue == SpvOp(0xffffffff))
+ {
+ if (ret.opcode.token.type == TokenType::IntegerLiteral)
+ {
+ Int intVal = -1;
+ StringUtil::parseInt(ret.opcode.token.getContent(), intVal);
+ ret.opcode.knownValue = (SpvWord)intVal;
+ }
+ else
+ {
+ parser->diagnose(ret.opcode.token, Diagnostics::unrecognizedSPIRVOpcode, ret.opcode.token);
+ return std::nullopt;
+ }
+ }
+
return ret;
}