yum-mirror/glslang
git clone https://git.yummers.dev/yum-mirror/glslang
4da479aa
main
1#version 450 2 3// constant_id specified scalar spec constants 4layout (constant_id = 200 )const int spec_int = 3 ; 5layout (constant_id = 201 )const float spec_float = 3.14 ; 6layout (constant_id = 202 )const 7double spec_double = 3.1415926535897932384626433832795 ; 8layout (constant_id = 203 )const bool spec_bool = true; 9 10// const float cast_spec_float = float(spec_float); 11 12// Flat struct 13struct flat_struct { 14int i ; 15float f ; 16double d ; 17bool b ; 18}; 19 20// Nesting struct 21struct nesting_struct { 22flat_struct nested ; 23vec4 v ; 24int i ; 25}; 26 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, 32// spec_bool}; 33 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), 38// spec_int}; 39 40// Vector constructor 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); 46 47// Matrix constructor 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); 50 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}; 56 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}; 59 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. 64in vec4 global_vec4_array_with_spec_length [spec_int ]; 65 66out vec4 color ; 67 68void refer_primary_spec_const () { 69if (spec_bool )color *=spec_int ; 70} 71 72void refer_composite_spec_const () { 73//color += spec_vec4_all_spec; 74//color -= spec_vec4_partial_spec; 75} 76 77void refer_copmosite_dot_dereference () { 78//color *= spec_nesting_struct_all_spec.i; 79//color += spec_vec4_all_spec.x; 80} 81 82void refer_composite_bracket_dereference () { 83//color -= spec_float_array[1]; 84//color /= spec_int_array[spec_int_array[spec_int]]; 85} 86 87int refer_spec_const_array_length () { 88int len = global_vec4_array_with_spec_length .length (); 89return len ; 90} 91 92void 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; 96} 97 98void main () {}