================
@@ -0,0 +1,56 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - 
-fsyntax-only %s -verify
+
+// valid
+cbuffer cbuf {
+    RWBuffer<int> r : register(u0, space0);
+}
+
+cbuffer cbuf2 {
+    struct x {
+        // expected-error@+1 {{'register' attribute only applies to 
cbuffer/tbuffer and external global variables}}
+        RWBuffer<int> E : register(u2, space3);
+    };
+}
+
+struct MyStruct {
+    RWBuffer<int> E;
+};
+
+cbuffer cbuf3 {
+  MyStruct E : register(u2, space3);
----------------
damyanp wrote:

https://godbolt.org/z/ezj1sc3sx - it looks like DXC doesn't actually get the 
binding right in this case:

```
; Name                                 Type  Format         Dim      ID      
HLSL Bind  Count
; ------------------------------ ---------- ------- ----------- ------- 
-------------- ------
; E.E                                   UAV     i32         buf      U0    
u4294967295     1
```

Also I think that the case we're discussing:

```
struct MyStruct {
    RWBuffer<int> E;
};

cbuffer cbuf3 {
  MyStruct E : register(u2, space3);
}
```

We should consider as equivalent to:

```
struct MyStruct {
    RWBuffer<int> E;
};

MyStruct E : register(u2, space3);
```

And I think that we said that this would report a "can't use space on globals" 
error?


https://github.com/llvm/llvm-project/pull/106782
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to