0xc3 4 weeks ago
parent
commit
e81e562a2c
3 changed files with 6 additions and 202 deletions
  1. 2 0
      .gitignore
  2. 4 0
      README.md
  3. 0 202
      src/cmd/sandbox/shader.odin

+ 2 - 0
.gitignore

@@ -1 +1,3 @@
 build/
+
+src/cmd/*/shader.odin

+ 4 - 0
README.md

@@ -1,5 +1,9 @@
 # huginn
 
+```
+make build_third_party
+```
+
 ```
 make run_sandbox_debug
 ```

+ 0 - 202
src/cmd/sandbox/shader.odin

@@ -1,202 +0,0 @@
-package main
-import sg "third-party:sokol/gfx"
-import m "huginn:core/math"
-/*
-    #version:1# (machine generated, don't edit!)
-
-    Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
-
-    Cmdline:
-        sokol-shdc -i ./src/cmd/sandbox/shader.glsl -o ./src/cmd/sandbox/shader.odin -l glsl430 -f sokol_odin
-
-    Overview:
-    =========
-    Shader program: 'quad':
-        Get shader desc: quad_shader_desc(sg.query_backend())
-        Vertex Shader: vs
-        Fragment Shader: fs
-        Attributes:
-            ATTR_quad_position => 0
-    Bindings:
-        Uniform block 'vs_params':
-            Odin struct: Vs_Params
-            Bind slot: UB_vs_params => 0
-*/
-ATTR_quad_position :: 0
-UB_vs_params :: 0
-Vs_Params :: struct #align(16) {
-    using _: struct #packed {
-        u_projection: m.mat4,
-        u_color: m.vec4,
-    },
-}
-/*
-    #version 430
-
-    uniform vec4 vs_params[5];
-    layout(location = 0) in vec4 position;
-    layout(location = 0) out vec4 color;
-    layout(location = 1) out vec2 frag_coord;
-
-    void main()
-    {
-        gl_Position = mat4(vs_params[0], vs_params[1], vs_params[2], vs_params[3]) * position;
-        color = vs_params[4];
-        frag_coord = position.xy;
-    }
-
-*/
-@(private="file")
-vs_source_glsl430 := [325]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,0x76,0x73,0x5f,0x70,0x61,
-    0x72,0x61,0x6d,0x73,0x5b,0x35,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,0x34,0x20,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,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,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6f,0x72,0x64,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,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,
-    0x5d,0x2c,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,
-    0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x76,
-    0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x70,
-    0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x63,0x6f,0x6c,
-    0x6f,0x72,0x20,0x3d,0x20,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,
-    0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6f,0x72,
-    0x64,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x3b,
-    0x0a,0x7d,0x0a,0x0a,0x00,
-}
-/*
-    #version 430
-
-    layout(location = 1) in vec2 frag_coord;
-    layout(location = 0) in vec4 color;
-    layout(location = 0) out vec4 frag_color;
-
-    float sdf_rect_rounded(vec2 p, vec2 b, inout vec4 r)
-    {
-        vec2 _25;
-        if (p.x > 0.0)
-        {
-            _25 = r.xy;
-        }
-        else
-        {
-            _25 = r.zw;
-        }
-        r.x = _25.x;
-        r.y = _25.y;
-        float _42;
-        if (p.y > 0.0)
-        {
-            _42 = r.x;
-        }
-        else
-        {
-            _42 = r.y;
-        }
-        r.x = _42;
-        vec2 _60 = (abs(p) - b) + vec2(r.x);
-        return (min(max(_60.x, _60.y), 0.0) + length(max(_60, vec2(0.0)))) - r.x;
-    }
-
-    void main()
-    {
-        vec2 param = frag_coord - vec2(0.5);
-        vec2 param_1 = vec2(0.5);
-        vec4 param_2 = vec4(0.100000001490116119384765625);
-        float _92 = sdf_rect_rounded(param, param_1, param_2);
-        float _95 = fwidth(_92);
-        float _109 = color.w - smoothstep(_95 * (-0.5), _95 * 0.5, _92);
-        vec4 _118 = vec4(color.xyz, _109);
-        frag_color = mix(_118, _118, vec4(_109));
-    }
-
-*/
-@(private="file")
-fs_source_glsl430 := [958]u8 {
-    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,
-    0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x66,0x72,0x61,0x67,0x5f,
-    0x63,0x6f,0x6f,0x72,0x64,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,0x6f,0x72,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,0x72,0x61,0x67,0x5f,0x63,0x6f,
-    0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x20,0x73,0x64,0x66,0x5f,
-    0x72,0x65,0x63,0x74,0x5f,0x72,0x6f,0x75,0x6e,0x64,0x65,0x64,0x28,0x76,0x65,0x63,
-    0x32,0x20,0x70,0x2c,0x20,0x76,0x65,0x63,0x32,0x20,0x62,0x2c,0x20,0x69,0x6e,0x6f,
-    0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x72,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
-    0x20,0x76,0x65,0x63,0x32,0x20,0x5f,0x32,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,
-    0x66,0x20,0x28,0x70,0x2e,0x78,0x20,0x3e,0x20,0x30,0x2e,0x30,0x29,0x0a,0x20,0x20,
-    0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x32,0x35,0x20,
-    0x3d,0x20,0x72,0x2e,0x78,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,
-    0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,
-    0x20,0x20,0x20,0x20,0x20,0x5f,0x32,0x35,0x20,0x3d,0x20,0x72,0x2e,0x7a,0x77,0x3b,
-    0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x72,0x2e,0x78,0x20,0x3d,
-    0x20,0x5f,0x32,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x2e,0x79,0x20,
-    0x3d,0x20,0x5f,0x32,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
-    0x61,0x74,0x20,0x5f,0x34,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,
-    0x70,0x2e,0x79,0x20,0x3e,0x20,0x30,0x2e,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,
-    0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x34,0x32,0x20,0x3d,0x20,0x72,
-    0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,
-    0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
-    0x20,0x5f,0x34,0x32,0x20,0x3d,0x20,0x72,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,
-    0x7d,0x0a,0x20,0x20,0x20,0x20,0x72,0x2e,0x78,0x20,0x3d,0x20,0x5f,0x34,0x32,0x3b,
-    0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x5f,0x36,0x30,0x20,0x3d,0x20,
-    0x28,0x61,0x62,0x73,0x28,0x70,0x29,0x20,0x2d,0x20,0x62,0x29,0x20,0x2b,0x20,0x76,
-    0x65,0x63,0x32,0x28,0x72,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,
-    0x74,0x75,0x72,0x6e,0x20,0x28,0x6d,0x69,0x6e,0x28,0x6d,0x61,0x78,0x28,0x5f,0x36,
-    0x30,0x2e,0x78,0x2c,0x20,0x5f,0x36,0x30,0x2e,0x79,0x29,0x2c,0x20,0x30,0x2e,0x30,
-    0x29,0x20,0x2b,0x20,0x6c,0x65,0x6e,0x67,0x74,0x68,0x28,0x6d,0x61,0x78,0x28,0x5f,
-    0x36,0x30,0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x29,0x29,0x29,0x29,
-    0x20,0x2d,0x20,0x72,0x2e,0x78,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,0x66,0x72,0x61,0x67,0x5f,0x63,
-    0x6f,0x6f,0x72,0x64,0x20,0x2d,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x35,0x29,
-    0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,
-    0x5f,0x31,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,
-    0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,
-    0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x31,0x30,0x30,0x30,0x30,0x30,
-    0x30,0x30,0x31,0x34,0x39,0x30,0x31,0x31,0x36,0x31,0x31,0x39,0x33,0x38,0x34,0x37,
-    0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
-    0x74,0x20,0x5f,0x39,0x32,0x20,0x3d,0x20,0x73,0x64,0x66,0x5f,0x72,0x65,0x63,0x74,
-    0x5f,0x72,0x6f,0x75,0x6e,0x64,0x65,0x64,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,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x39,0x35,
-    0x20,0x3d,0x20,0x66,0x77,0x69,0x64,0x74,0x68,0x28,0x5f,0x39,0x32,0x29,0x3b,0x0a,
-    0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x31,0x30,0x39,0x20,0x3d,
-    0x20,0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x77,0x20,0x2d,0x20,0x73,0x6d,0x6f,0x6f,0x74,
-    0x68,0x73,0x74,0x65,0x70,0x28,0x5f,0x39,0x35,0x20,0x2a,0x20,0x28,0x2d,0x30,0x2e,
-    0x35,0x29,0x2c,0x20,0x5f,0x39,0x35,0x20,0x2a,0x20,0x30,0x2e,0x35,0x2c,0x20,0x5f,
-    0x39,0x32,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x31,
-    0x31,0x38,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x63,0x6f,0x6c,0x6f,0x72,0x2e,
-    0x78,0x79,0x7a,0x2c,0x20,0x5f,0x31,0x30,0x39,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
-    0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x6d,0x69,0x78,
-    0x28,0x5f,0x31,0x31,0x38,0x2c,0x20,0x5f,0x31,0x31,0x38,0x2c,0x20,0x76,0x65,0x63,
-    0x34,0x28,0x5f,0x31,0x30,0x39,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
-}
-quad_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
-    desc: sg.Shader_Desc
-    desc.label = "quad_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 = "position"
-        desc.uniform_blocks[0].stage = .VERTEX
-        desc.uniform_blocks[0].layout = .STD140
-        desc.uniform_blocks[0].size = 80
-        desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4
-        desc.uniform_blocks[0].glsl_uniforms[0].array_count = 5
-        desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params"
-    }
-    return desc
-}