1 module shaders.vertexpull;
2 import sg = sokol.gfx;
3 import m = handmade.math;
4 extern(C):
5 
6 /*
7     #version:1# (machine generated, don't edit!)
8 
9     Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
10 
11     Cmdline:
12         sokol-shdc -i src/examples/shaders/vertexpull.glsl -o src/examples/shaders/vertexpull.d -l glsl430:metal_macos:hlsl5:glsl300es:wgsl -f sokol_d
13 
14     Overview:
15     =========
16     Shader program: 'vertexpull':
17         Get shader desc: vertexpullShaderDesc(sg.queryBackend());
18         Vertex Shader: vs
19         Fragment Shader: fs
20         Attributes:
21     Bindings:
22         Uniform block 'vs_params':
23             D struct: VsParams
24             Bind slot: UB_VS_PARAMS => 0
25         Storage buffer 'ssbo':
26             D struct: Ssbo
27             Bind slot: SBUF_SSBO => 0
28 */
29 enum UB_VS_PARAMS = 0;
30 enum SBUF_SSBO = 0;
31 struct VsParams {
32     align(16) m.Mat4 mvp;
33 }
34 struct SbVertex {
35     align(16) float[3] pos = 0;
36     align(1) ubyte[4] _pad_12 = 0;
37     align(1) float[4] color = 0;
38 }
39 /*
40     #version 430
41 
42     struct sb_vertex
43     {
44         vec3 pos;
45         vec4 color;
46     };
47 
48     uniform vec4 vs_params[4];
49     layout(binding = 0, std430) readonly buffer ssbo
50     {
51         sb_vertex vtx[];
52     } _28;
53 
54     layout(location = 0) out vec4 color;
55 
56     void main()
57     {
58         gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * vec4(_28.vtx[gl_VertexID].pos, 1.0);
59         color = _28.vtx[gl_VertexID].color;
60     }
61 
62 */
63 __gshared char[388] VS_SOURCE_GLSL430 = [
64     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x73,0x74,
65     0x72,0x75,0x63,0x74,0x20,0x73,0x62,0x5f,0x76,0x65,0x72,0x74,0x65,0x78,0x0a,0x7b,
66     0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x20,
67     0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,
68     0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,
69     0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,
70     0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x30,
71     0x2c,0x20,0x73,0x74,0x64,0x34,0x33,0x30,0x29,0x20,0x72,0x65,0x61,0x64,0x6f,0x6e,
72     0x6c,0x79,0x20,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x73,0x73,0x62,0x6f,0x0a,0x7b,
73     0x0a,0x20,0x20,0x20,0x20,0x73,0x62,0x5f,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x76,
74     0x74,0x78,0x5b,0x5d,0x3b,0x0a,0x7d,0x20,0x5f,0x32,0x38,0x3b,0x0a,0x0a,0x6c,0x61,
75     0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
76     0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,
77     0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,
78     0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,
79     0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
80     0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
81     0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,
82     0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,
83     0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x32,0x38,0x2e,0x76,0x74,0x78,0x5b,
84     0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x5d,0x2e,0x70,0x6f,0x73,
85     0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,
86     0x72,0x20,0x3d,0x20,0x5f,0x32,0x38,0x2e,0x76,0x74,0x78,0x5b,0x67,0x6c,0x5f,0x56,
87     0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x5d,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,
88     0x7d,0x0a,0x0a,0x00,
89 ];
90 /*
91     #version 430
92 
93     layout(location = 0) out vec4 frag_color;
94     layout(location = 0) in vec4 color;
95 
96     void main()
97     {
98         frag_color = color;
99     }
100 
101 */
102 __gshared char[135] FS_SOURCE_GLSL430 = [
103     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61,
104     0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
105     0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,
106     0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
107     0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,
108     0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,
109     0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
110     0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,
111     0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
112 ];
113 /*
114     #version 300 es
115 
116     struct sb_vertex
117     {
118         vec3 pos;
119         vec4 color;
120     };
121 
122     uniform vec4 vs_params[4];
123     layout(std430) readonly buffer ssbo
124     {
125         sb_vertex vtx[];
126     } _28;
127 
128     out vec4 color;
129 
130     void main()
131     {
132         gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * vec4(_28.vtx[gl_VertexID].pos, 1.0);
133         color = _28.vtx[gl_VertexID].color;
134     }
135 
136 */
137 __gshared char[357] VS_SOURCE_GLSL300ES = [
138     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
139     0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x73,0x62,0x5f,0x76,0x65,0x72,0x74,0x65,
140     0x78,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73,
141     0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,
142     0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,
143     0x63,0x34,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,
144     0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x73,0x74,0x64,0x34,0x33,0x30,0x29,0x20,
145     0x72,0x65,0x61,0x64,0x6f,0x6e,0x6c,0x79,0x20,0x62,0x75,0x66,0x66,0x65,0x72,0x20,
146     0x73,0x73,0x62,0x6f,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x73,0x62,0x5f,0x76,0x65,
147     0x72,0x74,0x65,0x78,0x20,0x76,0x74,0x78,0x5b,0x5d,0x3b,0x0a,0x7d,0x20,0x5f,0x32,
148     0x38,0x3b,0x0a,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,
149     0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,
150     0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
151     0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,
152     0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
153     0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
154     0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,
155     0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x32,0x38,0x2e,0x76,0x74,0x78,
156     0x5b,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x5d,0x2e,0x70,0x6f,
157     0x73,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,
158     0x6f,0x72,0x20,0x3d,0x20,0x5f,0x32,0x38,0x2e,0x76,0x74,0x78,0x5b,0x67,0x6c,0x5f,
159     0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x5d,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,
160     0x0a,0x7d,0x0a,0x0a,0x00,
161 ];
162 /*
163     #version 300 es
164     precision mediump float;
165     precision highp int;
166 
167     layout(location = 0) out highp vec4 frag_color;
168     in highp vec4 color;
169 
170     void main()
171     {
172         frag_color = color;
173     }
174 
175 */
176 __gshared char[175] FS_SOURCE_GLSL300ES = [
177     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
178     0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
179     0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
180     0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x6c,
181     0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
182     0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,
183     0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,
184     0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,
185     0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,
186     0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
187     0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
188 ];
189 /*
190     struct sb_vertex
191     {
192         float3 pos;
193         float4 color;
194     };
195 
196     cbuffer vs_params : register(b0)
197     {
198         row_major float4x4 _19_mvp : packoffset(c0);
199     };
200 
201     ByteAddressBuffer _28 : register(t16);
202 
203     static float4 gl_Position;
204     static int gl_VertexIndex;
205     static float4 color;
206 
207     struct SPIRV_Cross_Input
208     {
209         uint gl_VertexIndex : SV_VertexID;
210     };
211 
212     struct SPIRV_Cross_Output
213     {
214         float4 color : TEXCOORD0;
215         float4 gl_Position : SV_Position;
216     };
217 
218     void vert_main()
219     {
220         gl_Position = mul(float4(asfloat(_28.Load3(gl_VertexIndex * 32 + 0)), 1.0f), _19_mvp);
221         color = asfloat(_28.Load4(gl_VertexIndex * 32 + 16));
222     }
223 
224     SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
225     {
226         gl_VertexIndex = int(stage_input.gl_VertexIndex);
227         vert_main();
228         SPIRV_Cross_Output stage_output;
229         stage_output.gl_Position = gl_Position;
230         stage_output.color = color;
231         return stage_output;
232     }
233 */
234 __gshared char[871] VS_SOURCE_HLSL5 = [
235     0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x73,0x62,0x5f,0x76,0x65,0x72,0x74,0x65,0x78,
236     0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,
237     0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,
238     0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x63,0x62,0x75,0x66,0x66,0x65,0x72,
239     0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x3a,0x20,0x72,0x65,0x67,
240     0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
241     0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
242     0x78,0x34,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76,0x70,0x20,0x3a,0x20,0x70,0x61,0x63,
243     0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,0x30,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,
244     0x0a,0x42,0x79,0x74,0x65,0x41,0x64,0x64,0x72,0x65,0x73,0x73,0x42,0x75,0x66,0x66,
245     0x65,0x72,0x20,0x5f,0x32,0x38,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,
246     0x72,0x28,0x74,0x31,0x36,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,
247     0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
248     0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x74,0x20,0x67,
249     0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x3b,0x0a,0x73,
250     0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,
251     0x6f,0x72,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,
252     0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,
253     0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,
254     0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x3a,0x20,0x53,0x56,0x5f,0x56,0x65,0x72,
255     0x74,0x65,0x78,0x49,0x44,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,
256     0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,
257     0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
258     0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,
259     0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
260     0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56,
261     0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,
262     0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,
263     0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,
264     0x6e,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x61,
265     0x73,0x66,0x6c,0x6f,0x61,0x74,0x28,0x5f,0x32,0x38,0x2e,0x4c,0x6f,0x61,0x64,0x33,
266     0x28,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,
267     0x2a,0x20,0x33,0x32,0x20,0x2b,0x20,0x30,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x66,
268     0x29,0x2c,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a,0x20,0x20,0x20,
269     0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x61,0x73,0x66,0x6c,0x6f,0x61,0x74,
270     0x28,0x5f,0x32,0x38,0x2e,0x4c,0x6f,0x61,0x64,0x34,0x28,0x67,0x6c,0x5f,0x56,0x65,
271     0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x2a,0x20,0x33,0x32,0x20,0x2b,
272     0x20,0x31,0x36,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,
273     0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,
274     0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,
275     0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,
276     0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,
277     0x49,0x6e,0x64,0x65,0x78,0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,0x73,0x74,0x61,0x67,
278     0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,
279     0x78,0x49,0x6e,0x64,0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,
280     0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,
281     0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,
282     0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,
283     0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,
284     0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,
285     0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,
286     0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,
287     0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,
288     0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,
289     0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00,
290 ];
291 /*
292     static float4 frag_color;
293     static float4 color;
294 
295     struct SPIRV_Cross_Input
296     {
297         float4 color : TEXCOORD0;
298     };
299 
300     struct SPIRV_Cross_Output
301     {
302         float4 frag_color : SV_Target0;
303     };
304 
305     void frag_main()
306     {
307         frag_color = color;
308     }
309 
310     SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
311     {
312         color = stage_input.color;
313         frag_main();
314         SPIRV_Cross_Output stage_output;
315         stage_output.frag_color = frag_color;
316         return stage_output;
317     }
318 */
319 __gshared char[435] FS_SOURCE_HLSL5 = [
320     0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,
321     0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,
322     0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,
323     0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,
324     0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
325     0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54,0x45,
326     0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,
327     0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,
328     0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
329     0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,
330     0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,
331     0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,
332     0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
333     0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,
334     0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,
335     0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,
336     0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,
337     0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,
338     0x72,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,
339     0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,
340     0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,
341     0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,
342     0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,
343     0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x72,
344     0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,
345     0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
346     0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,
347     0x7d,0x0a,0x00,
348 ];
349 /*
350     #include <metal_stdlib>
351     #include <simd/simd.h>
352 
353     using namespace metal;
354 
355     struct vs_params
356     {
357         float4x4 mvp;
358     };
359 
360     struct sb_vertex
361     {
362         float3 pos;
363         float4 color;
364     };
365 
366     struct ssbo
367     {
368         sb_vertex vtx[1];
369     };
370 
371     struct main0_out
372     {
373         float4 color [[user(locn0)]];
374         float4 gl_Position [[position]];
375     };
376 
377     vertex main0_out main0(constant vs_params& _19 [[buffer(0)]], const device ssbo& _28 [[buffer(8)]], uint gl_VertexIndex [[vertex_id]])
378     {
379         main0_out out = {};
380         out.gl_Position = _19.mvp * float4(_28.vtx[int(gl_VertexIndex)].pos, 1.0);
381         out.color = _28.vtx[int(gl_VertexIndex)].color;
382         return out;
383     }
384 
385 */
386 __gshared char[616] VS_SOURCE_METAL_MACOS = [
387     0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
388     0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
389     0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
390     0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
391     0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x76,
392     0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
393     0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x6d,0x76,0x70,0x3b,0x0a,0x7d,0x3b,0x0a,
394     0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x73,0x62,0x5f,0x76,0x65,0x72,0x74,0x65,
395     0x78,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,
396     0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,
397     0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,
398     0x20,0x73,0x73,0x62,0x6f,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x73,0x62,0x5f,0x76,
399     0x65,0x72,0x74,0x65,0x78,0x20,0x76,0x74,0x78,0x5b,0x31,0x5d,0x3b,0x0a,0x7d,0x3b,
400     0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,
401     0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
402     0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,
403     0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
404     0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,
405     0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,
406     0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,
407     0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,
408     0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x31,0x39,0x20,0x5b,
409     0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x63,0x6f,
410     0x6e,0x73,0x74,0x20,0x64,0x65,0x76,0x69,0x63,0x65,0x20,0x73,0x73,0x62,0x6f,0x26,
411     0x20,0x5f,0x32,0x38,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x38,0x29,
412     0x5d,0x5d,0x2c,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,
413     0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x5b,0x5b,0x76,0x65,0x72,0x74,0x65,0x78,
414     0x5f,0x69,0x64,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,
415     0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,
416     0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,
417     0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a,
418     0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x32,0x38,0x2e,0x76,0x74,0x78,0x5b,
419     0x69,0x6e,0x74,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,
420     0x65,0x78,0x29,0x5d,0x2e,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,
421     0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,
422     0x5f,0x32,0x38,0x2e,0x76,0x74,0x78,0x5b,0x69,0x6e,0x74,0x28,0x67,0x6c,0x5f,0x56,
423     0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x29,0x5d,0x2e,0x63,0x6f,0x6c,
424     0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,
425     0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
426 ];
427 /*
428     #include <metal_stdlib>
429     #include <simd/simd.h>
430 
431     using namespace metal;
432 
433     struct main0_out
434     {
435         float4 frag_color [[color(0)]];
436     };
437 
438     struct main0_in
439     {
440         float4 color [[user(locn0)]];
441     };
442 
443     fragment main0_out main0(main0_in in [[stage_in]])
444     {
445         main0_out out = {};
446         out.frag_color = in.color;
447         return out;
448     }
449 
450 */
451 __gshared char[315] FS_SOURCE_METAL_MACOS = [
452     0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
453     0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
454     0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
455     0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
456     0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
457     0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
458     0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
459     0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,
460     0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
461     0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
462     0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,
463     0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,
464     0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,
465     0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,
466     0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,
467     0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,
468     0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,
469     0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,
470     0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
471     0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
472 ];
473 /*
474     diagnostic(off, derivative_uniformity);
475 
476     struct vs_params {
477       /_ @offset(0) _/
478       mvp : mat4x4f,
479     }
480 
481     struct sb_vertex {
482       /_ @offset(0) _/
483       pos : vec3f,
484       /_ @offset(16) _/
485       color : vec4f,
486     }
487 
488     alias RTArr = array<sb_vertex>;
489 
490     struct ssbo {
491       /_ @offset(0) _/
492       vtx : RTArr,
493     }
494 
495     @group(0) @binding(0) var<uniform> x_19 : vs_params;
496 
497     @group(1) @binding(32) var<storage, read> x_28 : ssbo;
498 
499     var<private> gl_VertexIndex : i32;
500 
501     var<private> color : vec4f;
502 
503     var<private> gl_Position : vec4f;
504 
505     fn main_1() {
506       let x_22 : mat4x4f = x_19.mvp;
507       let x_31 : i32 = gl_VertexIndex;
508       let x_34 : vec3f = x_28.vtx[x_31].pos;
509       gl_Position = (x_22 * vec4f(x_34.x, x_34.y, x_34.z, 1.0f));
510       let x_44 : i32 = gl_VertexIndex;
511       let x_48 : vec4f = x_28.vtx[x_44].color;
512       color = x_48;
513       return;
514     }
515 
516     struct main_out {
517       @builtin(position)
518       gl_Position : vec4f,
519       @location(0)
520       color_1 : vec4f,
521     }
522 
523     @vertex
524     fn main(@builtin(vertex_index) gl_VertexIndex_param : u32) -> main_out {
525       gl_VertexIndex = bitcast<i32>(gl_VertexIndex_param);
526       main_1();
527       return main_out(gl_Position, color);
528     }
529 
530 */
531 __gshared char[1068] VS_SOURCE_WGSL = [
532     0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
533     0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
534     0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,
535     0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,
536     0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,
537     0x20,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c,0x0a,
538     0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x73,0x62,0x5f,0x76,0x65,0x72,
539     0x74,0x65,0x78,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,
540     0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x70,0x6f,0x73,0x20,0x3a,
541     0x20,0x76,0x65,0x63,0x33,0x66,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,
542     0x66,0x73,0x65,0x74,0x28,0x31,0x36,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x63,0x6f,
543     0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,
544     0x61,0x6c,0x69,0x61,0x73,0x20,0x52,0x54,0x41,0x72,0x72,0x20,0x3d,0x20,0x61,0x72,
545     0x72,0x61,0x79,0x3c,0x73,0x62,0x5f,0x76,0x65,0x72,0x74,0x65,0x78,0x3e,0x3b,0x0a,
546     0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x73,0x73,0x62,0x6f,0x20,0x7b,0x0a,0x20,
547     0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,
548     0x2f,0x0a,0x20,0x20,0x76,0x74,0x78,0x20,0x3a,0x20,0x52,0x54,0x41,0x72,0x72,0x2c,
549     0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,
550     0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,
551     0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31,0x39,0x20,0x3a,0x20,0x76,0x73,
552     0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,
553     0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x33,0x32,0x29,
554     0x20,0x76,0x61,0x72,0x3c,0x73,0x74,0x6f,0x72,0x61,0x67,0x65,0x2c,0x20,0x72,0x65,
555     0x61,0x64,0x3e,0x20,0x78,0x5f,0x32,0x38,0x20,0x3a,0x20,0x73,0x73,0x62,0x6f,0x3b,
556     0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x67,
557     0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x3a,0x20,
558     0x69,0x33,0x32,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,
559     0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,
560     0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,
561     0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,
562     0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,
563     0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x32,0x20,0x3a,
564     0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,
565     0x6d,0x76,0x70,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x31,0x20,
566     0x3a,0x20,0x69,0x33,0x32,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,
567     0x78,0x49,0x6e,0x64,0x65,0x78,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,
568     0x33,0x34,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x78,0x5f,0x32,
569     0x38,0x2e,0x76,0x74,0x78,0x5b,0x78,0x5f,0x33,0x31,0x5d,0x2e,0x70,0x6f,0x73,0x3b,
570     0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,
571     0x20,0x28,0x78,0x5f,0x32,0x32,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,
572     0x5f,0x33,0x34,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x33,0x34,0x2e,0x79,0x2c,0x20,0x78,
573     0x5f,0x33,0x34,0x2e,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a,0x20,
574     0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x34,0x20,0x3a,0x20,0x69,0x33,0x32,0x20,
575     0x3d,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,
576     0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x38,0x20,0x3a,0x20,0x76,
577     0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x32,0x38,0x2e,0x76,0x74,0x78,0x5b,
578     0x78,0x5f,0x34,0x34,0x5d,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x63,
579     0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x78,0x5f,0x34,0x38,0x3b,0x0a,0x20,0x20,0x72,
580     0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,
581     0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x62,
582     0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,
583     0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,
584     0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,
585     0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,
586     0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,
587     0x72,0x74,0x65,0x78,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x62,0x75,
588     0x69,0x6c,0x74,0x69,0x6e,0x28,0x76,0x65,0x72,0x74,0x65,0x78,0x5f,0x69,0x6e,0x64,
589     0x65,0x78,0x29,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,
590     0x65,0x78,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x75,0x33,0x32,0x29,0x20,
591     0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,
592     0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x3d,
593     0x20,0x62,0x69,0x74,0x63,0x61,0x73,0x74,0x3c,0x69,0x33,0x32,0x3e,0x28,0x67,0x6c,
594     0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x5f,0x70,0x61,0x72,
595     0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,
596     0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,
597     0x75,0x74,0x28,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,
598     0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
599 ];
600 /*
601     diagnostic(off, derivative_uniformity);
602 
603     var<private> frag_color : vec4f;
604 
605     var<private> color : vec4f;
606 
607     fn main_1() {
608       let x_12 : vec4f = color;
609       frag_color = x_12;
610       return;
611     }
612 
613     struct main_out {
614       @location(0)
615       frag_color_1 : vec4f,
616     }
617 
618     @fragment
619     fn main(@location(0) color_param : vec4f) -> main_out {
620       color = color_param;
621       main_1();
622       return main_out(frag_color);
623     }
624 
625 */
626 __gshared char[376] FS_SOURCE_WGSL = [
627     0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
628     0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
629     0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
630     0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
631     0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,
632     0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,
633     0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,
634     0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x32,
635     0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,
636     0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,
637     0x20,0x78,0x5f,0x31,0x32,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,
638     0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,
639     0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
640     0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
641     0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,
642     0x40,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,
643     0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x63,
644     0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,
645     0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,
646     0x7b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,
647     0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,
648     0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,
649     0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
650     0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
651 ];
652 sg.ShaderDesc vertexpullShaderDesc(sg.Backend backend) @trusted @nogc nothrow {
653     sg.ShaderDesc desc;
654     desc.label = "vertexpull_shader";
655     switch (backend) {
656         case sg.Backend.Glcore:
657             desc.vertex_func.source = &VS_SOURCE_GLSL430[0];
658             desc.vertex_func.entry = "main";
659             desc.fragment_func.source = &FS_SOURCE_GLSL430[0];
660             desc.fragment_func.entry = "main";
661             desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex;
662             desc.uniform_blocks[0].layout = sg.UniformLayout.Std140;
663             desc.uniform_blocks[0].size = 64;
664             desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4;
665             desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
666             desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params";
667             desc.storage_buffers[0].stage = sg.ShaderStage.Vertex;
668             desc.storage_buffers[0].readonly = true;
669             desc.storage_buffers[0].glsl_binding_n = 0;
670             break;
671         case sg.Backend.Gles3:
672             desc.vertex_func.source = &VS_SOURCE_GLSL300ES[0];
673             desc.vertex_func.entry = "main";
674             desc.fragment_func.source = &FS_SOURCE_GLSL300ES[0];
675             desc.fragment_func.entry = "main";
676             desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex;
677             desc.uniform_blocks[0].layout = sg.UniformLayout.Std140;
678             desc.uniform_blocks[0].size = 64;
679             desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4;
680             desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
681             desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params";
682             desc.storage_buffers[0].stage = sg.ShaderStage.Vertex;
683             desc.storage_buffers[0].readonly = true;
684             desc.storage_buffers[0].glsl_binding_n = 0;
685             break;
686         case sg.Backend.D3d11:
687             desc.vertex_func.source = &VS_SOURCE_HLSL5[0];
688             desc.vertex_func.d3d11_target = "vs_5_0";
689             desc.vertex_func.entry = "main";
690             desc.fragment_func.source = &FS_SOURCE_HLSL5[0];
691             desc.fragment_func.d3d11_target = "ps_5_0";
692             desc.fragment_func.entry = "main";
693             desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex;
694             desc.uniform_blocks[0].layout = sg.UniformLayout.Std140;
695             desc.uniform_blocks[0].size = 64;
696             desc.uniform_blocks[0].hlsl_register_b_n = 0;
697             desc.storage_buffers[0].stage = sg.ShaderStage.Vertex;
698             desc.storage_buffers[0].readonly = true;
699             desc.storage_buffers[0].hlsl_register_t_n = 16;
700             break;
701         case sg.Backend.Metal_macos:
702             desc.vertex_func.source = &VS_SOURCE_METAL_MACOS[0];
703             desc.vertex_func.entry = "main0";
704             desc.fragment_func.source = &FS_SOURCE_METAL_MACOS[0];
705             desc.fragment_func.entry = "main0";
706             desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex;
707             desc.uniform_blocks[0].layout = sg.UniformLayout.Std140;
708             desc.uniform_blocks[0].size = 64;
709             desc.uniform_blocks[0].msl_buffer_n = 0;
710             desc.storage_buffers[0].stage = sg.ShaderStage.Vertex;
711             desc.storage_buffers[0].readonly = true;
712             desc.storage_buffers[0].msl_buffer_n = 8;
713             break;
714         case sg.Backend.Wgpu:
715             desc.vertex_func.source = &VS_SOURCE_WGSL[0];
716             desc.vertex_func.entry = "main";
717             desc.fragment_func.source = &FS_SOURCE_WGSL[0];
718             desc.fragment_func.entry = "main";
719             desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex;
720             desc.uniform_blocks[0].layout = sg.UniformLayout.Std140;
721             desc.uniform_blocks[0].size = 64;
722             desc.uniform_blocks[0].wgsl_group0_binding_n = 0;
723             desc.storage_buffers[0].stage = sg.ShaderStage.Vertex;
724             desc.storage_buffers[0].readonly = true;
725             desc.storage_buffers[0].wgsl_group1_binding_n = 32;
726             break;
727         default: break;
728     }
729     return desc;
730 }