1 // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify
\r
3 // This test validates the diagnostics that are emitted when a variable with a "resource" type
\r
4 // is bound to a register using the register annotation
\r
8 struct MyTemplatedSRV {
\r
9 __hlsl_resource_t [[hlsl::resource_class(SRV)]] x;
\r
13 __hlsl_resource_t [[hlsl::resource_class(SRV)]] x;
\r
17 __hlsl_resource_t [[hlsl::resource_class(Sampler)]] x;
\r
21 __hlsl_resource_t [[hlsl::resource_class(UAV)]] x;
\r
25 __hlsl_resource_t [[hlsl::resource_class(CBuffer)]] x;
\r
29 // expected-error@+1 {{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}}
\r
30 MySRV invalid : register(i2);
\r
32 // expected-error@+1 {{binding type 't' only applies to SRV resources}}
\r
33 MyUAV a : register(t2, space1);
\r
35 // expected-error@+1 {{binding type 'u' only applies to UAV resources}}
\r
36 MySampler b : register(u2, space1);
\r
38 // expected-error@+1 {{binding type 'b' only applies to constant buffer resources}}
\r
39 MyTemplatedSRV<int> c : register(b2);
\r
41 // expected-error@+1 {{binding type 's' only applies to sampler state}}
\r
42 MyUAV d : register(s2, space1);
\r
44 // empty binding prefix cases:
\r
45 // expected-error@+1 {{expected identifier}}
\r
46 MyTemplatedSRV<int> e: register();
\r
48 // expected-error@+1 {{expected identifier}}
\r
49 MyTemplatedSRV<int> f: register("");
\r