Changes while attempting to debug
This commit is contained in:
		| @@ -6,7 +6,7 @@ import sg "thirdparty:sokol/gfx" | ||||
|     Generated by sokol-shdc (https://github.com/floooh/sokol-tools) | ||||
|  | ||||
|     Cmdline: | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\simple_font_glyph.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\simple_font_glyph.odin --slang hlsl5 --format=sokol_odin | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\simple_font_glyph.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\simple_font_glyph.odin --slang glsl410:hlsl5 --format=sokol_odin | ||||
|  | ||||
|     Overview: | ||||
|     ========= | ||||
| @@ -52,6 +52,84 @@ Font_Glyph_Fs_Params :: struct #align(16) { | ||||
|         _: [4]u8, | ||||
|     }, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     uniform vec4 font_glyph_vs_params[4]; | ||||
|     layout(location = 0) in vec2 vertex; | ||||
|     layout(location = 0) out vec2 uv; | ||||
|     layout(location = 1) in vec2 texture_coord; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         gl_Position = mat4(font_glyph_vs_params[0], font_glyph_vs_params[1], font_glyph_vs_params[2], font_glyph_vs_params[3]) * vec4(vertex, 0.0, 1.0); | ||||
|         uv = texture_coord; | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| font_glyph_vs_source_glsl410 := [359]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, | ||||
|     0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x6f,0x6e,0x74,0x5f, | ||||
|     0x67,0x6c,0x79,0x70,0x68,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,0x65,0x72,0x74,0x65,0x78,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,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,0x74,0x65,0x78,0x74,0x75,0x72,0x65,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,0x66,0x6f,0x6e, | ||||
|     0x74,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, | ||||
|     0x73,0x5b,0x30,0x5d,0x2c,0x20,0x66,0x6f,0x6e,0x74,0x5f,0x67,0x6c,0x79,0x70,0x68, | ||||
|     0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x66, | ||||
|     0x6f,0x6e,0x74,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72, | ||||
|     0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x66,0x6f,0x6e,0x74,0x5f,0x67,0x6c,0x79, | ||||
|     0x70,0x68,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29, | ||||
|     0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x65,0x72,0x74,0x65,0x78,0x2c,0x20, | ||||
|     0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75, | ||||
|     0x76,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x63,0x6f,0x6f,0x72, | ||||
|     0x64,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     uniform vec4 font_glyph_fs_params[1]; | ||||
|     uniform sampler2D glyph_bitmap_glyph_bitmap_sampler; | ||||
|  | ||||
|     layout(location = 0) in vec2 uv; | ||||
|     layout(location = 0) out vec4 color; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         color = vec4(font_glyph_fs_params[0].xyz, texture(glyph_bitmap_glyph_bitmap_sampler, uv).x); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| font_glyph_fs_source_glsl410 := [292]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, | ||||
|     0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x6f,0x6e,0x74,0x5f, | ||||
|     0x67,0x6c,0x79,0x70,0x68,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, | ||||
|     0x31,0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70, | ||||
|     0x6c,0x65,0x72,0x32,0x44,0x20,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x69,0x74,0x6d, | ||||
|     0x61,0x70,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x69,0x74,0x6d,0x61,0x70,0x5f, | ||||
|     0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,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,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, | ||||
|     0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,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,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28, | ||||
|     0x66,0x6f,0x6e,0x74,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x66,0x73,0x5f,0x70,0x61, | ||||
|     0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x74,0x65,0x78, | ||||
|     0x74,0x75,0x72,0x65,0x28,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x69,0x74,0x6d,0x61, | ||||
|     0x70,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x69,0x74,0x6d,0x61,0x70,0x5f,0x73, | ||||
|     0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x29,0x2e,0x78,0x29,0x3b,0x0a, | ||||
|     0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     cbuffer font_glyph_vs_params : register(b0) | ||||
|     { | ||||
| @@ -232,6 +310,33 @@ font_glyph_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc { | ||||
|     desc: sg.Shader_Desc | ||||
|     desc.label = "font_glyph_shader" | ||||
|     #partial switch backend { | ||||
|     case .GLCORE: | ||||
|         desc.attrs[0].name = "vertex" | ||||
|         desc.attrs[1].name = "texture_coord" | ||||
|         desc.vs.source = transmute(cstring)&font_glyph_vs_source_glsl410 | ||||
|         desc.vs.entry = "main" | ||||
|         desc.vs.uniform_blocks[0].size = 64 | ||||
|         desc.vs.uniform_blocks[0].layout = .STD140 | ||||
|         desc.vs.uniform_blocks[0].uniforms[0].name = "font_glyph_vs_params" | ||||
|         desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4 | ||||
|         desc.vs.uniform_blocks[0].uniforms[0].array_count = 4 | ||||
|         desc.fs.source = transmute(cstring)&font_glyph_fs_source_glsl410 | ||||
|         desc.fs.entry = "main" | ||||
|         desc.fs.uniform_blocks[0].size = 16 | ||||
|         desc.fs.uniform_blocks[0].layout = .STD140 | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].name = "font_glyph_fs_params" | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4 | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].array_count = 1 | ||||
|         desc.fs.images[0].used = true | ||||
|         desc.fs.images[0].multisampled = false | ||||
|         desc.fs.images[0].image_type = ._2D | ||||
|         desc.fs.images[0].sample_type = .FLOAT | ||||
|         desc.fs.samplers[0].used = true | ||||
|         desc.fs.samplers[0].sampler_type = .FILTERING | ||||
|         desc.fs.image_sampler_pairs[0].used = true | ||||
|         desc.fs.image_sampler_pairs[0].image_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].sampler_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].glsl_name = "glyph_bitmap_glyph_bitmap_sampler" | ||||
|     case .D3D11: | ||||
|         desc.attrs[0].sem_name = "TEXCOORD" | ||||
|         desc.attrs[0].sem_index = 0 | ||||
|   | ||||
| @@ -6,7 +6,7 @@ import sg "thirdparty:sokol/gfx" | ||||
|     Generated by sokol-shdc (https://github.com/floooh/sokol-tools) | ||||
|  | ||||
|     Cmdline: | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_blit_atlas.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_blit_atlas.odin --slang hlsl5 --format=sokol_odin --module =vefc_blit_atlas | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_blit_atlas.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_blit_atlas.odin --slang glsl410:hlsl5 --format=sokol_odin --module =vefc_blit_atlas | ||||
|  | ||||
|     Overview: | ||||
|     ========= | ||||
| @@ -43,6 +43,203 @@ Ve_Blit_Atlas_Fs_Params :: struct #align(16) { | ||||
|         _: [12]u8, | ||||
|     }, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     layout(location = 0) out vec2 uv; | ||||
|     layout(location = 1) in vec2 v_texture; | ||||
|     layout(location = 0) in vec2 v_position; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         uv = v_texture; | ||||
|         gl_Position = vec4(v_position, 0.0, 1.0); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_blit_atlas_vs_source_glsl410 := [214]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,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,0x32,0x20,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,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,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,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, | ||||
|     0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75, | ||||
|     0x72,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, | ||||
|     0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x5f,0x70,0x6f,0x73, | ||||
|     0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29, | ||||
|     0x3b,0x0a,0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     uniform ivec4 ve_blit_atlas_fs_params[1]; | ||||
|     uniform sampler2D ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler; | ||||
|  | ||||
|     layout(location = 0) in vec2 uv; | ||||
|     layout(location = 0) out vec4 frag_color; | ||||
|  | ||||
|     float down_sample(vec2 uv_1, vec2 texture_size) | ||||
|     { | ||||
|         return 0.25 * (((texture(ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler, uv_1).x + texture(ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler, fma(vec2(0.0, 1.0), texture_size, uv_1)).x) + texture(ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler, fma(vec2(1.0, 0.0), texture_size, uv_1)).x) + texture(ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler, uv_1 + texture_size).x); | ||||
|     } | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         uint _88 = uint(ve_blit_atlas_fs_params[0].x); | ||||
|         bool _89 = _88 == 0u; | ||||
|         bool _98; | ||||
|         if (!_89) | ||||
|         { | ||||
|             _98 = _88 == 1u; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             _98 = _89; | ||||
|         } | ||||
|         bool _107; | ||||
|         if (!_98) | ||||
|         { | ||||
|             _107 = _88 == 2u; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             _107 = _98; | ||||
|         } | ||||
|         if (_107) | ||||
|         { | ||||
|             vec2 param = uv + vec2(-0.00048828125, -0.0029296875); | ||||
|             vec2 param_1 = vec2(0.00048828125, 0.001953125); | ||||
|             vec2 param_2 = uv + vec2(0.000244140625, -0.0029296875); | ||||
|             vec2 param_3 = vec2(0.00048828125, 0.001953125); | ||||
|             vec2 param_4 = uv + vec2(-0.000732421875, 0.0009765625); | ||||
|             vec2 param_5 = vec2(0.00048828125, 0.001953125); | ||||
|             vec2 param_6 = uv + vec2(0.000244140625, 0.0009765625); | ||||
|             vec2 param_7 = vec2(0.00048828125, 0.001953125); | ||||
|             frag_color = vec4(1.0, 1.0, 1.0, 0.25 * (((down_sample(param, param_1) + down_sample(param_2, param_3)) + down_sample(param_4, param_5)) + down_sample(param_6, param_7))); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             frag_color = vec4(0.0, 0.0, 0.0, 1.0); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_blit_atlas_fs_source_glsl410 := [1716]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, | ||||
|     0x69,0x66,0x6f,0x72,0x6d,0x20,0x69,0x76,0x65,0x63,0x34,0x20,0x76,0x65,0x5f,0x62, | ||||
|     0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72, | ||||
|     0x61,0x6d,0x73,0x5b,0x31,0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20, | ||||
|     0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x76,0x65,0x5f,0x62,0x6c,0x69, | ||||
|     0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74, | ||||
|     0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61, | ||||
|     0x73,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,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,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,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,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x76,0x65, | ||||
|     0x63,0x32,0x20,0x75,0x76,0x5f,0x31,0x2c,0x20,0x76,0x65,0x63,0x32,0x20,0x74,0x65, | ||||
|     0x78,0x74,0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x29,0x0a,0x7b,0x0a,0x20,0x20, | ||||
|     0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x30,0x2e,0x32,0x35,0x20,0x2a,0x20, | ||||
|     0x28,0x28,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f,0x62,0x6c, | ||||
|     0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78, | ||||
|     0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c, | ||||
|     0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20, | ||||
|     0x75,0x76,0x5f,0x31,0x29,0x2e,0x78,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72, | ||||
|     0x65,0x28,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f, | ||||
|     0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x62, | ||||
|     0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61, | ||||
|     0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x66,0x6d,0x61,0x28,0x76,0x65,0x63,0x32,0x28, | ||||
|     0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x2c,0x20,0x74,0x65,0x78,0x74,0x75, | ||||
|     0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x2c,0x20,0x75,0x76,0x5f,0x31,0x29,0x29,0x2e, | ||||
|     0x78,0x29,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f, | ||||
|     0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,0x61, | ||||
|     0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72, | ||||
|     0x2c,0x20,0x66,0x6d,0x61,0x28,0x76,0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x2c,0x20, | ||||
|     0x30,0x2e,0x30,0x29,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x73,0x69, | ||||
|     0x7a,0x65,0x2c,0x20,0x75,0x76,0x5f,0x31,0x29,0x29,0x2e,0x78,0x29,0x20,0x2b,0x20, | ||||
|     0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f, | ||||
|     0x61,0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72, | ||||
|     0x65,0x5f,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f, | ||||
|     0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x5f, | ||||
|     0x31,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65, | ||||
|     0x29,0x2e,0x78,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, | ||||
|     0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20, | ||||
|     0x5f,0x38,0x38,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x76,0x65,0x5f,0x62,0x6c, | ||||
|     0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, | ||||
|     0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f, | ||||
|     0x6f,0x6c,0x20,0x5f,0x38,0x39,0x20,0x3d,0x20,0x5f,0x38,0x38,0x20,0x3d,0x3d,0x20, | ||||
|     0x30,0x75,0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x39,0x38, | ||||
|     0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x38,0x39,0x29,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x39, | ||||
|     0x38,0x20,0x3d,0x20,0x5f,0x38,0x38,0x20,0x3d,0x3d,0x20,0x31,0x75,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,0x39,0x38,0x20, | ||||
|     0x3d,0x20,0x5f,0x38,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20, | ||||
|     0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x69,0x66,0x20,0x28,0x21,0x5f,0x39,0x38,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x37,0x20,0x3d,0x20,0x5f, | ||||
|     0x38,0x38,0x20,0x3d,0x3d,0x20,0x32,0x75,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,0x31,0x30,0x37,0x20,0x3d,0x20,0x5f,0x39, | ||||
|     0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20, | ||||
|     0x28,0x5f,0x31,0x30,0x37,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20, | ||||
|     0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x30, | ||||
|     0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x30, | ||||
|     0x30,0x32,0x39,0x32,0x39,0x36,0x38,0x37,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     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,0x30,0x30,0x30,0x34,0x38,0x38, | ||||
|     0x32,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31, | ||||
|     0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63, | ||||
|     0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b, | ||||
|     0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34, | ||||
|     0x30,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x32,0x39,0x32,0x39,0x36, | ||||
|     0x38,0x37,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65, | ||||
|     0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x76,0x65,0x63, | ||||
|     0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x2c, | ||||
|     0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x29,0x3b,0x0a,0x20, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61, | ||||
|     0x6d,0x5f,0x34,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28, | ||||
|     0x2d,0x30,0x2e,0x30,0x30,0x30,0x37,0x33,0x32,0x34,0x32,0x31,0x38,0x37,0x35,0x2c, | ||||
|     0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72, | ||||
|     0x61,0x6d,0x5f,0x35,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30, | ||||
|     0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31, | ||||
|     0x39,0x35,0x33,0x31,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x20,0x3d,0x20, | ||||
|     0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32, | ||||
|     0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39, | ||||
|     0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x20,0x3d,0x20, | ||||
|     0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31, | ||||
|     0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x29, | ||||
|     0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, | ||||
|     0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c, | ||||
|     0x20,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x32,0x35,0x20, | ||||
|     0x2a,0x20,0x28,0x28,0x28,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65, | ||||
|     0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29, | ||||
|     0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70, | ||||
|     0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29, | ||||
|     0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28, | ||||
|     0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35, | ||||
|     0x29,0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65, | ||||
|     0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, | ||||
|     0x37,0x29,0x29,0x29,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,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20, | ||||
|     0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30, | ||||
|     0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a, | ||||
|     0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     static float4 gl_Position; | ||||
|     static float2 uv; | ||||
| @@ -342,6 +539,28 @@ ve_blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc { | ||||
|     desc: sg.Shader_Desc | ||||
|     desc.label = "ve_blit_atlas_shader" | ||||
|     #partial switch backend { | ||||
|     case .GLCORE: | ||||
|         desc.attrs[0].name = "v_position" | ||||
|         desc.attrs[1].name = "v_texture" | ||||
|         desc.vs.source = transmute(cstring)&ve_blit_atlas_vs_source_glsl410 | ||||
|         desc.vs.entry = "main" | ||||
|         desc.fs.source = transmute(cstring)&ve_blit_atlas_fs_source_glsl410 | ||||
|         desc.fs.entry = "main" | ||||
|         desc.fs.uniform_blocks[0].size = 16 | ||||
|         desc.fs.uniform_blocks[0].layout = .STD140 | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].name = "ve_blit_atlas_fs_params" | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].type = .INT4 | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].array_count = 1 | ||||
|         desc.fs.images[0].used = true | ||||
|         desc.fs.images[0].multisampled = false | ||||
|         desc.fs.images[0].image_type = ._2D | ||||
|         desc.fs.images[0].sample_type = .FLOAT | ||||
|         desc.fs.samplers[0].used = true | ||||
|         desc.fs.samplers[0].sampler_type = .FILTERING | ||||
|         desc.fs.image_sampler_pairs[0].used = true | ||||
|         desc.fs.image_sampler_pairs[0].image_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].sampler_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].glsl_name = "ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler" | ||||
|     case .D3D11: | ||||
|         desc.attrs[0].sem_name = "TEXCOORD" | ||||
|         desc.attrs[0].sem_index = 0 | ||||
|   | ||||
							
								
								
									
										0
									
								
								code/sectr/shaders/ve_demo/ve_demo_glyph_vs.glsl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								code/sectr/shaders/ve_demo/ve_demo_glyph_vs.glsl
									
									
									
									
									
										Normal file
									
								
							| @@ -6,7 +6,7 @@ import sg "thirdparty:sokol/gfx" | ||||
|     Generated by sokol-shdc (https://github.com/floooh/sokol-tools) | ||||
|  | ||||
|     Cmdline: | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_draw_text.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_draw_text.odin --slang hlsl5 --format=sokol_odin --module =vefc_draw_text | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_draw_text.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_draw_text.odin --slang glsl410:hlsl5 --format=sokol_odin --module =vefc_draw_text | ||||
|  | ||||
|     Overview: | ||||
|     ========= | ||||
| @@ -44,6 +44,127 @@ Ve_Draw_Text_Fs_Params :: struct #align(16) { | ||||
|         colour: [4]f32, | ||||
|     }, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     layout(location = 0) out vec2 uv; | ||||
|     layout(location = 1) in vec2 v_texture; | ||||
|     layout(location = 0) in vec2 v_position; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         uv = v_texture; | ||||
|         gl_Position = vec4((v_position * 2.0) - vec2(1.0), 0.0, 1.0); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_draw_text_vs_source_glsl410 := [234]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,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,0x32,0x20,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,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,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,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, | ||||
|     0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75, | ||||
|     0x72,0x65,0x3b,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,0x76,0x5f,0x70,0x6f, | ||||
|     0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x20,0x2d,0x20, | ||||
|     0x76,0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20, | ||||
|     0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     struct ve_draw_text_fs_params | ||||
|     { | ||||
|         int down_sample; | ||||
|         vec4 colour; | ||||
|     }; | ||||
|  | ||||
|     uniform ve_draw_text_fs_params _31; | ||||
|  | ||||
|     uniform sampler2D ve_draw_text_src_texture_ve_draw_text_src_sampler; | ||||
|  | ||||
|     layout(location = 0) in vec2 uv; | ||||
|     layout(location = 0) out vec4 frag_color; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         float alpha = texture(ve_draw_text_src_texture_ve_draw_text_src_sampler, uv).x; | ||||
|         if (uint(_31.down_sample) == 1u) | ||||
|         { | ||||
|             alpha = 0.25 * (((texture(ve_draw_text_src_texture_ve_draw_text_src_sampler, uv + vec2(-0.000244140625, -0.0009765625)).x + texture(ve_draw_text_src_texture_ve_draw_text_src_sampler, uv + vec2(-0.000244140625, 0.0009765625)).x) + texture(ve_draw_text_src_texture_ve_draw_text_src_sampler, uv + vec2(0.000244140625, -0.0009765625)).x) + texture(ve_draw_text_src_texture_ve_draw_text_src_sampler, uv + vec2(0.000244140625, 0.0009765625)).x); | ||||
|         } | ||||
|         frag_color = vec4(_31.colour.xyz, _31.colour.w * alpha); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_draw_text_fs_source_glsl410 := [931]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x73,0x74, | ||||
|     0x72,0x75,0x63,0x74,0x20,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78, | ||||
|     0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20, | ||||
|     0x20,0x20,0x69,0x6e,0x74,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c, | ||||
|     0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f, | ||||
|     0x75,0x72,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20, | ||||
|     0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f, | ||||
|     0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x5f,0x33,0x31,0x3b,0x0a,0x0a,0x75,0x6e,0x69, | ||||
|     0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x76, | ||||
|     0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f, | ||||
|     0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f, | ||||
|     0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72, | ||||
|     0x3b,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, | ||||
|     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,0x6f,0x75,0x74,0x20,0x76,0x65,0x63, | ||||
|     0x34,0x20,0x66,0x72,0x61,0x67,0x5f,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,0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x6c,0x70,0x68,0x61,0x20,0x3d,0x20,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f, | ||||
|     0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63, | ||||
|     0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x29,0x2e,0x78,0x3b, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x75,0x69,0x6e,0x74,0x28,0x5f,0x33, | ||||
|     0x31,0x2e,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x29,0x20,0x3d, | ||||
|     0x3d,0x20,0x31,0x75,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x20,0x20,0x61,0x6c,0x70,0x68,0x61,0x20,0x3d,0x20,0x30,0x2e,0x32,0x35, | ||||
|     0x20,0x2a,0x20,0x28,0x28,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65, | ||||
|     0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c, | ||||
|     0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30, | ||||
|     0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x30, | ||||
|     0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2e,0x78,0x20,0x2b,0x20, | ||||
|     0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f, | ||||
|     0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65, | ||||
|     0x5f,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72, | ||||
|     0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x20,0x2b,0x20, | ||||
|     0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34, | ||||
|     0x30,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36, | ||||
|     0x32,0x35,0x29,0x29,0x2e,0x78,0x29,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72, | ||||
|     0x65,0x28,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73, | ||||
|     0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x64,0x72, | ||||
|     0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70, | ||||
|     0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x30, | ||||
|     0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x2d, | ||||
|     0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2e,0x78, | ||||
|     0x29,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f,0x64, | ||||
|     0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78, | ||||
|     0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78, | ||||
|     0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75, | ||||
|     0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34, | ||||
|     0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37, | ||||
|     0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, | ||||
|     0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x33,0x31,0x2e,0x63,0x6f,0x6c,0x6f, | ||||
|     0x75,0x72,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,0x33,0x31,0x2e,0x63,0x6f,0x6c,0x6f, | ||||
|     0x75,0x72,0x2e,0x77,0x20,0x2a,0x20,0x61,0x6c,0x70,0x68,0x61,0x29,0x3b,0x0a,0x7d, | ||||
|     0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     static float4 gl_Position; | ||||
|     static float2 uv; | ||||
| @@ -257,6 +378,31 @@ ve_draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc { | ||||
|     desc: sg.Shader_Desc | ||||
|     desc.label = "ve_draw_text_shader" | ||||
|     #partial switch backend { | ||||
|     case .GLCORE: | ||||
|         desc.attrs[0].name = "v_position" | ||||
|         desc.attrs[1].name = "v_texture" | ||||
|         desc.vs.source = transmute(cstring)&ve_draw_text_vs_source_glsl410 | ||||
|         desc.vs.entry = "main" | ||||
|         desc.fs.source = transmute(cstring)&ve_draw_text_fs_source_glsl410 | ||||
|         desc.fs.entry = "main" | ||||
|         desc.fs.uniform_blocks[0].size = 32 | ||||
|         desc.fs.uniform_blocks[0].layout = .STD140 | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].name = "_31.down_sample" | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].type = .INT | ||||
|         // array_count = desc.fs.uniform_blocks[0].uniforms[0] | ||||
|         desc.fs.uniform_blocks[0].uniforms[1].name = "_31.colour" | ||||
|         desc.fs.uniform_blocks[0].uniforms[1].type = .FLOAT4 | ||||
|         // array_count = desc.fs.uniform_blocks[0].uniforms[1] | ||||
|         desc.fs.images[0].used = true | ||||
|         desc.fs.images[0].multisampled = false | ||||
|         desc.fs.images[0].image_type = ._2D | ||||
|         desc.fs.images[0].sample_type = .FLOAT | ||||
|         desc.fs.samplers[0].used = true | ||||
|         desc.fs.samplers[0].sampler_type = .FILTERING | ||||
|         desc.fs.image_sampler_pairs[0].used = true | ||||
|         desc.fs.image_sampler_pairs[0].image_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].sampler_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].glsl_name = "ve_draw_text_src_texture_ve_draw_text_src_sampler" | ||||
|     case .D3D11: | ||||
|         desc.attrs[0].sem_name = "TEXCOORD" | ||||
|         desc.attrs[0].sem_index = 0 | ||||
|   | ||||
| @@ -6,7 +6,7 @@ import sg "thirdparty:sokol/gfx" | ||||
|     Generated by sokol-shdc (https://github.com/floooh/sokol-tools) | ||||
|  | ||||
|     Cmdline: | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_render_glyph.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_render_glyph.odin --slang hlsl5 --format=sokol_odin --module =vefc_render_glyph | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_render_glyph.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_render_glyph.odin --slang glsl410:hlsl5 --format=sokol_odin --module =vefc_render_glyph | ||||
|  | ||||
|     Overview: | ||||
|     ========= | ||||
| @@ -20,6 +20,61 @@ import sg "thirdparty:sokol/gfx" | ||||
| */ | ||||
| ATTR_ve_render_glyph_vs_v_position :: 0 | ||||
| ATTR_ve_render_glyph_vs_v_texture :: 1 | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     layout(location = 0) out vec2 uv; | ||||
|     layout(location = 1) in vec2 v_texture; | ||||
|     layout(location = 0) in vec2 v_position; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         uv = v_texture; | ||||
|         gl_Position = vec4(v_position, 0.0, 1.0); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_render_glyph_vs_source_glsl410 := [214]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,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,0x32,0x20,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,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,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,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, | ||||
|     0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75, | ||||
|     0x72,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, | ||||
|     0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x5f,0x70,0x6f,0x73, | ||||
|     0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29, | ||||
|     0x3b,0x0a,0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     layout(location = 0) out vec4 frag_color; | ||||
|     layout(location = 0) in vec2 uv; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         frag_color = vec4(1.0); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_render_glyph_fs_source_glsl410 := [136]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,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,0x66,0x72,0x61,0x67, | ||||
|     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,0x30,0x29,0x20,0x69,0x6e,0x20, | ||||
|     0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d, | ||||
|     0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67, | ||||
|     0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e, | ||||
|     0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     static float4 gl_Position; | ||||
|     static float2 uv; | ||||
| @@ -163,6 +218,13 @@ ve_render_glyph_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc { | ||||
|     desc: sg.Shader_Desc | ||||
|     desc.label = "ve_render_glyph_shader" | ||||
|     #partial switch backend { | ||||
|     case .GLCORE: | ||||
|         desc.attrs[0].name = "v_position" | ||||
|         desc.attrs[1].name = "v_texture" | ||||
|         desc.vs.source = transmute(cstring)&ve_render_glyph_vs_source_glsl410 | ||||
|         desc.vs.entry = "main" | ||||
|         desc.fs.source = transmute(cstring)&ve_render_glyph_fs_source_glsl410 | ||||
|         desc.fs.entry = "main" | ||||
|     case .D3D11: | ||||
|         desc.attrs[0].sem_name = "TEXCOORD" | ||||
|         desc.attrs[0].sem_index = 0 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user