From a1827ee5e9b8088b23db3fa688b7bd62b7bbe9ac Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 23 Feb 2024 19:05:23 -0800 Subject: SPIRV Fixes. (#3622) * Use SpvSourceLanguageSlang enum. * Fix spirv entrypoint interface. * Cleanup. * Add error on unknown spirv opcode. * Fix CI. * Fix. --- source/slang/slang-parser.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source/slang/slang-parser.cpp') 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; } -- cgit v1.2.3