================
@@ -0,0 +1,123 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o -
-fsyntax-only %s -verify
+
+struct MySRV {
+ [[hlsl::resource_class(SRV)]] int x;
+};
+
+struct MySampler {
+ [[hlsl::resource_class(Sampler)]] int x;
+};
+
+struct MyUAV {
+ [[hlsl::resource_class(UAV)]] int x;
+};
+
+struct MyCBuffer {
+ [[hlsl::resource_class(CBuffer)]] int x;
+};
+
+// Valid: f is skipped, SRVBuf is bound to t0, UAVBuf is bound to u0
+struct Eg1 {
+ float f;
+ MySRV SRVBuf;
+ MyUAV UAVBuf;
+ };
+Eg1 e1 : register(t0) : register(u0);
+
+// Valid: f is skipped, SRVBuf is bound to t0, UAVBuf is bound to u0.
+// UAVBuf2 gets automatically assigned to u1 even though there is no explicit
binding for u1.
+struct Eg2 {
+ float f;
+ MySRV SRVBuf;
+ MyUAV UAVBuf;
+ MyUAV UAVBuf2;
+ };
+Eg2 e2 : register(t0) : register(u0);
+
+// Valid: Bar, the struct within Eg3, has a valid resource that can be bound
to t0.
+struct Eg3 {
+ struct Bar {
+ MyUAV a;
+ };
+ Bar b;
----------------
hekota wrote:
formatting
https://github.com/llvm/llvm-project/pull/97103
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits