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 src/examples/shaders/shapes.glsl -o src/examples/shaders/shapes.d -l glsl410:metal_macos:hlsl5:glsl300es: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 @group(0) @binding(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 let x_23 : mat4x4f = x_19.mvp; 612 let x_26 : vec4f = position_1; 613 gl_Position = (x_23 * x_26); 614 let x_32 : f32 = x_19.draw_mode; 615 if ((x_32 == 0.0f)) { 616 let x_42 : vec3f = normal; 617 let x_47 : vec3f = ((x_42 + vec3f(1.0f, 1.0f, 1.0f)) * 0.5f); 618 color = vec4f(x_47.x, x_47.y, x_47.z, 1.0f); 619 } else { 620 let x_54 : f32 = x_19.draw_mode; 621 if ((x_54 == 1.0f)) { 622 let x_61 : vec2f = texcoord; 623 color = vec4f(x_61.x, x_61.y, 0.0f, 1.0f); 624 } else { 625 let x_67 : vec4f = color0; 626 color = x_67; 627 } 628 } 629 return; 630 } 631 632 struct main_out { 633 @builtin(position) 634 gl_Position : vec4f, 635 @location(0) 636 color_1 : vec4f, 637 } 638 639 @vertex 640 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 { 641 position_1 = position_1_param; 642 normal = normal_param; 643 texcoord = texcoord_param; 644 color0 = color0_param; 645 main_1(); 646 return main_out(gl_Position, color); 647 } 648 649 */ 650 __gshared char[1387] VS_SOURCE_WGSL = [ 651 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, 652 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, 653 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, 654 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a, 655 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20, 656 0x20,0x64,0x72,0x61,0x77,0x5f,0x6d,0x6f,0x64,0x65,0x20,0x3a,0x20,0x66,0x33,0x32, 657 0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31, 658 0x36,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61, 659 0x74,0x34,0x78,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70, 660 0x28,0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20, 661 0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31, 662 0x39,0x20,0x3a,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a, 663 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x70,0x6f,0x73, 664 0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b, 665 0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63, 666 0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76, 667 0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x6e,0x6f,0x72,0x6d, 668 0x61,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72, 669 0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f, 670 0x72,0x64,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72, 671 0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30, 672 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70, 673 0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, 674 0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e, 675 0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65, 676 0x74,0x20,0x78,0x5f,0x32,0x33,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66, 677 0x20,0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x3b,0x0a,0x20,0x20,0x6c, 678 0x65,0x74,0x20,0x78,0x5f,0x32,0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20, 679 0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x3b,0x0a,0x20,0x20, 680 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x28,0x78, 681 0x5f,0x32,0x33,0x20,0x2a,0x20,0x78,0x5f,0x32,0x36,0x29,0x3b,0x0a,0x20,0x20,0x6c, 682 0x65,0x74,0x20,0x78,0x5f,0x33,0x32,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20, 683 0x78,0x5f,0x31,0x39,0x2e,0x64,0x72,0x61,0x77,0x5f,0x6d,0x6f,0x64,0x65,0x3b,0x0a, 684 0x20,0x20,0x69,0x66,0x20,0x28,0x28,0x78,0x5f,0x33,0x32,0x20,0x3d,0x3d,0x20,0x30, 685 0x2e,0x30,0x66,0x29,0x29,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20, 686 0x78,0x5f,0x34,0x32,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x6e, 687 0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78, 688 0x5f,0x34,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x28,0x28, 689 0x78,0x5f,0x34,0x32,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x66,0x28,0x31,0x2e,0x30, 690 0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x29,0x20, 691 0x2a,0x20,0x30,0x2e,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c, 692 0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x34,0x37,0x2e, 693 0x78,0x2c,0x20,0x78,0x5f,0x34,0x37,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x34,0x37,0x2e, 694 0x7a,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x7d,0x20,0x65,0x6c, 695 0x73,0x65,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35, 696 0x34,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,0x64, 697 0x72,0x61,0x77,0x5f,0x6d,0x6f,0x64,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66, 698 0x20,0x28,0x28,0x78,0x5f,0x35,0x34,0x20,0x3d,0x3d,0x20,0x31,0x2e,0x30,0x66,0x29, 699 0x29,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f, 700 0x36,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x74,0x65,0x78, 701 0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c, 702 0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x36,0x31,0x2e, 703 0x78,0x2c,0x20,0x78,0x5f,0x36,0x31,0x2e,0x79,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c, 704 0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x20,0x65,0x6c, 705 0x73,0x65,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78, 706 0x5f,0x36,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x63,0x6f, 707 0x6c,0x6f,0x72,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f, 708 0x72,0x20,0x3d,0x20,0x78,0x5f,0x36,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a, 709 0x20,0x20,0x7d,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a, 710 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74, 711 0x20,0x7b,0x0a,0x20,0x20,0x40,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x70,0x6f, 712 0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, 713 0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20, 714 0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20, 715 0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c, 716 0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,0x72,0x74,0x65,0x78,0x0a,0x66,0x6e,0x20,0x6d, 717 0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29, 718 0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f,0x70,0x61,0x72,0x61, 719 0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61, 720 0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x70, 721 0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x2c,0x20,0x40,0x6c, 722 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x32,0x29,0x20,0x74,0x65,0x78,0x63,0x6f, 723 0x6f,0x72,0x64,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32, 724 0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x33,0x29,0x20, 725 0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76, 726 0x65,0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75, 727 0x74,0x20,0x7b,0x0a,0x20,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, 728 0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f,0x70,0x61, 729 0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20, 730 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20, 731 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f, 732 0x6f,0x72,0x64,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x63,0x6f,0x6c, 733 0x6f,0x72,0x30,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x30,0x5f,0x70,0x61,0x72, 734 0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a, 735 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75, 736 0x74,0x28,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x63, 737 0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 738 ]; 739 /* 740 diagnostic(off, derivative_uniformity); 741 742 var<private> frag_color : vec4f; 743 744 var<private> color : vec4f; 745 746 fn main_1() { 747 let x_12 : vec4f = color; 748 frag_color = x_12; 749 return; 750 } 751 752 struct main_out { 753 @location(0) 754 frag_color_1 : vec4f, 755 } 756 757 @fragment 758 fn main(@location(0) color_param : vec4f) -> main_out { 759 color = color_param; 760 main_1(); 761 return main_out(frag_color); 762 } 763 764 */ 765 __gshared char[376] FS_SOURCE_WGSL = [ 766 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, 767 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, 768 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, 769 0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, 770 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70, 771 0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20, 772 0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f, 773 0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x32, 774 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f,0x72, 775 0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, 776 0x20,0x78,0x5f,0x31,0x32,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b, 777 0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f, 778 0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, 779 0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, 780 0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a, 781 0x40,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69, 782 0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x63, 783 0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63, 784 0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20, 785 0x7b,0x0a,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x6f, 786 0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f, 787 0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61, 788 0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, 789 0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 790 ]; 791 sg.ShaderDesc shapesShaderDesc(sg.Backend backend) @trusted @nogc nothrow { 792 sg.ShaderDesc desc; 793 desc.label = "shapes_shader"; 794 switch (backend) { 795 case sg.Backend.Glcore: 796 desc.vertex_func.source = &VS_SOURCE_GLSL410[0]; 797 desc.vertex_func.entry = "main"; 798 desc.fragment_func.source = &FS_SOURCE_GLSL410[0]; 799 desc.fragment_func.entry = "main"; 800 desc.attrs[0].glsl_name = "position"; 801 desc.attrs[1].glsl_name = "normal"; 802 desc.attrs[2].glsl_name = "texcoord"; 803 desc.attrs[3].glsl_name = "color0"; 804 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 805 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 806 desc.uniform_blocks[0].size = 80; 807 desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4; 808 desc.uniform_blocks[0].glsl_uniforms[0].array_count = 5; 809 desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; 810 break; 811 case sg.Backend.Gles3: 812 desc.vertex_func.source = &VS_SOURCE_GLSL300ES[0]; 813 desc.vertex_func.entry = "main"; 814 desc.fragment_func.source = &FS_SOURCE_GLSL300ES[0]; 815 desc.fragment_func.entry = "main"; 816 desc.attrs[0].glsl_name = "position"; 817 desc.attrs[1].glsl_name = "normal"; 818 desc.attrs[2].glsl_name = "texcoord"; 819 desc.attrs[3].glsl_name = "color0"; 820 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 821 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 822 desc.uniform_blocks[0].size = 80; 823 desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4; 824 desc.uniform_blocks[0].glsl_uniforms[0].array_count = 5; 825 desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; 826 break; 827 case sg.Backend.D3d11: 828 desc.vertex_func.source = &VS_SOURCE_HLSL5[0]; 829 desc.vertex_func.d3d11_target = "vs_5_0"; 830 desc.vertex_func.entry = "main"; 831 desc.fragment_func.source = &FS_SOURCE_HLSL5[0]; 832 desc.fragment_func.d3d11_target = "ps_5_0"; 833 desc.fragment_func.entry = "main"; 834 desc.attrs[0].hlsl_sem_name = "TEXCOORD"; 835 desc.attrs[0].hlsl_sem_index = 0; 836 desc.attrs[1].hlsl_sem_name = "TEXCOORD"; 837 desc.attrs[1].hlsl_sem_index = 1; 838 desc.attrs[2].hlsl_sem_name = "TEXCOORD"; 839 desc.attrs[2].hlsl_sem_index = 2; 840 desc.attrs[3].hlsl_sem_name = "TEXCOORD"; 841 desc.attrs[3].hlsl_sem_index = 3; 842 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 843 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 844 desc.uniform_blocks[0].size = 80; 845 desc.uniform_blocks[0].hlsl_register_b_n = 0; 846 break; 847 case sg.Backend.Metal_macos: 848 desc.vertex_func.source = &VS_SOURCE_METAL_MACOS[0]; 849 desc.vertex_func.entry = "main0"; 850 desc.fragment_func.source = &FS_SOURCE_METAL_MACOS[0]; 851 desc.fragment_func.entry = "main0"; 852 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 853 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 854 desc.uniform_blocks[0].size = 80; 855 desc.uniform_blocks[0].msl_buffer_n = 0; 856 break; 857 case sg.Backend.Wgpu: 858 desc.vertex_func.source = &VS_SOURCE_WGSL[0]; 859 desc.vertex_func.entry = "main"; 860 desc.fragment_func.source = &FS_SOURCE_WGSL[0]; 861 desc.fragment_func.entry = "main"; 862 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 863 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 864 desc.uniform_blocks[0].size = 80; 865 desc.uniform_blocks[0].wgsl_group0_binding_n = 0; 866 break; 867 default: break; 868 } 869 return desc; 870 }