Debian Codegraph @

clang/test/SemaHLSL/resource_binding_implicit.hlsl

raw
1 // RUN: %clang_cc1 -Whlsl-implicit-binding -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify
2
3 // expected-warning@+1 {{resource has implicit register binding}}
4 cbuffer cb0 {
5 int a;
6 }
7
8 // No warning - this is an element of the $Globals buffer not it's own binding.
9 float b;
10
11 // expected-warning@+1 {{resource has implicit register binding}}
12 RWBuffer<int> c;
13
14 // No warning - explicit binding.
15 RWBuffer<float> d : register(u0);
16
17 // expected-warning@+1 {{resource has implicit register binding}}
18 RWBuffer<float> dd : register(space1);
19
20 // No warning - explicit binding.
21 RWBuffer<float> ddd : register(u3, space4);
22
23 struct S { int x; };
24 // expected-warning@+1 {{resource has implicit register binding}}
25 StructuredBuffer<S> e;
26
27 // No warning - __hlsl_resource_t isn't itself a resource object.
28 __hlsl_resource_t [[hlsl::resource_class(SRV)]] f;
29
30 struct CustomSRV {
31 __hlsl_resource_t [[hlsl::resource_class(SRV)]] x;
32 };
33 // expected-warning@+1 {{resource has implicit register binding}}
34 CustomSRV g;
35
36 // expected-warning@+1 {{resource has implicit register binding}}
37 RWBuffer<float> h[10];
38
39 // No warning - explicit binding.
40 RWBuffer<float> hh[100] : register(u4);