File: spv.specConstantComposite2.vert

package info (click to toggle)
glslang 16.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 51,712 kB
  • sloc: cpp: 92,305; yacc: 4,320; sh: 603; python: 305; ansic: 94; javascript: 74; makefile: 17
file content (98 lines) | stat: -rw-r--r-- 3,088 bytes parent folder | download | duplicates (25)
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
#version 450

// constant_id specified scalar spec constants
layout(constant_id = 200) const int spec_int = 3;
layout(constant_id = 201) const float spec_float = 3.14;
layout(constant_id = 202) const
    double spec_double = 3.1415926535897932384626433832795;
layout(constant_id = 203) const bool spec_bool = true;

// const float cast_spec_float = float(spec_float);

// Flat struct
struct flat_struct {
    int i;
    float f;
    double d;
    bool b;
};

// Nesting struct
struct nesting_struct {
    flat_struct nested;
    vec4 v;
    int i;
};

// Expect OpSpecConstantComposite
// Flat struct initializer
//const flat_struct spec_flat_struct_all_spec = {spec_int, spec_float,
//                                               spec_double, spec_bool};
//const flat_struct spec_flat_struct_partial_spec = {30, 30.14, spec_double,
//                                                   spec_bool};

// Nesting struct initializer
//const nesting_struct nesting_struct_ctor = {
//    {spec_int, spec_float, spec_double, false},
//    vec4(0.1, 0.1, 0.1, 0.1),
//    spec_int};

// Vector constructor
//const vec4 spec_vec4_all_spec =
//    vec4(spec_float, spec_float, spec_float, spec_float);
//const vec4 spec_vec4_partial_spec =
//    vec4(spec_float, spec_float, 300.14, 300.14);
//const vec4 spec_vec4_from_one_scalar = vec4(spec_float);

// Matrix constructor
//const mat2x3 spec_mat2x3 = mat2x3(spec_float, spec_float, spec_float, 1.1, 2.2, 3.3);
//const mat2x3 spec_mat2x3_from_one_scalar = mat2x3(spec_float);

// Struct nesting constructor
//const nesting_struct spec_nesting_struct_all_spec = {
//    spec_flat_struct_all_spec, spec_vec4_all_spec, spec_int};
//const nesting_struct spec_nesting_struct_partial_spec = {
//    spec_flat_struct_partial_spec, spec_vec4_partial_spec, 3000};

//const float spec_float_array[5] = {spec_float, spec_float, 1.0, 2.0, 3.0};
//const int spec_int_array[5] = {spec_int, spec_int, 1, 2, 30};

// global_vec4_array_with_spec_length is not a spec constant, but its array
// size is. When calling global_vec4_array_with_spec_length.length(), A
// TIntermSymbol Node should be returned, instead of a TIntermConstantUnion
// node which represents a known constant value.
in vec4 global_vec4_array_with_spec_length[spec_int];

out vec4 color;

void refer_primary_spec_const() {
    if (spec_bool) color *= spec_int;
}

void refer_composite_spec_const() {
    //color += spec_vec4_all_spec;
    //color -= spec_vec4_partial_spec;
}

void refer_copmosite_dot_dereference() {
    //color *= spec_nesting_struct_all_spec.i;
    //color += spec_vec4_all_spec.x;
}

void refer_composite_bracket_dereference() {
    //color -= spec_float_array[1];
    //color /= spec_int_array[spec_int_array[spec_int]];
}

int refer_spec_const_array_length() {
    int len = global_vec4_array_with_spec_length.length();
    return len;
}

void declare_spec_const_in_func() {
    //const nesting_struct spec_const_declared_in_func = {
    //    spec_flat_struct_partial_spec, spec_vec4_partial_spec, 10};
    //color /= spec_const_declared_in_func.i;
}

void main() {}