xref: /llvm-project/clang/test/SemaHLSL/resource_binding_attr_error_basic.hlsl (revision b55c52c047a167f42abbde9a33356cfb96b82c7f)
1// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - -fsyntax-only %s -verify
2
3// expected-error@+1{{binding type 't' only applies to SRV resources}}
4float f1 : register(t0);
5
6// expected-error@+1 {{binding type 'u' only applies to UAV resources}}
7float f2 : register(u0);
8
9// expected-error@+1{{binding type 'b' only applies to constant buffers. The 'bool constant' binding type is no longer supported}}
10float f3 : register(b9);
11
12// expected-error@+1 {{binding type 's' only applies to sampler state}}
13float f4 : register(s0);
14
15// expected-error@+1{{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}}
16float f5 : register(i9);
17
18// expected-error@+1{{binding type 'x' is invalid}}
19float f6 : register(x9);
20
21cbuffer g_cbuffer1 {
22// expected-error@+1{{binding type 'c' ignored in buffer declaration. Did you mean 'packoffset'?}}
23    float f7 : register(c2);
24};
25
26tbuffer g_tbuffer1 {
27// expected-error@+1{{binding type 'c' ignored in buffer declaration. Did you mean 'packoffset'?}}
28    float f8 : register(c2);
29};
30
31cbuffer g_cbuffer2 {
32// expected-error@+1{{binding type 'b' only applies to constant buffer resources}}
33    float f9 : register(b2);
34};
35
36tbuffer g_tbuffer2 {
37// expected-error@+1{{binding type 'i' ignored. The 'integer constant' binding type is no longer supported}}
38    float f10 : register(i2);
39};
40
41// expected-error@+1{{binding type 'c' only applies to numeric variables in the global scope}}
42RWBuffer<float> f11 : register(c3);
43