diff --git a/glsl/edge.glsl b/glsl/edge.glsl index 456aa75..34a07e7 100644 --- a/glsl/edge.glsl +++ b/glsl/edge.glsl @@ -1,4 +1,4 @@ -@module e +@module edge @vs vs @glsl_options fixup_clipspace @@ -21,11 +21,40 @@ precision mediump float; layout(binding=1) uniform Fparam { vec4 color; }; -out vec4 fc; +out vec4 c; void main(){ - fc = color; + c = color; } @end -@program edge vs fs +@vs vsoff +@glsl_options fixup_clipspace + +precision mediump float; + +layout(binding=0) uniform Vparam { + mat4 mvp; +}; +in vec3 pos; +flat out uint idx; + +void main(){ + gl_Position = mvp * vec4(pos, 1.0); + idx = (gl_VertexIndex >> 1) + 1 | 1<<31; +} +@end + +@fs fsoff +precision mediump float; + +flat in uint idx; +out uint fc; + +void main(){ + fc = idx; +} +@end + +@program idx vsoff fsoff +@program s vs fs diff --git a/glsl/edge.h b/glsl/edge.h index 6ba1101..c1f0889 100644 --- a/glsl/edge.h +++ b/glsl/edge.h @@ -9,19 +9,25 @@ Overview: ========= - Shader program: 'edge': - Get shader desc: e_edge_shader_desc(sg_query_backend()); + Shader program: 'idx': + Get shader desc: edge_idx_shader_desc(sg_query_backend()); + Vertex Shader: vsoff + Fragment Shader: fsoff + Attributes: + ATTR_edge_idx_pos => 0 + Shader program: 's': + Get shader desc: edge_s_shader_desc(sg_query_backend()); Vertex Shader: vs Fragment Shader: fs Attributes: - ATTR_edge_pos => 0 + ATTR_edge_s_pos => 0 Bindings: Uniform block 'Vparam': - C struct: e_Vparam_t - Bind slot: UB_Vparam => 0 + C struct: edge_Vparam_t + Bind slot: UB_edge_Vparam => 0 Uniform block 'Fparam': - C struct: e_Fparam_t - Bind slot: UB_Fparam => 1 + C struct: edge_Fparam_t + Bind slot: UB_edge_Fparam => 1 */ #if !defined(SOKOL_GFX_INCLUDED) #error "Please include sokol_gfx.h before edge.h" @@ -33,19 +39,21 @@ #define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a))) #endif #endif -const sg_shader_desc* e_edge_shader_desc(sg_backend backend); -#define ATTR_edge_pos (0) -#define UB_Vparam (0) -#define UB_Fparam (1) +const sg_shader_desc* edge_idx_shader_desc(sg_backend backend); +const sg_shader_desc* edge_s_shader_desc(sg_backend backend); +#define ATTR_edge_idx_pos (0) +#define ATTR_edge_s_pos (0) +#define UB_edge_Vparam (0) +#define UB_edge_Fparam (1) #pragma pack(push,1) -SOKOL_SHDC_ALIGN(16) typedef struct e_Vparam_t { +SOKOL_SHDC_ALIGN(16) typedef struct edge_Vparam_t { float mvp[16]; -} e_Vparam_t; +} edge_Vparam_t; #pragma pack(pop) #pragma pack(push,1) -SOKOL_SHDC_ALIGN(16) typedef struct e_Fparam_t { +SOKOL_SHDC_ALIGN(16) typedef struct edge_Fparam_t { float color[4]; -} e_Fparam_t; +} edge_Fparam_t; #pragma pack(pop) #if defined(SOKOL_SHDC_IMPL) /* @@ -61,7 +69,7 @@ SOKOL_SHDC_ALIGN(16) typedef struct e_Fparam_t { } */ -static const uint8_t e_vs_source_glsl430[233] = { +static const uint8_t edge_vs_source_glsl430[233] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61, 0x6d,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, @@ -82,22 +90,82 @@ static const uint8_t e_vs_source_glsl430[233] = { #version 430 uniform vec4 Fparam[1]; - layout(location = 0) out vec4 fc; + layout(location = 0) out vec4 c; void main() { - fc = Fparam[0]; + c = Fparam[0]; } */ -static const uint8_t e_fs_source_glsl430[111] = { +static const uint8_t edge_fs_source_glsl430[109] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x46,0x70,0x61,0x72,0x61, 0x6d,0x5b,0x31,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76, - 0x65,0x63,0x34,0x20,0x66,0x63,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, - 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x63,0x20,0x3d,0x20, - 0x46,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x65,0x63,0x34,0x20,0x63,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69, + 0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x46,0x70, + 0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, +}; +/* + #version 430 + + uniform vec4 Vparam[4]; + layout(location = 0) in vec3 pos; + layout(location = 0) flat out uint idx; + + void main() + { + gl_Position = mat4(Vparam[0], Vparam[1], Vparam[2], Vparam[3]) * vec4(pos, 1.0); + idx = uint(((gl_VertexID >> 1) + 1) | int(0x80000000)); + gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; + } + +*/ +static const uint8_t edge_vsoff_source_glsl430[333] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, + 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61, + 0x6d,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, + 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65, + 0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c, + 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x66,0x6c,0x61, + 0x74,0x20,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a, + 0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d, + 0x20,0x6d,0x61,0x74,0x34,0x28,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x2c, + 0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x31,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72, + 0x61,0x6d,0x5b,0x32,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x33,0x5d, + 0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e, + 0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x75,0x69, + 0x6e,0x74,0x28,0x28,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44, + 0x20,0x3e,0x3e,0x20,0x31,0x29,0x20,0x2b,0x20,0x31,0x29,0x20,0x7c,0x20,0x69,0x6e, + 0x74,0x28,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x29,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e, + 0x7a,0x20,0x3d,0x20,0x32,0x2e,0x30,0x20,0x2a,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, + 0x69,0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x2d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, + 0x69,0x74,0x69,0x6f,0x6e,0x2e,0x77,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, +}; +/* + #version 430 + + layout(location = 0) out uint fc; + layout(location = 0) flat in uint idx; + + void main() + { + fc = idx; + } + +*/ +static const uint8_t edge_fsoff_source_glsl430[120] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61, + 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, + 0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x66,0x63,0x3b,0x0a, + 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, + 0x3d,0x20,0x30,0x29,0x20,0x66,0x6c,0x61,0x74,0x20,0x69,0x6e,0x20,0x75,0x69,0x6e, + 0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69, + 0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x63,0x20,0x3d,0x20,0x69, + 0x64,0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; /* #version 300 es @@ -112,7 +180,7 @@ static const uint8_t e_fs_source_glsl430[111] = { } */ -static const uint8_t e_vs_source_glsl300es[252] = { +static const uint8_t edge_vs_source_glsl300es[252] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, 0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x34,0x5d,0x3b, @@ -136,15 +204,15 @@ static const uint8_t e_vs_source_glsl300es[252] = { precision highp int; uniform vec4 Fparam[1]; - layout(location = 0) out vec4 fc; + layout(location = 0) out vec4 c; void main() { - fc = Fparam[0]; + c = Fparam[0]; } */ -static const uint8_t e_fs_source_glsl300es[160] = { +static const uint8_t edge_fs_source_glsl300es[158] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, @@ -152,10 +220,73 @@ static const uint8_t e_fs_source_glsl300es[160] = { 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x46,0x70,0x61,0x72, 0x61,0x6d,0x5b,0x31,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f, 0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20, - 0x76,0x65,0x63,0x34,0x20,0x66,0x63,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d, - 0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x63,0x20,0x3d, - 0x20,0x46,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x76,0x65,0x63,0x34,0x20,0x63,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, + 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x46, + 0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, +}; +/* + #version 300 es + uniform mediump vec4 Vparam[4]; + layout(location = 0) in mediump vec3 pos; + flat out uint idx; + + void main() + { + gl_Position = mat4(Vparam[0], Vparam[1], Vparam[2], Vparam[3]) * vec4(pos, 1.0); + idx = uint(((gl_VertexID >> 1) + 1) | int(0x80000000)); + gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; + } + +*/ +static const uint8_t edge_vsoff_source_glsl300es[331] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, + 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, + 0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x34,0x5d,0x3b, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, + 0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x66,0x6c,0x61,0x74,0x20, + 0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x76, + 0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, + 0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d, + 0x61,0x74,0x34,0x28,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x2c,0x20,0x56, + 0x70,0x61,0x72,0x61,0x6d,0x5b,0x31,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d, + 0x5b,0x32,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x33,0x5d,0x29,0x20, + 0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74, + 0x28,0x28,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x20,0x3e, + 0x3e,0x20,0x31,0x29,0x20,0x2b,0x20,0x31,0x29,0x20,0x7c,0x20,0x69,0x6e,0x74,0x28, + 0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20, + 0x3d,0x20,0x32,0x2e,0x30,0x20,0x2a,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, + 0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x2d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, + 0x69,0x6f,0x6e,0x2e,0x77,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, +}; +/* + #version 300 es + precision mediump float; + precision highp int; + + layout(location = 0) out uint fc; + flat in uint idx; + + void main() + { + fc = idx; + } + +*/ +static const uint8_t edge_fsoff_source_glsl300es[148] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, + 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, + 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, + 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x6c, + 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, + 0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x66,0x63,0x3b, + 0x0a,0x66,0x6c,0x61,0x74,0x20,0x69,0x6e,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64, + 0x78,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x63,0x20,0x3d,0x20,0x69,0x64,0x78,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; /* cbuffer Vparam : register(b0) @@ -191,7 +322,7 @@ static const uint8_t e_fs_source_glsl300es[160] = { return stage_output; } */ -static const uint8_t e_vs_source_hlsl5[545] = { +static const uint8_t edge_vs_source_hlsl5[545] = { 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, 0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a, 0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,0x20,0x66,0x6c, @@ -235,48 +366,197 @@ static const uint8_t e_vs_source_hlsl5[545] = { }; - static float4 fc; + static float4 c; struct SPIRV_Cross_Output { - float4 fc : SV_Target0; + float4 c : SV_Target0; }; void frag_main() { - fc = _12_color; + c = _12_color; } SPIRV_Cross_Output main() { frag_main(); SPIRV_Cross_Output stage_output; - stage_output.fc = fc; + stage_output.c = c; return stage_output; } */ -static const uint8_t e_fs_source_hlsl5[333] = { +static const uint8_t edge_fs_source_hlsl5[328] = { 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x46,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, 0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a, 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x31,0x32,0x5f,0x63, 0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65, 0x74,0x28,0x63,0x30,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,0x73,0x74,0x61,0x74, - 0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x63,0x3b,0x0a,0x0a,0x73, - 0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73, - 0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x63,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,0x61, - 0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20, - 0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x63,0x20,0x3d,0x20,0x5f,0x31,0x32,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73, - 0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73, - 0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f, - 0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65, - 0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x63,0x20,0x3d,0x20,0x66,0x63,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67, - 0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, + 0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x3b,0x0a,0x0a,0x73,0x74, + 0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73, + 0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x34,0x20,0x63,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67, + 0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72, + 0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, + 0x63,0x20,0x3d,0x20,0x5f,0x31,0x32,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d, + 0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75, + 0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20, + 0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f, + 0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70, + 0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75, + 0x74,0x70,0x75,0x74,0x2e,0x63,0x20,0x3d,0x20,0x63,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74, + 0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, +}; +/* + cbuffer Vparam : register(b0) + { + row_major float4x4 _19_mvp : packoffset(c0); + }; + + + static float4 gl_Position; + static int gl_VertexIndex; + static float3 pos; + static uint idx; + + struct SPIRV_Cross_Input + { + float3 pos : TEXCOORD0; + uint gl_VertexIndex : SV_VertexID; + }; + + struct SPIRV_Cross_Output + { + nointerpolation uint idx : TEXCOORD0; + float4 gl_Position : SV_Position; + }; + + void vert_main() + { + gl_Position = mul(float4(pos, 1.0f), _19_mvp); + idx = uint(((gl_VertexIndex >> 1) + 1) | int(0x80000000)); + } + + SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) + { + gl_VertexIndex = int(stage_input.gl_VertexIndex); + pos = stage_input.pos; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.idx = idx; + return stage_output; + } +*/ +static const uint8_t edge_vsoff_source_hlsl5[815] = { + 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, + 0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76,0x70,0x20,0x3a, + 0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,0x30,0x29,0x3b, + 0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, + 0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x56, + 0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x3b,0x0a,0x73,0x74,0x61,0x74, + 0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x73, + 0x74,0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a, + 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72, + 0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, + 0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x20,0x3a,0x20,0x54,0x45,0x58, + 0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74, + 0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20, + 0x3a,0x20,0x53,0x56,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x3b,0x0a,0x7d, + 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f, + 0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x6e,0x6f,0x69,0x6e,0x74,0x65,0x72,0x70,0x6f,0x6c,0x61,0x74,0x69, + 0x6f,0x6e,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x3a,0x20,0x54,0x45, + 0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, + 0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d, + 0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69, + 0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, + 0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28,0x66,0x6c,0x6f,0x61, + 0x74,0x34,0x28,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x2c,0x20,0x5f, + 0x31,0x39,0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78, + 0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x28,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72, + 0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x3e,0x3e,0x20,0x31,0x29,0x20,0x2b, + 0x20,0x31,0x29,0x20,0x7c,0x20,0x69,0x6e,0x74,0x28,0x30,0x78,0x38,0x30,0x30,0x30, + 0x30,0x30,0x30,0x30,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56, + 0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61, + 0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49, + 0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74, + 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65, + 0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,0x73,0x74,0x61, + 0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74, + 0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f, + 0x73,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e, + 0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61, + 0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f, + 0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61, + 0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73, + 0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50, + 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, + 0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65, + 0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x69,0x64,0x78,0x20,0x3d,0x20,0x69,0x64, + 0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74, + 0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, +}; +/* + static uint fc; + static uint idx; + + struct SPIRV_Cross_Input + { + nointerpolation uint idx : TEXCOORD0; + }; + + struct SPIRV_Cross_Output + { + uint fc : SV_Target0; + }; + + void frag_main() + { + fc = idx; + } + + SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) + { + idx = stage_input.idx; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.fc = fc; + return stage_output; + } +*/ +static const uint8_t edge_fsoff_source_hlsl5[393] = { + 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74,0x20,0x66,0x63,0x3b,0x0a, + 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b, + 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, + 0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20, + 0x20,0x6e,0x6f,0x69,0x6e,0x74,0x65,0x72,0x70,0x6f,0x6c,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x3a,0x20,0x54,0x45,0x58,0x43, + 0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63, + 0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75, + 0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20, + 0x66,0x63,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b, + 0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d, + 0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x63,0x20,0x3d, + 0x20,0x69,0x64,0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, + 0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e, + 0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70, + 0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x73,0x74,0x61,0x67, + 0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x69,0x64,0x78,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75, + 0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75, + 0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74, + 0x70,0x75,0x74,0x2e,0x66,0x63,0x20,0x3d,0x20,0x66,0x63,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75, + 0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, }; /* #include @@ -307,7 +587,7 @@ static const uint8_t e_fs_source_hlsl5[333] = { } */ -static const uint8_t e_vs_source_metal_macos[409] = { +static const uint8_t edge_vs_source_metal_macos[409] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -348,18 +628,18 @@ static const uint8_t e_vs_source_metal_macos[409] = { struct main0_out { - float4 fc [[color(0)]]; + float4 c [[color(0)]]; }; fragment main0_out main0(constant Fparam& _12 [[buffer(0)]]) { main0_out out = {}; - out.fc = _12.color; + out.c = _12.color; return out; } */ -static const uint8_t e_fs_source_metal_macos[292] = { +static const uint8_t edge_fs_source_metal_macos[290] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -368,27 +648,221 @@ static const uint8_t e_fs_source_metal_macos[292] = { 0x70,0x61,0x72,0x61,0x6d,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, 0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74, 0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x63,0x20,0x5b, - 0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a, - 0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, - 0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x63,0x6f,0x6e,0x73,0x74,0x61, - 0x6e,0x74,0x20,0x46,0x70,0x61,0x72,0x61,0x6d,0x26,0x20,0x5f,0x31,0x32,0x20,0x5b, - 0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75, - 0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e, - 0x66,0x63,0x20,0x3d,0x20,0x5f,0x31,0x32,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a, - 0x7d,0x0a,0x0a,0x00, + 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x20,0x5b,0x5b, + 0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a, + 0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f, + 0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e, + 0x74,0x20,0x46,0x70,0x61,0x72,0x61,0x6d,0x26,0x20,0x5f,0x31,0x32,0x20,0x5b,0x5b, + 0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74, + 0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63, + 0x20,0x3d,0x20,0x5f,0x31,0x32,0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a, + 0x0a,0x00, +}; +/* + #include + #include + + using namespace metal; + + struct Vparam + { + float4x4 mvp; + }; + + struct main0_out + { + uint idx [[user(locn0)]]; + float4 gl_Position [[position]]; + }; + + struct main0_in + { + float3 pos [[attribute(0)]]; + }; + + vertex main0_out main0(main0_in in [[stage_in]], constant Vparam& _19 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) + { + main0_out out = {}; + out.gl_Position = _19.mvp * float4(in.pos, 1.0); + out.idx = uint(((int(gl_VertexIndex) >> 1) + 1) | int(0x80000000)); + return out; + } + +*/ +static const uint8_t edge_vsoff_source_metal_macos[546] = { + 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, + 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, + 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, + 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, + 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x56, + 0x70,0x61,0x72,0x61,0x6d,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x34,0x78,0x34,0x20,0x6d,0x76,0x70,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74, + 0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b, + 0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x5b,0x5b, + 0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, + 0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, + 0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d, + 0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69, + 0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76, + 0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20, + 0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69, + 0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20, + 0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x26, + 0x20,0x5f,0x31,0x39,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29, + 0x5d,0x5d,0x2c,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74, + 0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x5b,0x5b,0x76,0x65,0x72,0x74,0x65,0x78, + 0x5f,0x69,0x64,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69, + 0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69, + 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x2c,0x20, + 0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x69,0x64, + 0x78,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x28,0x28,0x69,0x6e,0x74,0x28,0x67, + 0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x29,0x20,0x3e, + 0x3e,0x20,0x31,0x29,0x20,0x2b,0x20,0x31,0x29,0x20,0x7c,0x20,0x69,0x6e,0x74,0x28, + 0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a, + 0x0a,0x00, }; -const sg_shader_desc* e_edge_shader_desc(sg_backend backend) { +/* + #include + #include + + using namespace metal; + + struct main0_out + { + uint fc [[color(0)]]; + }; + + struct main0_in + { + uint idx [[user(locn0)]]; + }; + + fragment main0_out main0(main0_in in [[stage_in]]) + { + main0_out out = {}; + out.fc = in.idx; + return out; + } + +*/ +static const uint8_t edge_fsoff_source_metal_macos[291] = { + 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, + 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, + 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, + 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, + 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d, + 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75, + 0x69,0x6e,0x74,0x20,0x66,0x63,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30, + 0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, + 0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75, + 0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c, + 0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61, + 0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20, + 0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69, + 0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20, + 0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75, + 0x74,0x2e,0x66,0x63,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x69,0x64,0x78,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d, + 0x0a,0x0a,0x00, +}; +const sg_shader_desc* edge_idx_shader_desc(sg_backend backend) { + if (backend == SG_BACKEND_GLCORE) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vertex_func.source = (const char*)edge_vsoff_source_glsl430; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = (const char*)edge_fsoff_source_glsl430; + desc.fragment_func.entry = "main"; + desc.attrs[0].glsl_name = "pos"; + desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; + desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.uniform_blocks[0].size = 64; + desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "Vparam"; + desc.label = "edge_idx_shader"; + } + return &desc; + } + if (backend == SG_BACKEND_GLES3) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vertex_func.source = (const char*)edge_vsoff_source_glsl300es; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = (const char*)edge_fsoff_source_glsl300es; + desc.fragment_func.entry = "main"; + desc.attrs[0].glsl_name = "pos"; + desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; + desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.uniform_blocks[0].size = 64; + desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "Vparam"; + desc.label = "edge_idx_shader"; + } + return &desc; + } + if (backend == SG_BACKEND_D3D11) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vertex_func.source = (const char*)edge_vsoff_source_hlsl5; + desc.vertex_func.d3d11_target = "vs_5_0"; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = (const char*)edge_fsoff_source_hlsl5; + desc.fragment_func.d3d11_target = "ps_5_0"; + desc.fragment_func.entry = "main"; + desc.attrs[0].hlsl_sem_name = "TEXCOORD"; + desc.attrs[0].hlsl_sem_index = 0; + desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; + desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.uniform_blocks[0].size = 64; + desc.uniform_blocks[0].hlsl_register_b_n = 0; + desc.label = "edge_idx_shader"; + } + return &desc; + } + if (backend == SG_BACKEND_METAL_MACOS) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vertex_func.source = (const char*)edge_vsoff_source_metal_macos; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = (const char*)edge_fsoff_source_metal_macos; + desc.fragment_func.entry = "main0"; + desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; + desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.uniform_blocks[0].size = 64; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.label = "edge_idx_shader"; + } + return &desc; + } + return 0; +} +const sg_shader_desc* edge_s_shader_desc(sg_backend backend) { if (backend == SG_BACKEND_GLCORE) { static sg_shader_desc desc; static bool valid; if (!valid) { valid = true; - desc.vertex_func.source = (const char*)e_vs_source_glsl430; + desc.vertex_func.source = (const char*)edge_vs_source_glsl430; desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)e_fs_source_glsl430; + desc.fragment_func.source = (const char*)edge_fs_source_glsl430; desc.fragment_func.entry = "main"; desc.attrs[0].glsl_name = "pos"; desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; @@ -403,7 +877,7 @@ const sg_shader_desc* e_edge_shader_desc(sg_backend backend) { desc.uniform_blocks[1].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 1; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "Fparam"; - desc.label = "e_edge_shader"; + desc.label = "edge_s_shader"; } return &desc; } @@ -412,9 +886,9 @@ const sg_shader_desc* e_edge_shader_desc(sg_backend backend) { static bool valid; if (!valid) { valid = true; - desc.vertex_func.source = (const char*)e_vs_source_glsl300es; + desc.vertex_func.source = (const char*)edge_vs_source_glsl300es; desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)e_fs_source_glsl300es; + desc.fragment_func.source = (const char*)edge_fs_source_glsl300es; desc.fragment_func.entry = "main"; desc.attrs[0].glsl_name = "pos"; desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; @@ -429,7 +903,7 @@ const sg_shader_desc* e_edge_shader_desc(sg_backend backend) { desc.uniform_blocks[1].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; desc.uniform_blocks[1].glsl_uniforms[0].array_count = 1; desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "Fparam"; - desc.label = "e_edge_shader"; + desc.label = "edge_s_shader"; } return &desc; } @@ -438,10 +912,10 @@ const sg_shader_desc* e_edge_shader_desc(sg_backend backend) { static bool valid; if (!valid) { valid = true; - desc.vertex_func.source = (const char*)e_vs_source_hlsl5; + desc.vertex_func.source = (const char*)edge_vs_source_hlsl5; desc.vertex_func.d3d11_target = "vs_5_0"; desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)e_fs_source_hlsl5; + desc.fragment_func.source = (const char*)edge_fs_source_hlsl5; desc.fragment_func.d3d11_target = "ps_5_0"; desc.fragment_func.entry = "main"; desc.attrs[0].hlsl_sem_name = "TEXCOORD"; @@ -454,7 +928,7 @@ const sg_shader_desc* e_edge_shader_desc(sg_backend backend) { desc.uniform_blocks[1].layout = SG_UNIFORMLAYOUT_STD140; desc.uniform_blocks[1].size = 16; desc.uniform_blocks[1].hlsl_register_b_n = 0; - desc.label = "e_edge_shader"; + desc.label = "edge_s_shader"; } return &desc; } @@ -463,9 +937,9 @@ const sg_shader_desc* e_edge_shader_desc(sg_backend backend) { static bool valid; if (!valid) { valid = true; - desc.vertex_func.source = (const char*)e_vs_source_metal_macos; + desc.vertex_func.source = (const char*)edge_vs_source_metal_macos; desc.vertex_func.entry = "main0"; - desc.fragment_func.source = (const char*)e_fs_source_metal_macos; + desc.fragment_func.source = (const char*)edge_fs_source_metal_macos; desc.fragment_func.entry = "main0"; desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; @@ -475,7 +949,7 @@ const sg_shader_desc* e_edge_shader_desc(sg_backend backend) { desc.uniform_blocks[1].layout = SG_UNIFORMLAYOUT_STD140; desc.uniform_blocks[1].size = 16; desc.uniform_blocks[1].msl_buffer_n = 0; - desc.label = "e_edge_shader"; + desc.label = "edge_s_shader"; } return &desc; } diff --git a/glsl/edgeidx.glsl b/glsl/edgeidx.glsl deleted file mode 100644 index 356ce78..0000000 --- a/glsl/edgeidx.glsl +++ /dev/null @@ -1,36 +0,0 @@ -@module ei - -@vs vs -@glsl_options fixup_clipspace - -precision mediump float; - -layout(binding=0) uniform Vparam { - mat4 mvp; -}; -in vec3 pos; -flat out uint idx; - -void main(){ - gl_Position = mvp * vec4(pos, 1.0); - idx = (gl_VertexIndex >> 1) + 1 | 1<<31; -} -@end - -@fs fs -precision mediump float; - -layout(binding=1) uniform Fparam { - vec4 color; -}; -flat in uint idx; -out vec4 c0; -out uint c1; - -void main(){ - c0 = color; - c1 = idx; -} -@end - -@program edgeidx vs fs diff --git a/glsl/edgeidx.h b/glsl/edgeidx.h deleted file mode 100644 index de6b0d1..0000000 --- a/glsl/edgeidx.h +++ /dev/null @@ -1,590 +0,0 @@ -#pragma once -/* - #version:1# (machine generated, don't edit!) - - Generated by sokol-shdc (https://github.com/floooh/sokol-tools) - - Cmdline: - sokol-shdc -f sokol_impl -i glsl/edgeidx.glsl -l glsl430:hlsl5:metal_macos:glsl300es -o glsl/edgeidx.h - - Overview: - ========= - Shader program: 'edgeidx': - Get shader desc: ei_edgeidx_shader_desc(sg_query_backend()); - Vertex Shader: vs - Fragment Shader: fs - Attributes: - ATTR_edgeidx_pos => 0 - Bindings: - Uniform block 'Vparam': - C struct: ei_Vparam_t - Bind slot: UB_Vparam => 0 - Uniform block 'Fparam': - C struct: ei_Fparam_t - Bind slot: UB_Fparam => 1 -*/ -#if !defined(SOKOL_GFX_INCLUDED) -#error "Please include sokol_gfx.h before edgeidx.h" -#endif -#if !defined(SOKOL_SHDC_ALIGN) -#if defined(_MSC_VER) -#define SOKOL_SHDC_ALIGN(a) __declspec(align(a)) -#else -#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a))) -#endif -#endif -const sg_shader_desc* ei_edgeidx_shader_desc(sg_backend backend); -#define ATTR_edgeidx_pos (0) -#define UB_Vparam (0) -#define UB_Fparam (1) -#pragma pack(push,1) -SOKOL_SHDC_ALIGN(16) typedef struct ei_Vparam_t { - float mvp[16]; -} ei_Vparam_t; -#pragma pack(pop) -#pragma pack(push,1) -SOKOL_SHDC_ALIGN(16) typedef struct ei_Fparam_t { - float color[4]; -} ei_Fparam_t; -#pragma pack(pop) -#if defined(SOKOL_SHDC_IMPL) -/* - #version 430 - - uniform vec4 Vparam[4]; - layout(location = 0) in vec3 pos; - layout(location = 0) flat out uint idx; - - void main() - { - gl_Position = mat4(Vparam[0], Vparam[1], Vparam[2], Vparam[3]) * vec4(pos, 1.0); - idx = uint(((gl_VertexID >> 1) + 1) | int(0x80000000)); - gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; - } - -*/ -static const uint8_t ei_vs_source_glsl430[333] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, - 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61, - 0x6d,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, - 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65, - 0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c, - 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x66,0x6c,0x61, - 0x74,0x20,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a, - 0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20, - 0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d, - 0x20,0x6d,0x61,0x74,0x34,0x28,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x2c, - 0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x31,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72, - 0x61,0x6d,0x5b,0x32,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x33,0x5d, - 0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e, - 0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x75,0x69, - 0x6e,0x74,0x28,0x28,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44, - 0x20,0x3e,0x3e,0x20,0x31,0x29,0x20,0x2b,0x20,0x31,0x29,0x20,0x7c,0x20,0x69,0x6e, - 0x74,0x28,0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x29,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e, - 0x7a,0x20,0x3d,0x20,0x32,0x2e,0x30,0x20,0x2a,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x2d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x2e,0x77,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -/* - #version 430 - - uniform vec4 Fparam[1]; - layout(location = 0) out vec4 c0; - layout(location = 1) out uint c1; - layout(location = 0) flat in uint idx; - - void main() - { - c0 = Fparam[0]; - c1 = idx; - } - -*/ -static const uint8_t ei_fs_source_glsl430[198] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, - 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x46,0x70,0x61,0x72,0x61, - 0x6d,0x5b,0x31,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, - 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76, - 0x65,0x63,0x34,0x20,0x63,0x30,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c, - 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x6f,0x75,0x74, - 0x20,0x75,0x69,0x6e,0x74,0x20,0x63,0x31,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, - 0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x66, - 0x6c,0x61,0x74,0x20,0x69,0x6e,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b, - 0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x63,0x30,0x20,0x3d,0x20,0x46,0x70,0x61,0x72,0x61,0x6d,0x5b, - 0x30,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x31,0x20,0x3d,0x20,0x69,0x64,0x78, - 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -/* - #version 300 es - - uniform mediump vec4 Vparam[4]; - layout(location = 0) in mediump vec3 pos; - flat out uint idx; - - void main() - { - gl_Position = mat4(Vparam[0], Vparam[1], Vparam[2], Vparam[3]) * vec4(pos, 1.0); - idx = uint(((gl_VertexID >> 1) + 1) | int(0x80000000)); - gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; - } - -*/ -static const uint8_t ei_vs_source_glsl300es[331] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, - 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, - 0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x34,0x5d,0x3b, - 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, - 0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x66,0x6c,0x61,0x74,0x20, - 0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x76, - 0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d, - 0x61,0x74,0x34,0x28,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x2c,0x20,0x56, - 0x70,0x61,0x72,0x61,0x6d,0x5b,0x31,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d, - 0x5b,0x32,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x33,0x5d,0x29,0x20, - 0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74, - 0x28,0x28,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x20,0x3e, - 0x3e,0x20,0x31,0x29,0x20,0x2b,0x20,0x31,0x29,0x20,0x7c,0x20,0x69,0x6e,0x74,0x28, - 0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20, - 0x3d,0x20,0x32,0x2e,0x30,0x20,0x2a,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, - 0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x2d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, - 0x69,0x6f,0x6e,0x2e,0x77,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -/* - #version 300 es - precision mediump float; - precision highp int; - - uniform vec4 Fparam[1]; - layout(location = 0) out vec4 c0; - layout(location = 1) out uint c1; - flat in uint idx; - - void main() - { - c0 = Fparam[0]; - c1 = idx; - } - -*/ -static const uint8_t ei_fs_source_glsl300es[226] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, - 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, - 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, - 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75, - 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x46,0x70,0x61,0x72, - 0x61,0x6d,0x5b,0x31,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f, - 0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20, - 0x76,0x65,0x63,0x34,0x20,0x63,0x30,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, - 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x6f,0x75, - 0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x63,0x31,0x3b,0x0a,0x66,0x6c,0x61,0x74,0x20, - 0x69,0x6e,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x76,0x6f, - 0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, - 0x63,0x30,0x20,0x3d,0x20,0x46,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x63,0x31,0x20,0x3d,0x20,0x69,0x64,0x78,0x3b,0x0a,0x7d,0x0a, - 0x0a,0x00, -}; -/* - cbuffer Vparam : register(b0) - { - row_major float4x4 _19_mvp : packoffset(c0); - }; - - - static float4 gl_Position; - static int gl_VertexIndex; - static float3 pos; - static uint idx; - - struct SPIRV_Cross_Input - { - float3 pos : TEXCOORD0; - uint gl_VertexIndex : SV_VertexID; - }; - - struct SPIRV_Cross_Output - { - nointerpolation uint idx : TEXCOORD0; - float4 gl_Position : SV_Position; - }; - - void vert_main() - { - gl_Position = mul(float4(pos, 1.0f), _19_mvp); - idx = uint(((gl_VertexIndex >> 1) + 1) | int(0x80000000)); - } - - SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) - { - gl_VertexIndex = int(stage_input.gl_VertexIndex); - pos = stage_input.pos; - vert_main(); - SPIRV_Cross_Output stage_output; - stage_output.gl_Position = gl_Position; - stage_output.idx = idx; - return stage_output; - } -*/ -static const uint8_t ei_vs_source_hlsl5[815] = { - 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, - 0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x5f,0x31,0x39,0x5f,0x6d,0x76,0x70,0x20,0x3a, - 0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,0x30,0x29,0x3b, - 0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, - 0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x56, - 0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x3b,0x0a,0x73,0x74,0x61,0x74, - 0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x73, - 0x74,0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a, - 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72, - 0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x20,0x3a,0x20,0x54,0x45,0x58, - 0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74, - 0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20, - 0x3a,0x20,0x53,0x56,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x44,0x3b,0x0a,0x7d, - 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f, - 0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20, - 0x20,0x20,0x20,0x6e,0x6f,0x69,0x6e,0x74,0x65,0x72,0x70,0x6f,0x6c,0x61,0x74,0x69, - 0x6f,0x6e,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x3a,0x20,0x54,0x45, - 0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, - 0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d, - 0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69, - 0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28,0x66,0x6c,0x6f,0x61, - 0x74,0x34,0x28,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x2c,0x20,0x5f, - 0x31,0x39,0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78, - 0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x28,0x28,0x67,0x6c,0x5f,0x56,0x65,0x72, - 0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x3e,0x3e,0x20,0x31,0x29,0x20,0x2b, - 0x20,0x31,0x29,0x20,0x7c,0x20,0x69,0x6e,0x74,0x28,0x30,0x78,0x38,0x30,0x30,0x30, - 0x30,0x30,0x30,0x30,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56, - 0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61, - 0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49, - 0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74, - 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74,0x65, - 0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74, - 0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f, - 0x73,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e, - 0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61, - 0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f, - 0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73, - 0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50, - 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65, - 0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x69,0x64,0x78,0x20,0x3d,0x20,0x69,0x64, - 0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74, - 0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, -}; -/* - cbuffer Fparam : register(b0) - { - float4 _12_color : packoffset(c0); - }; - - - static float4 c0; - static uint c1; - static uint idx; - - struct SPIRV_Cross_Input - { - nointerpolation uint idx : TEXCOORD0; - }; - - struct SPIRV_Cross_Output - { - float4 c0 : SV_Target0; - uint c1 : SV_Target1; - }; - - void frag_main() - { - c0 = _12_color; - c1 = idx; - } - - SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) - { - idx = stage_input.idx; - frag_main(); - SPIRV_Cross_Output stage_output; - stage_output.c0 = c0; - stage_output.c1 = c1; - return stage_output; - } -*/ -static const uint8_t ei_fs_source_hlsl5[561] = { - 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x46,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, - 0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x31,0x32,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65, - 0x74,0x28,0x63,0x30,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,0x73,0x74,0x61,0x74, - 0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x30,0x3b,0x0a,0x73,0x74, - 0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74,0x20,0x63,0x31,0x3b,0x0a,0x73,0x74, - 0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a, - 0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f, - 0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6e, - 0x6f,0x69,0x6e,0x74,0x65,0x72,0x70,0x6f,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x20,0x75, - 0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f, - 0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, - 0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70, - 0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, - 0x63,0x30,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x63,0x31,0x20,0x3a,0x20,0x53, - 0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x31,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76, - 0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a, - 0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x30,0x20,0x3d,0x20,0x5f,0x31,0x32,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x31,0x20,0x3d,0x20,0x69, - 0x64,0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f, - 0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53, - 0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74, - 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f, - 0x69,0x6e,0x70,0x75,0x74,0x2e,0x69,0x64,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70, - 0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75, - 0x74,0x2e,0x63,0x30,0x20,0x3d,0x20,0x63,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73, - 0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x63,0x31,0x20,0x3d, - 0x20,0x63,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, - 0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a, - 0x00, -}; -/* - #include - #include - - using namespace metal; - - struct Vparam - { - float4x4 mvp; - }; - - struct main0_out - { - uint idx [[user(locn0)]]; - float4 gl_Position [[position]]; - }; - - struct main0_in - { - float3 pos [[attribute(0)]]; - }; - - vertex main0_out main0(main0_in in [[stage_in]], constant Vparam& _19 [[buffer(0)]], uint gl_VertexIndex [[vertex_id]]) - { - main0_out out = {}; - out.gl_Position = _19.mvp * float4(in.pos, 1.0); - out.idx = uint(((int(gl_VertexIndex) >> 1) + 1) | int(0x80000000)); - return out; - } - -*/ -static const uint8_t ei_vs_source_metal_macos[546] = { - 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, - 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, - 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, - 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, - 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x56, - 0x70,0x61,0x72,0x61,0x6d,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x34,0x78,0x34,0x20,0x6d,0x76,0x70,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74, - 0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x5b,0x5b, - 0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69, - 0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76, - 0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20, - 0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69, - 0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20, - 0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x26, - 0x20,0x5f,0x31,0x39,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29, - 0x5d,0x5d,0x2c,0x20,0x75,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x56,0x65,0x72,0x74, - 0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x20,0x5b,0x5b,0x76,0x65,0x72,0x74,0x65,0x78, - 0x5f,0x69,0x64,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69, - 0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69, - 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x2c,0x20, - 0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x69,0x64, - 0x78,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x28,0x28,0x69,0x6e,0x74,0x28,0x67, - 0x6c,0x5f,0x56,0x65,0x72,0x74,0x65,0x78,0x49,0x6e,0x64,0x65,0x78,0x29,0x20,0x3e, - 0x3e,0x20,0x31,0x29,0x20,0x2b,0x20,0x31,0x29,0x20,0x7c,0x20,0x69,0x6e,0x74,0x28, - 0x30,0x78,0x38,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a, - 0x0a,0x00, -}; -/* - #include - #include - - using namespace metal; - - struct Fparam - { - float4 color; - }; - - struct main0_out - { - float4 c0 [[color(0)]]; - uint c1 [[color(1)]]; - }; - - struct main0_in - { - uint idx [[user(locn0)]]; - }; - - fragment main0_out main0(main0_in in [[stage_in]], constant Fparam& _12 [[buffer(0)]]) - { - main0_out out = {}; - out.c0 = _12.color; - out.c1 = in.idx; - return out; - } - -*/ -static const uint8_t ei_fs_source_metal_macos[417] = { - 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, - 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, - 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, - 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, - 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x46, - 0x70,0x61,0x72,0x61,0x6d,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74, - 0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x30,0x20,0x5b, - 0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x75,0x69,0x6e,0x74,0x20,0x63,0x31,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72, - 0x28,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63, - 0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72, - 0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66, - 0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75, - 0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e, - 0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d, - 0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x46,0x70,0x61,0x72,0x61, - 0x6d,0x26,0x20,0x5f,0x31,0x32,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28, - 0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e, - 0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x30,0x20,0x3d,0x20,0x5f,0x31,0x32, - 0x2e,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e, - 0x63,0x31,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x69,0x64,0x78,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a, - 0x00, -}; -const sg_shader_desc* ei_edgeidx_shader_desc(sg_backend backend) { - if (backend == SG_BACKEND_GLCORE) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)ei_vs_source_glsl430; - desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)ei_fs_source_glsl430; - desc.fragment_func.entry = "main"; - desc.attrs[0].glsl_name = "pos"; - desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; - desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[0].size = 64; - desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; - desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "Vparam"; - desc.uniform_blocks[1].stage = SG_SHADERSTAGE_FRAGMENT; - desc.uniform_blocks[1].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[1].size = 16; - desc.uniform_blocks[1].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.uniform_blocks[1].glsl_uniforms[0].array_count = 1; - desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "Fparam"; - desc.label = "ei_edgeidx_shader"; - } - return &desc; - } - if (backend == SG_BACKEND_GLES3) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)ei_vs_source_glsl300es; - desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)ei_fs_source_glsl300es; - desc.fragment_func.entry = "main"; - desc.attrs[0].glsl_name = "pos"; - desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; - desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[0].size = 64; - desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; - desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "Vparam"; - desc.uniform_blocks[1].stage = SG_SHADERSTAGE_FRAGMENT; - desc.uniform_blocks[1].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[1].size = 16; - desc.uniform_blocks[1].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.uniform_blocks[1].glsl_uniforms[0].array_count = 1; - desc.uniform_blocks[1].glsl_uniforms[0].glsl_name = "Fparam"; - desc.label = "ei_edgeidx_shader"; - } - return &desc; - } - if (backend == SG_BACKEND_D3D11) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)ei_vs_source_hlsl5; - desc.vertex_func.d3d11_target = "vs_5_0"; - desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)ei_fs_source_hlsl5; - desc.fragment_func.d3d11_target = "ps_5_0"; - desc.fragment_func.entry = "main"; - desc.attrs[0].hlsl_sem_name = "TEXCOORD"; - desc.attrs[0].hlsl_sem_index = 0; - desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; - desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[0].size = 64; - desc.uniform_blocks[0].hlsl_register_b_n = 0; - desc.uniform_blocks[1].stage = SG_SHADERSTAGE_FRAGMENT; - desc.uniform_blocks[1].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[1].size = 16; - desc.uniform_blocks[1].hlsl_register_b_n = 0; - desc.label = "ei_edgeidx_shader"; - } - return &desc; - } - if (backend == SG_BACKEND_METAL_MACOS) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)ei_vs_source_metal_macos; - desc.vertex_func.entry = "main0"; - desc.fragment_func.source = (const char*)ei_fs_source_metal_macos; - desc.fragment_func.entry = "main0"; - desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; - desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[0].size = 64; - desc.uniform_blocks[0].msl_buffer_n = 0; - desc.uniform_blocks[1].stage = SG_SHADERSTAGE_FRAGMENT; - desc.uniform_blocks[1].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[1].size = 16; - desc.uniform_blocks[1].msl_buffer_n = 0; - desc.label = "ei_edgeidx_shader"; - } - return &desc; - } - return 0; -} -#endif // SOKOL_SHDC_IMPL \ No newline at end of file diff --git a/glsl/lines.h b/glsl/lines.h index e86b966..01f0eb7 100644 --- a/glsl/lines.h +++ b/glsl/lines.h @@ -14,12 +14,12 @@ Vertex Shader: vs Fragment Shader: fs Attributes: - ATTR_line_pos => 0 - ATTR_line_color => 1 + ATTR_l_line_pos => 0 + ATTR_l_line_color => 1 Bindings: Uniform block 'Vparam': C struct: l_Vparam_t - Bind slot: UB_Vparam => 0 + Bind slot: UB_l_Vparam => 0 */ #if !defined(SOKOL_GFX_INCLUDED) #error "Please include sokol_gfx.h before lines.h" @@ -32,9 +32,9 @@ #endif #endif const sg_shader_desc* l_line_shader_desc(sg_backend backend); -#define ATTR_line_pos (0) -#define ATTR_line_color (1) -#define UB_Vparam (0) +#define ATTR_l_line_pos (0) +#define ATTR_l_line_color (1) +#define UB_l_Vparam (0) #pragma pack(push,1) SOKOL_SHDC_ALIGN(16) typedef struct l_Vparam_t { float mvp[16]; diff --git a/glsl/node.glsl b/glsl/node.glsl index 4d841bb..3aed397 100644 --- a/glsl/node.glsl +++ b/glsl/node.glsl @@ -1,4 +1,4 @@ -@module n +@module node @vs vs @glsl_options fixup_clipspace @@ -11,9 +11,9 @@ layout(binding=0) uniform Vparam { in vec2 geom; in vec3 pos; in vec3 dir; -in vec4 col0; +in vec4 col; in float len; -out vec4 col; +out vec4 c; vec2 rotatez(vec2 v, float c, float s){ return mat2(c, s, -s, c) * v; @@ -23,19 +23,57 @@ void main(){ vec2 g = geom * vec2(len, 1.0); vec3 r = vec3(rotatez(g, dir.x, dir.y), 0.0); gl_Position = mvp * vec4(r + pos, 1.0); - col = col0; + c = col; } @end @fs fs precision mediump float; -in vec4 col; -out vec4 c0; +in vec4 c; +out vec4 fc; + +void main(){ + fc = c; +} +@end + +@vs vsoff +@glsl_options fixup_clipspace + +precision mediump float; + +layout(binding=0) uniform Vparam { + mat4 mvp; +}; +in vec2 geom; +in vec3 pos; +in vec3 dir; +in float len; +flat out uint idx; + +vec2 rotatez(vec2 v, float c, float s){ + return mat2(c, s, -s, c) * v; +} + +void main(){ + vec2 g = geom * vec2(len, 1.0); + vec3 r = vec3(rotatez(g, dir.x, dir.y), 0.0); + gl_Position = mvp * vec4(r + pos, 1.0); + idx = gl_InstanceIndex + 1; +} +@end + +@fs fsoff +precision mediump float; + +flat in uint idx; +out uint fc; void main(){ - c0 = col; + fc = idx; } @end -@program node vs fs +@program idx vsoff fsoff +@program s vs fs diff --git a/glsl/node.h b/glsl/node.h index 488bef0..f4ea99c 100644 --- a/glsl/node.h +++ b/glsl/node.h @@ -9,20 +9,29 @@ Overview: ========= - Shader program: 'node': - Get shader desc: n_node_shader_desc(sg_query_backend()); + Shader program: 'idx': + Get shader desc: node_idx_shader_desc(sg_query_backend()); + Vertex Shader: vsoff + Fragment Shader: fsoff + Attributes: + ATTR_node_idx_geom => 0 + ATTR_node_idx_pos => 1 + ATTR_node_idx_dir => 2 + ATTR_node_idx_len => 3 + Shader program: 's': + Get shader desc: node_s_shader_desc(sg_query_backend()); Vertex Shader: vs Fragment Shader: fs Attributes: - ATTR_node_geom => 0 - ATTR_node_pos => 1 - ATTR_node_dir => 2 - ATTR_node_col0 => 3 - ATTR_node_len => 4 + ATTR_node_s_geom => 0 + ATTR_node_s_pos => 1 + ATTR_node_s_dir => 2 + ATTR_node_s_col => 3 + ATTR_node_s_len => 4 Bindings: Uniform block 'Vparam': - C struct: n_Vparam_t - Bind slot: UB_Vparam => 0 + C struct: node_Vparam_t + Bind slot: UB_node_Vparam => 0 */ #if !defined(SOKOL_GFX_INCLUDED) #error "Please include sokol_gfx.h before node.h" @@ -34,17 +43,22 @@ #define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a))) #endif #endif -const sg_shader_desc* n_node_shader_desc(sg_backend backend); -#define ATTR_node_geom (0) -#define ATTR_node_pos (1) -#define ATTR_node_dir (2) -#define ATTR_node_col0 (3) -#define ATTR_node_len (4) -#define UB_Vparam (0) +const sg_shader_desc* node_idx_shader_desc(sg_backend backend); +const sg_shader_desc* node_s_shader_desc(sg_backend backend); +#define ATTR_node_idx_geom (0) +#define ATTR_node_idx_pos (1) +#define ATTR_node_idx_dir (2) +#define ATTR_node_idx_len (3) +#define ATTR_node_s_geom (0) +#define ATTR_node_s_pos (1) +#define ATTR_node_s_dir (2) +#define ATTR_node_s_col (3) +#define ATTR_node_s_len (4) +#define UB_node_Vparam (0) #pragma pack(push,1) -SOKOL_SHDC_ALIGN(16) typedef struct n_Vparam_t { +SOKOL_SHDC_ALIGN(16) typedef struct node_Vparam_t { float mvp[16]; -} n_Vparam_t; +} node_Vparam_t; #pragma pack(pop) #if defined(SOKOL_SHDC_IMPL) /* @@ -55,12 +69,12 @@ SOKOL_SHDC_ALIGN(16) typedef struct n_Vparam_t { layout(location = 4) in float len; layout(location = 2) in vec3 dir; layout(location = 1) in vec3 pos; - layout(location = 0) out vec4 col; - layout(location = 3) in vec4 col0; + layout(location = 0) out vec4 c; + layout(location = 3) in vec4 col; - vec2 rotatez(vec2 v, float c, float s) + vec2 rotatez(vec2 v, float c_1, float s) { - return mat2(vec2(c, s), vec2(-s, c)) * v; + return mat2(vec2(c_1, s), vec2(-s, c_1)) * v; } void main() @@ -69,12 +83,12 @@ SOKOL_SHDC_ALIGN(16) typedef struct n_Vparam_t { float param_1 = dir.x; float param_2 = dir.y; gl_Position = mat4(Vparam[0], Vparam[1], Vparam[2], Vparam[3]) * vec4(vec3(rotatez(param, param_1, param_2), 0.0) + pos, 1.0); - col = col0; + c = col; gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; } */ -static const uint8_t n_vs_source_glsl430[653] = { +static const uint8_t node_vs_source_glsl430[653] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61, 0x6d,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, @@ -87,31 +101,31 @@ static const uint8_t n_vs_source_glsl430[653] = { 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, 0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a, 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, - 0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f, - 0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69, - 0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20, - 0x63,0x6f,0x6c,0x30,0x3b,0x0a,0x0a,0x76,0x65,0x63,0x32,0x20,0x72,0x6f,0x74,0x61, - 0x74,0x65,0x7a,0x28,0x76,0x65,0x63,0x32,0x20,0x76,0x2c,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x20,0x63,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x29,0x0a,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x74,0x32,0x28, - 0x76,0x65,0x63,0x32,0x28,0x63,0x2c,0x20,0x73,0x29,0x2c,0x20,0x76,0x65,0x63,0x32, - 0x28,0x2d,0x73,0x2c,0x20,0x63,0x29,0x29,0x20,0x2a,0x20,0x76,0x3b,0x0a,0x7d,0x0a, - 0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20, - 0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20, - 0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x6c,0x65,0x6e,0x2c, - 0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x78, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x32,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d, - 0x61,0x74,0x34,0x28,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x2c,0x20,0x56, - 0x70,0x61,0x72,0x61,0x6d,0x5b,0x31,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d, - 0x5b,0x32,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x33,0x5d,0x29,0x20, - 0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x65,0x63,0x33,0x28,0x72,0x6f,0x74,0x61, - 0x74,0x65,0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30,0x2e, - 0x30,0x29,0x20,0x2b,0x20,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x30,0x3b,0x0a, + 0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x3b, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f, + 0x6c,0x3b,0x0a,0x0a,0x76,0x65,0x63,0x32,0x20,0x72,0x6f,0x74,0x61,0x74,0x65,0x7a, + 0x28,0x76,0x65,0x63,0x32,0x20,0x76,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63, + 0x5f,0x31,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x29,0x0a,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x74,0x32,0x28,0x76, + 0x65,0x63,0x32,0x28,0x63,0x5f,0x31,0x2c,0x20,0x73,0x29,0x2c,0x20,0x76,0x65,0x63, + 0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x5f,0x31,0x29,0x29,0x20,0x2a,0x20,0x76,0x3b, + 0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d, + 0x20,0x3d,0x20,0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x6c, + 0x65,0x6e,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x64,0x69, + 0x72,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70, + 0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x79,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, + 0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d, + 0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x31,0x5d,0x2c,0x20,0x56,0x70,0x61, + 0x72,0x61,0x6d,0x5b,0x32,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x33, + 0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x65,0x63,0x33,0x28,0x72, + 0x6f,0x74,0x61,0x74,0x65,0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61, + 0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c, + 0x20,0x30,0x2e,0x30,0x29,0x20,0x2b,0x20,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30, + 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x3b,0x0a, 0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e, 0x7a,0x20,0x3d,0x20,0x32,0x2e,0x30,0x20,0x2a,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, 0x69,0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x2d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, @@ -120,24 +134,114 @@ static const uint8_t n_vs_source_glsl430[653] = { /* #version 430 - layout(location = 0) out vec4 c0; - layout(location = 0) in vec4 col; + layout(location = 0) out vec4 fc; + layout(location = 0) in vec4 c; void main() { - c0 = col; + fc = c; } */ -static const uint8_t n_fs_source_glsl430[115] = { +static const uint8_t node_fs_source_glsl430[111] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61, 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, - 0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x30,0x3b,0x0a, + 0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x63,0x3b,0x0a, 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, - 0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c, - 0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x63,0x30,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x7d, - 0x0a,0x0a,0x00, + 0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x3b,0x0a, + 0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x63,0x20,0x3d,0x20,0x63,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, +}; +/* + #version 430 + + uniform vec4 Vparam[4]; + layout(location = 0) in vec2 geom; + layout(location = 3) in float len; + layout(location = 2) in vec3 dir; + layout(location = 1) in vec3 pos; + layout(location = 0) flat out uint idx; + + vec2 rotatez(vec2 v, float c, float s) + { + return mat2(vec2(c, s), vec2(-s, c)) * v; + } + + void main() + { + vec2 param = geom * vec2(len, 1.0); + float param_1 = dir.x; + float param_2 = dir.y; + gl_Position = mat4(Vparam[0], Vparam[1], Vparam[2], Vparam[3]) * vec4(vec3(rotatez(param, param_1, param_2), 0.0) + pos, 1.0); + idx = uint(gl_InstanceID + 1); + gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; + } + +*/ +static const uint8_t node_vsoff_source_glsl430[642] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, + 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61, + 0x6d,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, + 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65, + 0x63,0x32,0x20,0x67,0x65,0x6f,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, + 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6c,0x65,0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f, + 0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29, + 0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x64,0x69,0x72,0x3b,0x0a,0x6c,0x61, + 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, + 0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a, + 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, + 0x3d,0x20,0x30,0x29,0x20,0x66,0x6c,0x61,0x74,0x20,0x6f,0x75,0x74,0x20,0x75,0x69, + 0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x76,0x65,0x63,0x32,0x20,0x72,0x6f, + 0x74,0x61,0x74,0x65,0x7a,0x28,0x76,0x65,0x63,0x32,0x20,0x76,0x2c,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x20,0x63,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x29,0x0a, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x74, + 0x32,0x28,0x76,0x65,0x63,0x32,0x28,0x63,0x2c,0x20,0x73,0x29,0x2c,0x20,0x76,0x65, + 0x63,0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x29,0x29,0x20,0x2a,0x20,0x76,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b, + 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20, + 0x3d,0x20,0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x6c,0x65, + 0x6e,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x64,0x69,0x72, + 0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61, + 0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d, + 0x20,0x6d,0x61,0x74,0x34,0x28,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x2c, + 0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x31,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72, + 0x61,0x6d,0x5b,0x32,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x33,0x5d, + 0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x65,0x63,0x33,0x28,0x72,0x6f, + 0x74,0x61,0x74,0x65,0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72, + 0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20, + 0x30,0x2e,0x30,0x29,0x20,0x2b,0x20,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74, + 0x28,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x44,0x20,0x2b, + 0x20,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69, + 0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x3d,0x20,0x32,0x2e,0x30,0x20,0x2a,0x20,0x67, + 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x2d,0x20,0x67, + 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x77,0x3b,0x0a,0x7d,0x0a, + 0x0a,0x00, +}; +/* + #version 430 + + layout(location = 0) out uint fc; + layout(location = 0) flat in uint idx; + + void main() + { + fc = idx; + } + +*/ +static const uint8_t node_fsoff_source_glsl430[120] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61, + 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, + 0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x66,0x63,0x3b,0x0a, + 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, + 0x3d,0x20,0x30,0x29,0x20,0x66,0x6c,0x61,0x74,0x20,0x69,0x6e,0x20,0x75,0x69,0x6e, + 0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69, + 0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x63,0x20,0x3d,0x20,0x69, + 0x64,0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; /* #version 300 es @@ -147,12 +251,12 @@ static const uint8_t n_fs_source_glsl430[115] = { layout(location = 4) in mediump float len; layout(location = 2) in mediump vec3 dir; layout(location = 1) in mediump vec3 pos; - out mediump vec4 col; - layout(location = 3) in mediump vec4 col0; + out mediump vec4 c; + layout(location = 3) in mediump vec4 col; - mediump vec2 rotatez(mediump vec2 v, mediump float c, mediump float s) + mediump vec2 rotatez(mediump vec2 v, mediump float c_1, mediump float s) { - return mat2(vec2(c, s), vec2(-s, c)) * v; + return mat2(vec2(c_1, s), vec2(-s, c_1)) * v; } void main() @@ -161,12 +265,12 @@ static const uint8_t n_fs_source_glsl430[115] = { mediump float param_1 = dir.x; mediump float param_2 = dir.y; gl_Position = mat4(Vparam[0], Vparam[1], Vparam[2], Vparam[3]) * vec4(vec3(rotatez(param, param_1, param_2), 0.0) + pos, 1.0); - col = col0; + c = col; gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; } */ -static const uint8_t n_vs_source_glsl300es[747] = { +static const uint8_t node_vs_source_glsl300es[747] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, 0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x34,0x5d,0x3b, @@ -181,35 +285,35 @@ static const uint8_t n_vs_source_glsl300es[747] = { 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, 0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, 0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x6d, - 0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x3b, - 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, - 0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x30,0x3b,0x0a,0x0a,0x6d,0x65,0x64, - 0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x72,0x6f,0x74,0x61,0x74,0x65, - 0x7a,0x28,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x76, + 0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x3b,0x0a,0x6c, + 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, + 0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76, + 0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x0a,0x6d,0x65,0x64,0x69,0x75,0x6d, + 0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x72,0x6f,0x74,0x61,0x74,0x65,0x7a,0x28,0x6d, + 0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x76,0x2c,0x20,0x6d, + 0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63,0x5f,0x31, 0x2c,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20, - 0x63,0x2c,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x20,0x73,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e, - 0x20,0x6d,0x61,0x74,0x32,0x28,0x76,0x65,0x63,0x32,0x28,0x63,0x2c,0x20,0x73,0x29, - 0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x29,0x29,0x20,0x2a, - 0x20,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e, - 0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, - 0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x67,0x65, - 0x6f,0x6d,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x6c,0x65,0x6e,0x2c,0x20,0x31, - 0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d, - 0x20,0x64,0x69,0x72,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x65,0x64,0x69, + 0x73,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, + 0x6d,0x61,0x74,0x32,0x28,0x76,0x65,0x63,0x32,0x28,0x63,0x5f,0x31,0x2c,0x20,0x73, + 0x29,0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x5f,0x31,0x29, + 0x29,0x20,0x2a,0x20,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d, + 0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x65,0x64,0x69, + 0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d, + 0x20,0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x6c,0x65,0x6e, + 0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x65,0x64,0x69, 0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, - 0x32,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67, - 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74, - 0x34,0x28,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x2c,0x20,0x56,0x70,0x61, - 0x72,0x61,0x6d,0x5b,0x31,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x32, - 0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20, - 0x76,0x65,0x63,0x34,0x28,0x76,0x65,0x63,0x33,0x28,0x72,0x6f,0x74,0x61,0x74,0x65, - 0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, - 0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29, - 0x20,0x2b,0x20,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x63,0x6f,0x6c,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x30,0x3b,0x0a,0x20,0x20, + 0x31,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d, + 0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72, + 0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, + 0x6d,0x61,0x74,0x34,0x28,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x2c,0x20, + 0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x31,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61, + 0x6d,0x5b,0x32,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x33,0x5d,0x29, + 0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x65,0x63,0x33,0x28,0x72,0x6f,0x74, + 0x61,0x74,0x65,0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61, + 0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30, + 0x2e,0x30,0x29,0x20,0x2b,0x20,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x20,0x20, 0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20, 0x3d,0x20,0x32,0x2e,0x30,0x20,0x2a,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, 0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x2d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, @@ -220,25 +324,125 @@ static const uint8_t n_vs_source_glsl300es[747] = { precision mediump float; precision highp int; - layout(location = 0) out vec4 c0; - in vec4 col; + layout(location = 0) out vec4 fc; + in vec4 c; + + void main() + { + fc = c; + } + +*/ +static const uint8_t node_fs_source_glsl300es[139] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, + 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, + 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, + 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x6c, + 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, + 0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x63,0x3b, + 0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x3b,0x0a,0x0a,0x76,0x6f,0x69, + 0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, + 0x63,0x20,0x3d,0x20,0x63,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, +}; +/* + #version 300 es + + uniform mediump vec4 Vparam[4]; + layout(location = 0) in mediump vec2 geom; + layout(location = 3) in mediump float len; + layout(location = 2) in mediump vec3 dir; + layout(location = 1) in mediump vec3 pos; + flat out uint idx; + + mediump vec2 rotatez(mediump vec2 v, mediump float c, mediump float s) + { + return mat2(vec2(c, s), vec2(-s, c)) * v; + } + + void main() + { + mediump vec2 param = geom * vec2(len, 1.0); + mediump float param_1 = dir.x; + mediump float param_2 = dir.y; + gl_Position = mat4(Vparam[0], Vparam[1], Vparam[2], Vparam[3]) * vec4(vec3(rotatez(param, param_1, param_2), 0.0) + pos, 1.0); + idx = uint(gl_InstanceID + 1); + gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; + } + +*/ +static const uint8_t node_vsoff_source_glsl300es[720] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, + 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, + 0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x34,0x5d,0x3b, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, + 0x20,0x76,0x65,0x63,0x32,0x20,0x67,0x65,0x6f,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f, + 0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29, + 0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x20,0x6c,0x65,0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f, + 0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x6d, + 0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x64,0x69,0x72,0x3b, + 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, + 0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x66,0x6c,0x61,0x74,0x20, + 0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x6d, + 0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x72,0x6f,0x74,0x61, + 0x74,0x65,0x7a,0x28,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x32, + 0x20,0x76,0x2c,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x20,0x63,0x2c,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x20,0x73,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75, + 0x72,0x6e,0x20,0x6d,0x61,0x74,0x32,0x28,0x76,0x65,0x63,0x32,0x28,0x63,0x2c,0x20, + 0x73,0x29,0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x29,0x29, + 0x20,0x2a,0x20,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, + 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x65,0x64,0x69,0x75, + 0x6d,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20, + 0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x6c,0x65,0x6e,0x2c, + 0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x65,0x64,0x69,0x75, + 0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, + 0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x65, + 0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61, + 0x6d,0x5f,0x32,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d, + 0x61,0x74,0x34,0x28,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x2c,0x20,0x56, + 0x70,0x61,0x72,0x61,0x6d,0x5b,0x31,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d, + 0x5b,0x32,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x33,0x5d,0x29,0x20, + 0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x65,0x63,0x33,0x28,0x72,0x6f,0x74,0x61, + 0x74,0x65,0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d, + 0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30,0x2e, + 0x30,0x29,0x20,0x2b,0x20,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x67, + 0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x44,0x20,0x2b,0x20,0x31, + 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69, + 0x6f,0x6e,0x2e,0x7a,0x20,0x3d,0x20,0x32,0x2e,0x30,0x20,0x2a,0x20,0x67,0x6c,0x5f, + 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x2d,0x20,0x67,0x6c,0x5f, + 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x77,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + +}; +/* + #version 300 es + precision mediump float; + precision highp int; + + layout(location = 0) out uint fc; + flat in uint idx; void main() { - c0 = col; + fc = idx; } */ -static const uint8_t n_fs_source_glsl300es[143] = { +static const uint8_t node_fsoff_source_glsl300es[148] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x6c, 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, - 0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x30,0x3b, - 0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x0a,0x76, - 0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x63,0x30,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x66,0x63,0x3b, + 0x0a,0x66,0x6c,0x61,0x74,0x20,0x69,0x6e,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64, + 0x78,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x63,0x20,0x3d,0x20,0x69,0x64,0x78,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; /* cbuffer Vparam : register(b0) @@ -252,27 +456,27 @@ static const uint8_t n_fs_source_glsl300es[143] = { static float len; static float3 dir; static float3 pos; + static float4 c; static float4 col; - static float4 col0; struct SPIRV_Cross_Input { float2 geom : TEXCOORD0; float3 pos : TEXCOORD1; float3 dir : TEXCOORD2; - float4 col0 : TEXCOORD3; + float4 col : TEXCOORD3; float len : TEXCOORD4; }; struct SPIRV_Cross_Output { - float4 col : TEXCOORD0; + float4 c : TEXCOORD0; float4 gl_Position : SV_Position; }; - float2 rotatez(float2 v, float c, float s) + float2 rotatez(float2 v, float c_1, float s) { - return mul(v, float2x2(float2(c, s), float2(-s, c))); + return mul(v, float2x2(float2(c_1, s), float2(-s, c_1))); } void vert_main() @@ -281,7 +485,7 @@ static const uint8_t n_fs_source_glsl300es[143] = { float param_1 = dir.x; float param_2 = dir.y; gl_Position = mul(float4(float3(rotatez(param, param_1, param_2), 0.0f) + pos, 1.0f), _70_mvp); - col = col0; + c = col; } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) @@ -290,15 +494,15 @@ static const uint8_t n_fs_source_glsl300es[143] = { len = stage_input.len; dir = stage_input.dir; pos = stage_input.pos; - col0 = stage_input.col0; + col = stage_input.col; vert_main(); SPIRV_Cross_Output stage_output; stage_output.gl_Position = gl_Position; - stage_output.col = col; + stage_output.c = c; return stage_output; } */ -static const uint8_t n_vs_source_hlsl5[1192] = { +static const uint8_t node_vs_source_hlsl5[1183] = { 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, 0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a, 0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,0x20,0x66,0x6c, @@ -311,32 +515,32 @@ static const uint8_t n_vs_source_hlsl5[1192] = { 0x74,0x20,0x6c,0x65,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c, 0x6f,0x61,0x74,0x33,0x20,0x64,0x69,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63, 0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x73,0x74,0x61, - 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x3b,0x0a, - 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f, - 0x6c,0x30,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52, - 0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x67,0x65,0x6f,0x6d,0x20, - 0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x20,0x3a,0x20,0x54,0x45, - 0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x33,0x20,0x64,0x69,0x72,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f, - 0x52,0x44,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, - 0x63,0x6f,0x6c,0x30,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x33, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6c,0x65,0x6e,0x20, - 0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x34,0x3b,0x0a,0x7d,0x3b,0x0a, - 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72, - 0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x20,0x3a,0x20,0x54,0x45, - 0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, - 0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d, - 0x3b,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x72,0x6f,0x74,0x61,0x74,0x65, - 0x7a,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x2c,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x20,0x63,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x29,0x0a,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x75,0x6c,0x28,0x76, - 0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x78,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74, - 0x32,0x28,0x63,0x2c,0x20,0x73,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28, - 0x2d,0x73,0x2c,0x20,0x63,0x29,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69, + 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x3b,0x0a,0x73,0x74, + 0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x3b, + 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, + 0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x67,0x65,0x6f,0x6d,0x20,0x3a,0x20,0x54, + 0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f, + 0x4f,0x52,0x44,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33, + 0x20,0x64,0x69,0x72,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x32, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c, + 0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x33,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6c,0x65,0x6e,0x20,0x3a,0x20,0x54,0x45, + 0x58,0x43,0x4f,0x4f,0x52,0x44,0x34,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72, + 0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f, + 0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x34,0x20,0x63,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44, + 0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c, + 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56,0x5f,0x50, + 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x6c,0x6f, + 0x61,0x74,0x32,0x20,0x72,0x6f,0x74,0x61,0x74,0x65,0x7a,0x28,0x66,0x6c,0x6f,0x61, + 0x74,0x32,0x20,0x76,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63,0x5f,0x31,0x2c, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, + 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x75,0x6c,0x28,0x76,0x2c,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x32,0x78,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x63,0x5f, + 0x31,0x2c,0x20,0x73,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x73, + 0x2c,0x20,0x63,0x5f,0x31,0x29,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69, 0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d, 0x20,0x3d,0x20,0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, @@ -350,85 +554,278 @@ static const uint8_t n_vs_source_hlsl5[1192] = { 0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70, 0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x20,0x2b, 0x20,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x2c,0x20,0x5f,0x37,0x30, - 0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x20,0x3d, - 0x20,0x63,0x6f,0x6c,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f, - 0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69, - 0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e, - 0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x65,0x6f,0x6d,0x20,0x3d,0x20,0x73,0x74, - 0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x67,0x65,0x6f,0x6d,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x6c,0x65,0x6e,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f, - 0x69,0x6e,0x70,0x75,0x74,0x2e,0x6c,0x65,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x64, - 0x69,0x72,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74, - 0x2e,0x64,0x69,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f,0x73,0x20,0x3d,0x20, - 0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x70,0x6f,0x73,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x30,0x20,0x3d,0x20,0x73,0x74,0x61,0x67, - 0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x30,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f, - 0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70, - 0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75, - 0x74,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74, - 0x2e,0x63,0x6f,0x6c,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74, - 0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, + 0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x63, + 0x6f,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f, + 0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53, + 0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74, + 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x67,0x65,0x6f,0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65, + 0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x67,0x65,0x6f,0x6d,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x6c,0x65,0x6e,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70, + 0x75,0x74,0x2e,0x6c,0x65,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x64,0x69,0x72,0x20, + 0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x64,0x69, + 0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f,0x73,0x20,0x3d,0x20,0x73,0x74,0x61, + 0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x63,0x6f,0x6c,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e, + 0x70,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72, + 0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50, + 0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74, + 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e, + 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c, + 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73, + 0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x63,0x20,0x3d,0x20, + 0x63,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74, + 0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, }; /* - static float4 c0; - static float4 col; + static float4 fc; + static float4 c; struct SPIRV_Cross_Input { - float4 col : TEXCOORD0; + float4 c : TEXCOORD0; }; struct SPIRV_Cross_Output { - float4 c0 : SV_Target0; + float4 fc : SV_Target0; }; void frag_main() { - c0 = col; + fc = c; } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { - col = stage_input.col; + c = stage_input.c; frag_main(); SPIRV_Cross_Output stage_output; - stage_output.c0 = c0; + stage_output.fc = fc; return stage_output; } */ -static const uint8_t n_fs_source_hlsl5[385] = { - 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x30, +static const uint8_t node_fs_source_hlsl5[375] = { + 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x63, 0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, - 0x63,0x6f,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49, - 0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x20, - 0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a, - 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72, - 0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x30,0x20,0x3a,0x20,0x53,0x56,0x5f, - 0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69, - 0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x63,0x30,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x7d,0x0a, - 0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74, - 0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, - 0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65, - 0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f, - 0x6c,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e, - 0x63,0x6f,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61, - 0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f, - 0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73, - 0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x63,0x30,0x20,0x3d, - 0x20,0x63,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, - 0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a, - 0x00, + 0x63,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56, + 0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x20,0x3a,0x20,0x54,0x45, + 0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72, + 0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f, + 0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x34,0x20,0x66,0x63,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67, + 0x65,0x74,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72, + 0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, + 0x66,0x63,0x20,0x3d,0x20,0x63,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56, + 0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61, + 0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49, + 0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74, + 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x20,0x3d,0x20,0x73,0x74,0x61,0x67, + 0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x63,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, + 0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70, + 0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75, + 0x74,0x2e,0x66,0x63,0x20,0x3d,0x20,0x66,0x63,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72, + 0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70, + 0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, +}; +/* + cbuffer Vparam : register(b0) + { + row_major float4x4 _70_mvp : packoffset(c0); + }; + + + static float4 gl_Position; + static int gl_InstanceIndex; + static float2 geom; + static float len; + static float3 dir; + static float3 pos; + static uint idx; + + struct SPIRV_Cross_Input + { + float2 geom : TEXCOORD0; + float3 pos : TEXCOORD1; + float3 dir : TEXCOORD2; + float len : TEXCOORD3; + uint gl_InstanceIndex : SV_InstanceID; + }; + + struct SPIRV_Cross_Output + { + nointerpolation uint idx : TEXCOORD0; + float4 gl_Position : SV_Position; + }; + + float2 rotatez(float2 v, float c, float s) + { + return mul(v, float2x2(float2(c, s), float2(-s, c))); + } + + void vert_main() + { + float2 param = geom * float2(len, 1.0f); + float param_1 = dir.x; + float param_2 = dir.y; + gl_Position = mul(float4(float3(rotatez(param, param_1, param_2), 0.0f) + pos, 1.0f), _70_mvp); + idx = uint(gl_InstanceIndex + 1); + } + + SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) + { + gl_InstanceIndex = int(stage_input.gl_InstanceIndex); + geom = stage_input.geom; + len = stage_input.len; + dir = stage_input.dir; + pos = stage_input.pos; + vert_main(); + SPIRV_Cross_Output stage_output; + stage_output.gl_Position = gl_Position; + stage_output.idx = idx; + return stage_output; + } +*/ +static const uint8_t node_vsoff_source_hlsl5[1278] = { + 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, + 0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x5f,0x37,0x30,0x5f,0x6d,0x76,0x70,0x20,0x3a, + 0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,0x30,0x29,0x3b, + 0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, + 0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x49, + 0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x3b,0x0a,0x73,0x74, + 0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x67,0x65,0x6f,0x6d, + 0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6c, + 0x65,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74, + 0x33,0x20,0x64,0x69,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63, + 0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75, + 0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49, + 0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, + 0x32,0x20,0x67,0x65,0x6f,0x6d,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52, + 0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70, + 0x6f,0x73,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x64,0x69,0x72,0x20,0x3a, + 0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x66,0x6c,0x6f,0x61,0x74,0x20,0x6c,0x65,0x6e,0x20,0x3a,0x20,0x54,0x45,0x58,0x43, + 0x4f,0x4f,0x52,0x44,0x33,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20, + 0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78, + 0x20,0x3a,0x20,0x53,0x56,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x44, + 0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49, + 0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x0a, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x6e,0x6f,0x69,0x6e,0x74,0x65,0x72,0x70,0x6f,0x6c, + 0x61,0x74,0x69,0x6f,0x6e,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x3a, + 0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69, + 0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, + 0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x72,0x6f,0x74, + 0x61,0x74,0x65,0x7a,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x2c,0x20,0x66, + 0x6c,0x6f,0x61,0x74,0x20,0x63,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x29, + 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x75, + 0x6c,0x28,0x76,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x78,0x32,0x28,0x66,0x6c, + 0x6f,0x61,0x74,0x32,0x28,0x63,0x2c,0x20,0x73,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x29,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a, + 0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29, + 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61, + 0x72,0x61,0x6d,0x20,0x3d,0x20,0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x32,0x28,0x6c,0x65,0x6e,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x31,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, + 0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x64, + 0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, + 0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28,0x66,0x6c,0x6f,0x61, + 0x74,0x34,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x72,0x6f,0x74,0x61,0x74,0x65, + 0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, + 0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30,0x2e,0x30,0x66, + 0x29,0x20,0x2b,0x20,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x2c,0x20, + 0x5f,0x37,0x30,0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64, + 0x78,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74, + 0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x20,0x2b,0x20,0x31,0x29,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f, + 0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56, + 0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61, + 0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, + 0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78, + 0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70, + 0x75,0x74,0x2e,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e, + 0x64,0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x65,0x6f,0x6d,0x20,0x3d, + 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x67,0x65,0x6f, + 0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x6e,0x20,0x3d,0x20,0x73,0x74,0x61, + 0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x6c,0x65,0x6e,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x64,0x69,0x72,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e, + 0x70,0x75,0x74,0x2e,0x64,0x69,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f,0x73, + 0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x70, + 0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69, + 0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, + 0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67, + 0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74, + 0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f, + 0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69, + 0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f, + 0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x69,0x64,0x78,0x20,0x3d,0x20,0x69,0x64,0x78, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61, + 0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, +}; +/* + static uint fc; + static uint idx; + + struct SPIRV_Cross_Input + { + nointerpolation uint idx : TEXCOORD0; + }; + + struct SPIRV_Cross_Output + { + uint fc : SV_Target0; + }; + + void frag_main() + { + fc = idx; + } + + SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) + { + idx = stage_input.idx; + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.fc = fc; + return stage_output; + } +*/ +static const uint8_t node_fsoff_source_hlsl5[393] = { + 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74,0x20,0x66,0x63,0x3b,0x0a, + 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b, + 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, + 0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20, + 0x20,0x6e,0x6f,0x69,0x6e,0x74,0x65,0x72,0x70,0x6f,0x6c,0x61,0x74,0x69,0x6f,0x6e, + 0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x3a,0x20,0x54,0x45,0x58,0x43, + 0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63, + 0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75, + 0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20, + 0x66,0x63,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x30,0x3b, + 0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d, + 0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x63,0x20,0x3d, + 0x20,0x69,0x64,0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, + 0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e, + 0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70, + 0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x73,0x74,0x61,0x67, + 0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x69,0x64,0x78,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75, + 0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75, + 0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74, + 0x70,0x75,0x74,0x2e,0x66,0x63,0x20,0x3d,0x20,0x66,0x63,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75, + 0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, }; /* #pragma clang diagnostic ignored "-Wmissing-prototypes" @@ -445,7 +842,7 @@ static const uint8_t n_fs_source_hlsl5[385] = { struct main0_out { - float4 col [[user(locn0)]]; + float4 c [[user(locn0)]]; float4 gl_Position [[position]]; }; @@ -454,7 +851,7 @@ static const uint8_t n_fs_source_hlsl5[385] = { float2 geom [[attribute(0)]]; float3 pos [[attribute(1)]]; float3 dir [[attribute(2)]]; - float4 col0 [[attribute(3)]]; + float4 col [[attribute(3)]]; float len [[attribute(4)]]; }; @@ -471,12 +868,12 @@ static const uint8_t n_fs_source_hlsl5[385] = { float param_1 = in.dir.x; float param_2 = in.dir.y; out.gl_Position = _70.mvp * float4(float3(rotatez(param, param_1, param_2), 0.0) + in.pos, 1.0); - out.col = in.col0; + out.c = in.col; return out; } */ -static const uint8_t n_vs_source_metal_macos[1001] = { +static const uint8_t node_vs_source_metal_macos[995] = { 0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x63,0x6c,0x61,0x6e,0x67,0x20,0x64,0x69, 0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x20,0x69,0x67,0x6e,0x6f,0x72,0x65,0x64, 0x20,0x22,0x2d,0x57,0x6d,0x69,0x73,0x73,0x69,0x6e,0x67,0x2d,0x70,0x72,0x6f,0x74, @@ -489,57 +886,57 @@ static const uint8_t n_vs_source_metal_macos[1001] = { 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x6d,0x76, 0x70,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61, 0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28, - 0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d, - 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, - 0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20, - 0x67,0x65,0x6f,0x6d,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65, - 0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x33,0x20,0x70,0x6f,0x73,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74, - 0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x33,0x20,0x64,0x69,0x72,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75, - 0x74,0x65,0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69, - 0x62,0x75,0x74,0x65,0x28,0x33,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x6c,0x65,0x6e,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69, - 0x62,0x75,0x74,0x65,0x28,0x34,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73, - 0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61, - 0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61, - 0x79,0x73,0x5f,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f,0x61, - 0x74,0x32,0x20,0x72,0x6f,0x74,0x61,0x74,0x65,0x7a,0x28,0x74,0x68,0x72,0x65,0x61, - 0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x26,0x20, - 0x76,0x2c,0x20,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,0x63,0x2c,0x20,0x74,0x68,0x72,0x65,0x61,0x64, - 0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,0x73,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x32,0x78,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x63,0x2c, - 0x20,0x73,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x73,0x2c,0x20, - 0x63,0x29,0x29,0x20,0x2a,0x20,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x72,0x74, - 0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69, - 0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b, - 0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e, - 0x73,0x74,0x61,0x6e,0x74,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x26,0x20,0x5f,0x37, - 0x30,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74, - 0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x69,0x6e, - 0x2e,0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x69, - 0x6e,0x2e,0x6c,0x65,0x6e,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d, - 0x20,0x69,0x6e,0x2e,0x64,0x69,0x72,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x69, - 0x6e,0x2e,0x64,0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74, - 0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f, - 0x37,0x30,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28, - 0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x72,0x6f,0x74,0x61,0x74,0x65,0x7a,0x28,0x70, - 0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2b,0x20, - 0x69,0x6e,0x2e,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63, - 0x6f,0x6c,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20, - 0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x6f,0x61,0x74,0x34,0x20,0x63,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f, + 0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b, + 0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a, + 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e, + 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x67,0x65, + 0x6f,0x6d,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30, + 0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20, + 0x70,0x6f,0x73,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28, + 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33, + 0x20,0x64,0x69,0x72,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65, + 0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, + 0x34,0x20,0x63,0x6f,0x6c,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74, + 0x65,0x28,0x33,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x20,0x6c,0x65,0x6e,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74, + 0x65,0x28,0x34,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74, + 0x69,0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74,0x72, + 0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73,0x5f, + 0x69,0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20, + 0x72,0x6f,0x74,0x61,0x74,0x65,0x7a,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63, + 0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x26,0x20,0x76,0x2c,0x20, + 0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f, + 0x61,0x74,0x26,0x20,0x63,0x2c,0x20,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f, + 0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,0x73,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74, + 0x32,0x78,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x63,0x2c,0x20,0x73,0x29, + 0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x29,0x29, + 0x20,0x2a,0x20,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20, + 0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28, + 0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74, + 0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61, + 0x6e,0x74,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x26,0x20,0x5f,0x37,0x30,0x20,0x5b, + 0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75, + 0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x67,0x65, + 0x6f,0x6d,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x69,0x6e,0x2e,0x6c, + 0x65,0x6e,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x69,0x6e, + 0x2e,0x64,0x69,0x72,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x64, + 0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c, + 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x37,0x30,0x2e, + 0x6d,0x76,0x70,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x66,0x6c,0x6f, + 0x61,0x74,0x33,0x28,0x72,0x6f,0x74,0x61,0x74,0x65,0x7a,0x28,0x70,0x61,0x72,0x61, + 0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61, + 0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2b,0x20,0x69,0x6e,0x2e, + 0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f, + 0x75,0x74,0x2e,0x63,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d, + 0x0a,0x0a,0x00, }; /* #include @@ -549,57 +946,307 @@ static const uint8_t n_vs_source_metal_macos[1001] = { struct main0_out { - float4 c0 [[color(0)]]; + float4 fc [[color(0)]]; }; struct main0_in { - float4 col [[user(locn0)]]; + float4 c [[user(locn0)]]; }; fragment main0_out main0(main0_in in [[stage_in]]) { main0_out out = {}; - out.c0 = in.col; + out.fc = in.c; return out; } */ -static const uint8_t n_fs_source_metal_macos[295] = { +static const uint8_t node_fs_source_metal_macos[291] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d, 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x30,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72, + 0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x63,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72, 0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63, 0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x20,0x5b,0x5b,0x75,0x73, - 0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a, - 0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, - 0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f, - 0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72, + 0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66, + 0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75, + 0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e, + 0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d, + 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75, + 0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x6f,0x75,0x74,0x2e,0x66,0x63,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d, + 0x0a,0x0a,0x00, +}; +/* + #pragma clang diagnostic ignored "-Wmissing-prototypes" + + #include + #include + + using namespace metal; + + struct Vparam + { + float4x4 mvp; + }; + + struct main0_out + { + uint idx [[user(locn0)]]; + float4 gl_Position [[position]]; + }; + + struct main0_in + { + float2 geom [[attribute(0)]]; + float3 pos [[attribute(1)]]; + float3 dir [[attribute(2)]]; + float len [[attribute(3)]]; + }; + + static inline __attribute__((always_inline)) + float2 rotatez(thread const float2& v, thread const float& c, thread const float& s) + { + return float2x2(float2(c, s), float2(-s, c)) * v; + } + + vertex main0_out main0(main0_in in [[stage_in]], constant Vparam& _70 [[buffer(0)]], uint gl_InstanceIndex [[instance_id]]) + { + main0_out out = {}; + float2 param = in.geom * float2(in.len, 1.0); + float param_1 = in.dir.x; + float param_2 = in.dir.y; + out.gl_Position = _70.mvp * float4(float3(rotatez(param, param_1, param_2), 0.0) + in.pos, 1.0); + out.idx = uint(int(gl_InstanceIndex) + 1); + return out; + } + +*/ +static const uint8_t node_vsoff_source_metal_macos[1028] = { + 0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x63,0x6c,0x61,0x6e,0x67,0x20,0x64,0x69, + 0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x20,0x69,0x67,0x6e,0x6f,0x72,0x65,0x64, + 0x20,0x22,0x2d,0x57,0x6d,0x69,0x73,0x73,0x69,0x6e,0x67,0x2d,0x70,0x72,0x6f,0x74, + 0x6f,0x74,0x79,0x70,0x65,0x73,0x22,0x0a,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64, + 0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,0x73,0x74,0x64,0x6c,0x69,0x62,0x3e, + 0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f, + 0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,0x75,0x73,0x69,0x6e,0x67,0x20,0x6e, + 0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a, + 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x0a,0x7b, + 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x6d,0x76, + 0x70,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61, + 0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69, + 0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f, + 0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b, + 0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a, + 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e, + 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x67,0x65, + 0x6f,0x6d,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30, + 0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20, + 0x70,0x6f,0x73,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28, + 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33, + 0x20,0x64,0x69,0x72,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65, + 0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, + 0x20,0x6c,0x65,0x6e,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65, + 0x28,0x33,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69, + 0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74,0x72,0x69, + 0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73,0x5f,0x69, + 0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x72, + 0x6f,0x74,0x61,0x74,0x65,0x7a,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f, + 0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x26,0x20,0x76,0x2c,0x20,0x74, + 0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x26,0x20,0x63,0x2c,0x20,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e, + 0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,0x73,0x29,0x0a,0x7b,0x0a,0x20, + 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, + 0x78,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x63,0x2c,0x20,0x73,0x29,0x2c, + 0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x29,0x29,0x20, + 0x2a,0x20,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d, + 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d, + 0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61, + 0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e, + 0x74,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x26,0x20,0x5f,0x37,0x30,0x20,0x5b,0x5b, + 0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x75,0x69,0x6e, + 0x74,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64, + 0x65,0x78,0x20,0x5b,0x5b,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x5f,0x69,0x64, 0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f, 0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x30,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f, - 0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75, - 0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d, + 0x20,0x69,0x6e,0x2e,0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74, + 0x32,0x28,0x69,0x6e,0x2e,0x6c,0x65,0x6e,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, + 0x31,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x64,0x69,0x72,0x2e,0x78,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20, + 0x3d,0x20,0x69,0x6e,0x2e,0x64,0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, + 0x3d,0x20,0x5f,0x37,0x30,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61, + 0x74,0x34,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x72,0x6f,0x74,0x61,0x74,0x65, + 0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, + 0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29, + 0x20,0x2b,0x20,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x69,0x64,0x78,0x20,0x3d,0x20,0x75, + 0x69,0x6e,0x74,0x28,0x69,0x6e,0x74,0x28,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61, + 0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x29,0x20,0x2b,0x20,0x31,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, +}; +/* + #include + #include + + using namespace metal; + + struct main0_out + { + uint fc [[color(0)]]; + }; + + struct main0_in + { + uint idx [[user(locn0)]]; + }; + + fragment main0_out main0(main0_in in [[stage_in]]) + { + main0_out out = {}; + out.fc = in.idx; + return out; + } + +*/ +static const uint8_t node_fsoff_source_metal_macos[291] = { + 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, + 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, + 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, + 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, + 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d, + 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75, + 0x69,0x6e,0x74,0x20,0x66,0x63,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30, + 0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, + 0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75, + 0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c, + 0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61, + 0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20, + 0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69, + 0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20, + 0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75, + 0x74,0x2e,0x66,0x63,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x69,0x64,0x78,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d, + 0x0a,0x0a,0x00, }; -const sg_shader_desc* n_node_shader_desc(sg_backend backend) { +const sg_shader_desc* node_idx_shader_desc(sg_backend backend) { + if (backend == SG_BACKEND_GLCORE) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vertex_func.source = (const char*)node_vsoff_source_glsl430; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = (const char*)node_fsoff_source_glsl430; + desc.fragment_func.entry = "main"; + desc.attrs[0].glsl_name = "geom"; + desc.attrs[1].glsl_name = "pos"; + desc.attrs[2].glsl_name = "dir"; + desc.attrs[3].glsl_name = "len"; + desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; + desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.uniform_blocks[0].size = 64; + desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "Vparam"; + desc.label = "node_idx_shader"; + } + return &desc; + } + if (backend == SG_BACKEND_GLES3) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vertex_func.source = (const char*)node_vsoff_source_glsl300es; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = (const char*)node_fsoff_source_glsl300es; + desc.fragment_func.entry = "main"; + desc.attrs[0].glsl_name = "geom"; + desc.attrs[1].glsl_name = "pos"; + desc.attrs[2].glsl_name = "dir"; + desc.attrs[3].glsl_name = "len"; + desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; + desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.uniform_blocks[0].size = 64; + desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; + desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "Vparam"; + desc.label = "node_idx_shader"; + } + return &desc; + } + if (backend == SG_BACKEND_D3D11) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vertex_func.source = (const char*)node_vsoff_source_hlsl5; + desc.vertex_func.d3d11_target = "vs_5_0"; + desc.vertex_func.entry = "main"; + desc.fragment_func.source = (const char*)node_fsoff_source_hlsl5; + desc.fragment_func.d3d11_target = "ps_5_0"; + desc.fragment_func.entry = "main"; + desc.attrs[0].hlsl_sem_name = "TEXCOORD"; + desc.attrs[0].hlsl_sem_index = 0; + desc.attrs[1].hlsl_sem_name = "TEXCOORD"; + desc.attrs[1].hlsl_sem_index = 1; + desc.attrs[2].hlsl_sem_name = "TEXCOORD"; + desc.attrs[2].hlsl_sem_index = 2; + desc.attrs[3].hlsl_sem_name = "TEXCOORD"; + desc.attrs[3].hlsl_sem_index = 3; + desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; + desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.uniform_blocks[0].size = 64; + desc.uniform_blocks[0].hlsl_register_b_n = 0; + desc.label = "node_idx_shader"; + } + return &desc; + } + if (backend == SG_BACKEND_METAL_MACOS) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vertex_func.source = (const char*)node_vsoff_source_metal_macos; + desc.vertex_func.entry = "main0"; + desc.fragment_func.source = (const char*)node_fsoff_source_metal_macos; + desc.fragment_func.entry = "main0"; + desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; + desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.uniform_blocks[0].size = 64; + desc.uniform_blocks[0].msl_buffer_n = 0; + desc.label = "node_idx_shader"; + } + return &desc; + } + return 0; +} +const sg_shader_desc* node_s_shader_desc(sg_backend backend) { if (backend == SG_BACKEND_GLCORE) { static sg_shader_desc desc; static bool valid; if (!valid) { valid = true; - desc.vertex_func.source = (const char*)n_vs_source_glsl430; + desc.vertex_func.source = (const char*)node_vs_source_glsl430; desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)n_fs_source_glsl430; + desc.fragment_func.source = (const char*)node_fs_source_glsl430; desc.fragment_func.entry = "main"; desc.attrs[0].glsl_name = "geom"; desc.attrs[1].glsl_name = "pos"; desc.attrs[2].glsl_name = "dir"; - desc.attrs[3].glsl_name = "col0"; + desc.attrs[3].glsl_name = "col"; desc.attrs[4].glsl_name = "len"; desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; @@ -607,7 +1254,7 @@ const sg_shader_desc* n_node_shader_desc(sg_backend backend) { desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "Vparam"; - desc.label = "n_node_shader"; + desc.label = "node_s_shader"; } return &desc; } @@ -616,14 +1263,14 @@ const sg_shader_desc* n_node_shader_desc(sg_backend backend) { static bool valid; if (!valid) { valid = true; - desc.vertex_func.source = (const char*)n_vs_source_glsl300es; + desc.vertex_func.source = (const char*)node_vs_source_glsl300es; desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)n_fs_source_glsl300es; + desc.fragment_func.source = (const char*)node_fs_source_glsl300es; desc.fragment_func.entry = "main"; desc.attrs[0].glsl_name = "geom"; desc.attrs[1].glsl_name = "pos"; desc.attrs[2].glsl_name = "dir"; - desc.attrs[3].glsl_name = "col0"; + desc.attrs[3].glsl_name = "col"; desc.attrs[4].glsl_name = "len"; desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; @@ -631,7 +1278,7 @@ const sg_shader_desc* n_node_shader_desc(sg_backend backend) { desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "Vparam"; - desc.label = "n_node_shader"; + desc.label = "node_s_shader"; } return &desc; } @@ -640,10 +1287,10 @@ const sg_shader_desc* n_node_shader_desc(sg_backend backend) { static bool valid; if (!valid) { valid = true; - desc.vertex_func.source = (const char*)n_vs_source_hlsl5; + desc.vertex_func.source = (const char*)node_vs_source_hlsl5; desc.vertex_func.d3d11_target = "vs_5_0"; desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)n_fs_source_hlsl5; + desc.fragment_func.source = (const char*)node_fs_source_hlsl5; desc.fragment_func.d3d11_target = "ps_5_0"; desc.fragment_func.entry = "main"; desc.attrs[0].hlsl_sem_name = "TEXCOORD"; @@ -660,7 +1307,7 @@ const sg_shader_desc* n_node_shader_desc(sg_backend backend) { desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; desc.uniform_blocks[0].size = 64; desc.uniform_blocks[0].hlsl_register_b_n = 0; - desc.label = "n_node_shader"; + desc.label = "node_s_shader"; } return &desc; } @@ -669,15 +1316,15 @@ const sg_shader_desc* n_node_shader_desc(sg_backend backend) { static bool valid; if (!valid) { valid = true; - desc.vertex_func.source = (const char*)n_vs_source_metal_macos; + desc.vertex_func.source = (const char*)node_vs_source_metal_macos; desc.vertex_func.entry = "main0"; - desc.fragment_func.source = (const char*)n_fs_source_metal_macos; + desc.fragment_func.source = (const char*)node_fs_source_metal_macos; desc.fragment_func.entry = "main0"; desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; desc.uniform_blocks[0].size = 64; desc.uniform_blocks[0].msl_buffer_n = 0; - desc.label = "n_node_shader"; + desc.label = "node_s_shader"; } return &desc; } diff --git a/glsl/nodeidx.glsl b/glsl/nodeidx.glsl deleted file mode 100644 index 228b8e8..0000000 --- a/glsl/nodeidx.glsl +++ /dev/null @@ -1,47 +0,0 @@ -@module ni - -@vs vs -@glsl_options fixup_clipspace - -precision mediump float; - -layout(binding=0) uniform Vparam { - mat4 mvp; -}; -in vec2 geom; -in vec3 pos; -in vec3 dir; -in vec4 col0; -in float len; -out vec4 col; -flat out uint idx; - -vec2 rotatez(vec2 v, float c, float s){ - return mat2(c, s, -s, c) * v; -} - -void main(){ - vec2 g = geom * vec2(len, 1.0); - vec3 r = vec3(rotatez(g, dir.x, dir.y), 0.0); - gl_Position = mvp * vec4(r + pos, 1.0); - col = col0; - idx = gl_InstanceIndex + 1; -} -@end - -@fs fs -precision mediump float; - -in vec4 col; -flat in uint idx; - -layout(location=0) out vec4 c0; -layout(location=1) out uint c1; - -void main(){ - c0 = col; - c1 = idx; -} -@end - -@program nodeidx vs fs diff --git a/glsl/nodeidx.h b/glsl/nodeidx.h deleted file mode 100644 index 250019e..0000000 --- a/glsl/nodeidx.h +++ /dev/null @@ -1,772 +0,0 @@ -#pragma once -/* - #version:1# (machine generated, don't edit!) - - Generated by sokol-shdc (https://github.com/floooh/sokol-tools) - - Cmdline: - sokol-shdc -f sokol_impl -i glsl/nodeidx.glsl -l glsl430:hlsl5:metal_macos:glsl300es -o glsl/nodeidx.h - - Overview: - ========= - Shader program: 'nodeidx': - Get shader desc: ni_nodeidx_shader_desc(sg_query_backend()); - Vertex Shader: vs - Fragment Shader: fs - Attributes: - ATTR_nodeidx_geom => 0 - ATTR_nodeidx_pos => 1 - ATTR_nodeidx_dir => 2 - ATTR_nodeidx_col0 => 3 - ATTR_nodeidx_len => 4 - Bindings: - Uniform block 'Vparam': - C struct: ni_Vparam_t - Bind slot: UB_Vparam => 0 -*/ -#if !defined(SOKOL_GFX_INCLUDED) -#error "Please include sokol_gfx.h before nodeidx.h" -#endif -#if !defined(SOKOL_SHDC_ALIGN) -#if defined(_MSC_VER) -#define SOKOL_SHDC_ALIGN(a) __declspec(align(a)) -#else -#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a))) -#endif -#endif -const sg_shader_desc* ni_nodeidx_shader_desc(sg_backend backend); -#define ATTR_nodeidx_geom (0) -#define ATTR_nodeidx_pos (1) -#define ATTR_nodeidx_dir (2) -#define ATTR_nodeidx_col0 (3) -#define ATTR_nodeidx_len (4) -#define UB_Vparam (0) -#pragma pack(push,1) -SOKOL_SHDC_ALIGN(16) typedef struct ni_Vparam_t { - float mvp[16]; -} ni_Vparam_t; -#pragma pack(pop) -#if defined(SOKOL_SHDC_IMPL) -/* - #version 430 - - uniform vec4 Vparam[4]; - layout(location = 0) in vec2 geom; - layout(location = 4) in float len; - layout(location = 2) in vec3 dir; - layout(location = 1) in vec3 pos; - layout(location = 0) out vec4 col; - layout(location = 3) in vec4 col0; - layout(location = 1) flat out uint idx; - - vec2 rotatez(vec2 v, float c, float s) - { - return mat2(vec2(c, s), vec2(-s, c)) * v; - } - - void main() - { - vec2 param = geom * vec2(len, 1.0); - float param_1 = dir.x; - float param_2 = dir.y; - gl_Position = mat4(Vparam[0], Vparam[1], Vparam[2], Vparam[3]) * vec4(vec3(rotatez(param, param_1, param_2), 0.0) + pos, 1.0); - col = col0; - idx = uint(gl_InstanceID + 1); - gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; - } - -*/ -static const uint8_t ni_vs_source_glsl430[728] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e, - 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61, - 0x6d,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, - 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65, - 0x63,0x32,0x20,0x67,0x65,0x6f,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, - 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x34,0x29,0x20,0x69,0x6e, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6c,0x65,0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f, - 0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29, - 0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x64,0x69,0x72,0x3b,0x0a,0x6c,0x61, - 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, - 0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a, - 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, - 0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f, - 0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69, - 0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20, - 0x63,0x6f,0x6c,0x30,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, - 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x66,0x6c,0x61,0x74,0x20, - 0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x76, - 0x65,0x63,0x32,0x20,0x72,0x6f,0x74,0x61,0x74,0x65,0x7a,0x28,0x76,0x65,0x63,0x32, - 0x20,0x76,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63,0x2c,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x20,0x73,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75, - 0x72,0x6e,0x20,0x6d,0x61,0x74,0x32,0x28,0x76,0x65,0x63,0x32,0x28,0x63,0x2c,0x20, - 0x73,0x29,0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x29,0x29, - 0x20,0x2a,0x20,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, - 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20, - 0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x76, - 0x65,0x63,0x32,0x28,0x6c,0x65,0x6e,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, - 0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x64,0x69, - 0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69, - 0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x56,0x70,0x61,0x72, - 0x61,0x6d,0x5b,0x30,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x31,0x5d, - 0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x32,0x5d,0x2c,0x20,0x56,0x70,0x61, - 0x72,0x61,0x6d,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76, - 0x65,0x63,0x33,0x28,0x72,0x6f,0x74,0x61,0x74,0x65,0x7a,0x28,0x70,0x61,0x72,0x61, - 0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2b,0x20,0x70,0x6f,0x73, - 0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x20, - 0x3d,0x20,0x63,0x6f,0x6c,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20, - 0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e, - 0x63,0x65,0x49,0x44,0x20,0x2b,0x20,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67, - 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x3d,0x20,0x32, - 0x2e,0x30,0x20,0x2a,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x2e,0x7a,0x20,0x2d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x2e,0x77,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -/* - #version 430 - - layout(location = 0) out vec4 c0; - layout(location = 0) in vec4 col; - layout(location = 1) out uint c1; - layout(location = 1) flat in uint idx; - - void main() - { - c0 = col; - c1 = idx; - } - -*/ -static const uint8_t ni_fs_source_glsl430[202] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61, - 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, - 0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x30,0x3b,0x0a, - 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, - 0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c, - 0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, - 0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20, - 0x63,0x31,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74, - 0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x66,0x6c,0x61,0x74,0x20,0x69,0x6e, - 0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64, - 0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x30, - 0x20,0x3d,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x31,0x20,0x3d, - 0x20,0x69,0x64,0x78,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -/* - #version 300 es - - uniform mediump vec4 Vparam[4]; - layout(location = 0) in mediump vec2 geom; - layout(location = 4) in mediump float len; - layout(location = 2) in mediump vec3 dir; - layout(location = 1) in mediump vec3 pos; - out mediump vec4 col; - layout(location = 3) in mediump vec4 col0; - flat out uint idx; - - mediump vec2 rotatez(mediump vec2 v, mediump float c, mediump float s) - { - return mat2(vec2(c, s), vec2(-s, c)) * v; - } - - void main() - { - mediump vec2 param = geom * vec2(len, 1.0); - mediump float param_1 = dir.x; - mediump float param_2 = dir.y; - gl_Position = mat4(Vparam[0], Vparam[1], Vparam[2], Vparam[3]) * vec4(vec3(rotatez(param, param_1, param_2), 0.0) + pos, 1.0); - col = col0; - idx = uint(gl_InstanceID + 1); - gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; - } - -*/ -static const uint8_t ni_vs_source_glsl300es[801] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, - 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, - 0x20,0x76,0x65,0x63,0x34,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x34,0x5d,0x3b, - 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, - 0x20,0x76,0x65,0x63,0x32,0x20,0x67,0x65,0x6f,0x6d,0x3b,0x0a,0x6c,0x61,0x79,0x6f, - 0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x34,0x29, - 0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x20,0x6c,0x65,0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f, - 0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x6d, - 0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x64,0x69,0x72,0x3b, - 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, - 0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x6d, - 0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x3b, - 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70, - 0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x30,0x3b,0x0a,0x66,0x6c,0x61,0x74, - 0x20,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a, - 0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x72,0x6f,0x74, - 0x61,0x74,0x65,0x7a,0x28,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x76,0x65,0x63, - 0x32,0x20,0x76,0x2c,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x20,0x63,0x2c,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x20,0x73,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74, - 0x75,0x72,0x6e,0x20,0x6d,0x61,0x74,0x32,0x28,0x76,0x65,0x63,0x32,0x28,0x63,0x2c, - 0x20,0x73,0x29,0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x29, - 0x29,0x20,0x2a,0x20,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d, - 0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x65,0x64,0x69, - 0x75,0x6d,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d, - 0x20,0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x76,0x65,0x63,0x32,0x28,0x6c,0x65,0x6e, - 0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x65,0x64,0x69, - 0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, - 0x31,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d, - 0x65,0x64,0x69,0x75,0x6d,0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72, - 0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, - 0x6d,0x61,0x74,0x34,0x28,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x30,0x5d,0x2c,0x20, - 0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x31,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61, - 0x6d,0x5b,0x32,0x5d,0x2c,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x5b,0x33,0x5d,0x29, - 0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x65,0x63,0x33,0x28,0x72,0x6f,0x74, - 0x61,0x74,0x65,0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30, - 0x2e,0x30,0x29,0x20,0x2b,0x20,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x30,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28, - 0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x44,0x20,0x2b,0x20, - 0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, - 0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x3d,0x20,0x32,0x2e,0x30,0x20,0x2a,0x20,0x67,0x6c, - 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x2d,0x20,0x67,0x6c, - 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x77,0x3b,0x0a,0x7d,0x0a,0x0a, - 0x00, -}; -/* - #version 300 es - precision mediump float; - precision highp int; - - layout(location = 0) out vec4 c0; - in vec4 col; - layout(location = 1) out uint c1; - flat in uint idx; - - void main() - { - c0 = col; - c1 = idx; - } - -*/ -static const uint8_t ni_fs_source_glsl300es[209] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, - 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, - 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, - 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x6c, - 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, - 0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x30,0x3b, - 0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x6c,0x61, - 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, - 0x31,0x29,0x20,0x6f,0x75,0x74,0x20,0x75,0x69,0x6e,0x74,0x20,0x63,0x31,0x3b,0x0a, - 0x66,0x6c,0x61,0x74,0x20,0x69,0x6e,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78, - 0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x63,0x30,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x63,0x31,0x20,0x3d,0x20,0x69,0x64,0x78,0x3b,0x0a,0x7d,0x0a,0x0a, - 0x00, -}; -/* - cbuffer Vparam : register(b0) - { - row_major float4x4 _70_mvp : packoffset(c0); - }; - - - static float4 gl_Position; - static int gl_InstanceIndex; - static float2 geom; - static float len; - static float3 dir; - static float3 pos; - static float4 col; - static float4 col0; - static uint idx; - - struct SPIRV_Cross_Input - { - float2 geom : TEXCOORD0; - float3 pos : TEXCOORD1; - float3 dir : TEXCOORD2; - float4 col0 : TEXCOORD3; - float len : TEXCOORD4; - uint gl_InstanceIndex : SV_InstanceID; - }; - - struct SPIRV_Cross_Output - { - float4 col : TEXCOORD0; - nointerpolation uint idx : TEXCOORD1; - float4 gl_Position : SV_Position; - }; - - float2 rotatez(float2 v, float c, float s) - { - return mul(v, float2x2(float2(c, s), float2(-s, c))); - } - - void vert_main() - { - float2 param = geom * float2(len, 1.0f); - float param_1 = dir.x; - float param_2 = dir.y; - gl_Position = mul(float4(float3(rotatez(param, param_1, param_2), 0.0f) + pos, 1.0f), _70_mvp); - col = col0; - idx = uint(gl_InstanceIndex + 1); - } - - SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) - { - gl_InstanceIndex = int(stage_input.gl_InstanceIndex); - geom = stage_input.geom; - len = stage_input.len; - dir = stage_input.dir; - pos = stage_input.pos; - col0 = stage_input.col0; - vert_main(); - SPIRV_Cross_Output stage_output; - stage_output.gl_Position = gl_Position; - stage_output.col = col; - stage_output.idx = idx; - return stage_output; - } -*/ -static const uint8_t ni_vs_source_hlsl5[1447] = { - 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, - 0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x72,0x6f,0x77,0x5f,0x6d,0x61,0x6a,0x6f,0x72,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x5f,0x37,0x30,0x5f,0x6d,0x76,0x70,0x20,0x3a, - 0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x63,0x30,0x29,0x3b, - 0x0a,0x7d,0x3b,0x0a,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, - 0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x49, - 0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x3b,0x0a,0x73,0x74, - 0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x67,0x65,0x6f,0x6d, - 0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6c, - 0x65,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x33,0x20,0x64,0x69,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x73,0x74,0x61, - 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x30,0x3b, - 0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78, - 0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f, - 0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x67,0x65,0x6f,0x6d,0x20,0x3a,0x20, - 0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x6f,0x73,0x20,0x3a,0x20,0x54,0x45,0x58,0x43, - 0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x33,0x20,0x64,0x69,0x72,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44, - 0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f, - 0x6c,0x30,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x33,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6c,0x65,0x6e,0x20,0x3a,0x20, - 0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75, - 0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49, - 0x6e,0x64,0x65,0x78,0x20,0x3a,0x20,0x53,0x56,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e, - 0x63,0x65,0x49,0x44,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74, - 0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74, - 0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34, - 0x20,0x63,0x6f,0x6c,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x6e,0x6f,0x69,0x6e,0x74,0x65,0x72,0x70,0x6f,0x6c, - 0x61,0x74,0x69,0x6f,0x6e,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x3a, - 0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69, - 0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x72,0x6f,0x74, - 0x61,0x74,0x65,0x7a,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x2c,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x63,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x75, - 0x6c,0x28,0x76,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x78,0x32,0x28,0x66,0x6c, - 0x6f,0x61,0x74,0x32,0x28,0x63,0x2c,0x20,0x73,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x29,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a, - 0x76,0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61, - 0x72,0x61,0x6d,0x20,0x3d,0x20,0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x32,0x28,0x6c,0x65,0x6e,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, - 0x31,0x20,0x3d,0x20,0x64,0x69,0x72,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x64, - 0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x75,0x6c,0x28,0x66,0x6c,0x6f,0x61, - 0x74,0x34,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x72,0x6f,0x74,0x61,0x74,0x65, - 0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, - 0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30,0x2e,0x30,0x66, - 0x29,0x20,0x2b,0x20,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x2c,0x20, - 0x5f,0x37,0x30,0x5f,0x6d,0x76,0x70,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f, - 0x6c,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64, - 0x78,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74, - 0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78,0x20,0x2b,0x20,0x31,0x29,0x3b,0x0a, - 0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f, - 0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56, - 0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, - 0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65,0x78, - 0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70, - 0x75,0x74,0x2e,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e, - 0x64,0x65,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x65,0x6f,0x6d,0x20,0x3d, - 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x67,0x65,0x6f, - 0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x6e,0x20,0x3d,0x20,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x6c,0x65,0x6e,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x64,0x69,0x72,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e, - 0x70,0x75,0x74,0x2e,0x64,0x69,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f,0x73, - 0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x70, - 0x6f,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x30,0x20,0x3d,0x20,0x73, - 0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x30,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73, - 0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f, - 0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65, - 0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, - 0x69,0x6f,0x6e,0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74, - 0x70,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x20,0x3d,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e, - 0x69,0x64,0x78,0x20,0x3d,0x20,0x69,0x64,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72, - 0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70, - 0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, -}; -/* - static float4 c0; - static float4 col; - static uint c1; - static uint idx; - - struct SPIRV_Cross_Input - { - float4 col : TEXCOORD0; - nointerpolation uint idx : TEXCOORD1; - }; - - struct SPIRV_Cross_Output - { - float4 c0 : SV_Target0; - uint c1 : SV_Target1; - }; - - void frag_main() - { - c0 = col; - c1 = idx; - } - - SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) - { - col = stage_input.col; - idx = stage_input.idx; - frag_main(); - SPIRV_Cross_Output stage_output; - stage_output.c0 = c0; - stage_output.c1 = c1; - return stage_output; - } -*/ -static const uint8_t ni_fs_source_hlsl5[553] = { - 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x30, - 0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, - 0x63,0x6f,0x6c,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74, - 0x20,0x63,0x31,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x75,0x69,0x6e,0x74, - 0x20,0x69,0x64,0x78,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50, - 0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a, - 0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c, - 0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x6e,0x6f,0x69,0x6e,0x74,0x65,0x72,0x70,0x6f,0x6c,0x61,0x74,0x69,0x6f, - 0x6e,0x20,0x75,0x69,0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x3a,0x20,0x54,0x45,0x58, - 0x43,0x4f,0x4f,0x52,0x44,0x31,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75, - 0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f, - 0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x34,0x20,0x63,0x30,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65, - 0x74,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20,0x63,0x31,0x20, - 0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74,0x31,0x3b,0x0a,0x7d,0x3b, - 0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e, - 0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x30,0x20,0x3d,0x20,0x63,0x6f, - 0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x31,0x20,0x3d,0x20,0x69,0x64,0x78,0x3b, - 0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f, - 0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52, - 0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74, - 0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x63,0x6f,0x6c,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70, - 0x75,0x74,0x2e,0x63,0x6f,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x64,0x78,0x20, - 0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x69,0x64, - 0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e, - 0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72, - 0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65, - 0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x63,0x30,0x20,0x3d,0x20,0x63, - 0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74, - 0x70,0x75,0x74,0x2e,0x63,0x31,0x20,0x3d,0x20,0x63,0x31,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75, - 0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, -}; -/* - #pragma clang diagnostic ignored "-Wmissing-prototypes" - - #include - #include - - using namespace metal; - - struct Vparam - { - float4x4 mvp; - }; - - struct main0_out - { - float4 col [[user(locn0)]]; - uint idx [[user(locn1)]]; - float4 gl_Position [[position]]; - }; - - struct main0_in - { - float2 geom [[attribute(0)]]; - float3 pos [[attribute(1)]]; - float3 dir [[attribute(2)]]; - float4 col0 [[attribute(3)]]; - float len [[attribute(4)]]; - }; - - static inline __attribute__((always_inline)) - float2 rotatez(thread const float2& v, thread const float& c, thread const float& s) - { - return float2x2(float2(c, s), float2(-s, c)) * v; - } - - vertex main0_out main0(main0_in in [[stage_in]], constant Vparam& _70 [[buffer(0)]], uint gl_InstanceIndex [[instance_id]]) - { - main0_out out = {}; - float2 param = in.geom * float2(in.len, 1.0); - float param_1 = in.dir.x; - float param_2 = in.dir.y; - out.gl_Position = _70.mvp * float4(float3(rotatez(param, param_1, param_2), 0.0) + in.pos, 1.0); - out.col = in.col0; - out.idx = uint(int(gl_InstanceIndex) + 1); - return out; - } - -*/ -static const uint8_t ni_vs_source_metal_macos[1117] = { - 0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x63,0x6c,0x61,0x6e,0x67,0x20,0x64,0x69, - 0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x20,0x69,0x67,0x6e,0x6f,0x72,0x65,0x64, - 0x20,0x22,0x2d,0x57,0x6d,0x69,0x73,0x73,0x69,0x6e,0x67,0x2d,0x70,0x72,0x6f,0x74, - 0x6f,0x74,0x79,0x70,0x65,0x73,0x22,0x0a,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64, - 0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,0x73,0x74,0x64,0x6c,0x69,0x62,0x3e, - 0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f, - 0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,0x75,0x73,0x69,0x6e,0x67,0x20,0x6e, - 0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a, - 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x6d,0x76, - 0x70,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61, - 0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28, - 0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69, - 0x6e,0x74,0x20,0x69,0x64,0x78,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f, - 0x63,0x6e,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b, - 0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a, - 0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x67,0x65, - 0x6f,0x6d,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30, - 0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20, - 0x70,0x6f,0x73,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28, - 0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33, - 0x20,0x64,0x69,0x72,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65, - 0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x34,0x20,0x63,0x6f,0x6c,0x30,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75, - 0x74,0x65,0x28,0x33,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x20,0x6c,0x65,0x6e,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75, - 0x74,0x65,0x28,0x34,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x61, - 0x74,0x69,0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74, - 0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73, - 0x5f,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x32, - 0x20,0x72,0x6f,0x74,0x61,0x74,0x65,0x7a,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20, - 0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x26,0x20,0x76,0x2c, - 0x20,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x26,0x20,0x63,0x2c,0x20,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63, - 0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,0x73,0x29,0x0a,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x32,0x78,0x32,0x28,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x63,0x2c,0x20,0x73, - 0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x73,0x2c,0x20,0x63,0x29, - 0x29,0x20,0x2a,0x20,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78, - 0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30, - 0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73, - 0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74, - 0x61,0x6e,0x74,0x20,0x56,0x70,0x61,0x72,0x61,0x6d,0x26,0x20,0x5f,0x37,0x30,0x20, - 0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x75, - 0x69,0x6e,0x74,0x20,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49, - 0x6e,0x64,0x65,0x78,0x20,0x5b,0x5b,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x5f, - 0x69,0x64,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e, - 0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d, - 0x20,0x3d,0x20,0x69,0x6e,0x2e,0x67,0x65,0x6f,0x6d,0x20,0x2a,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x32,0x28,0x69,0x6e,0x2e,0x6c,0x65,0x6e,0x2c,0x20,0x31,0x2e,0x30,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x5f,0x31,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x64,0x69,0x72,0x2e,0x78,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, - 0x32,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x64,0x69,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x20,0x3d,0x20,0x5f,0x37,0x30,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x34,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x72,0x6f,0x74,0x61, - 0x74,0x65,0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x31,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x30,0x2e, - 0x30,0x29,0x20,0x2b,0x20,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x2c,0x20,0x31,0x2e,0x30, - 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x20,0x3d, - 0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75, - 0x74,0x2e,0x69,0x64,0x78,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x69,0x6e,0x74, - 0x28,0x67,0x6c,0x5f,0x49,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x49,0x6e,0x64,0x65, - 0x78,0x29,0x20,0x2b,0x20,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74, - 0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -/* - #include - #include - - using namespace metal; - - struct main0_out - { - float4 c0 [[color(0)]]; - uint c1 [[color(1)]]; - }; - - struct main0_in - { - float4 col [[user(locn0)]]; - uint idx [[user(locn1)]]; - }; - - fragment main0_out main0(main0_in in [[stage_in]]) - { - main0_out out = {}; - out.c0 = in.col; - out.c1 = in.idx; - return out; - } - -*/ -static const uint8_t ni_fs_source_metal_macos[372] = { - 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, - 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, - 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, - 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, - 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x30,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72, - 0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20, - 0x63,0x31,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x31,0x29,0x5d,0x5d,0x3b, - 0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e, - 0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74, - 0x34,0x20,0x63,0x6f,0x6c,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63, - 0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20, - 0x69,0x64,0x78,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31, - 0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e, - 0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e, - 0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b, - 0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20, - 0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20, - 0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x30, - 0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x6f,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f, - 0x75,0x74,0x2e,0x63,0x31,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x69,0x64,0x78,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a, - 0x7d,0x0a,0x0a,0x00, -}; -const sg_shader_desc* ni_nodeidx_shader_desc(sg_backend backend) { - if (backend == SG_BACKEND_GLCORE) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)ni_vs_source_glsl430; - desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)ni_fs_source_glsl430; - desc.fragment_func.entry = "main"; - desc.attrs[0].glsl_name = "geom"; - desc.attrs[1].glsl_name = "pos"; - desc.attrs[2].glsl_name = "dir"; - desc.attrs[3].glsl_name = "col0"; - desc.attrs[4].glsl_name = "len"; - desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; - desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[0].size = 64; - desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; - desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "Vparam"; - desc.label = "ni_nodeidx_shader"; - } - return &desc; - } - if (backend == SG_BACKEND_GLES3) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)ni_vs_source_glsl300es; - desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)ni_fs_source_glsl300es; - desc.fragment_func.entry = "main"; - desc.attrs[0].glsl_name = "geom"; - desc.attrs[1].glsl_name = "pos"; - desc.attrs[2].glsl_name = "dir"; - desc.attrs[3].glsl_name = "col0"; - desc.attrs[4].glsl_name = "len"; - desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; - desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[0].size = 64; - desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4; - desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "Vparam"; - desc.label = "ni_nodeidx_shader"; - } - return &desc; - } - if (backend == SG_BACKEND_D3D11) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)ni_vs_source_hlsl5; - desc.vertex_func.d3d11_target = "vs_5_0"; - desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)ni_fs_source_hlsl5; - desc.fragment_func.d3d11_target = "ps_5_0"; - desc.fragment_func.entry = "main"; - desc.attrs[0].hlsl_sem_name = "TEXCOORD"; - desc.attrs[0].hlsl_sem_index = 0; - desc.attrs[1].hlsl_sem_name = "TEXCOORD"; - desc.attrs[1].hlsl_sem_index = 1; - desc.attrs[2].hlsl_sem_name = "TEXCOORD"; - desc.attrs[2].hlsl_sem_index = 2; - desc.attrs[3].hlsl_sem_name = "TEXCOORD"; - desc.attrs[3].hlsl_sem_index = 3; - desc.attrs[4].hlsl_sem_name = "TEXCOORD"; - desc.attrs[4].hlsl_sem_index = 4; - desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; - desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[0].size = 64; - desc.uniform_blocks[0].hlsl_register_b_n = 0; - desc.label = "ni_nodeidx_shader"; - } - return &desc; - } - if (backend == SG_BACKEND_METAL_MACOS) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)ni_vs_source_metal_macos; - desc.vertex_func.entry = "main0"; - desc.fragment_func.source = (const char*)ni_fs_source_metal_macos; - desc.fragment_func.entry = "main0"; - desc.uniform_blocks[0].stage = SG_SHADERSTAGE_VERTEX; - desc.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.uniform_blocks[0].size = 64; - desc.uniform_blocks[0].msl_buffer_n = 0; - desc.label = "ni_nodeidx_shader"; - } - return &desc; - } - return 0; -} -#endif // SOKOL_SHDC_IMPL \ No newline at end of file diff --git a/glsl/scr.glsl b/glsl/scr.glsl deleted file mode 100644 index 4e2649c..0000000 --- a/glsl/scr.glsl +++ /dev/null @@ -1,27 +0,0 @@ -@module s - -@vs vs -@glsl_options flip_vert_y - -in vec2 pos; -out vec2 uv0; - -void main(){ - gl_Position = vec4(2 * pos - 1, 0.5, 1.0); - uv0 = vec2(pos.x, 1 - pos.y); -} -@end - -@fs fs - -layout(binding=0) uniform texture2D tex; -layout(binding=0) uniform sampler smp; -in vec2 uv0; -out vec4 col; - -void main(){ - col = texture(sampler2D(tex, smp), uv0); -} -@end - -@program scr vs fs diff --git a/glsl/scr.h b/glsl/scr.h deleted file mode 100644 index 743f4cf..0000000 --- a/glsl/scr.h +++ /dev/null @@ -1,507 +0,0 @@ -#pragma once -/* - #version:1# (machine generated, don't edit!) - - Generated by sokol-shdc (https://github.com/floooh/sokol-tools) - - Cmdline: - sokol-shdc -f sokol_impl -i glsl/scr.glsl -l glsl430:hlsl5:metal_macos:glsl300es -o glsl/scr.h - - Overview: - ========= - Shader program: 'scr': - Get shader desc: s_scr_shader_desc(sg_query_backend()); - Vertex Shader: vs - Fragment Shader: fs - Attributes: - ATTR_scr_pos => 0 - Bindings: - Image 'tex': - Image type: SG_IMAGETYPE_2D - Sample type: SG_IMAGESAMPLETYPE_FLOAT - Multisampled: false - Bind slot: IMG_tex => 0 - Sampler 'smp': - Type: SG_SAMPLERTYPE_FILTERING - Bind slot: SMP_smp => 0 -*/ -#if !defined(SOKOL_GFX_INCLUDED) -#error "Please include sokol_gfx.h before scr.h" -#endif -#if !defined(SOKOL_SHDC_ALIGN) -#if defined(_MSC_VER) -#define SOKOL_SHDC_ALIGN(a) __declspec(align(a)) -#else -#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a))) -#endif -#endif -const sg_shader_desc* s_scr_shader_desc(sg_backend backend); -#define ATTR_scr_pos (0) -#define IMG_tex (0) -#define SMP_smp (0) -#if defined(SOKOL_SHDC_IMPL) -/* - #version 430 - - layout(location = 0) in vec2 pos; - layout(location = 0) out vec2 uv0; - - void main() - { - gl_Position = vec4((pos * 2.0) - vec2(1.0), 0.5, 1.0); - uv0 = vec2(pos.x, 1.0 - pos.y); - gl_Position.y = -gl_Position.y; - } - -*/ -static const uint8_t s_vs_source_glsl430[233] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61, - 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, - 0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x6f,0x73,0x3b,0x0a, - 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, - 0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76, - 0x30,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a, - 0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x70,0x6f,0x73,0x20,0x2a,0x20, - 0x32,0x2e,0x30,0x29,0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x29, - 0x2c,0x20,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x75,0x76,0x30,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x70,0x6f,0x73,0x2e, - 0x78,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x70,0x6f,0x73,0x2e,0x79,0x29,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x2e,0x79,0x20,0x3d,0x20,0x2d,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x2e,0x79,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -/* - #version 430 - - layout(binding = 16) uniform sampler2D tex_smp; - - layout(location = 0) out vec4 col; - layout(location = 0) in vec2 uv0; - - void main() - { - col = texture(tex_smp, uv0); - } - -*/ -static const uint8_t s_fs_source_glsl430[184] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61, - 0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31, - 0x36,0x29,0x20,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c, - 0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c, - 0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d, - 0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c, - 0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, - 0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75, - 0x76,0x30,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,0x20,0x3d,0x20,0x74,0x65,0x78, - 0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76, - 0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -/* - #version 300 es - - layout(location = 0) in vec2 pos; - out vec2 uv0; - - void main() - { - gl_Position = vec4((pos * 2.0) - vec2(1.0), 0.5, 1.0); - uv0 = vec2(pos.x, 1.0 - pos.y); - gl_Position.y = -gl_Position.y; - } - -*/ -static const uint8_t s_vs_source_glsl300es[215] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, - 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x6f, - 0x73,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x30,0x3b, - 0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, - 0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x70,0x6f,0x73,0x20,0x2a,0x20,0x32,0x2e, - 0x30,0x29,0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x29,0x2c,0x20, - 0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75, - 0x76,0x30,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x70,0x6f,0x73,0x2e,0x78,0x2c, - 0x20,0x31,0x2e,0x30,0x20,0x2d,0x20,0x70,0x6f,0x73,0x2e,0x79,0x29,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79, - 0x20,0x3d,0x20,0x2d,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e, - 0x79,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -/* - #version 300 es - precision mediump float; - precision highp int; - - uniform highp sampler2D tex_smp; - - layout(location = 0) out highp vec4 col; - in highp vec2 uv0; - - void main() - { - col = texture(tex_smp, uv0); - } - -*/ -static const uint8_t s_fs_source_glsl300es[209] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, - 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, - 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, - 0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75, - 0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x73,0x6d,0x70,0x3b,0x0a, - 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20, - 0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67, - 0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x30,0x3b,0x0a,0x0a,0x76,0x6f, - 0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, - 0x63,0x6f,0x6c,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65, - 0x78,0x5f,0x73,0x6d,0x70,0x2c,0x20,0x75,0x76,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a, - 0x00, -}; -/* - static float4 gl_Position; - static float2 pos; - static float2 uv0; - - struct SPIRV_Cross_Input - { - float2 pos : TEXCOORD0; - }; - - struct SPIRV_Cross_Output - { - float2 uv0 : TEXCOORD0; - float4 gl_Position : SV_Position; - }; - - void vert_main() - { - gl_Position = float4((pos * 2.0f) - 1.0f.xx, 0.5f, 1.0f); - uv0 = float2(pos.x, 1.0f - pos.y); - } - - SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) - { - pos = stage_input.pos; - vert_main(); - SPIRV_Cross_Output stage_output; - stage_output.gl_Position = gl_Position; - stage_output.uv0 = uv0; - return stage_output; - } -*/ -static const uint8_t s_vs_source_hlsl5[584] = { - 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c, - 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69, - 0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x6f,0x73,0x3b,0x0a,0x73,0x74, - 0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x30,0x3b, - 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, - 0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x6f,0x73,0x20,0x3a,0x20,0x54,0x45, - 0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72, - 0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f, - 0x4f,0x75,0x74,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x32,0x20,0x75,0x76,0x30,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f,0x4f, - 0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, - 0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x53,0x56, - 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76, - 0x6f,0x69,0x64,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a, - 0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x70,0x6f,0x73,0x20, - 0x2a,0x20,0x32,0x2e,0x30,0x66,0x29,0x20,0x2d,0x20,0x31,0x2e,0x30,0x66,0x2e,0x78, - 0x78,0x2c,0x20,0x30,0x2e,0x35,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x75,0x76,0x30,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, - 0x28,0x70,0x6f,0x73,0x2e,0x78,0x2c,0x20,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x70, - 0x6f,0x73,0x2e,0x79,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f, - 0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69, - 0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e, - 0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x70,0x6f,0x73,0x20,0x3d,0x20,0x73,0x74,0x61, - 0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x70,0x6f,0x73,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x76,0x65,0x72,0x74,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f, - 0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70, - 0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75, - 0x74,0x70,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74, - 0x2e,0x75,0x76,0x30,0x20,0x3d,0x20,0x75,0x76,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74, - 0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, -}; -/* - Texture2D tex : register(t0); - SamplerState smp : register(s0); - - static float4 col; - static float2 uv0; - - struct SPIRV_Cross_Input - { - float2 uv0 : TEXCOORD0; - }; - - struct SPIRV_Cross_Output - { - float4 col : SV_Target0; - }; - - void frag_main() - { - col = tex.Sample(smp, uv0); - } - - SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) - { - uv0 = stage_input.uv0; - frag_main(); - SPIRV_Cross_Output stage_output; - stage_output.col = col; - return stage_output; - } -*/ -static const uint8_t s_fs_source_hlsl5[479] = { - 0x54,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34, - 0x3e,0x20,0x74,0x65,0x78,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72, - 0x28,0x74,0x30,0x29,0x3b,0x0a,0x53,0x61,0x6d,0x70,0x6c,0x65,0x72,0x53,0x74,0x61, - 0x74,0x65,0x20,0x73,0x6d,0x70,0x20,0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65, - 0x72,0x28,0x73,0x30,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69, - 0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x30,0x3b,0x0a,0x0a,0x73, - 0x74,0x72,0x75,0x63,0x74,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73, - 0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x30,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f, - 0x4f,0x52,0x44,0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74, - 0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74, - 0x70,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34, - 0x20,0x63,0x6f,0x6c,0x20,0x3a,0x20,0x53,0x56,0x5f,0x54,0x61,0x72,0x67,0x65,0x74, - 0x30,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67, - 0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f, - 0x6c,0x20,0x3d,0x20,0x74,0x65,0x78,0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73, - 0x6d,0x70,0x2c,0x20,0x75,0x76,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49, - 0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20, - 0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73, - 0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70, - 0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x30,0x20,0x3d,0x20, - 0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,0x30,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73, - 0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f, - 0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65, - 0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x20,0x3d,0x20,0x63,0x6f, - 0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74, - 0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, -}; -/* - #include - #include - - using namespace metal; - - struct main0_out - { - float2 uv0 [[user(locn0)]]; - float4 gl_Position [[position]]; - }; - - struct main0_in - { - float2 pos [[attribute(0)]]; - }; - - vertex main0_out main0(main0_in in [[stage_in]]) - { - main0_out out = {}; - out.gl_Position = float4((in.pos * 2.0) - float2(1.0), 0.5, 1.0); - out.uv0 = float2(in.pos.x, 1.0 - in.pos.y); - return out; - } - -*/ -static const uint8_t s_vs_source_metal_macos[432] = { - 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, - 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, - 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, - 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, - 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x30,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72, - 0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a, - 0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30, - 0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, - 0x20,0x70,0x6f,0x73,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65, - 0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65, - 0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e, - 0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b, - 0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20, - 0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20, - 0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c, - 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61, - 0x74,0x34,0x28,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x20,0x2a,0x20,0x32,0x2e,0x30, - 0x29,0x20,0x2d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x31,0x2e,0x30,0x29,0x2c, - 0x20,0x30,0x2e,0x35,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x6f,0x75,0x74,0x2e,0x75,0x76,0x30,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, - 0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x2e,0x78,0x2c,0x20,0x31,0x2e,0x30,0x20,0x2d, - 0x20,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x2e,0x79,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, - -}; -/* - #include - #include - - using namespace metal; - - struct main0_out - { - float4 col [[color(0)]]; - }; - - struct main0_in - { - float2 uv0 [[user(locn0)]]; - }; - - fragment main0_out main0(main0_in in [[stage_in]], texture2d tex [[texture(0)]], sampler smp [[sampler(0)]]) - { - main0_out out = {}; - out.col = tex.sample(smp, in.uv0); - return out; - } - -*/ -static const uint8_t s_fs_source_metal_macos[379] = { - 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, - 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, - 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, - 0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20, - 0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d, - 0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x34,0x20,0x63,0x6f,0x6c,0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f, - 0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75, - 0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x30,0x20,0x5b,0x5b,0x75, - 0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b, - 0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30, - 0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30, - 0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69, - 0x6e,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66, - 0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74, - 0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65, - 0x72,0x20,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28, - 0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e, - 0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x63,0x6f,0x6c,0x20,0x3d,0x20,0x74,0x65, - 0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x73,0x6d,0x70,0x2c,0x20,0x69,0x6e, - 0x2e,0x75,0x76,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72, - 0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -const sg_shader_desc* s_scr_shader_desc(sg_backend backend) { - if (backend == SG_BACKEND_GLCORE) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)s_vs_source_glsl430; - desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)s_fs_source_glsl430; - desc.fragment_func.entry = "main"; - desc.attrs[0].glsl_name = "pos"; - desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.images[0].image_type = SG_IMAGETYPE_2D; - desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.images[0].multisampled = false; - desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 0; - desc.image_sampler_pairs[0].sampler_slot = 0; - desc.image_sampler_pairs[0].glsl_name = "tex_smp"; - desc.label = "s_scr_shader"; - } - return &desc; - } - if (backend == SG_BACKEND_GLES3) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)s_vs_source_glsl300es; - desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)s_fs_source_glsl300es; - desc.fragment_func.entry = "main"; - desc.attrs[0].glsl_name = "pos"; - desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.images[0].image_type = SG_IMAGETYPE_2D; - desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.images[0].multisampled = false; - desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 0; - desc.image_sampler_pairs[0].sampler_slot = 0; - desc.image_sampler_pairs[0].glsl_name = "tex_smp"; - desc.label = "s_scr_shader"; - } - return &desc; - } - if (backend == SG_BACKEND_D3D11) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)s_vs_source_hlsl5; - desc.vertex_func.d3d11_target = "vs_5_0"; - desc.vertex_func.entry = "main"; - desc.fragment_func.source = (const char*)s_fs_source_hlsl5; - desc.fragment_func.d3d11_target = "ps_5_0"; - desc.fragment_func.entry = "main"; - desc.attrs[0].hlsl_sem_name = "TEXCOORD"; - desc.attrs[0].hlsl_sem_index = 0; - desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.images[0].image_type = SG_IMAGETYPE_2D; - desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.images[0].multisampled = false; - desc.images[0].hlsl_register_t_n = 0; - desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.samplers[0].hlsl_register_s_n = 0; - desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 0; - desc.image_sampler_pairs[0].sampler_slot = 0; - desc.label = "s_scr_shader"; - } - return &desc; - } - if (backend == SG_BACKEND_METAL_MACOS) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vertex_func.source = (const char*)s_vs_source_metal_macos; - desc.vertex_func.entry = "main0"; - desc.fragment_func.source = (const char*)s_fs_source_metal_macos; - desc.fragment_func.entry = "main0"; - desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.images[0].image_type = SG_IMAGETYPE_2D; - desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.images[0].multisampled = false; - desc.images[0].msl_texture_n = 0; - desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.samplers[0].msl_sampler_n = 0; - desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT; - desc.image_sampler_pairs[0].image_slot = 0; - desc.image_sampler_pairs[0].sampler_slot = 0; - desc.label = "s_scr_shader"; - } - return &desc; - } - return 0; -} -#endif // SOKOL_SHDC_IMPL \ No newline at end of file diff --git a/sokol/draw.c b/sokol/draw.c index d7d018b..8ad2a94 100644 --- a/sokol/draw.c +++ b/sokol/draw.c @@ -14,10 +14,7 @@ #include "lib/sokol_glue.h" #include "sokol_gfx_ext.h" #include "glsl/edge.h" -#include "glsl/edgeidx.h" #include "glsl/node.h" -#include "glsl/nodeidx.h" -#include "glsl/scr.h" #define NK_INCLUDE_FIXED_TYPES #define NK_INCLUDE_STANDARD_IO #define NK_INCLUDE_DEFAULT_ALLOCATOR @@ -154,32 +151,24 @@ renderdirect(void) static Clk clk = {.lab = "renderdirect"}; CLK0(clk); - drawui(snk_new_frame()); sg_begin_pass(&(sg_pass){ .action = render.clearscreen, .swapchain = sglue_swapchain(), }); if((n = ndedges) >= 1){ - sg_update_buffer(render.edgebind.vertex_buffers[0], &(sg_range){ - .ptr = redges, - .size = n * sizeof *redges, - }); sg_apply_pipeline(render.edgepipe); sg_apply_bindings(&render.edgebind); - sg_apply_uniforms(UB_Vparam, &SG_RANGE(render.cam)); - sg_apply_uniforms(UB_Fparam, &SG_RANGE(render.edgefs)); + sg_apply_uniforms(UB_edge_Vparam, &SG_RANGE(render.cam)); + sg_apply_uniforms(UB_edge_Fparam, &SG_RANGE(render.edgefs)); sg_draw(0, render.nedgev * n, 1); } if((n = ndnodes) >= 1){ - sg_update_buffer(render.nodebind.vertex_buffers[1], &(sg_range){ - .ptr = rnodes, - .size = n * sizeof *rnodes, - }); sg_apply_pipeline(render.nodepipe); sg_apply_bindings(&render.nodebind); - sg_apply_uniforms(UB_Vparam, &SG_RANGE(render.cam)); + sg_apply_uniforms(UB_node_Vparam, &SG_RANGE(render.cam)); sg_draw(0, render.nnodev, n); } + drawui(snk_new_frame()); snk_render(view.w, view.h); sg_end_pass(); CLK1(clk); @@ -192,48 +181,49 @@ renderoffscreen(void) static Clk clk = {.lab = "renderoffscreen"}; CLK0(clk); - drawui(snk_new_frame()); sg_begin_pass(&(sg_pass){ - .action = render.clearscreen, - .attachments = render.offscrfb, + .action = render.clearpick, + .attachments = render.pickimg, }); if((n = ndedges) >= 1){ - sg_update_buffer(render.edgebind.vertex_buffers[0], &(sg_range){ - .ptr = redges, - .size = n * sizeof *redges, - }); sg_apply_pipeline(render.offscredgepipe); sg_apply_bindings(&render.edgebind); - sg_apply_uniforms(UB_Vparam, &SG_RANGE(render.cam)); - sg_apply_uniforms(UB_Fparam, &SG_RANGE(render.edgefs)); + sg_apply_uniforms(UB_edge_Vparam, &SG_RANGE(render.cam)); sg_draw(0, render.nedgev * n, 1); } if((n = ndnodes) >= 1){ - sg_update_buffer(render.nodebind.vertex_buffers[1], &(sg_range){ - .ptr = rnodes, - .size = n * sizeof *rnodes, - }); sg_apply_pipeline(render.offscrnodepipe); sg_apply_bindings(&render.nodebind); - sg_apply_uniforms(UB_Vparam, &SG_RANGE(render.cam)); + sg_apply_uniforms(UB_node_Vparam, &SG_RANGE(render.cam)); sg_draw(0, render.nnodev, n); } sg_end_pass(); - sg_begin_pass(&(sg_pass){ - .action = render.nothing, - .swapchain = sglue_swapchain(), - }); - sg_apply_pipeline(render.offscrpipe); - sg_apply_bindings(&render.offscrbind); - sg_draw(0, 4, 1); - snk_render(view.w, view.h); - sg_end_pass(); CLK1(clk); } +static void +updatebuffers(void) +{ + int n; + + if((n = ndedges) >= 1){ + sg_update_buffer(render.edgebind.vertex_buffers[0], &(sg_range){ + .ptr = redges, + .size = n * sizeof *redges, + }); + } + if((n = ndnodes) >= 1){ + sg_update_buffer(render.nodebind.vertex_buffers[1], &(sg_range){ + .ptr = rnodes, + .size = n * sizeof *rnodes, + }); + } +} + static void clearscreen(void) { + drawui(snk_new_frame()); sg_begin_pass(&(sg_pass){ .action = render.clearscreen, .swapchain = sglue_swapchain(), @@ -245,12 +235,14 @@ clearscreen(void) static void flush(void) { - if(dylen(rnodes) <= 0) + if(dylen(rnodes) <= 0){ clearscreen(); - else if(!render.caching) - renderdirect(); - else + return; + } + updatebuffers(); + if(render.caching) renderoffscreen(); + renderdirect(); sg_commit(); } diff --git a/sokol/impl_glsl.c b/sokol/impl_glsl.c index 7adff7f..4b6f7b3 100644 --- a/sokol/impl_glsl.c +++ b/sokol/impl_glsl.c @@ -1,7 +1,4 @@ #include "lib/sokol_gfx.h" #define SOKOL_SHDC_IMPL #include "glsl/edge.h" -#include "glsl/edgeidx.h" #include "glsl/node.h" -#include "glsl/nodeidx.h" -#include "glsl/scr.h" diff --git a/sokol/shaders.c b/sokol/shaders.c index 0e5a1a2..1e5c93d 100644 --- a/sokol/shaders.c +++ b/sokol/shaders.c @@ -6,10 +6,7 @@ #include "sokol_gfx_ext.h" #include "sokol.h" #include "glsl/edge.h" -#include "glsl/edgeidx.h" #include "glsl/node.h" -#include "glsl/nodeidx.h" -#include "glsl/scr.h" #include "drw.h" #include "ui.h" #include "threads.h" @@ -17,7 +14,7 @@ Render render; -static sg_image fb, pickfb, zfb; +static sg_image pickfb, zfb; u32int mousepick(int x, int y) @@ -93,13 +90,6 @@ initfb(int w, int h) { view.w = w; view.h = h; - /* multi-target rendering targets, without multisampling */ - fb = sg_make_image(&(sg_image_desc){ - .render_target = true, - .width = w, - .height = h, - .sample_count = 1, - }); pickfb = sg_make_image(&(sg_image_desc){ .render_target = true, .width = w, @@ -114,25 +104,20 @@ initfb(int w, int h) .pixel_format = SG_PIXELFORMAT_DEPTH, .sample_count = 1, }); - render.offscrfb = sg_make_attachments(&(sg_attachments_desc){ - .colors = { - [0].image = fb, - [1].image = pickfb, - }, + render.pickimg = sg_make_attachments(&(sg_attachments_desc){ + .colors[0].image = pickfb, .depth_stencil.image = zfb, }); - render.offscrbind.images[IMG_tex] = fb; render.pickfb = emalloc(w * h * sizeof *render.pickfb); } void resize(void) { - sg_destroy_image(fb); sg_destroy_image(pickfb); sg_destroy_image(zfb); free(render.pickfb); - sg_destroy_attachments(render.offscrfb); + sg_destroy_attachments(render.pickimg); initfb(sapp_width(), sapp_height()); updateview(); } @@ -151,7 +136,7 @@ setupnodes(void) }, }; setnodeshape(0); - sg_shader sh = sg_make_shader(n_node_shader_desc(sg_query_backend())); + sg_shader sh = sg_make_shader(node_s_shader_desc(sg_query_backend())); render.nodepipe = sg_make_pipeline(&(sg_pipeline_desc){ .layout = { .buffers = { @@ -164,23 +149,23 @@ setupnodes(void) }, }, .attrs = { - [ATTR_node_geom] = { + [ATTR_node_s_geom] = { .format = SG_VERTEXFORMAT_FLOAT2, .buffer_index = 0, }, - [ATTR_node_pos] = { + [ATTR_node_s_pos] = { .format = SG_VERTEXFORMAT_FLOAT3, .buffer_index = 1, }, - [ATTR_node_dir] = { + [ATTR_node_s_dir] = { .format = SG_VERTEXFORMAT_FLOAT3, .buffer_index = 1, }, - [ATTR_node_col0] = { + [ATTR_node_s_col] = { .format = SG_VERTEXFORMAT_FLOAT4, .buffer_index = 1, }, - [ATTR_node_len] = { + [ATTR_node_s_len] = { .format = SG_VERTEXFORMAT_FLOAT, .buffer_index = 1, }, @@ -196,6 +181,7 @@ setupnodes(void) .write_enabled = true }, .color_count = 1, + /* NOTE: per-attachment blend state may not be supported */ .colors = { [0] = { .blend = { @@ -211,7 +197,7 @@ setupnodes(void) }, .sample_count = drawing.flags & DFmsaa ? 4 : 1, }); - sh = sg_make_shader(ni_nodeidx_shader_desc(sg_query_backend())); + sh = sg_make_shader(node_idx_shader_desc(sg_query_backend())); render.offscrnodepipe = sg_make_pipeline(&(sg_pipeline_desc){ .layout = { .buffers = { @@ -224,26 +210,21 @@ setupnodes(void) }, }, .attrs = { - [ATTR_nodeidx_geom] = { + [ATTR_node_idx_geom] = { .format = SG_VERTEXFORMAT_FLOAT2, .buffer_index = 0, }, - [ATTR_nodeidx_pos] = { + [ATTR_node_idx_pos] = { .offset = offsetof(RNode, pos), .format = SG_VERTEXFORMAT_FLOAT3, .buffer_index = 1, }, - [ATTR_nodeidx_dir] = { + [ATTR_node_idx_dir] = { .offset = offsetof(RNode, dir), .format = SG_VERTEXFORMAT_FLOAT3, .buffer_index = 1, }, - [ATTR_nodeidx_col0] = { - .offset = offsetof(RNode, col), - .format = SG_VERTEXFORMAT_FLOAT4, - .buffer_index = 1, - }, - [ATTR_nodeidx_len] = { + [ATTR_node_idx_len] = { .offset = offsetof(RNode, len), .format = SG_VERTEXFORMAT_FLOAT, .buffer_index = 1, @@ -260,21 +241,9 @@ setupnodes(void) .compare = SG_COMPAREFUNC_LESS_EQUAL, .write_enabled = true }, - .color_count = 2, - /* NOTE: per-attachment blend state may not be supported */ + .color_count = 1, .colors = { [0] = { - .blend = { - .enabled = true, - .src_factor_rgb = SG_BLENDFACTOR_ONE, - .dst_factor_rgb = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, - .op_rgb = SG_BLENDOP_ADD, - .src_factor_alpha = SG_BLENDFACTOR_ONE, - .dst_factor_alpha = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, - .op_alpha = SG_BLENDOP_ADD, - }, - }, - [1] = { .pixel_format = SG_PIXELFORMAT_R32UI, }, }, @@ -295,11 +264,11 @@ setupedges(void) }), }, }; - sh = sg_make_shader(e_edge_shader_desc(sg_query_backend())); + sh = sg_make_shader(edge_s_shader_desc(sg_query_backend())); render.edgepipe = sg_make_pipeline(&(sg_pipeline_desc){ .layout = { .attrs = { - [ATTR_edge_pos] = { + [ATTR_edge_s_pos] = { .format = SG_VERTEXFORMAT_FLOAT3, }, } @@ -328,11 +297,11 @@ setupedges(void) }, .sample_count = drawing.flags & DFmsaa ? 4 : 1, }); - sh = sg_make_shader(ei_edgeidx_shader_desc(sg_query_backend())); + sh = sg_make_shader(edge_idx_shader_desc(sg_query_backend())); render.offscredgepipe = sg_make_pipeline(&(sg_pipeline_desc){ .layout = { .attrs = { - [ATTR_edgeidx_pos] = { + [ATTR_edge_idx_pos] = { .format = SG_VERTEXFORMAT_FLOAT3, }, } @@ -346,20 +315,9 @@ setupedges(void) .compare = SG_COMPAREFUNC_LESS_EQUAL, .write_enabled = true, }, - .color_count = 2, + .color_count = 1, .colors = { [0] = { - .blend = { - .enabled = true, - .src_factor_rgb = SG_BLENDFACTOR_ONE, - .dst_factor_rgb = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, - .op_rgb = SG_BLENDOP_ADD, - .src_factor_alpha = SG_BLENDFACTOR_ONE, - .dst_factor_alpha = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, - .op_alpha = SG_BLENDOP_ADD, - }, - }, - [1] = { .pixel_format = SG_PIXELFORMAT_R32UI, }, }, @@ -368,77 +326,30 @@ setupedges(void) render.nedgev = 2; } -static void -setupscreen(void) -{ - sg_shader sh; - - /* drawing to display */ - float quad_vertices[] = { - 0.0f, 0.0f, - 1.0f, 0.0f, - 0.0f, 1.0f, - 1.0f, 1.0f, - }; - sg_buffer quad_vbuf = sg_make_buffer(&(sg_buffer_desc){ - .data = SG_RANGE(quad_vertices) - }); - sg_sampler smp = sg_make_sampler(&(sg_sampler_desc){ - .min_filter = SG_FILTER_LINEAR, - .mag_filter = SG_FILTER_LINEAR, - .wrap_u = SG_WRAP_CLAMP_TO_EDGE, - .wrap_v = SG_WRAP_CLAMP_TO_EDGE, - }); - render.offscrbind = (sg_bindings){ - .vertex_buffers[IMG_tex] = quad_vbuf, - .samplers[SMP_smp] = smp, - }; - sh = sg_make_shader(s_scr_shader_desc(sg_query_backend())); - render.offscrpipe = sg_make_pipeline(&(sg_pipeline_desc){ - .layout = { - .attrs[ATTR_scr_pos].format = SG_VERTEXFORMAT_FLOAT2 - }, - .shader = sh, - .primitive_type = SG_PRIMITIVETYPE_TRIANGLE_STRIP - }); -} - static void setuppasses(void) { Color *c; c = color(theme[Cbg]); - /* clear colors on the first pass, don't do anything on the second */ render.clearscreen = (sg_pass_action){ .colors = { [0] = { .load_action = SG_LOADACTION_CLEAR, .clear_value = { c->col[0], c->col[1], c->col[2], c->col[3] }, }, - [1] = { - .load_action = SG_LOADACTION_CLEAR, - .clear_value = { 0.0f }, - }, }, }; - /* screen pipeline: no clear needed, whole screen is overwritten */ - render.nothing = (sg_pass_action){ + render.clearpick = (sg_pass_action){ .colors = { [0] = { - .load_action = SG_LOADACTION_DONTCARE, - /* image set in initfb */ + .load_action = SG_LOADACTION_CLEAR, + .clear_value = { 0.0f }, }, }, }; } -static void -setuplines(void) -{ - /* FIXME */ -} - void initgl(void) { @@ -446,8 +357,6 @@ initgl(void) setupnodes(); setupedges(); - setupscreen(); - setuplines(); setuppasses(); setcolor(render.edgefs.color, theme[Cedge]); initfb(sapp_width(), sapp_height()); diff --git a/sokol/sokol.h b/sokol/sokol.h index 4ebf320..be130f4 100644 --- a/sokol/sokol.h +++ b/sokol/sokol.h @@ -16,16 +16,14 @@ struct Render{ int stalepick; /* picking cache stale */ int pickflip; /* non-gl: flip y for mouse picking (kludge) */ sg_pass_action clearscreen; - sg_pass_action nothing; - sg_attachments offscrfb; + sg_pass_action clearpick; + sg_attachments pickimg; sg_pipeline nodepipe; sg_pipeline offscrnodepipe; sg_pipeline edgepipe; sg_pipeline offscredgepipe; - sg_pipeline offscrpipe; sg_bindings nodebind; sg_bindings edgebind; - sg_bindings offscrbind; u32int *pickfb; int nnodev; int nedgev;