[llvm] [DirectX] Add static sampler support to root signature (PR #143422)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 27 11:02:18 PDT 2025


================
@@ -406,6 +492,58 @@ static bool verifyDescriptorRangeFlag(uint32_t Version, uint32_t Type,
   return (Flags & ~Mask) == FlagT::NONE;
 }
 
+static bool verifySamplerFilter(uint32_t Value) {
+  switch (Value) {
+#define STATIC_SAMPLER_FILTER(Num, Val)                                        \
+  case llvm::to_underlying(dxbc::StaticSamplerFilter::Val):
+#include "llvm/BinaryFormat/DXContainerConstants.def"
+    return true;
+  }
+  return false;
+}
+
+// Values allowed here:
+// https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_texture_address_mode#syntax
+static bool verifyAddress(uint32_t Address) {
+  switch (Address) {
+#define TEXTURE_ADDRESS_MODE(Num, Val)                                         \
+  case llvm::to_underlying(dxbc::TextureAddressMode::Val):
+#include "llvm/BinaryFormat/DXContainerConstants.def"
+    return true;
+  }
+  return false;
+}
+
+static bool verifyMipLODBias(float MipLODBias) {
+  return MipLODBias >= -16.f && MipLODBias <= 15.99f;
----------------
bogner wrote:

I guess this matches what DXC's validator does so it's probably "correct", but `15.99` isn't actually representable in float and this literal is subject to rounding.

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


More information about the llvm-commits mailing list