1 module shaders.offscreen; 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/offscreen.glsl -o examples/shaders/offscreen.d -l glsl410:glsl300es:metal_macos:hlsl5:wgsl -f sokol_d 13 14 Overview: 15 ========= 16 Shader program: 'default': 17 Get shader desc: defaultShaderDesc(sg.queryBackend()); 18 Vertex Shader: vs_default 19 Fragment Shader: fs_default 20 Attributes: 21 ATTR_DEFAULT_POSITION => 0 22 ATTR_DEFAULT_NORMAL => 1 23 ATTR_DEFAULT_TEXCOORD0 => 2 24 Shader program: 'offscreen': 25 Get shader desc: offscreenShaderDesc(sg.queryBackend()); 26 Vertex Shader: vs_offscreen 27 Fragment Shader: fs_offscreen 28 Attributes: 29 ATTR_OFFSCREEN_POSITION => 0 30 ATTR_OFFSCREEN_NORMAL => 1 31 Bindings: 32 Uniform block 'vs_params': 33 D struct: VsParams 34 Bind slot: UB_VS_PARAMS => 0 35 Image 'tex': 36 Image type: sg.ImageType._2d 37 Sample type: sg.ImageSampleType.Float 38 Multisampled: false 39 Bind slot: IMG_TEX => 0 40 Sampler 'smp': 41 Type: sg.SamplerType.Filtering 42 Bind slot: SMP_SMP => 0 43 */ 44 enum ATTR_DEFAULT_POSITION = 0; 45 enum ATTR_DEFAULT_NORMAL = 1; 46 enum ATTR_DEFAULT_TEXCOORD0 = 2; 47 enum ATTR_OFFSCREEN_POSITION = 0; 48 enum ATTR_OFFSCREEN_NORMAL = 1; 49 enum UB_VS_PARAMS = 0; 50 enum IMG_TEX = 0; 51 enum SMP_SMP = 0; 52 struct VsParams { 53 align(16) m.Mat4 mvp; 54 } 55 /* 56 #version 410 57 58 uniform vec4 vs_params[4]; 59 layout(location = 0) in vec4 position; 60 layout(location = 0) out vec4 nrm; 61 layout(location = 1) in vec4 normal; 62 63 void main() 64 { 65 gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position; 66 nrm = normal; 67 } 68 69 */ 70 __gshared char[280] VS_OFFSCREEN_SOURCE_GLSL410 = [ 71 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, 72 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x70,0x61, 73 0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, 74 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e, 75 0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a, 76 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, 77 0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x72, 78 0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69, 79 0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20, 80 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, 81 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f, 82 0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73, 83 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70, 84 0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72, 85 0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, 86 0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, 87 0x3b,0x0a,0x20,0x20,0x20,0x20,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d, 88 0x61,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 89 ]; 90 /* 91 #version 410 92 93 layout(location = 0) out vec4 frag_color; 94 layout(location = 0) in vec4 nrm; 95 96 void main() 97 { 98 frag_color = vec4((nrm.xyz * 0.5) + vec3(0.5), 1.0); 99 } 100 101 */ 102 __gshared char[166] FS_OFFSCREEN_SOURCE_GLSL410 = [ 103 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61, 104 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, 105 0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67, 106 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c, 107 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20, 108 0x76,0x65,0x63,0x34,0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20, 109 0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61, 110 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28, 111 0x6e,0x72,0x6d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b, 112 0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29, 113 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 114 ]; 115 /* 116 #version 410 117 118 uniform vec4 vs_params[4]; 119 layout(location = 0) in vec4 position; 120 layout(location = 1) out vec2 uv; 121 layout(location = 2) in vec2 texcoord0; 122 layout(location = 0) out vec4 nrm; 123 layout(location = 1) in vec4 normal; 124 125 void main() 126 { 127 mat4 _22 = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]); 128 gl_Position = _22 * position; 129 uv = texcoord0; 130 nrm = _22 * normal; 131 } 132 133 */ 134 __gshared char[400] VS_DEFAULT_SOURCE_GLSL410 = [ 135 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, 136 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73,0x5f,0x70,0x61, 137 0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, 138 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e, 139 0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a, 140 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, 141 0x3d,0x20,0x31,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76, 142 0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, 143 0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x74, 144 0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, 145 0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f, 146 0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79, 147 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31, 148 0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c, 149 0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b, 150 0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x74,0x34,0x20,0x5f,0x32,0x32,0x20,0x3d,0x20, 151 0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30, 152 0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c, 153 0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76, 154 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x3b,0x0a,0x20,0x20, 155 0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, 156 0x5f,0x32,0x32,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a, 157 0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72, 158 0x64,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x5f,0x32, 159 0x32,0x20,0x2a,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 160 161 ]; 162 /* 163 #version 410 164 165 uniform sampler2D tex_smp; 166 167 layout(location = 1) in vec2 uv; 168 layout(location = 0) in vec4 nrm; 169 layout(location = 0) out vec4 frag_color; 170 171 void main() 172 { 173 frag_color = vec4(texture(tex_smp, uv * vec2(20.0, 10.0)).xyz * ((clamp(dot(nrm.xyz, vec3(0.57735025882720947265625, 0.57735025882720947265625, -0.57735025882720947265625)), 0.0, 1.0) * 2.0) + 0.25), 1.0); 174 } 175 176 */ 177 __gshared char[380] FS_DEFAULT_SOURCE_GLSL410 = [ 178 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, 179 0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20, 180 0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, 181 0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69, 182 0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75, 183 0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20, 184 0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79, 185 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30, 186 0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f, 187 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69, 188 0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, 189 0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x74,0x65,0x78,0x74, 190 0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x20, 191 0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x32,0x30,0x2e,0x30,0x2c,0x20,0x31,0x30,0x2e, 192 0x30,0x29,0x29,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x28,0x63,0x6c,0x61,0x6d, 193 0x70,0x28,0x64,0x6f,0x74,0x28,0x6e,0x72,0x6d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x76, 194 0x65,0x63,0x33,0x28,0x30,0x2e,0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35,0x38,0x38, 195 0x32,0x37,0x32,0x30,0x39,0x34,0x37,0x32,0x36,0x35,0x36,0x32,0x35,0x2c,0x20,0x30, 196 0x2e,0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35,0x38,0x38,0x32,0x37,0x32,0x30,0x39, 197 0x34,0x37,0x32,0x36,0x35,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x35,0x37,0x37, 198 0x33,0x35,0x30,0x32,0x35,0x38,0x38,0x32,0x37,0x32,0x30,0x39,0x34,0x37,0x32,0x36, 199 0x35,0x36,0x32,0x35,0x29,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30, 200 0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x20,0x2b,0x20,0x30,0x2e,0x32,0x35,0x29, 201 0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 202 ]; 203 /* 204 #version 300 es 205 206 uniform vec4 vs_params[4]; 207 layout(location = 0) in vec4 position; 208 out vec4 nrm; 209 layout(location = 1) in vec4 normal; 210 211 void main() 212 { 213 gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position; 214 nrm = normal; 215 } 216 217 */ 218 __gshared char[262] VS_OFFSCREEN_SOURCE_GLSL300ES = [ 219 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 220 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73, 221 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f, 222 0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29, 223 0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, 224 0x6e,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x72,0x6d,0x3b, 225 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, 226 0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x6f, 227 0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e, 228 0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69, 229 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73,0x5f,0x70, 230 0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72, 231 0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, 232 0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, 233 0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a, 234 0x20,0x20,0x20,0x20,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c, 235 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 236 ]; 237 /* 238 #version 300 es 239 precision mediump float; 240 precision highp int; 241 242 layout(location = 0) out highp vec4 frag_color; 243 in highp vec4 nrm; 244 245 void main() 246 { 247 frag_color = vec4((nrm.xyz * 0.5) + vec3(0.5), 1.0); 248 } 249 250 */ 251 __gshared char[206] FS_OFFSCREEN_SOURCE_GLSL300ES = [ 252 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 253 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 254 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, 255 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x6c, 256 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, 257 0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65, 258 0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69, 259 0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x72,0x6d, 260 0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b, 261 0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20, 262 0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x6e,0x72,0x6d,0x2e,0x78,0x79,0x7a,0x20, 263 0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e, 264 0x35,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 265 ]; 266 /* 267 #version 300 es 268 269 uniform vec4 vs_params[4]; 270 layout(location = 0) in vec4 position; 271 out vec2 uv; 272 layout(location = 2) in vec2 texcoord0; 273 out vec4 nrm; 274 layout(location = 1) in vec4 normal; 275 276 void main() 277 { 278 mat4 _22 = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]); 279 gl_Position = _22 * position; 280 uv = texcoord0; 281 nrm = _22 * normal; 282 } 283 284 */ 285 __gshared char[361] VS_DEFAULT_SOURCE_GLSL300ES = [ 286 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 287 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x76,0x73, 288 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f, 289 0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29, 290 0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, 291 0x6e,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a, 292 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, 293 0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x74,0x65,0x78, 294 0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34, 295 0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, 296 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65, 297 0x63,0x34,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64, 298 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61, 299 0x74,0x34,0x20,0x5f,0x32,0x32,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x76,0x73, 300 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70, 301 0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72, 302 0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, 303 0x73,0x5b,0x33,0x5d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f, 304 0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x32,0x32,0x20,0x2a,0x20,0x70, 305 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20, 306 0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x20,0x20,0x20, 307 0x20,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x5f,0x32,0x32,0x20,0x2a,0x20,0x6e,0x6f,0x72, 308 0x6d,0x61,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 309 ]; 310 /* 311 #version 300 es 312 precision mediump float; 313 precision highp int; 314 315 uniform highp sampler2D tex_smp; 316 317 in highp vec2 uv; 318 in highp vec4 nrm; 319 layout(location = 0) out highp vec4 frag_color; 320 321 void main() 322 { 323 frag_color = vec4(texture(tex_smp, uv * vec2(20.0, 10.0)).xyz * ((clamp(dot(nrm.xyz, vec3(0.57735025882720947265625, 0.57735025882720947265625, -0.57735025882720947265625)), 0.0, 1.0) * 2.0) + 0.25), 1.0); 324 } 325 326 */ 327 __gshared char[411] FS_DEFAULT_SOURCE_GLSL300ES = [ 328 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 329 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 330 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, 331 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75, 332 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d, 333 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a, 334 0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x75, 335 0x76,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34, 336 0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, 337 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68, 338 0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, 339 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e, 340 0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, 341 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x74,0x65,0x78,0x74,0x75, 342 0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x20,0x2a, 343 0x20,0x76,0x65,0x63,0x32,0x28,0x32,0x30,0x2e,0x30,0x2c,0x20,0x31,0x30,0x2e,0x30, 344 0x29,0x29,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x28,0x63,0x6c,0x61,0x6d,0x70, 345 0x28,0x64,0x6f,0x74,0x28,0x6e,0x72,0x6d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x76,0x65, 346 0x63,0x33,0x28,0x30,0x2e,0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35,0x38,0x38,0x32, 347 0x37,0x32,0x30,0x39,0x34,0x37,0x32,0x36,0x35,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e, 348 0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35,0x38,0x38,0x32,0x37,0x32,0x30,0x39,0x34, 349 0x37,0x32,0x36,0x35,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x35,0x37,0x37,0x33, 350 0x35,0x30,0x32,0x35,0x38,0x38,0x32,0x37,0x32,0x30,0x39,0x34,0x37,0x32,0x36,0x35, 351 0x36,0x32,0x35,0x29,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29, 352 0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x20,0x2b,0x20,0x30,0x2e,0x32,0x35,0x29,0x2c, 353 0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 354 ]; 355 /* 356 cbuffer vs_params : register(b0) 357 { 358 row_major float4x4 _19_mvp : packoffset(c0); 359 }; 360 361 362 static float4 gl_Position; 363 static float4 position; 364 static float4 nrm; 365 static float4 normal; 366 367 struct SPIRV_Cross_Input 368 { 369 float4 position : TEXCOORD0; 370 float4 normal : TEXCOORD1; 371 }; 372 373 struct SPIRV_Cross_Output 374 { 375 float4 nrm : TEXCOORD0; 376 float4 gl_Position : SV_Position; 377 }; 378 379 void vert_main() 380 { 381 gl_Position = mul(position, _19_mvp); 382 nrm = normal; 383 } 384 385 SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) 386 { 387 position = stage_input.position; 388 normal = stage_input.normal; 389 vert_main(); 390 SPIRV_Cross_Output stage_output; 391 stage_output.gl_Position = gl_Position; 392 stage_output.nrm = nrm; 393 return stage_output; 394 } 395 */ 396 __gshared char[738] VS_OFFSCREEN_SOURCE_HLSL5 = [ 397 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, 398 0x73,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29, 399 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72, 400 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76, 401 0x70,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63, 402 0x30,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20, 403 0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69, 404 0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74, 405 0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74, 406 0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x73, 407 0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x6f,0x72, 408 0x6d,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49, 409 0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b, 410 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69, 411 0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30, 412 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x6f,0x72, 413 0x6d,0x61,0x6c,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b, 414 0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52, 415 0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b, 416 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x72,0x6d,0x20, 417 0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20, 418 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, 419 0x69,0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f, 420 0x6e,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74, 421 0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c, 422 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28, 423 0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76, 424 0x70,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x6f, 425 0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, 426 0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e, 427 0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70, 428 0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a, 429 0x7b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d, 430 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x70,0x6f,0x73, 431 0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6e,0x6f,0x72,0x6d,0x61, 432 0x6c,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e, 433 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74, 434 0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49, 435 0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20, 436 0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20, 437 0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x67, 438 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f, 439 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74, 440 0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x6e,0x72,0x6d,0x20,0x3d, 441 0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e, 442 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d, 443 0x0a,0x00, 444 ]; 445 /* 446 static float4 frag_color; 447 static float4 nrm; 448 449 struct SPIRV_Cross_Input 450 { 451 float4 nrm : TEXCOORD0; 452 }; 453 454 struct SPIRV_Cross_Output 455 { 456 float4 frag_color : SV_Target0; 457 }; 458 459 void frag_main() 460 { 461 frag_color = float4((nrm.xyz * 0.5f) + 0.5f.xxx, 1.0f); 462 } 463 464 SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) 465 { 466 nrm = stage_input.nrm; 467 frag_main(); 468 SPIRV_Cross_Output stage_output; 469 stage_output.frag_color = frag_color; 470 return stage_output; 471 } 472 */ 473 __gshared char[463] FS_OFFSCREEN_SOURCE_HLSL5 = [ 474 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72, 475 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63, 476 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x0a,0x73,0x74, 477 0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73, 478 0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, 479 0x61,0x74,0x34,0x20,0x6e,0x72,0x6d,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f, 480 0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, 481 0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70, 482 0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, 483 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x53,0x56,0x5f, 484 0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69, 485 0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, 486 0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, 487 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x6e,0x72,0x6d,0x2e,0x78,0x79,0x7a, 488 0x20,0x2a,0x20,0x30,0x2e,0x35,0x66,0x29,0x20,0x2b,0x20,0x30,0x2e,0x35,0x66,0x2e, 489 0x78,0x78,0x78,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53, 490 0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75, 491 0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f, 492 0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69, 493 0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6e,0x72,0x6d,0x20, 494 0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x6e,0x72, 495 0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e, 496 0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72, 497 0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65, 498 0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61, 499 0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63, 500 0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, 501 0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74, 502 0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, 503 ]; 504 /* 505 cbuffer vs_params : register(b0) 506 { 507 row_major float4x4 _19_mvp : packoffset(c0); 508 }; 509 510 511 static float4 gl_Position; 512 static float4 position; 513 static float2 uv; 514 static float2 texcoord0; 515 static float4 nrm; 516 static float4 normal; 517 518 struct SPIRV_Cross_Input 519 { 520 float4 position : TEXCOORD0; 521 float4 normal : TEXCOORD1; 522 float2 texcoord0 : TEXCOORD2; 523 }; 524 525 struct SPIRV_Cross_Output 526 { 527 float4 nrm : TEXCOORD0; 528 float2 uv : TEXCOORD1; 529 float4 gl_Position : SV_Position; 530 }; 531 532 void vert_main() 533 { 534 gl_Position = mul(position, _19_mvp); 535 uv = texcoord0; 536 nrm = mul(normal, _19_mvp); 537 } 538 539 SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) 540 { 541 position = stage_input.position; 542 texcoord0 = stage_input.texcoord0; 543 normal = stage_input.normal; 544 vert_main(); 545 SPIRV_Cross_Output stage_output; 546 stage_output.gl_Position = gl_Position; 547 stage_output.uv = uv; 548 stage_output.nrm = nrm; 549 return stage_output; 550 } 551 */ 552 __gshared char[941] VS_DEFAULT_SOURCE_HLSL5 = [ 553 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, 554 0x73,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29, 555 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72, 556 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76, 557 0x70,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63, 558 0x30,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20, 559 0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69, 560 0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74, 561 0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74, 562 0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x73,0x74, 563 0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x74,0x65,0x78,0x63, 564 0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c, 565 0x6f,0x61,0x74,0x34,0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63, 566 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a, 567 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72, 568 0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, 569 0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, 570 0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20, 571 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3a, 572 0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20, 573 0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30, 574 0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x32,0x3b,0x0a,0x7d,0x3b, 575 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, 576 0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20, 577 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x72,0x6d,0x20,0x3a,0x20,0x54, 578 0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, 579 0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f, 580 0x52,0x44,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, 581 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56, 582 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76, 583 0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a, 584 0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f, 585 0x6e,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, 586 0x2c,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 587 0x75,0x76,0x20,0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a, 588 0x20,0x20,0x20,0x20,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28,0x6e,0x6f, 589 0x72,0x6d,0x61,0x6c,0x2c,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a, 590 0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f, 591 0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56, 592 0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61, 593 0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, 594 0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65, 595 0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, 596 0x0a,0x20,0x20,0x20,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x3d, 597 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x74,0x65,0x78, 598 0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6e,0x6f,0x72,0x6d, 599 0x61,0x6c,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74, 600 0x2e,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72, 601 0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50, 602 0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74, 603 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20, 604 0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e, 605 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c, 606 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73, 607 0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d, 608 0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f, 609 0x75,0x74,0x70,0x75,0x74,0x2e,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x72,0x6d,0x3b, 610 0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67, 611 0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, 612 ]; 613 /* 614 Texture2D<float4> tex : register(t0); 615 SamplerState smp : register(s0); 616 617 static float2 uv; 618 static float4 nrm; 619 static float4 frag_color; 620 621 struct SPIRV_Cross_Input 622 { 623 float4 nrm : TEXCOORD0; 624 float2 uv : TEXCOORD1; 625 }; 626 627 struct SPIRV_Cross_Output 628 { 629 float4 frag_color : SV_Target0; 630 }; 631 632 void frag_main() 633 { 634 frag_color = float4(tex.Sample(smp, uv * float2(20.0f, 10.0f)).xyz * ((clamp(dot(nrm.xyz, float3(0.57735025882720947265625f, 0.57735025882720947265625f, -0.57735025882720947265625f)), 0.0f, 1.0f) * 2.0f) + 0.25f), 1.0f); 635 } 636 637 SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) 638 { 639 uv = stage_input.uv; 640 nrm = stage_input.nrm; 641 frag_main(); 642 SPIRV_Cross_Output stage_output; 643 stage_output.frag_color = frag_color; 644 return stage_output; 645 } 646 */ 647 __gshared char[770] FS_DEFAULT_SOURCE_HLSL5 = [ 648 0x54,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34, 649 0x3e,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72, 650 0x28,0x74,0x30,0x29,0x3b,0x0a,0x53,0x61,0x6d,0x70,0x6c,0x65,0x72,0x53,0x74,0x61, 651 0x74,0x65,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65, 652 0x72,0x28,0x73,0x30,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66, 653 0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63, 654 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x72,0x6d,0x3b,0x0a,0x73,0x74,0x61, 655 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f, 656 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53, 657 0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74, 658 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x72, 659 0x6d,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20, 660 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x20,0x3a,0x20,0x54, 661 0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74, 662 0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73, 663 0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, 664 0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20, 665 0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b, 666 0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e, 667 0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, 668 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x74,0x65,0x78, 669 0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x20, 670 0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x32,0x30,0x2e,0x30,0x66,0x2c,0x20, 671 0x31,0x30,0x2e,0x30,0x66,0x29,0x29,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x28, 672 0x63,0x6c,0x61,0x6d,0x70,0x28,0x64,0x6f,0x74,0x28,0x6e,0x72,0x6d,0x2e,0x78,0x79, 673 0x7a,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x37,0x37,0x33, 674 0x35,0x30,0x32,0x35,0x38,0x38,0x32,0x37,0x32,0x30,0x39,0x34,0x37,0x32,0x36,0x35, 675 0x36,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35, 676 0x38,0x38,0x32,0x37,0x32,0x30,0x39,0x34,0x37,0x32,0x36,0x35,0x36,0x32,0x35,0x66, 677 0x2c,0x20,0x2d,0x30,0x2e,0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35,0x38,0x38,0x32, 678 0x37,0x32,0x30,0x39,0x34,0x37,0x32,0x36,0x35,0x36,0x32,0x35,0x66,0x29,0x29,0x2c, 679 0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x20,0x2a,0x20,0x32, 680 0x2e,0x30,0x66,0x29,0x20,0x2b,0x20,0x30,0x2e,0x32,0x35,0x66,0x29,0x2c,0x20,0x31, 681 0x2e,0x30,0x66,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, 682 0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e, 683 0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70, 684 0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a, 685 0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65, 686 0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6e, 687 0x72,0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74, 688 0x2e,0x6e,0x72,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d, 689 0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56, 690 0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74, 691 0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20, 692 0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x72,0x61, 693 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, 694 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e, 695 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d, 696 0x0a,0x00, 697 ]; 698 /* 699 #include <metal_stdlib> 700 #include <simd/simd.h> 701 702 using namespace metal; 703 704 struct vs_params 705 { 706 float4x4 mvp; 707 }; 708 709 struct main0_out 710 { 711 float4 nrm [[user(locn0)]]; 712 float4 gl_Position [[position]]; 713 }; 714 715 struct main0_in 716 { 717 float4 position [[attribute(0)]]; 718 float4 normal [[attribute(1)]]; 719 }; 720 721 vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) 722 { 723 main0_out out = {}; 724 out.gl_Position = _19.mvp * in.position; 725 out.nrm = in.normal; 726 return out; 727 } 728 729 */ 730 __gshared char[505] VS_OFFSCREEN_SOURCE_METAL_MACOS = [ 731 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 732 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 733 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, 734 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, 735 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x76, 736 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, 737 0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x6d,0x76,0x70,0x3b,0x0a,0x7d,0x3b,0x0a, 738 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75, 739 0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e, 740 0x72,0x6d,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29, 741 0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67, 742 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,0x6f,0x73, 743 0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72, 744 0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20, 745 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69, 746 0x6f,0x6e,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30, 747 0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, 748 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75, 749 0x74,0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72, 750 0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61, 751 0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20, 752 0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f, 753 0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, 754 0x26,0x20,0x5f,0x31,0x39,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30, 755 0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30, 756 0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20, 757 0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69, 758 0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x69, 759 0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20, 760 0x6f,0x75,0x74,0x2e,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x6e,0x6f,0x72, 761 0x6d,0x61,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, 762 0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 763 ]; 764 /* 765 #include <metal_stdlib> 766 #include <simd/simd.h> 767 768 using namespace metal; 769 770 struct main0_out 771 { 772 float4 frag_color [[color(0)]]; 773 }; 774 775 struct main0_in 776 { 777 float4 nrm [[user(locn0)]]; 778 }; 779 780 fragment main0_out main0(main0_in in [[stage_in]]) 781 { 782 main0_out out = {}; 783 out.frag_color = float4((in.nrm.xyz * 0.5) + float3(0.5), 1.0); 784 return out; 785 } 786 787 */ 788 __gshared char[350] FS_OFFSCREEN_SOURCE_METAL_MACOS = [ 789 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 790 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 791 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, 792 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, 793 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d, 794 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, 795 0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, 796 0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d, 797 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, 798 0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, 799 0x6e,0x72,0x6d,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30, 800 0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e, 801 0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e, 802 0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b, 803 0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20, 804 0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20, 805 0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72, 806 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74, 807 0x34,0x28,0x28,0x69,0x6e,0x2e,0x6e,0x72,0x6d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20, 808 0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e, 809 0x35,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65, 810 0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 811 ]; 812 /* 813 #include <metal_stdlib> 814 #include <simd/simd.h> 815 816 using namespace metal; 817 818 struct vs_params 819 { 820 float4x4 mvp; 821 }; 822 823 struct main0_out 824 { 825 float4 nrm [[user(locn0)]]; 826 float2 uv [[user(locn1)]]; 827 float4 gl_Position [[position]]; 828 }; 829 830 struct main0_in 831 { 832 float4 position [[attribute(0)]]; 833 float4 normal [[attribute(1)]]; 834 float2 texcoord0 [[attribute(2)]]; 835 }; 836 837 vertex main0_out main0(main0_in in [[stage_in]], constant vs_params& _19 [[buffer(0)]]) 838 { 839 main0_out out = {}; 840 out.gl_Position = _19.mvp * in.position; 841 out.uv = in.texcoord0; 842 out.nrm = _19.mvp * in.normal; 843 return out; 844 } 845 846 */ 847 __gshared char[612] VS_DEFAULT_SOURCE_METAL_MACOS = [ 848 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 849 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 850 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, 851 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, 852 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x76, 853 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, 854 0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x6d,0x76,0x70,0x3b,0x0a,0x7d,0x3b,0x0a, 855 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75, 856 0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e, 857 0x72,0x6d,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29, 858 0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75, 859 0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29,0x5d, 860 0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c, 861 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69, 862 0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75, 863 0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20, 864 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, 865 0x6e,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30,0x29, 866 0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e, 867 0x6f,0x72,0x6d,0x61,0x6c,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74, 868 0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, 869 0x74,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x5b,0x5b,0x61, 870 0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x7d, 871 0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, 872 0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f, 873 0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e, 874 0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x76,0x73,0x5f, 875 0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x31,0x39,0x20,0x5b,0x5b,0x62,0x75, 876 0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, 877 0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d, 878 0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f, 879 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d, 880 0x76,0x70,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, 881 0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76,0x20,0x3d,0x20,0x69, 882 0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x20,0x20,0x20, 883 0x20,0x6f,0x75,0x74,0x2e,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d, 884 0x76,0x70,0x20,0x2a,0x20,0x69,0x6e,0x2e,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a, 885 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a, 886 0x7d,0x0a,0x0a,0x00, 887 ]; 888 /* 889 #include <metal_stdlib> 890 #include <simd/simd.h> 891 892 using namespace metal; 893 894 struct main0_out 895 { 896 float4 frag_color [[color(0)]]; 897 }; 898 899 struct main0_in 900 { 901 float4 nrm [[user(locn0)]]; 902 float2 uv [[user(locn1)]]; 903 }; 904 905 fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> tex [[texture(0)]], sampler smp [[sampler(0)]]) 906 { 907 main0_out out = {}; 908 out.frag_color = float4(tex.sample(smp, (in.uv * float2(20.0, 10.0))).xyz * ((fast::clamp(dot(in.nrm.xyz, float3(0.57735025882720947265625, 0.57735025882720947265625, -0.57735025882720947265625)), 0.0, 1.0) * 2.0) + 0.25), 1.0); 909 return out; 910 } 911 912 */ 913 __gshared char[611] FS_DEFAULT_SOURCE_METAL_MACOS = [ 914 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 915 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 916 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, 917 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, 918 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d, 919 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, 920 0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, 921 0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d, 922 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, 923 0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, 924 0x6e,0x72,0x6d,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30, 925 0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20, 926 0x75,0x76,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29, 927 0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74, 928 0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30, 929 0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73, 930 0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75, 931 0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x65,0x78,0x20, 932 0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20, 933 0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61, 934 0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20, 935 0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20, 936 0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72, 937 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74, 938 0x34,0x28,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x6d,0x70, 939 0x2c,0x20,0x28,0x69,0x6e,0x2e,0x75,0x76,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74, 940 0x32,0x28,0x32,0x30,0x2e,0x30,0x2c,0x20,0x31,0x30,0x2e,0x30,0x29,0x29,0x29,0x2e, 941 0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x63,0x6c, 942 0x61,0x6d,0x70,0x28,0x64,0x6f,0x74,0x28,0x69,0x6e,0x2e,0x6e,0x72,0x6d,0x2e,0x78, 943 0x79,0x7a,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x37,0x37, 944 0x33,0x35,0x30,0x32,0x35,0x38,0x38,0x32,0x37,0x32,0x30,0x39,0x34,0x37,0x32,0x36, 945 0x35,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e,0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35, 946 0x38,0x38,0x32,0x37,0x32,0x30,0x39,0x34,0x37,0x32,0x36,0x35,0x36,0x32,0x35,0x2c, 947 0x20,0x2d,0x30,0x2e,0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35,0x38,0x38,0x32,0x37, 948 0x32,0x30,0x39,0x34,0x37,0x32,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2c,0x20,0x30, 949 0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x20, 950 0x2b,0x20,0x30,0x2e,0x32,0x35,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20, 951 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d, 952 0x0a,0x0a,0x00, 953 ]; 954 /* 955 diagnostic(off, derivative_uniformity); 956 957 struct vs_params { 958 /_ @offset(0) _/ 959 mvp : mat4x4f, 960 } 961 962 @binding(0) @group(0) var<uniform> x_19 : vs_params; 963 964 var<private> position_1 : vec4f; 965 966 var<private> nrm : vec4f; 967 968 var<private> normal : vec4f; 969 970 var<private> gl_Position : vec4f; 971 972 fn main_1() { 973 gl_Position = (x_19.mvp * position_1); 974 nrm = normal; 975 return; 976 } 977 978 struct main_out { 979 @builtin(position) 980 gl_Position : vec4f, 981 @location(0) 982 nrm_1 : vec4f, 983 } 984 985 @vertex 986 fn main(@location(0) position_1_param : vec4f, @location(1) normal_param : vec4f) -> main_out { 987 position_1 = position_1_param; 988 normal = normal_param; 989 main_1(); 990 return main_out(gl_Position, nrm); 991 } 992 */ 993 __gshared char[674] VS_OFFSCREEN_SOURCE_WGSL = [ 994 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, 995 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, 996 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, 997 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a, 998 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20, 999 0x20,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c,0x0a, 1000 0x7d,0x0a,0x0a,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x40, 1001 0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69, 1002 0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31,0x39,0x20,0x3a,0x20,0x76,0x73,0x5f, 1003 0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, 1004 0x76,0x61,0x74,0x65,0x3e,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, 1005 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70, 1006 0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x6e,0x72,0x6d,0x20,0x3a,0x20,0x76,0x65, 1007 0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74, 1008 0x65,0x3e,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, 1009 0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e, 1010 0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76, 1011 0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31, 1012 0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69, 1013 0x6f,0x6e,0x20,0x3d,0x20,0x28,0x78,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a, 1014 0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20, 1015 0x6e,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x20,0x20, 1016 0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63, 1017 0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40, 1018 0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, 1019 0x29,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, 1020 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61, 1021 0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x6e,0x72,0x6d,0x5f,0x31,0x20, 1022 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,0x72, 1023 0x74,0x65,0x78,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63, 1024 0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, 1025 0x6e,0x5f,0x31,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, 1026 0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20, 1027 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76, 1028 0x65,0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75, 1029 0x74,0x20,0x7b,0x0a,0x20,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, 1030 0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f,0x70,0x61, 1031 0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20, 1032 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20, 1033 0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75, 1034 0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x67,0x6c,0x5f,0x50, 1035 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x6e,0x72,0x6d,0x29,0x3b,0x0a,0x7d, 1036 0x0a,0x00, 1037 ]; 1038 /* 1039 diagnostic(off, derivative_uniformity); 1040 1041 var<private> frag_color : vec4f; 1042 1043 var<private> nrm : vec4f; 1044 1045 fn main_1() { 1046 let x_18 = ((nrm.xyz * 0.5f) + vec3f(0.5f)); 1047 frag_color = vec4f(x_18.x, x_18.y, x_18.z, 1.0f); 1048 return; 1049 } 1050 1051 struct main_out { 1052 @location(0) 1053 frag_color_1 : vec4f, 1054 } 1055 1056 @fragment 1057 fn main(@location(0) nrm_param : vec4f) -> main_out { 1058 nrm = nrm_param; 1059 main_1(); 1060 return main_out(frag_color); 1061 } 1062 */ 1063 __gshared char[417] FS_OFFSCREEN_SOURCE_WGSL = [ 1064 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, 1065 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, 1066 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, 1067 0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, 1068 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70, 1069 0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x6e,0x72,0x6d,0x20,0x3a,0x20,0x76,0x65, 1070 0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28, 1071 0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x38,0x20,0x3d, 1072 0x20,0x28,0x28,0x6e,0x72,0x6d,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x35, 1073 0x66,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x66,0x28,0x30,0x2e,0x35,0x66,0x29, 1074 0x29,0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20, 1075 0x3d,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x31,0x38,0x2e,0x78,0x2c,0x20, 1076 0x78,0x5f,0x31,0x38,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x31,0x38,0x2e,0x7a,0x2c,0x20, 1077 0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b, 1078 0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f, 1079 0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, 1080 0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, 1081 0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a, 1082 0x40,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69, 1083 0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x6e, 1084 0x72,0x6d,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, 1085 0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a, 1086 0x20,0x20,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x72,0x6d,0x5f,0x70,0x61,0x72,0x61, 1087 0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20, 1088 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74, 1089 0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a, 1090 0x00, 1091 ]; 1092 /* 1093 diagnostic(off, derivative_uniformity); 1094 1095 struct vs_params { 1096 /_ @offset(0) _/ 1097 mvp : mat4x4f, 1098 } 1099 1100 @binding(0) @group(0) var<uniform> x_19 : vs_params; 1101 1102 var<private> position_1 : vec4f; 1103 1104 var<private> uv : vec2f; 1105 1106 var<private> texcoord0 : vec2f; 1107 1108 var<private> nrm : vec4f; 1109 1110 var<private> normal : vec4f; 1111 1112 var<private> gl_Position : vec4f; 1113 1114 fn main_1() { 1115 gl_Position = (x_19.mvp * position_1); 1116 uv = texcoord0; 1117 nrm = (x_19.mvp * normal); 1118 return; 1119 } 1120 1121 struct main_out { 1122 @builtin(position) 1123 gl_Position : vec4f, 1124 @location(1) 1125 uv_1 : vec2f, 1126 @location(0) 1127 nrm_1 : vec4f, 1128 } 1129 1130 @vertex 1131 fn main(@location(0) position_1_param : vec4f, @location(2) texcoord0_param : vec2f, @location(1) normal_param : vec4f) -> main_out { 1132 position_1 = position_1_param; 1133 texcoord0 = texcoord0_param; 1134 normal = normal_param; 1135 main_1(); 1136 return main_out(gl_Position, uv, nrm); 1137 } 1138 */ 1139 __gshared char[868] VS_DEFAULT_SOURCE_WGSL = [ 1140 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, 1141 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, 1142 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, 1143 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a, 1144 0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20, 1145 0x20,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c,0x0a, 1146 0x7d,0x0a,0x0a,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x40, 1147 0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69, 1148 0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31,0x39,0x20,0x3a,0x20,0x76,0x73,0x5f, 1149 0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, 1150 0x76,0x61,0x74,0x65,0x3e,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31, 1151 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70, 1152 0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63, 1153 0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65, 1154 0x3e,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x3a,0x20,0x76,0x65, 1155 0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74, 1156 0x65,0x3e,0x20,0x6e,0x72,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a, 1157 0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x6e,0x6f, 1158 0x72,0x6d,0x61,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76, 1159 0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x67,0x6c,0x5f,0x50, 1160 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b, 1161 0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a, 1162 0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, 1163 0x28,0x78,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x70,0x6f,0x73,0x69, 1164 0x74,0x69,0x6f,0x6e,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x75,0x76,0x20,0x3d,0x20, 1165 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x20,0x20,0x6e,0x72,0x6d, 1166 0x20,0x3d,0x20,0x28,0x78,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x6e, 1167 0x6f,0x72,0x6d,0x61,0x6c,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e, 1168 0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e, 1169 0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x62,0x75,0x69,0x6c,0x74,0x69, 1170 0x6e,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20,0x67,0x6c, 1171 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, 1172 0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31, 1173 0x29,0x0a,0x20,0x20,0x75,0x76,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, 1174 0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29, 1175 0x0a,0x20,0x20,0x6e,0x72,0x6d,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, 1176 0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,0x72,0x74,0x65,0x78,0x0a,0x66,0x6e,0x20, 1177 0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30, 1178 0x29,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f,0x70,0x61,0x72, 1179 0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63, 1180 0x61,0x74,0x69,0x6f,0x6e,0x28,0x32,0x29,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72, 1181 0x64,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, 1182 0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x6e, 1183 0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65, 1184 0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74, 1185 0x20,0x7b,0x0a,0x20,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x20, 1186 0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x31,0x5f,0x70,0x61,0x72, 1187 0x61,0x6d,0x3b,0x0a,0x20,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20, 1188 0x3d,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70,0x61,0x72,0x61, 1189 0x6d,0x3b,0x0a,0x20,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x6e,0x6f, 1190 0x72,0x6d,0x61,0x6c,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61, 1191 0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e, 1192 0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x67,0x6c,0x5f,0x50,0x6f,0x73, 1193 0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x75,0x76,0x2c,0x20,0x6e,0x72,0x6d,0x29,0x3b, 1194 0x0a,0x7d,0x0a,0x00, 1195 ]; 1196 /* 1197 diagnostic(off, derivative_uniformity); 1198 1199 @binding(64) @group(1) var tex : texture_2d<f32>; 1200 1201 @binding(80) @group(1) var smp : sampler; 1202 1203 var<private> uv : vec2f; 1204 1205 var<private> nrm : vec4f; 1206 1207 var<private> frag_color : vec4f; 1208 1209 fn main_1() { 1210 var c : vec4f; 1211 var l : f32; 1212 let x_23 = uv; 1213 let x_28 = textureSample(tex, smp, (x_23 * vec2f(20.0f, 10.0f))); 1214 c = x_28; 1215 l = (clamp(dot(nrm.xyz, vec3f(0.57735025882720947266f, 0.57735025882720947266f, -0.57735025882720947266f)), 0.0f, 1.0f) * 2.0f); 1216 let x_52 = (c.xyz * (l + 0.25f)); 1217 frag_color = vec4f(x_52.x, x_52.y, x_52.z, 1.0f); 1218 return; 1219 } 1220 1221 struct main_out { 1222 @location(0) 1223 frag_color_1 : vec4f, 1224 } 1225 1226 @fragment 1227 fn main(@location(1) uv_param : vec2f, @location(0) nrm_param : vec4f) -> main_out { 1228 uv = uv_param; 1229 nrm = nrm_param; 1230 main_1(); 1231 return main_out(frag_color); 1232 } 1233 */ 1234 __gshared char[834] FS_DEFAULT_SOURCE_WGSL = [ 1235 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, 1236 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, 1237 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e, 1238 0x67,0x28,0x36,0x34,0x29,0x20,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20, 1239 0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75,0x72, 1240 0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x62,0x69,0x6e, 1241 0x64,0x69,0x6e,0x67,0x28,0x38,0x30,0x29,0x20,0x40,0x67,0x72,0x6f,0x75,0x70,0x28, 1242 0x31,0x29,0x20,0x76,0x61,0x72,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x73,0x61,0x6d, 1243 0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61, 1244 0x74,0x65,0x3e,0x20,0x75,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a, 1245 0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x6e,0x72, 1246 0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c, 1247 0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, 1248 0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e, 1249 0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x76,0x61, 1250 0x72,0x20,0x63,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x20,0x20,0x76, 1251 0x61,0x72,0x20,0x6c,0x20,0x3a,0x20,0x66,0x33,0x32,0x3b,0x0a,0x20,0x20,0x6c,0x65, 1252 0x74,0x20,0x78,0x5f,0x32,0x33,0x20,0x3d,0x20,0x75,0x76,0x3b,0x0a,0x20,0x20,0x6c, 1253 0x65,0x74,0x20,0x78,0x5f,0x32,0x38,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72, 1254 0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x2c,0x20,0x73,0x6d,0x70, 1255 0x2c,0x20,0x28,0x78,0x5f,0x32,0x33,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x66,0x28, 1256 0x32,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x30,0x2e,0x30,0x66,0x29,0x29,0x29,0x3b, 1257 0x0a,0x20,0x20,0x63,0x20,0x3d,0x20,0x78,0x5f,0x32,0x38,0x3b,0x0a,0x20,0x20,0x6c, 1258 0x20,0x3d,0x20,0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x64,0x6f,0x74,0x28,0x6e,0x72, 1259 0x6d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x76,0x65,0x63,0x33,0x66,0x28,0x30,0x2e,0x35, 1260 0x37,0x37,0x33,0x35,0x30,0x32,0x35,0x38,0x38,0x32,0x37,0x32,0x30,0x39,0x34,0x37, 1261 0x32,0x36,0x36,0x66,0x2c,0x20,0x30,0x2e,0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35, 1262 0x38,0x38,0x32,0x37,0x32,0x30,0x39,0x34,0x37,0x32,0x36,0x36,0x66,0x2c,0x20,0x2d, 1263 0x30,0x2e,0x35,0x37,0x37,0x33,0x35,0x30,0x32,0x35,0x38,0x38,0x32,0x37,0x32,0x30, 1264 0x39,0x34,0x37,0x32,0x36,0x36,0x66,0x29,0x29,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c, 1265 0x20,0x31,0x2e,0x30,0x66,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x66,0x29,0x3b,0x0a, 1266 0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x32,0x20,0x3d,0x20,0x28,0x63,0x2e, 1267 0x78,0x79,0x7a,0x20,0x2a,0x20,0x28,0x6c,0x20,0x2b,0x20,0x30,0x2e,0x32,0x35,0x66, 1268 0x29,0x29,0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, 1269 0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x35,0x32,0x2e,0x78,0x2c, 1270 0x20,0x78,0x5f,0x35,0x32,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x35,0x32,0x2e,0x7a,0x2c, 1271 0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e, 1272 0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e, 1273 0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69, 1274 0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, 1275 0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a, 1276 0x0a,0x40,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61, 1277 0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20, 1278 0x75,0x76,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, 1279 0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x6e, 1280 0x72,0x6d,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, 1281 0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a, 1282 0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x75,0x76,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b, 1283 0x0a,0x20,0x20,0x6e,0x72,0x6d,0x20,0x3d,0x20,0x6e,0x72,0x6d,0x5f,0x70,0x61,0x72, 1284 0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a, 1285 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75, 1286 0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d, 1287 0x0a,0x00, 1288 ]; 1289 sg.ShaderDesc defaultShaderDesc(sg.Backend backend) @trusted @nogc nothrow { 1290 sg.ShaderDesc desc; 1291 desc.label = "default_shader"; 1292 switch (backend) { 1293 case sg.Backend.Glcore: 1294 desc.vertex_func.source = &VS_DEFAULT_SOURCE_GLSL410[0]; 1295 desc.vertex_func.entry = "main"; 1296 desc.fragment_func.source = &FS_DEFAULT_SOURCE_GLSL410[0]; 1297 desc.fragment_func.entry = "main"; 1298 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1299 desc.attrs[0].glsl_name = "position"; 1300 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1301 desc.attrs[1].glsl_name = "normal"; 1302 desc.attrs[2].base_type = sg.ShaderAttrBaseType.Float; 1303 desc.attrs[2].glsl_name = "texcoord0"; 1304 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1305 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1306 desc.uniform_blocks[0].size = 64; 1307 desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4; 1308 desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; 1309 desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; 1310 desc.images[0].stage = sg.ShaderStage.Fragment; 1311 desc.images[0].multisampled = false; 1312 desc.images[0].image_type = sg.ImageType._2d; 1313 desc.images[0].sample_type = sg.ImageSampleType.Float; 1314 desc.samplers[0].stage = sg.ShaderStage.Fragment; 1315 desc.samplers[0].sampler_type = sg.SamplerType.Filtering; 1316 desc.image_sampler_pairs[0].stage = sg.ShaderStage.Fragment; 1317 desc.image_sampler_pairs[0].image_slot = 0; 1318 desc.image_sampler_pairs[0].sampler_slot = 0; 1319 desc.image_sampler_pairs[0].glsl_name = "tex_smp"; 1320 break; 1321 case sg.Backend.Gles3: 1322 desc.vertex_func.source = &VS_DEFAULT_SOURCE_GLSL300ES[0]; 1323 desc.vertex_func.entry = "main"; 1324 desc.fragment_func.source = &FS_DEFAULT_SOURCE_GLSL300ES[0]; 1325 desc.fragment_func.entry = "main"; 1326 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1327 desc.attrs[0].glsl_name = "position"; 1328 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1329 desc.attrs[1].glsl_name = "normal"; 1330 desc.attrs[2].base_type = sg.ShaderAttrBaseType.Float; 1331 desc.attrs[2].glsl_name = "texcoord0"; 1332 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1333 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1334 desc.uniform_blocks[0].size = 64; 1335 desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4; 1336 desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; 1337 desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; 1338 desc.images[0].stage = sg.ShaderStage.Fragment; 1339 desc.images[0].multisampled = false; 1340 desc.images[0].image_type = sg.ImageType._2d; 1341 desc.images[0].sample_type = sg.ImageSampleType.Float; 1342 desc.samplers[0].stage = sg.ShaderStage.Fragment; 1343 desc.samplers[0].sampler_type = sg.SamplerType.Filtering; 1344 desc.image_sampler_pairs[0].stage = sg.ShaderStage.Fragment; 1345 desc.image_sampler_pairs[0].image_slot = 0; 1346 desc.image_sampler_pairs[0].sampler_slot = 0; 1347 desc.image_sampler_pairs[0].glsl_name = "tex_smp"; 1348 break; 1349 case sg.Backend.D3d11: 1350 desc.vertex_func.source = &VS_DEFAULT_SOURCE_HLSL5[0]; 1351 desc.vertex_func.d3d11_target = "vs_5_0"; 1352 desc.vertex_func.entry = "main"; 1353 desc.fragment_func.source = &FS_DEFAULT_SOURCE_HLSL5[0]; 1354 desc.fragment_func.d3d11_target = "ps_5_0"; 1355 desc.fragment_func.entry = "main"; 1356 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1357 desc.attrs[0].hlsl_sem_name = "TEXCOORD"; 1358 desc.attrs[0].hlsl_sem_index = 0; 1359 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1360 desc.attrs[1].hlsl_sem_name = "TEXCOORD"; 1361 desc.attrs[1].hlsl_sem_index = 1; 1362 desc.attrs[2].base_type = sg.ShaderAttrBaseType.Float; 1363 desc.attrs[2].hlsl_sem_name = "TEXCOORD"; 1364 desc.attrs[2].hlsl_sem_index = 2; 1365 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1366 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1367 desc.uniform_blocks[0].size = 64; 1368 desc.uniform_blocks[0].hlsl_register_b_n = 0; 1369 desc.images[0].stage = sg.ShaderStage.Fragment; 1370 desc.images[0].multisampled = false; 1371 desc.images[0].image_type = sg.ImageType._2d; 1372 desc.images[0].sample_type = sg.ImageSampleType.Float; 1373 desc.images[0].hlsl_register_t_n = 0; 1374 desc.samplers[0].stage = sg.ShaderStage.Fragment; 1375 desc.samplers[0].sampler_type = sg.SamplerType.Filtering; 1376 desc.samplers[0].hlsl_register_s_n = 0; 1377 desc.image_sampler_pairs[0].stage = sg.ShaderStage.Fragment; 1378 desc.image_sampler_pairs[0].image_slot = 0; 1379 desc.image_sampler_pairs[0].sampler_slot = 0; 1380 break; 1381 case sg.Backend.Metal_macos: 1382 desc.vertex_func.source = &VS_DEFAULT_SOURCE_METAL_MACOS[0]; 1383 desc.vertex_func.entry = "main0"; 1384 desc.fragment_func.source = &FS_DEFAULT_SOURCE_METAL_MACOS[0]; 1385 desc.fragment_func.entry = "main0"; 1386 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1387 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1388 desc.attrs[2].base_type = sg.ShaderAttrBaseType.Float; 1389 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1390 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1391 desc.uniform_blocks[0].size = 64; 1392 desc.uniform_blocks[0].msl_buffer_n = 0; 1393 desc.images[0].stage = sg.ShaderStage.Fragment; 1394 desc.images[0].multisampled = false; 1395 desc.images[0].image_type = sg.ImageType._2d; 1396 desc.images[0].sample_type = sg.ImageSampleType.Float; 1397 desc.images[0].msl_texture_n = 0; 1398 desc.samplers[0].stage = sg.ShaderStage.Fragment; 1399 desc.samplers[0].sampler_type = sg.SamplerType.Filtering; 1400 desc.samplers[0].msl_sampler_n = 0; 1401 desc.image_sampler_pairs[0].stage = sg.ShaderStage.Fragment; 1402 desc.image_sampler_pairs[0].image_slot = 0; 1403 desc.image_sampler_pairs[0].sampler_slot = 0; 1404 break; 1405 case sg.Backend.Wgpu: 1406 desc.vertex_func.source = &VS_DEFAULT_SOURCE_WGSL[0]; 1407 desc.vertex_func.entry = "main"; 1408 desc.fragment_func.source = &FS_DEFAULT_SOURCE_WGSL[0]; 1409 desc.fragment_func.entry = "main"; 1410 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1411 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1412 desc.attrs[2].base_type = sg.ShaderAttrBaseType.Float; 1413 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1414 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1415 desc.uniform_blocks[0].size = 64; 1416 desc.uniform_blocks[0].wgsl_group0_binding_n = 0; 1417 desc.images[0].stage = sg.ShaderStage.Fragment; 1418 desc.images[0].multisampled = false; 1419 desc.images[0].image_type = sg.ImageType._2d; 1420 desc.images[0].sample_type = sg.ImageSampleType.Float; 1421 desc.images[0].wgsl_group1_binding_n = 64; 1422 desc.samplers[0].stage = sg.ShaderStage.Fragment; 1423 desc.samplers[0].sampler_type = sg.SamplerType.Filtering; 1424 desc.samplers[0].wgsl_group1_binding_n = 80; 1425 desc.image_sampler_pairs[0].stage = sg.ShaderStage.Fragment; 1426 desc.image_sampler_pairs[0].image_slot = 0; 1427 desc.image_sampler_pairs[0].sampler_slot = 0; 1428 break; 1429 default: break; 1430 } 1431 return desc; 1432 } 1433 sg.ShaderDesc offscreenShaderDesc(sg.Backend backend) @trusted @nogc nothrow { 1434 sg.ShaderDesc desc; 1435 desc.label = "offscreen_shader"; 1436 switch (backend) { 1437 case sg.Backend.Glcore: 1438 desc.vertex_func.source = &VS_OFFSCREEN_SOURCE_GLSL410[0]; 1439 desc.vertex_func.entry = "main"; 1440 desc.fragment_func.source = &FS_OFFSCREEN_SOURCE_GLSL410[0]; 1441 desc.fragment_func.entry = "main"; 1442 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1443 desc.attrs[0].glsl_name = "position"; 1444 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1445 desc.attrs[1].glsl_name = "normal"; 1446 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1447 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1448 desc.uniform_blocks[0].size = 64; 1449 desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4; 1450 desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; 1451 desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; 1452 break; 1453 case sg.Backend.Gles3: 1454 desc.vertex_func.source = &VS_OFFSCREEN_SOURCE_GLSL300ES[0]; 1455 desc.vertex_func.entry = "main"; 1456 desc.fragment_func.source = &FS_OFFSCREEN_SOURCE_GLSL300ES[0]; 1457 desc.fragment_func.entry = "main"; 1458 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1459 desc.attrs[0].glsl_name = "position"; 1460 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1461 desc.attrs[1].glsl_name = "normal"; 1462 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1463 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1464 desc.uniform_blocks[0].size = 64; 1465 desc.uniform_blocks[0].glsl_uniforms[0].type = sg.UniformType.Float4; 1466 desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; 1467 desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"; 1468 break; 1469 case sg.Backend.D3d11: 1470 desc.vertex_func.source = &VS_OFFSCREEN_SOURCE_HLSL5[0]; 1471 desc.vertex_func.d3d11_target = "vs_5_0"; 1472 desc.vertex_func.entry = "main"; 1473 desc.fragment_func.source = &FS_OFFSCREEN_SOURCE_HLSL5[0]; 1474 desc.fragment_func.d3d11_target = "ps_5_0"; 1475 desc.fragment_func.entry = "main"; 1476 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1477 desc.attrs[0].hlsl_sem_name = "TEXCOORD"; 1478 desc.attrs[0].hlsl_sem_index = 0; 1479 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1480 desc.attrs[1].hlsl_sem_name = "TEXCOORD"; 1481 desc.attrs[1].hlsl_sem_index = 1; 1482 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1483 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1484 desc.uniform_blocks[0].size = 64; 1485 desc.uniform_blocks[0].hlsl_register_b_n = 0; 1486 break; 1487 case sg.Backend.Metal_macos: 1488 desc.vertex_func.source = &VS_OFFSCREEN_SOURCE_METAL_MACOS[0]; 1489 desc.vertex_func.entry = "main0"; 1490 desc.fragment_func.source = &FS_OFFSCREEN_SOURCE_METAL_MACOS[0]; 1491 desc.fragment_func.entry = "main0"; 1492 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1493 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1494 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1495 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1496 desc.uniform_blocks[0].size = 64; 1497 desc.uniform_blocks[0].msl_buffer_n = 0; 1498 break; 1499 case sg.Backend.Wgpu: 1500 desc.vertex_func.source = &VS_OFFSCREEN_SOURCE_WGSL[0]; 1501 desc.vertex_func.entry = "main"; 1502 desc.fragment_func.source = &FS_OFFSCREEN_SOURCE_WGSL[0]; 1503 desc.fragment_func.entry = "main"; 1504 desc.attrs[0].base_type = sg.ShaderAttrBaseType.Float; 1505 desc.attrs[1].base_type = sg.ShaderAttrBaseType.Float; 1506 desc.uniform_blocks[0].stage = sg.ShaderStage.Vertex; 1507 desc.uniform_blocks[0].layout = sg.UniformLayout.Std140; 1508 desc.uniform_blocks[0].size = 64; 1509 desc.uniform_blocks[0].wgsl_group0_binding_n = 0; 1510 break; 1511 default: break; 1512 } 1513 return desc; 1514 }