[llvm] [DirectX] Update CBuffer to refer to a `dx.Layout` type (PR #128697)

Helena Kotas via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 10:52:26 PST 2025


================
@@ -197,6 +196,27 @@ class SamplerExtType : public TargetExtType {
   }
 };
 
+/// The dx.Layout target extension type
+///
+/// `target("dx.Layout", <Type>, <size>, [offsets...])`
+class LayoutExtType : public TargetExtType {
+public:
+  LayoutExtType() = delete;
+  LayoutExtType(const LayoutExtType &) = delete;
+  LayoutExtType &operator=(const LayoutExtType &) = delete;
+
+  Type *getWrappedType() const { return getTypeParameter(0); }
+  uint32_t getSize() const { return getIntParameter(0); }
+  uint32_t getIndexOfElement(int I) const { return getIntParameter(I + 1); }
----------------
hekota wrote:

```suggestion
  uint32_t getOffsetOfElement(int I) const { return getIntParameter(I + 1); }
```
The numbers are offsets in bytes, not indexes. The name should probably reflect that. 

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


More information about the llvm-commits mailing list