summaryrefslogtreecommitdiff
path: root/source/slang/slang-parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-parser.cpp')
-rw-r--r--source/slang/slang-parser.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp
index c3eba8c58..306d2cbec 100644
--- a/source/slang/slang-parser.cpp
+++ b/source/slang/slang-parser.cpp
@@ -6310,6 +6310,19 @@ namespace Slang
{
return SPIRVAsmOperand{SPIRVAsmOperand::ResultMarker, parser->ReadToken()};
}
+ // The handy __sampledType function
+ if(AdvanceIf(parser, "__sampledType"))
+ {
+ parser->ReadToken(TokenType::LParent);
+ const auto typeExpr = parser->ParseType();
+ parser->ReadMatchingToken(TokenType::RParent);
+ return SPIRVAsmOperand{SPIRVAsmOperand::SampledType, Token{}, typeExpr};
+ }
+ // The pseudo-operand for component truncation
+ else if(parser->LookAheadToken("__truncate"))
+ {
+ return SPIRVAsmOperand{SPIRVAsmOperand::TruncateMarker, parser->ReadToken()};
+ }
else if (AdvanceIf(parser, "builtin"))
{
// reference to a builtin var.
@@ -6325,7 +6338,6 @@ namespace Slang
{
return SPIRVAsmOperand{ SPIRVAsmOperand::GLSL450Set, parser->ReadToken() };
}
-
// A regular identifier
else if(parser->LookAheadToken(TokenType::Identifier))
{
@@ -6362,7 +6374,8 @@ namespace Slang
// A $foo variable
else if(AdvanceIf(parser, TokenType::Dollar))
{
- return slangIdentOperand(SPIRVAsmOperand::SlangValue);
+ Expr* expr = parseAtomicExpr(parser);
+ return SPIRVAsmOperand{SPIRVAsmOperand::SlangValue, Token{}, expr};
}
// A $$foo type
else if(AdvanceIf(parser, TokenType::DollarDollar))
@@ -6465,7 +6478,7 @@ namespace Slang
|| resultOperand)
{
// Insert the LHS result-type operand
- if(ret.operands.getCount() == opInfo->resultTypeIndex && resultTypeOperand)
+ if(opInfo && ret.operands.getCount() == opInfo->resultTypeIndex && resultTypeOperand)
{
ret.operands.add(*resultTypeOperand);
resultTypeOperand.reset();
@@ -6473,14 +6486,14 @@ namespace Slang
}
// Insert the LHS result operand
- if(ret.operands.getCount() == opInfo->resultIdIndex && resultOperand)
+ if(opInfo && ret.operands.getCount() == opInfo->resultIdIndex && resultOperand)
{
ret.operands.add(*resultOperand);
resultOperand.reset();
continue;
}
- if(ret.operands.getCount() == opInfo->maxOperandCount)
+ if(opInfo && ret.operands.getCount() == opInfo->maxOperandCount)
{
parser->diagnose(
parser->tokenReader.peekLoc(),