yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
e7b6de334
master
1#version 450 2// geometry-shader.slang.glsl 3//TEST_IGNORE_FILE: 4 5#define RasterVertex RasterVertex_0 6#define CoarseVertex CoarseVertex_0 7 8#define input_position coarseVertices_position_0 9#define input_color coarseVertices_color_0 10#define input_id coarseVertices_id_0 11#define output_position outputStream_position_0 12#define output_color outputStream_color_0 13 14layout (row_major )uniform ; 15layout (row_major )buffer ; 16 17layout (location = 0 ) 18in vec4 input_position [3 ]; 19 20layout (location = 1 ) 21in vec3 input_color [3 ]; 22 23layout (location = 2 ) 24in uint input_id [3 ]; 25 26layout (location = 0 ) 27out vec4 output_position ; 28 29layout (location = 1 ) 30out vec3 output_color ; 31 32struct RasterVertex 33{ 34vec4 position_0 ; 35vec3 color_0 ; 36uint id_0 ; 37}; 38 39struct CoarseVertex 40{ 41vec4 position_1 ; 42vec3 color_1 ; 43uint id_1 ; 44}; 45 46 47layout (max_vertices = 3 )out ; 48layout (triangles )in ; 49layout (triangle_strip )out ; 50 51void main () 52{ 53uint _S6 = uint (gl_PrimitiveIDIn ); 54 55// TODO: Having to make this copy to transpose things is unfortunate. 56// 57// The front-end should be able to generate code using aggregate 58// types for the input, and/or eliminate the redundant temporary 59// by indexing directly into the sub-arrays. 60// 61CoarseVertex_0 _S7 = {_S1 [0 ],_S2 [0 ],_S3 [0 ] }; 62CoarseVertex_0 _S8 = {_S1 [1 ],_S2 [1 ],_S3 [1 ] }; 63CoarseVertex_0 _S9 = {_S1 [2 ],_S2 [2 ],_S3 [2 ] }; 64 65CoarseVertex_0 _S10 [3 ]= {_S7 ,_S8 ,_S9 }; 66 67int ii_0 = 0 ; 68 69for (;;) 70 { 71RasterVertex_0 rasterVertex_0 ; 72rasterVertex_0 .position_0 = _S10 [ii_0 ].position_1 ; 73rasterVertex_0 .color_0 = _S10 [ii_0 ].color_1 ; 74rasterVertex_0 .id_0 = _S10 [ii_0 ].id_1 + _S6 ; 75RasterVertex_0 _S11 = rasterVertex_0 ; 76_S4 = rasterVertex_0 .position_0 ; 77_S5 = _S11 .color_0 ; 78gl_Layer = int (_S11 .id_0 ); 79EmitVertex (); 80int ii_1 = ii_0 + 1 ; 81if (ii_1 < 3 ) 82 { 83 } 84else 85 { 86break ; 87 } 88ii_0 = ii_1 ; 89 } 90return ; 91}