From db7bdc1a6752a1fccf140a1a86fd3106d7403df5 Mon Sep 17 00:00:00 2001 From: Xander Swan <[hidden email]> Date: Fri, 2 Jan 2026 16:15:25 -0500 Subject: remove useless dumb idiot shaders ugh --- src/draw/default.glsl | 38 --- src/draw/default_shader.odin | 538 ------------------------------------------- src/draw/sprite.odin | 3 - 3 files changed, 579 deletions(-) delete mode 100644 src/draw/default.glsl delete mode 100644 src/draw/default_shader.odin (limited to 'src/draw') diff --git a/src/draw/default.glsl b/src/draw/default.glsl deleted file mode 100644 index 15cb2e2..0000000 --- a/src/draw/default.glsl +++ /dev/null @@ -1,38 +0,0 @@ -@header package draw -@header import sg "shared:sokol/gfx" - -@vs vs -in vec2 vposition; -in vec2 vuv; -in vec4 vcolor; - -out vec4 fcolor; -out vec2 fuv; - -layout (binding = 0) uniform default_vs_params { - mat4 projection; -}; - -void main() { - gl_Position = projection * vec4(vposition, 0.0, 1.0); - fcolor = vcolor; - fuv = vuv; -} -@end - -@fs fs -in vec4 fcolor; -in vec2 fuv; - -out vec4 out_color; - -layout (binding = 0) uniform texture2D tex; -layout (binding = 0) uniform sampler tex_samp; -#define tex sampler2D(tex, tex_samp) - -void main() { - out_color = texture(tex, fuv) * fcolor; -} -@end - -@program default vs fs diff --git a/src/draw/default_shader.odin b/src/draw/default_shader.odin deleted file mode 100644 index eca5c62..0000000 --- a/src/draw/default_shader.odin +++ /dev/null @@ -1,538 +0,0 @@ -package draw -import sg "shared:sokol/gfx" -/* - #version:1# (machine generated, don't edit!) - - Generated by sokol-shdc (https://github.com/floooh/sokol-tools) - - Cmdline: - sokol-shdc -i src/draw/default.glsl -o src/draw/default_shader.odin -l glsl430:metal_macos:hlsl5 -f sokol_odin - - Overview: - ========= - Shader program: 'default': - Get shader desc: default_shader_desc(sg.query_backend()) - Vertex Shader: vs - Fragment Shader: fs - Attributes: - ATTR_default_vposition => 0 - ATTR_default_vuv => 1 - ATTR_default_vcolor => 2 - Bindings: - Uniform block 'default_vs_params': - Odin struct: Default_Vs_Params - Bind slot: UB_default_vs_params => 0 - Texture 'tex': - Image type: ._2D - Sample type: .FLOAT - Multisampled: false - Bind slot: VIEW_tex => 0 - Sampler 'tex_samp': - Type: .FILTERING - Bind slot: SMP_tex_samp => 0 -*/ -ATTR_default_vposition :: 0 -ATTR_default_vuv :: 1 -ATTR_default_vcolor :: 2 -UB_default_vs_params :: 0 -VIEW_tex :: 0 -SMP_tex_samp :: 0 -Default_Vs_Params :: struct #align(16) { - using _: struct #packed { - projection: [16]f32, - }, -} -/* - #version 430 - - uniform vec4 default_vs_params[4]; - layout(location = 0) in vec2 vposition; - layout(location = 0) out vec4 fcolor; - layout(location = 2) in vec4 vcolor; - layout(location = 1) out vec2 fuv; - layout(location = 1) in vec2 vuv; - - void main() - { - gl_Position = mat4(default_vs_params[0], default_vs_params[1], default_vs_params[2], default_vs_params[3]) * vec4(vposition, 0.0, 1.0); - fcolor = vcolor; - fuv = vuv; - } - -*/ -@(private="file") -vs_source_glsl430 := [428]u8 { - 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,0x64,0x65,0x66,0x61,0x75, - 0x6c,0x74,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,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,0x76,0x70, - 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,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,0x6f,0x6c,0x6f,0x72,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,0x34,0x20,0x76,0x63,0x6f,0x6c, - 0x6f,0x72,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,0x76,0x65,0x63, - 0x32,0x20,0x66,0x75,0x76,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,0x32,0x20,0x76,0x75,0x76,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,0x64, - 0x65,0x66,0x61,0x75,0x6c,0x74,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x30,0x5d,0x2c,0x20,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x5f,0x76,0x73,0x5f, - 0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x64,0x65,0x66,0x61,0x75, - 0x6c,0x74,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c, - 0x20,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61, - 0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x70, - 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e, - 0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, - 0x20,0x76,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x75,0x76, - 0x20,0x3d,0x20,0x76,0x75,0x76,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -} -/* - #version 430 - - layout(binding = 0) uniform sampler2D tex_tex_samp; - - layout(location = 0) out vec4 out_color; - layout(location = 1) in vec2 fuv; - layout(location = 0) in vec4 fcolor; - - void main() - { - out_color = texture(tex_tex_samp, fuv) * fcolor; - } - -*/ -@(private="file") -fs_source_glsl430 := [251]u8 { - 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,0x30, - 0x29,0x20,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65, - 0x72,0x32,0x44,0x20,0x74,0x65,0x78,0x5f,0x74,0x65,0x78,0x5f,0x73,0x61,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,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,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,0x32,0x20,0x66,0x75,0x76,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,0x66,0x63,0x6f,0x6c,0x6f, - 0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a, - 0x7b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20, - 0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x65,0x78,0x5f,0x74,0x65, - 0x78,0x5f,0x73,0x61,0x6d,0x70,0x2c,0x20,0x66,0x75,0x76,0x29,0x20,0x2a,0x20,0x66, - 0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -} -/* - cbuffer default_vs_params : register(b0) - { - row_major float4x4 _19_projection : packoffset(c0); - }; - - - static float4 gl_Position; - static float2 vposition; - static float4 fcolor; - static float4 vcolor; - static float2 fuv; - static float2 vuv; - - struct SPIRV_Cross_Input - { - float2 vposition : TEXCOORD0; - float2 vuv : TEXCOORD1; - float4 vcolor : TEXCOORD2; - }; - - struct SPIRV_Cross_Output - { - float4 fcolor : TEXCOORD0; - float2 fuv : TEXCOORD1; - float4 gl_Position : SV_Position; - }; - - void vert_main() - { - gl_Position = mul(float4(vposition, 0.0f, 1.0f), _19_projection); - fcolor = vcolor; - fuv = vuv; - } - - SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) - { - vposition = stage_input.vposition; - vcolor = stage_input.vcolor; - vuv = stage_input.vuv; - vert_main(); - SPIRV_Cross_Output stage_output; - stage_output.gl_Position = gl_Position; - stage_output.fcolor = fcolor; - stage_output.fuv = fuv; - return stage_output; - } -*/ -@(private="file") -vs_source_hlsl5 := [964]u8 { - 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x64,0x65,0x66,0x61,0x75,0x6c,0x74,0x5f, - 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,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,0x70,0x72,0x6f,0x6a,0x65,0x63,0x74,0x69,0x6f,0x6e, - 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,0x66,0x6c,0x6f,0x61,0x74,0x32, - 0x20,0x76,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x73,0x74,0x61,0x74, - 0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x63,0x6f,0x6c,0x6f,0x72, - 0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20, - 0x76,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x32,0x20,0x66,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69, - 0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x75,0x76,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,0x76,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a, - 0x20,0x54,0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x75,0x76,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,0x76,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54,0x45,0x58,0x43, - 0x4f,0x4f,0x52,0x44,0x32,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,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54,0x45,0x58,0x43,0x4f, - 0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, - 0x20,0x66,0x75,0x76,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,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,0x76,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30, - 0x66,0x29,0x2c,0x20,0x5f,0x31,0x39,0x5f,0x70,0x72,0x6f,0x6a,0x65,0x63,0x74,0x69, - 0x6f,0x6e,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x63,0x6f,0x6c,0x6f,0x72,0x20, - 0x3d,0x20,0x76,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x75, - 0x76,0x20,0x3d,0x20,0x76,0x75,0x76,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,0x76,0x70,0x6f,0x73,0x69,0x74,0x69, - 0x6f,0x6e,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74, - 0x2e,0x76,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x76,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69, - 0x6e,0x70,0x75,0x74,0x2e,0x76,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x76,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70, - 0x75,0x74,0x2e,0x76,0x75,0x76,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,0x66,0x63,0x6f,0x6c,0x6f, - 0x72,0x20,0x3d,0x20,0x66,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x75,0x76, - 0x20,0x3d,0x20,0x66,0x75,0x76,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 tex_samp : register(s0); - - static float4 out_color; - static float2 fuv; - static float4 fcolor; - - struct SPIRV_Cross_Input - { - float4 fcolor : TEXCOORD0; - float2 fuv : TEXCOORD1; - }; - - struct SPIRV_Cross_Output - { - float4 out_color : SV_Target0; - }; - - void frag_main() - { - out_color = tex.Sample(tex_samp, fuv) * fcolor; - } - - SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) - { - fuv = stage_input.fuv; - fcolor = stage_input.fcolor; - frag_main(); - SPIRV_Cross_Output stage_output; - stage_output.out_color = out_color; - return stage_output; - } -*/ -@(private="file") -fs_source_hlsl5 := [614]u8 { - 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,0x74,0x65,0x78,0x5f,0x73,0x61,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,0x6f,0x75,0x74,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x32,0x20,0x66,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x63,0x6f,0x6c,0x6f,0x72,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,0x66,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x54, - 0x45,0x58,0x43,0x4f,0x4f,0x52,0x44,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x32,0x20,0x66,0x75,0x76,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,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,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,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20, - 0x74,0x65,0x78,0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78,0x5f,0x73, - 0x61,0x6d,0x70,0x2c,0x20,0x66,0x75,0x76,0x29,0x20,0x2a,0x20,0x66,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,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,0x66,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f, - 0x69,0x6e,0x70,0x75,0x74,0x2e,0x66,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, - 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e, - 0x70,0x75,0x74,0x2e,0x66,0x63,0x6f,0x6c,0x6f,0x72,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,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x6f, - 0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,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 default_vs_params - { - float4x4 projection; - }; - - struct main0_out - { - float4 fcolor [[user(locn0)]]; - float2 fuv [[user(locn1)]]; - float4 gl_Position [[position]]; - }; - - struct main0_in - { - float2 vposition [[attribute(0)]]; - float2 vuv [[attribute(1)]]; - float4 vcolor [[attribute(2)]]; - }; - - vertex main0_out main0(main0_in in [[stage_in]], constant default_vs_params& _19 [[buffer(0)]]) - { - main0_out out = {}; - out.gl_Position = _19.projection * float4(in.vposition, 0.0, 1.0); - out.fcolor = in.vcolor; - out.fuv = in.vuv; - return out; - } - -*/ -@(private="file") -vs_source_metal_macos := [648]u8 { - 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,0x64, - 0x65,0x66,0x61,0x75,0x6c,0x74,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20, - 0x70,0x72,0x6f,0x6a,0x65,0x63,0x74,0x69,0x6f,0x6e,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, - 0x6f,0x6c,0x6f,0x72,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,0x32, - 0x20,0x66,0x75,0x76,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,0x76,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,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,0x32,0x20,0x76,0x75,0x76,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,0x34,0x20,0x76,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x5b,0x5b,0x61,0x74,0x74, - 0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x32,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,0x64,0x65,0x66,0x61,0x75, - 0x6c,0x74,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x31, - 0x39,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,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d, - 0x20,0x5f,0x31,0x39,0x2e,0x70,0x72,0x6f,0x6a,0x65,0x63,0x74,0x69,0x6f,0x6e,0x20, - 0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x76,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x63,0x6f,0x6c,0x6f,0x72, - 0x20,0x3d,0x20,0x69,0x6e,0x2e,0x76,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x75,0x76,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x76, - 0x75,0x76,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 out_color [[color(0)]]; - }; - - struct main0_in - { - float4 fcolor [[user(locn0)]]; - float2 fuv [[user(locn1)]]; - }; - - fragment main0_out main0(main0_in in [[stage_in]], texture2d tex [[texture(0)]], sampler tex_samp [[sampler(0)]]) - { - main0_out out = {}; - out.out_color = tex.sample(tex_samp, in.fuv) * in.fcolor; - return out; - } - -*/ -@(private="file") -fs_source_metal_macos := [448]u8 { - 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,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,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,0x66, - 0x63,0x6f,0x6c,0x6f,0x72,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, - 0x32,0x20,0x66,0x75,0x76,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,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,0x74,0x65,0x78,0x5f,0x73, - 0x61,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,0x6f,0x75,0x74,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20, - 0x3d,0x20,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x74,0x65,0x78, - 0x5f,0x73,0x61,0x6d,0x70,0x2c,0x20,0x69,0x6e,0x2e,0x66,0x75,0x76,0x29,0x20,0x2a, - 0x20,0x69,0x6e,0x2e,0x66,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, - -} -default_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc { - desc: sg.Shader_Desc - desc.label = "default_shader" - #partial switch backend { - case .GLCORE: - desc.vertex_func.source = transmute(cstring)&vs_source_glsl430 - desc.vertex_func.entry = "main" - desc.fragment_func.source = transmute(cstring)&fs_source_glsl430 - desc.fragment_func.entry = "main" - desc.attrs[0].base_type = .FLOAT - desc.attrs[0].glsl_name = "vposition" - desc.attrs[1].base_type = .FLOAT - desc.attrs[1].glsl_name = "vuv" - desc.attrs[2].base_type = .FLOAT - desc.attrs[2].glsl_name = "vcolor" - desc.uniform_blocks[0].stage = .VERTEX - desc.uniform_blocks[0].layout = .STD140 - desc.uniform_blocks[0].size = 64 - desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4 - desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4 - desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "default_vs_params" - desc.views[0].texture.stage = .FRAGMENT - desc.views[0].texture.image_type = ._2D - desc.views[0].texture.sample_type = .FLOAT - desc.views[0].texture.multisampled = false - desc.samplers[0].stage = .FRAGMENT - desc.samplers[0].sampler_type = .FILTERING - desc.texture_sampler_pairs[0].stage = .FRAGMENT - desc.texture_sampler_pairs[0].view_slot = 0 - desc.texture_sampler_pairs[0].sampler_slot = 0 - desc.texture_sampler_pairs[0].glsl_name = "tex_tex_samp" - case .D3D11: - desc.vertex_func.source = transmute(cstring)&vs_source_hlsl5 - desc.vertex_func.d3d11_target = "vs_5_0" - desc.vertex_func.entry = "main" - desc.fragment_func.source = transmute(cstring)&fs_source_hlsl5 - desc.fragment_func.d3d11_target = "ps_5_0" - desc.fragment_func.entry = "main" - desc.attrs[0].base_type = .FLOAT - desc.attrs[0].hlsl_sem_name = "TEXCOORD" - desc.attrs[0].hlsl_sem_index = 0 - desc.attrs[1].base_type = .FLOAT - desc.attrs[1].hlsl_sem_name = "TEXCOORD" - desc.attrs[1].hlsl_sem_index = 1 - desc.attrs[2].base_type = .FLOAT - desc.attrs[2].hlsl_sem_name = "TEXCOORD" - desc.attrs[2].hlsl_sem_index = 2 - desc.uniform_blocks[0].stage = .VERTEX - desc.uniform_blocks[0].layout = .STD140 - desc.uniform_blocks[0].size = 64 - desc.uniform_blocks[0].hlsl_register_b_n = 0 - desc.views[0].texture.stage = .FRAGMENT - desc.views[0].texture.image_type = ._2D - desc.views[0].texture.sample_type = .FLOAT - desc.views[0].texture.multisampled = false - desc.views[0].texture.hlsl_register_t_n = 0 - desc.samplers[0].stage = .FRAGMENT - desc.samplers[0].sampler_type = .FILTERING - desc.samplers[0].hlsl_register_s_n = 0 - desc.texture_sampler_pairs[0].stage = .FRAGMENT - desc.texture_sampler_pairs[0].view_slot = 0 - desc.texture_sampler_pairs[0].sampler_slot = 0 - case .METAL_MACOS: - desc.vertex_func.source = transmute(cstring)&vs_source_metal_macos - desc.vertex_func.entry = "main0" - desc.fragment_func.source = transmute(cstring)&fs_source_metal_macos - desc.fragment_func.entry = "main0" - desc.attrs[0].base_type = .FLOAT - desc.attrs[1].base_type = .FLOAT - desc.attrs[2].base_type = .FLOAT - desc.uniform_blocks[0].stage = .VERTEX - desc.uniform_blocks[0].layout = .STD140 - desc.uniform_blocks[0].size = 64 - desc.uniform_blocks[0].msl_buffer_n = 0 - desc.views[0].texture.stage = .FRAGMENT - desc.views[0].texture.image_type = ._2D - desc.views[0].texture.sample_type = .FLOAT - desc.views[0].texture.multisampled = false - desc.views[0].texture.msl_texture_n = 0 - desc.samplers[0].stage = .FRAGMENT - desc.samplers[0].sampler_type = .FILTERING - desc.samplers[0].msl_sampler_n = 0 - desc.texture_sampler_pairs[0].stage = .FRAGMENT - desc.texture_sampler_pairs[0].view_slot = 0 - desc.texture_sampler_pairs[0].sampler_slot = 0 - } - return desc -} diff --git a/src/draw/sprite.odin b/src/draw/sprite.odin index a6a109b..aec6c61 100644 --- a/src/draw/sprite.odin +++ b/src/draw/sprite.odin @@ -1,9 +1,6 @@ package draw import "core:log" -// import "core:image" -import "core:mem" -// import "core:image/qoi" import rl "vendor:raylib" -- cgit v1.3-2-g0d8e