Debian Codegraph @

clang/test/SemaHLSL/vk.spec-constant.error.hlsl

raw
1 // RUN: %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan1.3-compute -verify %s
2 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.8-compute -verify %s
3
4 #ifndef __spirv__
5 // expected-warning@+2{{'vk::constant_id' attribute ignored}}
6 #endif
7 [[vk::constant_id(0)]]
8 const bool sc0 = true;
9
10 #ifdef __spirv__
11 // expected-error@+2{{variable with 'vk::constant_id' attribute must be a const int/float/enum/bool and be initialized with a literal}}
12 [[vk::constant_id(1)]]
13 const bool sc1 = sc0; // error
14
15 // expected-warning@+1{{'vk::constant_id' attribute only applies to external global variables}}
16 [[vk::constant_id(2)]]
17 static const bool sc2 = false; // error
18
19 // expected-error@+2{{variable with 'vk::constant_id' attribute must be a const int/float/enum/bool and be initialized with a literal}}
20 [[vk::constant_id(3)]]
21 const bool sc3; // error
22
23 // expected-error@+2{{variable with 'vk::constant_id' attribute must be a const int/float/enum/bool and be initialized with a literal}}
24 [[vk::constant_id(4)]]
25 bool sc4 = false; // error
26
27 // expected-error@+2{{variable with 'vk::constant_id' attribute must be a const int/float/enum/bool and be initialized with a literal}}
28 [[vk::constant_id(5)]]
29 const int2 sc5 = {0,0}; // error
30
31 [numthreads(1,1,1)]
32 void main() {
33 // expected-warning@+1{{'vk::constant_id' attribute only applies to external global variables}}
34 [[vk::constant_id(6)]]
35 const bool sc6 = false; // error
36 }
37 #endif