summaryrefslogtreecommitdiffstats
path: root/source/compiler-core
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-09-12 17:44:34 +0800
committerGitHub <noreply@github.com>2023-09-12 17:44:34 +0800
commit3f4081d854db2d186adea4067da575eca7c7adf1 (patch)
tree67defa47d2640478cfeac952bf42214d37ec3e34 /source/compiler-core
parent09854a4596019ddb3bb315b8836b5c88e718cdc7 (diff)
Correctly identify the number of operands to image sampling operands in SPIR-V (#3200)
* Correctly identify the number of operands to image sampling operands in SPIR-V * Neaten imageoperands warning test * Neaten imageoperands warning test
Diffstat (limited to 'source/compiler-core')
-rw-r--r--source/compiler-core/slang-spirv-core-grammar.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/source/compiler-core/slang-spirv-core-grammar.cpp b/source/compiler-core/slang-spirv-core-grammar.cpp
index 8140d002a..9a4a7e17f 100644
--- a/source/compiler-core/slang-spirv-core-grammar.cpp
+++ b/source/compiler-core/slang-spirv-core-grammar.cpp
@@ -265,7 +265,17 @@ RefPtr<SPIRVCoreGrammarInfo> SPIRVCoreGrammarInfo::loadFromJSON(SourceView& sour
numOperandTypes++;
res->operandTypesStorage.add(*catIndex);
- if(o.quantifier == "")
+ // The number of "ImageOperands" is dependent on the bitmask
+ // operand, for our purposes treat them as unbounded
+ if(o.quantifier == "*" || o.kind == "ImageOperands")
+ {
+ maxOperandCount = 0xffff;
+ }
+ else if(o.quantifier == "?")
+ {
+ maxOperandCount++;
+ }
+ else if(o.quantifier == "")
{
// This catches the case where an "?" or "*" qualified operand
// appears before any unqualified operands
@@ -278,13 +288,13 @@ RefPtr<SPIRVCoreGrammarInfo> SPIRVCoreGrammarInfo::loadFromJSON(SourceView& sour
minOperandCount++;
maxOperandCount++;
}
- else if(o.quantifier == "?")
- {
- maxOperandCount++;
- }
- else if(o.quantifier == "*")
+ else
{
- maxOperandCount = 0xffff;
+ sink.diagnose(
+ SourceLoc{},
+ MiscDiagnostics::spirvCoreGrammarJSONParseFailure,
+ "quantifier wasn't empty, * or ?"
+ );
}
}