[llvm-branch-commits] [clang] [llvm] [HLSL][RootSignature] Add parsing infastructure for StaticSampler (PR #140180)
Finn Plummer via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue May 20 09:39:36 PDT 2025
================
@@ -606,6 +644,30 @@ RootSignatureParser::parseDescriptorTableClauseParams(TokenKind RegType) {
return Params;
}
+std::optional<RootSignatureParser::ParsedStaticSamplerParams>
+RootSignatureParser::parseStaticSamplerParams() {
+ assert(CurToken.TokKind == TokenKind::pu_l_paren &&
+ "Expects to only be invoked starting at given token");
+
+ ParsedStaticSamplerParams Params;
+ do {
+ // `s` POS_INT
+ if (tryConsumeExpectedToken(TokenKind::sReg)) {
+ if (Params.Reg.has_value()) {
+ getDiags().Report(CurToken.TokLoc, diag::err_hlsl_rootsig_repeat_param)
+ << CurToken.TokKind;
+ return std::nullopt;
+ }
+ auto Reg = parseRegister();
+ if (!Reg.has_value())
----------------
inbelic wrote:
This case would occur, for instance, when the register number would overflow an u32. Something like `s4294967296`.
It will have already reported the error (as part of `handleUIntLiteral` invoked by `parseRegister`) at this point and we are just propagating the error up.
https://github.com/llvm/llvm-project/pull/140180
More information about the llvm-branch-commits
mailing list