1 module shaders.shapes;
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 examples/shaders/shapes.glsl -o examples/shaders/shapes.d -l glsl410:glsl300es:metal_macos:hlsl5:wgsl -f sokol_d
13 
14     Overview:
15     =========
16     Shader program: 'shapes':
17         Get shader desc: shapesShaderDesc(sg.queryBackend());
18         Vertex Shader: vs
19         Fragment Shader: fs
20         Attributes:
21             ATTR_SHAPES_POSITION => 0
22             ATTR_SHAPES_NORMAL => 1
23             ATTR_SHAPES_TEXCOORD => 2
24             ATTR_SHAPES_COLOR0 => 3
25     Bindings:
26         Uniform block 'vs_params':
27             D struct: VsParams
28             Bind slot: UB_VS_PARAMS => 0
29 */
30 enum ATTR_SHAPES_POSITION = 0;
31 enum ATTR_SHAPES_NORMAL = 1;
32 enum ATTR_SHAPES_TEXCOORD = 2;
33 enum ATTR_SHAPES_COLOR0 = 3;
34 enum UB_VS_PARAMS = 0;
35 struct VsParams {
36     align(16) float draw_mode = 0;
37     align(1) ubyte[12] _pad_4 = 0;
38     align(1) m.Mat4 mvp;
39 }
40 /*
41     #version 410
42 
43     uniform vec4 vs_params[5];
44     layout(location = 0) in vec4 position;
45     layout(location = 0) out vec4 color;
46     layout(location = 1) in vec3 normal;
47     layout(location = 2) in vec2 texcoord;
48     layout(location = 3) in vec4 color0;
49 
50     void main()
51     {
52         gl_Position = mat4(vs_params[1], vs_params[2], vs_params[3], vs_params[4]) * position;
53         if (vs_params[0].x == 0.0)
54         {
55             color = vec4((normal + vec3(1.0)) * 0.5, 1.0);
56         }
57         else
58         {
59             if (vs_params[0].x == 1.0)
60             {
61                 color = vec4(texcoord, 0.0, 1.0);
62             }
63             else
64             {
65                 color = color0;
66             }
67         }
68     }
69 
70 */
71 __gshared char[621] VS_SOURCE_GLSL410 = [
72     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e,
73     0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x70,0x61,
74     0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,
75     0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,
76     0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
77     0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
78     0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,
79     0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,
80     0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,
81     0x33,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
82     0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,
83     0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,
84     0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,
85     0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,
86     0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,
87     0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,
88     0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,
89     0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,
90     0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
91     0x73,0x5b,0x33,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
92     0x34,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,
93     0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
94     0x73,0x5b,0x30,0x5d,0x2e,0x78,0x20,0x3d,0x3d,0x20,0x30,0x2e,0x30,0x29,0x0a,0x20,
95     0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,
96     0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x6e,0x6f,0x72,0x6d,0x61,
97     0x6c,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,0x29,0x29,0x20,0x2a,
98     0x20,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
99     0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,
100     0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x76,0x73,0x5f,
101     0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x20,0x3d,0x3d,0x20,0x31,
102     0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,
103     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,
104     0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x2c,
105     0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
106     0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,
107     0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,
108     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,
109     0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
110     0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x00,
111 ];
112 /*
113     #version 410
114 
115     layout(location = 0) out vec4 frag_color;
116     layout(location = 0) in vec4 color;
117 
118     void main()
119     {
120         frag_color = color;
121     }
122 
123 */
124 __gshared char[135] FS_SOURCE_GLSL410 = [
125     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
126     0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
127     0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,
128     0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
129     0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,
130     0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,
131     0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
132     0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,
133     0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
134 ];
135 /*
136     #version 300 es
137 
138     uniform vec4 vs_params[5];
139     layout(location = 0) in vec4 position;
140     out vec4 color;
141     layout(location = 1) in vec3 normal;
142     layout(location = 2) in vec2 texcoord;
143     layout(location = 3) in vec4 color0;
144 
145     void main()
146     {
147         gl_Position = mat4(vs_params[1], vs_params[2], vs_params[3], vs_params[4]) * position;
148         if (vs_params[0].x == 0.0)
149         {
150             color = vec4((normal + vec3(1.0)) * 0.5, 1.0);
151         }
152         else
153         {
154             if (vs_params[0].x == 1.0)
155             {
156                 color = vec4(texcoord, 0.0, 1.0);
157             }
158             else
159             {
160                 color = color0;
161             }
162         }
163     }
164 
165 */
166 __gshared char[603] VS_SOURCE_GLSL300ES = [
167     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
168     0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,
169     0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,
170     0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,
171     0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
172     0x6e,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,
173     0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,
174     0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,
175     0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
176     0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,
177     0x76,0x65,0x63,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x6c,
178     0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
179     0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,
180     0x72,0x30,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,
181     0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
182     0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,
183     0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
184     0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
185     0x33,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,
186     0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,
187     0x20,0x20,0x69,0x66,0x20,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
188     0x30,0x5d,0x2e,0x78,0x20,0x3d,0x3d,0x20,0x30,0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,
189     0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,
190     0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,
191     0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,0x29,0x29,0x20,0x2a,0x20,0x30,
192     0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,
193     0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,
194     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x76,0x73,0x5f,0x70,0x61,
195     0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x20,0x3d,0x3d,0x20,0x31,0x2e,0x30,
196     0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,
197     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,
198     0x76,0x65,0x63,0x34,0x28,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x2c,0x20,0x30,
199     0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
200     0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,
201     0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,
202     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,
203     0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,
204     0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x00,
205 ];
206 /*
207     #version 300 es
208     precision mediump float;
209     precision highp int;
210 
211     layout(location = 0) out highp vec4 frag_color;
212     in highp vec4 color;
213 
214     void main()
215     {
216         frag_color = color;
217     }
218 
219 */
220 __gshared char[175] FS_SOURCE_GLSL300ES = [
221     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
222     0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
223     0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
224     0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x6c,
225     0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
226     0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,
227     0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,
228     0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,
229     0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,
230     0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
231     0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
232 ];
233 /*
234     cbuffer vs_params : register(b0)
235     {
236         float _19_draw_mode : packoffset(c0);
237         row_major float4x4 _19_mvp : packoffset(c1);
238     };
239 
240 
241     static float4 gl_Position;
242     static float4 position;
243     static float4 color;
244     static float3 normal;
245     static float2 texcoord;
246     static float4 color0;
247 
248     struct SPIRV_Cross_Input
249     {
250         float4 position : TEXCOORD0;
251         float3 normal : TEXCOORD1;
252         float2 texcoord : TEXCOORD2;
253         float4 color0 : TEXCOORD3;
254     };
255 
256     struct SPIRV_Cross_Output
257     {
258         float4 color : TEXCOORD0;
259         float4 gl_Position : SV_Position;
260     };
261 
262     void vert_main()
263     {
264         gl_Position = mul(position, _19_mvp);
265         if (_19_draw_mode == 0.0f)
266         {
267             color = float4((normal + 1.0f.xxx) * 0.5f, 1.0f);
268         }
269         else
270         {
271             if (_19_draw_mode == 1.0f)
272             {
273                 color = float4(texcoord, 0.0f, 1.0f);
274             }
275             else
276             {
277                 color = color0;
278             }
279         }
280     }
281 
282     SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
283     {
284         position = stage_input.position;
285         normal = stage_input.normal;
286         texcoord = stage_input.texcoord;
287         color0 = stage_input.color0;
288         vert_main();
289         SPIRV_Cross_Output stage_output;
290         stage_output.gl_Position = gl_Position;
291         stage_output.color = color;
292         return stage_output;
293     }
294 */
295 __gshared char[1238] VS_SOURCE_HLSL5 = [
296     0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
297     0x73,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,
298     0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x39,
299     0x5f,0x64,0x72,0x61,0x77,0x5f,0x6d,0x6f,0x64,0x65,0x20,0x3a,0x20,0x70,0x61,0x63,
300     0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,
301     0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,0x20,0x66,0x6c,0x6f,0x61,0x74,
302     0x34,0x78,0x34,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76,0x70,0x20,0x3a,0x20,0x70,0x61,
303     0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,0x31,0x29,0x3b,0x0a,0x7d,0x3b,
304     0x0a,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
305     0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,
306     0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69,
307     0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,
308     0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,
309     0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,
310     0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x74,
311     0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,
312     0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x0a,
313     0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,
314     0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
315     0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,
316     0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,
317     0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3a,0x20,
318     0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
319     0x6c,0x6f,0x61,0x74,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x20,0x3a,
320     0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,
321     0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3a,0x20,
322     0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x33,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,
323     0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,
324     0x73,0x5f,0x4f,0x75,0x74,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,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
327     0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,
328     0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d,
329     0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,
330     0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,
331     0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28,0x70,0x6f,0x73,0x69,
332     0x74,0x69,0x6f,0x6e,0x2c,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a,
333     0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x39,0x5f,0x64,0x72,0x61,0x77,
334     0x5f,0x6d,0x6f,0x64,0x65,0x20,0x3d,0x3d,0x20,0x30,0x2e,0x30,0x66,0x29,0x0a,0x20,
335     0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,
336     0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x6e,0x6f,0x72,
337     0x6d,0x61,0x6c,0x20,0x2b,0x20,0x31,0x2e,0x30,0x66,0x2e,0x78,0x78,0x78,0x29,0x20,
338     0x2a,0x20,0x30,0x2e,0x35,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,
339     0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,
340     0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,
341     0x5f,0x31,0x39,0x5f,0x64,0x72,0x61,0x77,0x5f,0x6d,0x6f,0x64,0x65,0x20,0x3d,0x3d,
342     0x20,0x31,0x2e,0x30,0x66,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,
343     0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,
344     0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x74,0x65,0x78,0x63,
345     0x6f,0x6f,0x72,0x64,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,
346     0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,
347     0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
348     0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
349     0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,
350     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,
351     0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,
352     0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,
353     0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,
354     0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
355     0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,
356     0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,
357     0x0a,0x20,0x20,0x20,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x73,0x74,
358     0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
359     0x3b,0x0a,0x20,0x20,0x20,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x20,0x3d,
360     0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x74,0x65,0x78,
361     0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,
362     0x30,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,
363     0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74,
364     0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,
365     0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,
366     0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,
367     0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x67,
368     0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f,
369     0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,
370     0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,
371     0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,
372     0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,
373     0x74,0x3b,0x0a,0x7d,0x0a,0x00,
374 ];
375 /*
376     static float4 frag_color;
377     static float4 color;
378 
379     struct SPIRV_Cross_Input
380     {
381         float4 color : TEXCOORD0;
382     };
383 
384     struct SPIRV_Cross_Output
385     {
386         float4 frag_color : SV_Target0;
387     };
388 
389     void frag_main()
390     {
391         frag_color = color;
392     }
393 
394     SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
395     {
396         color = stage_input.color;
397         frag_main();
398         SPIRV_Cross_Output stage_output;
399         stage_output.frag_color = frag_color;
400         return stage_output;
401     }
402 */
403 __gshared char[435] FS_SOURCE_HLSL5 = [
404     0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,
405     0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,
406     0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,
407     0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,
408     0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
409     0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54,0x45,
410     0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,
411     0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,
412     0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
413     0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,
414     0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,
415     0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,
416     0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
417     0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,
418     0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,
419     0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,
420     0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,
421     0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,
422     0x72,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,
423     0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,
424     0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,
425     0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,
426     0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,
427     0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x72,
428     0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,
429     0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
430     0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,
431     0x7d,0x0a,0x00,
432 ];
433 /*
434     #include <metal_stdlib>
435     #include <simd/simd.h>
436 
437     using namespace metal;
438 
439     struct vs_params
440     {
441         float draw_mode;
442         float4x4 mvp;
443     };
444 
445     struct main0_out
446     {
447         float4 color [[user(locn0)]];
448         float4 gl_Position [[position]];
449     };
450 
451     struct main0_in
452     {
453         float4 position [[attribute(0)]];
454         float3 normal [[attribute(1)]];
455         float2 texcoord [[attribute(2)]];
456         float4 color0 [[attribute(3)]];
457     };
458 
459     vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]])
460     {
461         main0_out out = {};
462         out.gl_Position = _19.mvp * in.position;
463         if (_19.draw_mode == 0.0)
464         {
465             out.color = float4((in.normal + float3(1.0)) * 0.5, 1.0);
466         }
467         else
468         {
469             if (_19.draw_mode == 1.0)
470             {
471                 out.color = float4(in.texcoord, 0.0, 1.0);
472             }
473             else
474             {
475                 out.color = in.color0;
476             }
477         }
478         return out;
479     }
480 
481 */
482 __gshared char[883] VS_SOURCE_METAL_MACOS = [
483     0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
484     0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
485     0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
486     0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
487     0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x76,
488     0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
489     0x6c,0x6f,0x61,0x74,0x20,0x64,0x72,0x61,0x77,0x5f,0x6d,0x6f,0x64,0x65,0x3b,0x0a,
490     0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x6d,0x76,0x70,
491     0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,
492     0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
493     0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,
494     0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
495     0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,
496     0x6e,0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,
497     0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,
498     0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
499     0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,
500     0x69,0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,
501     0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x5b,0x5b,
502     0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b,0x0a,
503     0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,
504     0x6f,0x72,0x64,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,
505     0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
506     0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,
507     0x75,0x74,0x65,0x28,0x33,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,
508     0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,
509     0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,
510     0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,
511     0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
512     0x73,0x26,0x20,0x5f,0x31,0x39,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,
513     0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,
514     0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,
515     0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,
516     0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,
517     0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,
518     0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x39,0x2e,0x64,0x72,0x61,0x77,0x5f,0x6d,0x6f,
519     0x64,0x65,0x20,0x3d,0x3d,0x20,0x30,0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,
520     0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,
521     0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x69,0x6e,0x2e,
522     0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,
523     0x31,0x2e,0x30,0x29,0x29,0x20,0x2a,0x20,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,
524     0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,
525     0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
526     0x69,0x66,0x20,0x28,0x5f,0x31,0x39,0x2e,0x64,0x72,0x61,0x77,0x5f,0x6d,0x6f,0x64,
527     0x65,0x20,0x3d,0x3d,0x20,0x31,0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
528     0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
529     0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,
530     0x74,0x34,0x28,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x2c,0x20,
531     0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
532     0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,
533     0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,
534     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x6f,
535     0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,
536     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,
537     0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,
538     0x0a,0x0a,0x00,
539 ];
540 /*
541     #include <metal_stdlib>
542     #include <simd/simd.h>
543 
544     using namespace metal;
545 
546     struct main0_out
547     {
548         float4 frag_color [[color(0)]];
549     };
550 
551     struct main0_in
552     {
553         float4 color [[user(locn0)]];
554     };
555 
556     fragment main0_out main0(main0_in in [[stage_in]])
557     {
558         main0_out out = {};
559         out.frag_color = in.color;
560         return out;
561     }
562 
563 */
564 __gshared char[315] FS_SOURCE_METAL_MACOS = [
565     0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
566     0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
567     0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
568     0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
569     0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,
570     0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
571     0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
572     0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,
573     0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
574     0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
575     0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,
576     0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,
577     0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,
578     0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,
579     0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,
580     0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,
581     0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,
582     0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,
583     0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
584     0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
585 ];
586 /*
587     diagnostic(off, derivative_uniformity);
588 
589     struct vs_params {
590       /_ @offset(0) _/
591       draw_mode : f32,
592       /_ @offset(16) _/
593       mvp : mat4x4f,
594     }
595 
596     @binding(0) @group(0) var<uniform> x_19 : vs_params;
597 
598     var<private> position_1 : vec4f;
599 
600     var<private> color : vec4f;
601 
602     var<private> normal : vec3f;
603 
604     var<private> texcoord : vec2f;
605 
606     var<private> color0 : vec4f;
607 
608     var<private> gl_Position : vec4f;
609 
610     fn main_1() {
611       gl_Position = (x_19.mvp * position_1);
612       if ((x_19.draw_mode == 0.0f)) {
613         let x_47 = ((normal + vec3f(1.0f)) * 0.5f);
614         color = vec4f(x_47.x, x_47.y, x_47.z, 1.0f);
615       } else {
616         if ((x_19.draw_mode == 1.0f)) {
617           color = vec4f(texcoord.x, texcoord.y, 0.0f, 1.0f);
618         } else {
619           color = color0;
620         }
621       }
622       return;
623     }
624 
625     struct main_out {
626       @builtin(position)
627       gl_Position : vec4f,
628       @location(0)
629       color_1 : vec4f,
630     }
631 
632     @vertex
633     fn main(@location(0) position_1_param : vec4f, @location(1) normal_param : vec3f, @location(2) texcoord_param : vec2f, @location(3) color0_param : vec4f) -> main_out {
634       position_1 = position_1_param;
635       normal = normal_param;
636       texcoord = texcoord_param;
637       color0 = color0_param;
638       main_1();
639       return main_out(gl_Position, color);
640     }
641 */
642 __gshared char[1171] VS_SOURCE_WGSL = [
643     0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
644     0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
645     0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,
646     0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,
647     0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,
648     0x20,0x64,0x72,0x61,0x77,0x5f,0x6d,0x6f,0x64,0x65,0x20,0x3a,0x20,0x66,0x33,0x32,
649     0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,
650     0x36,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61,
651     0x74,0x34,0x78,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x62,0x69,0x6e,0x64,0x69,
652     0x6e,0x67,0x28,0x30,0x29,0x20,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,
653     0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31,
654     0x39,0x20,0x3a,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,
655     0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x70,0x6f,0x73,
656     0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,
657     0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63,
658     0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,
659     0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x6e,0x6f,0x72,0x6d,
660     0x61,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,
661     0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,
662     0x72,0x64,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,
663     0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,
664     0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,
665     0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,
666     0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,
667     0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x67,0x6c,
668     0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x28,0x78,0x5f,0x31,
669     0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
670     0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x69,0x66,0x20,0x28,0x28,0x78,0x5f,0x31,0x39,
671     0x2e,0x64,0x72,0x61,0x77,0x5f,0x6d,0x6f,0x64,0x65,0x20,0x3d,0x3d,0x20,0x30,0x2e,
672     0x30,0x66,0x29,0x29,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,
673     0x5f,0x34,0x37,0x20,0x3d,0x20,0x28,0x28,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x2b,
674     0x20,0x76,0x65,0x63,0x33,0x66,0x28,0x31,0x2e,0x30,0x66,0x29,0x29,0x20,0x2a,0x20,
675     0x30,0x2e,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,
676     0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x34,0x37,0x2e,0x78,0x2c,
677     0x20,0x78,0x5f,0x34,0x37,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x34,0x37,0x2e,0x7a,0x2c,
678     0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x7d,0x20,0x65,0x6c,0x73,0x65,
679     0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x28,0x78,0x5f,0x31,0x39,
680     0x2e,0x64,0x72,0x61,0x77,0x5f,0x6d,0x6f,0x64,0x65,0x20,0x3d,0x3d,0x20,0x31,0x2e,
681     0x30,0x66,0x29,0x29,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,
682     0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x74,0x65,0x78,0x63,0x6f,
683     0x6f,0x72,0x64,0x2e,0x78,0x2c,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x2e,
684     0x79,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,
685     0x20,0x20,0x20,0x20,0x7d,0x20,0x65,0x6c,0x73,0x65,0x20,0x7b,0x0a,0x20,0x20,0x20,
686     0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,
687     0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x7d,0x0a,0x20,0x20,0x72,
688     0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,
689     0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x62,
690     0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,
691     0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,
692     0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,
693     0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,
694     0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,
695     0x72,0x74,0x65,0x78,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,
696     0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,
697     0x6f,0x6e,0x5f,0x31,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,
698     0x34,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,
699     0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,
700     0x76,0x65,0x63,0x33,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,
701     0x28,0x32,0x29,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x5f,0x70,0x61,0x72,
702     0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,
703     0x61,0x74,0x69,0x6f,0x6e,0x28,0x33,0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,
704     0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x29,0x20,0x2d,
705     0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x70,
706     0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,
707     0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,
708     0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,
709     0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,
710     0x64,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x5f,0x70,0x61,0x72,
711     0x61,0x6d,0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x20,0x3d,0x20,0x63,
712     0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,
713     0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
714     0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x67,0x6c,0x5f,0x50,0x6f,
715     0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,
716     0x7d,0x0a,0x00,
717 ];
718 /*
719     diagnostic(off, derivative_uniformity);
720 
721     var<private> frag_color : vec4f;
722 
723     var<private> color : vec4f;
724 
725     fn main_1() {
726       frag_color = color;
727       return;
728     }
729 
730     struct main_out {
731       @location(0)
732       frag_color_1 : vec4f,
733     }
734 
735     @fragment
736     fn main(@location(0) color_param : vec4f) -> main_out {
737       color = color_param;
738       main_1();
739       return main_out(frag_color);
740     }
741 */
742 __gshared char[348] FS_SOURCE_WGSL = [
743     0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
744     0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
745     0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
746     0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
747     0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,
748     0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,
749     0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,
750     0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
751     0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x72,0x65,
752     0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,
753     0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,
754     0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,
755     0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,
756     0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66,
757     0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,
758     0x28,0x30,0x29,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,
759     0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,
760     0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,
761     0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,
762     0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,
763     0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,
764     0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x00,
765 ];
766 sg.ShaderDesc shapesShaderDesc(sg.Backend backend) @trusted @nogc nothrow {
767     sg.ShaderDesc desc;
768     desc.label = "shapes_shader";
769     switch (backend) {
770         case sg.Backend.Glcore:
771             desc.vertex_func.source = &VS_SOURCE_GLSL410[0];
772             desc.vertex_func.entry = "main";
773             desc.fragment_func.source = &FS_SOURCE_GLSL410[0];
774             desc.fragment_func.entry = "main";
775             desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float;
776             desc.attrs[0].glsl_name = "position";
777             desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float;
778             desc.attrs[1].glsl_name = "normal";
779             desc.attrs[2].base_type = sg.ShaderAttrBaseType.Float;
780             desc.attrs[2].glsl_name = "texcoord";
781             desc.attrs[3].base_type = sg.ShaderAttrBaseType.Float;
782             desc.attrs[3].glsl_name = "color0";
783             desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex;
784             desc.uniform_blocks[0].layout = sg.UniformLayout.Std140;
785             desc.uniform_blocks[0].size = 80;
786             desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4;
787             desc.uniform_blocks[0].glsl_uniforms[0].array_count = 5;
788             desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params";
789             break;
790         case sg.Backend.Gles3:
791             desc.vertex_func.source = &VS_SOURCE_GLSL300ES[0];
792             desc.vertex_func.entry = "main";
793             desc.fragment_func.source = &FS_SOURCE_GLSL300ES[0];
794             desc.fragment_func.entry = "main";
795             desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float;
796             desc.attrs[0].glsl_name = "position";
797             desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float;
798             desc.attrs[1].glsl_name = "normal";
799             desc.attrs[2].base_type = sg.ShaderAttrBaseType.Float;
800             desc.attrs[2].glsl_name = "texcoord";
801             desc.attrs[3].base_type = sg.ShaderAttrBaseType.Float;
802             desc.attrs[3].glsl_name = "color0";
803             desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex;
804             desc.uniform_blocks[0].layout = sg.UniformLayout.Std140;
805             desc.uniform_blocks[0].size = 80;
806             desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4;
807             desc.uniform_blocks[0].glsl_uniforms[0].array_count = 5;
808             desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params";
809             break;
810         case sg.Backend.D3d11:
811             desc.vertex_func.source = &VS_SOURCE_HLSL5[0];
812             desc.vertex_func.d3d11_target = "vs_5_0";
813             desc.vertex_func.entry = "main";
814             desc.fragment_func.source = &FS_SOURCE_HLSL5[0];
815             desc.fragment_func.d3d11_target = "ps_5_0";
816             desc.fragment_func.entry = "main";
817             desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float;
818             desc.attrs[0].hlsl_sem_name = "TEXCOORD";
819             desc.attrs[0].hlsl_sem_index = 0;
820             desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float;
821             desc.attrs[1].hlsl_sem_name = "TEXCOORD";
822             desc.attrs[1].hlsl_sem_index = 1;
823             desc.attrs[2].base_type = sg.ShaderAttrBaseType.Float;
824             desc.attrs[2].hlsl_sem_name = "TEXCOORD";
825             desc.attrs[2].hlsl_sem_index = 2;
826             desc.attrs[3].base_type = sg.ShaderAttrBaseType.Float;
827             desc.attrs[3].hlsl_sem_name = "TEXCOORD";
828             desc.attrs[3].hlsl_sem_index = 3;
829             desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex;
830             desc.uniform_blocks[0].layout = sg.UniformLayout.Std140;
831             desc.uniform_blocks[0].size = 80;
832             desc.uniform_blocks[0].hlsl_register_b_n = 0;
833             break;
834         case sg.Backend.Metal_macos:
835             desc.vertex_func.source = &VS_SOURCE_METAL_MACOS[0];
836             desc.vertex_func.entry = "main0";
837             desc.fragment_func.source = &FS_SOURCE_METAL_MACOS[0];
838             desc.fragment_func.entry = "main0";
839             desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float;
840             desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float;
841             desc.attrs[2].base_type = sg.ShaderAttrBaseType.Float;
842             desc.attrs[3].base_type = sg.ShaderAttrBaseType.Float;
843             desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex;
844             desc.uniform_blocks[0].layout = sg.UniformLayout.Std140;
845             desc.uniform_blocks[0].size = 80;
846             desc.uniform_blocks[0].msl_buffer_n = 0;
847             break;
848         case sg.Backend.Wgpu:
849             desc.vertex_func.source = &VS_SOURCE_WGSL[0];
850             desc.vertex_func.entry = "main";
851             desc.fragment_func.source = &FS_SOURCE_WGSL[0];
852             desc.fragment_func.entry = "main";
853             desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float;
854             desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float;
855             desc.attrs[2].base_type = sg.ShaderAttrBaseType.Float;
856             desc.attrs[3].base_type = sg.ShaderAttrBaseType.Float;
857             desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex;
858             desc.uniform_blocks[0].layout = sg.UniformLayout.Std140;
859             desc.uniform_blocks[0].size = 80;
860             desc.uniform_blocks[0].wgsl_group0_binding_n = 0;
861             break;
862         default: break;
863     }
864     return desc;
865 }