File: resource_binding_attr_error_space.hlsl

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (62 lines) | stat: -rw-r--r-- 1,880 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// 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 {
        // this test validates that no diagnostic is emitted on the space parameter, because
        // this register annotation is not in the global scope.
        // 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 {
  // valid
  MyStruct E : register(u2, space3);
}

// valid
MyStruct F : register(u3, space4);

cbuffer cbuf4 {
  // this test validates that no diagnostic is emitted on the space parameter, because
  // this register annotation is not in the global scope.
  // expected-error@+1 {{binding type 'u' only applies to UAV resources}}
  float a : register(u2, space3);
}

// expected-error@+1 {{invalid space specifier 's2' used; expected 'space' followed by an integer, like space1}}
cbuffer a : register(b0, s2) {

}

// expected-error@+1 {{invalid space specifier 'spaces' used; expected 'space' followed by an integer, like space1}}
cbuffer b : register(b2, spaces) {

}

// expected-error@+1 {{wrong argument format for hlsl attribute, use space3 instead}}
cbuffer c : register(b2, space 3) {}

// expected-error@+1 {{register space cannot be specified on global constants}}
int d : register(c2, space3);

// expected-error@+1 {{register space cannot be specified on global constants}}
int e : register(c2, space0);

// expected-error@+1 {{register space cannot be specified on global constants}}
int f : register(c2, space00);

// valid
RWBuffer<int> g : register(u2, space0);

// valid
RWBuffer<int> h : register(u2, space0);