File: vk.spec-constant.usage.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 (141 lines) | stat: -rw-r--r-- 8,706 bytes parent folder | download | duplicates (3)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// RUN: %clang_cc1 -finclude-default-header -triple spirv-unknown-vulkan-compute -x hlsl -ast-dump -o - %s | FileCheck %s

// CHECK: VarDecl {{.*}} bool_const 'const hlsl_private bool' static cinit
// CHECK-NEXT: CallExpr {{.*}} 'bool'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'bool (*)(unsigned int, bool) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'bool (unsigned int, bool) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_bool' 'bool (unsigned int, bool) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 1
// CHECK-NEXT: CXXBoolLiteralExpr {{.*}} 'bool' true
[[vk::constant_id(1)]]
const bool bool_const = true;

// CHECK: VarDecl {{.*}} short_const 'const hlsl_private short' static cinit
// CHECK-NEXT: CallExpr {{.*}} 'short'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'short (*)(unsigned int, short) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'short (unsigned int, short) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_short' 'short (unsigned int, short) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 2
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'short' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 4
[[vk::constant_id(2)]]
const short short_const = 4;

// CHECK: VarDecl {{.*}} int_const 'const hlsl_private int' static cinit
// CHECK-NEXT: CallExpr {{.*}} 'int'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int (*)(unsigned int, int) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int (unsigned int, int) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_int' 'int (unsigned int, int) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 3
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 5
[[vk::constant_id(3)]]
const int int_const = 5;

// CHECK: VarDecl {{.*}} long_const 'const hlsl_private long long' static cinit
// CHECK-NEXT: CallExpr {{.*}} 'long long'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'long long (*)(unsigned int, long long) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'long long (unsigned int, long long) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_longlong' 'long long (unsigned int, long long) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 4
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'long long' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 8
[[vk::constant_id(4)]]
const long long long_const = 8;

// CHECK: VarDecl {{.*}} ushort_const 'const hlsl_private unsigned short' static cinit
// CHECK-NEXT: CallExpr {{.*}} 'unsigned short'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned short (*)(unsigned int, unsigned short) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned short (unsigned int, unsigned short) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_ushort' 'unsigned short (unsigned int, unsigned short) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 5
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned short' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 10
[[vk::constant_id(5)]]
const unsigned short ushort_const = 10;

// CHECK: VarDecl {{.*}} uint_const 'const hlsl_private unsigned int' static cinit
// CHECK-NEXT: CallExpr {{.*}} 'unsigned int'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int (*)(unsigned int, unsigned int) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int (unsigned int, unsigned int) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_uint' 'unsigned int (unsigned int, unsigned int) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 6
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 12
[[vk::constant_id(6)]]
const unsigned int uint_const = 12;

// CHECK: VarDecl {{.*}} uint_const_2 'const hlsl_private uint':'const hlsl_private unsigned int' static cinit
// CHECK-NEXT: CallExpr {{.*}} 'unsigned int'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int (*)(unsigned int, unsigned int) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int (unsigned int, unsigned int) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_uint' 'unsigned int (unsigned int, unsigned int) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 6
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 12
[[vk::constant_id(6)]]
const uint uint_const_2 = 12;


// CHECK: VarDecl {{.*}} ulong_const 'const hlsl_private unsigned long long' static cinit
// CHECK-NEXT: CallExpr {{.*}} 'unsigned long long'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned long long (*)(unsigned int, unsigned long long) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned long long (unsigned int, unsigned long long) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_ulonglong' 'unsigned long long (unsigned int, unsigned long long) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 7
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned long long' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 25
[[vk::constant_id(7)]]
const unsigned long long ulong_const = 25;

// CHECK: VarDecl {{.*}} half_const 'const hlsl_private half' static cinit
// CHECK-NEXT: CallExpr {{.*}} 'half'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'half (*)(unsigned int, half) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'half (unsigned int, half) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_half' 'half (unsigned int, half) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 8
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'half' <FloatingCast>
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 4.040000e+01
[[vk::constant_id(8)]]
const half half_const = 40.4;

// CHECK: VarDecl {{.*}} float_const 'const hlsl_private float' static cinit
// CHECK-NEXT: CallExpr {{.*}} 'float'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float (*)(unsigned int, float) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'float (unsigned int, float) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_float' 'float (unsigned int, float) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 8
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 50
[[vk::constant_id(8)]]
const float float_const = 50;

// CHECK: VarDecl {{.*}} double_const 'const hlsl_private double' static cinit
// CHECK-NEXT: CallExpr {{.*}} 'double'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'double (*)(unsigned int, double) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'double (unsigned int, double) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_double' 'double (unsigned int, double) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 9
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'double' <IntegralToFloating>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 100
[[vk::constant_id(9)]]
const double double_const = 100;

// CHECK: VarDecl {{.*}} enum_const 'const hlsl_private E' static cinit
// CHECK-NEXT: CStyleCastExpr {{.*}} 'E' <IntegralCast>
// CHECK-NEXT: CallExpr {{.*}} 'int'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int (*)(unsigned int, int) noexcept' <FunctionToPointerDecay>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int (unsigned int, int) noexcept' lvalue Function {{.*}} '__builtin_get_spirv_spec_constant_int' 'int (unsigned int, int) noexcept'
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'unsigned int' <IntegralCast>
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 10 
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <IntegralCast>
// CHECK-NEXT: DeclRefExpr {{.*}} 'E' EnumConstant {{.*}} 'e2' 'E' 
enum E {
    e0 = 10,
    e1 = 20,
    e2 = 30
};

[[vk::constant_id(10)]]
const E enum_const = e2;

// CHECK-NOT: CXXRecordDecl {{.*}} implicit struct __cblayout_$Globals definition