[llvm-branch-commits] [clang] [llvm] [HLSL][RootSignature] Add parsing of floats for StaticSampler (PR #140181)

Justin Bogner via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue May 27 10:02:37 PDT 2025


================
@@ -711,6 +734,35 @@ std::optional<Register> RootSignatureParser::parseRegister() {
   return Reg;
 }
 
+std::optional<float> RootSignatureParser::parseFloatParam() {
+  assert(CurToken.TokKind == TokenKind::pu_equal &&
+         "Expects to only be invoked starting at given keyword");
+  // Consume sign modifier
+  bool Signed =
+      tryConsumeExpectedToken({TokenKind::pu_plus, TokenKind::pu_minus});
+  bool Negated = Signed && CurToken.TokKind == TokenKind::pu_minus;
+
+  // DXC will treat a postive signed integer as unsigned
+  if (!Negated && tryConsumeExpectedToken(TokenKind::int_literal)) {
+    auto UInt = handleUIntLiteral();
----------------
bogner wrote:

Better to spell out the types here for clarity I think, especially given we're casting the uint32_t to float here.

https://github.com/llvm/llvm-project/pull/140181


More information about the llvm-branch-commits mailing list