diff options
| author | Yong He <yonghe@outlook.com> | 2024-02-01 13:26:03 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-01 13:26:03 -0800 |
| commit | f370947c63bca707b9cfde7b18e67298f5fbace3 (patch) | |
| tree | 1180cdb722529c8157f673fc68a2d45f00b5e827 /source/slang/slang-parser.cpp | |
| parent | a2d2018a8be41aecd2c1810db8556e0c07595fb9 (diff) | |
FP16 atomics for RWByteAddresBuffer, fp32 atomics for images. (#3536)
* FP16 atomics for RWByteAddresBuffer, fp32 atomics for images.
* Fix spelling.
* Add overload.
* Fix test failures.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-parser.cpp')
| -rw-r--r-- | source/slang/slang-parser.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp index a086b3c7a..c5007569e 100644 --- a/source/slang/slang-parser.cpp +++ b/source/slang/slang-parser.cpp @@ -7138,12 +7138,22 @@ namespace Slang if(opInfo && ret.operands.getCount() == opInfo->maxOperandCount) { - parser->diagnose( - parser->tokenReader.peekLoc(), - Diagnostics::spirvInstructionWithTooManyOperands, - ret.opcode.token, - opInfo->maxOperandCount - ); + // The SPIRV grammar says we are providing more arguments than expected operand count. + // We will issue a warning if it is likely that the user missed a semicolon. + // This is likely the case when the next operand starts with "Op" or is an assignment + // in the form of %something = .... + // + auto token = parser->tokenReader.peekToken(); + if (token.getContent().startsWith("Op") || + token.type == TokenType::OpMod && (parser->LookAheadToken(TokenType::OpAssign, 2) || parser->LookAheadToken(TokenType::Colon, 2))) + { + parser->diagnose( + parser->tokenReader.peekLoc(), + Diagnostics::spirvInstructionWithTooManyOperands, + ret.opcode.token, + opInfo->maxOperandCount + ); + } } if(auto operand = parseSPIRVAsmOperand(parser)) @@ -7168,7 +7178,7 @@ namespace Slang static Expr* parseSPIRVAsmExpr(Parser* parser) { SPIRVAsmExpr* asmExpr = parser->astBuilder->create<SPIRVAsmExpr>(); - + parser->FillPosition(asmExpr); parser->ReadToken(TokenType::LBrace); while(!parser->tokenReader.isAtEnd()) { |
