3 // constant_id specified scalar spec constants
4 layout(constant_id = 200) const int spec_int = 3;
5 layout(constant_id = 201) const float spec_float = 3.14;
6 layout(constant_id = 202) const
7 double spec_double = 3.1415926535897932384626433832795;
8 layout(constant_id = 203) const bool spec_bool = true;
10 // const float cast_spec_float = float(spec_float);
21 struct nesting_struct {
27 // Expect OpSpecConstantComposite
28 // Flat struct initializer
29 //const flat_struct spec_flat_struct_all_spec = {spec_int, spec_float,
30 // spec_double, spec_bool};
31 //const flat_struct spec_flat_struct_partial_spec = {30, 30.14, spec_double,
34 // Nesting struct initializer
35 //const nesting_struct nesting_struct_ctor = {
36 // {spec_int, spec_float, spec_double, false},
37 // vec4(0.1, 0.1, 0.1, 0.1),
41 //const vec4 spec_vec4_all_spec =
42 // vec4(spec_float, spec_float, spec_float, spec_float);
43 //const vec4 spec_vec4_partial_spec =
44 // vec4(spec_float, spec_float, 300.14, 300.14);
45 //const vec4 spec_vec4_from_one_scalar = vec4(spec_float);
48 //const mat2x3 spec_mat2x3 = mat2x3(spec_float, spec_float, spec_float, 1.1, 2.2, 3.3);
49 //const mat2x3 spec_mat2x3_from_one_scalar = mat2x3(spec_float);
51 // Struct nesting constructor
52 //const nesting_struct spec_nesting_struct_all_spec = {
53 // spec_flat_struct_all_spec, spec_vec4_all_spec, spec_int};
54 //const nesting_struct spec_nesting_struct_partial_spec = {
55 // spec_flat_struct_partial_spec, spec_vec4_partial_spec, 3000};
57 //const float spec_float_array[5] = {spec_float, spec_float, 1.0, 2.0, 3.0};
58 //const int spec_int_array[5] = {spec_int, spec_int, 1, 2, 30};
60 // global_vec4_array_with_spec_length is not a spec constant, but its array
61 // size is. When calling global_vec4_array_with_spec_length.length(), A
62 // TIntermSymbol Node should be returned, instead of a TIntermConstantUnion
63 // node which represents a known constant value.
64 in vec4 global_vec4_array_with_spec_length[spec_int];
68 void refer_primary_spec_const() {
69 if (spec_bool) color *= spec_int;
72 void refer_composite_spec_const() {
73 //color += spec_vec4_all_spec;
74 //color -= spec_vec4_partial_spec;
77 void refer_copmosite_dot_dereference() {
78 //color *= spec_nesting_struct_all_spec.i;
79 //color += spec_vec4_all_spec.x;
82 void refer_composite_bracket_dereference() {
83 //color -= spec_float_array[1];
84 //color /= spec_int_array[spec_int_array[spec_int]];
87 int refer_spec_const_array_length() {
88 int len = global_vec4_array_with_spec_length.length();
92 void declare_spec_const_in_func() {
93 //const nesting_struct spec_const_declared_in_func = {
94 // spec_flat_struct_partial_spec, spec_vec4_partial_spec, 10};
95 //color /= spec_const_declared_in_func.i;