From 569ce5ce99b16cf607505e7cb3ebf1ee8d8cc389 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 15 Jun 2024 02:08:20 -0400 Subject: [PATCH] still diagnosing... --- code/sectr/engine/render_vefc.odin | 36 +- code/sectr/font/provider_VEFontCache.odin | 108 ++-- code/sectr/shaders/simple_font_glyph.odin | 119 +---- code/sectr/shaders/ve_blit_atlas.odin | 499 +++++------------- code/sectr/shaders/ve_blit_atlas.shdc.glsl | 25 +- code/sectr/shaders/ve_draw_text.odin | 352 ++++-------- code/sectr/shaders/ve_draw_text.shdc.glsl | 23 +- code/sectr/shaders/ve_render_glyph.odin | 170 ++---- code/sectr/shaders/ve_source_shared.shdc.glsl | 9 +- scripts/compile_shaders.ps1 | 8 +- 10 files changed, 399 insertions(+), 950 deletions(-) diff --git a/code/sectr/engine/render_vefc.odin b/code/sectr/engine/render_vefc.odin index 9bb7448..bc09286 100644 --- a/code/sectr/engine/render_vefc.odin +++ b/code/sectr/engine/render_vefc.odin @@ -129,8 +129,8 @@ render :: proc() } sokol_gfx.begin_pass( pass ) - // sokol_gfx.apply_viewport( 0,0, width, height, origin_top_left = true ) - // sokol_gfx.apply_scissor_rect( 0,0, width, height, origin_top_left = true ) + sokol_gfx.apply_viewport( 0,0, width, height, origin_top_left = true ) + sokol_gfx.apply_scissor_rect( 0,0, width, height, origin_top_left = true ) sokol_gfx.apply_pipeline( glyph_pipeline ) @@ -142,16 +142,11 @@ render :: proc() 0 = 0, }, index_buffer = draw_list_ibuf, - index_buffer_offset = 0,//i32(draw_call.start_index), + index_buffer_offset = 0,//i32(draw_call.start_index) * size_of(u32), fs = {}, } sokol_gfx.apply_bindings( bindings ) - // num_indices := draw_call.end_index - draw_call.start_index - // sokol_gfx.draw( 0, num_indices, 1 ) - - // sokol_gfx.end_pass() - // 2. Do the atlas rendering pass // A simple 16-tap box downsample shader is then used to blit from this intermediate texture to the final atlas location case .Atlas: @@ -166,13 +161,13 @@ render :: proc() } sokol_gfx.begin_pass( pass ) - // sokol_gfx.apply_viewport( 0, 0, width, height, origin_top_left = true ) - // sokol_gfx.apply_scissor_rect( 0, 0, width, height, origin_top_left = true ) + sokol_gfx.apply_viewport( 0, 0, width, height, origin_top_left = true ) + sokol_gfx.apply_scissor_rect( 0, 0, width, height, origin_top_left = true ) sokol_gfx.apply_pipeline( atlas_pipeline ) fs_uniform := Ve_Blit_Atlas_Fs_Params { region = cast(i32) draw_call.region } - sokol_gfx.apply_uniforms( ShaderStage.FS, SLOT_ve_blit_atlas_fs_params, Range { & fs_uniform, size_of(fs_uniform) }) + sokol_gfx.apply_uniforms( ShaderStage.FS, SLOT_ve_blit_atlas_fs_params, Range { & fs_uniform, size_of(Ve_Blit_Atlas_Fs_Params) }) sokol_gfx.apply_bindings(Bindings { vertex_buffers = { @@ -182,10 +177,10 @@ render :: proc() 0 = 0, }, index_buffer = draw_list_ibuf, - index_buffer_offset = 0,//i32(draw_call.start_index), + index_buffer_offset = 0,//i32(draw_call.start_index) * size_of(u32), fs = { images = { SLOT_ve_blit_atlas_src_texture = glyph_rt_color, }, - samplers = { SLOT_ve_blit_atlas_src_sampler = gfx_sampler, }, + samplers = { SLOT_ve_blit_atlas_src_sampler = glyph_rt_sampler, }, }, }) @@ -205,23 +200,24 @@ render :: proc() pass.swapchain = sokol_glue.swapchain() sokol_gfx.begin_pass( pass ) - // sokol_gfx.apply_viewport( 0, 0, width, height, origin_top_left = true ) - // sokol_gfx.apply_scissor_rect( 0, 0, width, height, origin_top_left = true ) + sokol_gfx.apply_viewport( 0, 0, width, height, origin_top_left = true ) + sokol_gfx.apply_scissor_rect( 0, 0, width, height, origin_top_left = true ) sokol_gfx.apply_pipeline( screen_pipeline ) src_rt := atlas_rt_color - fs_uniform := Ve_Draw_Text_Fs_Params { + fs_target_uniform := Ve_Draw_Text_Fs_Params { // down_sample = draw_call.pass == .Target_Uncached ? 1 : 0, + down_sample = 0, colour = {1, 1, 1, 1}, } if draw_call.pass == .Target_Uncached { - fs_uniform.down_sample = 1 + fs_target_uniform.down_sample = 1 src_rt = glyph_rt_color } - sokol_gfx.apply_uniforms( ShaderStage.FS, SLOT_ve_blit_atlas_fs_params, Range { & fs_uniform, size_of(fs_uniform) }) + sokol_gfx.apply_uniforms( ShaderStage.FS, SLOT_ve_draw_text_fs_params, Range { & fs_target_uniform, size_of(Ve_Draw_Text_Fs_Params) }) sokol_gfx.apply_bindings(Bindings { vertex_buffers = { @@ -231,10 +227,10 @@ render :: proc() 0 = 0, }, index_buffer = draw_list_ibuf, - index_buffer_offset = 0,//i32(draw_call.start_index), + index_buffer_offset = 0,//i32(draw_call.start_index) * size_of(u32), fs = { images = { SLOT_ve_draw_text_src_texture = src_rt, }, - samplers = { SLOT_ve_draw_text_src_sampler = gfx_sampler, }, + samplers = { SLOT_ve_draw_text_src_sampler = glyph_rt_sampler, }, }, }) } diff --git a/code/sectr/font/provider_VEFontCache.odin b/code/sectr/font/provider_VEFontCache.odin index 93191c5..8273052 100644 --- a/code/sectr/font/provider_VEFontCache.odin +++ b/code/sectr/font/provider_VEFontCache.odin @@ -32,6 +32,7 @@ FontProviderData :: struct font_cache : HMapChained(FontDef), gfx_sampler : sokol_gfx.Sampler, + glyph_rt_sampler : sokol_gfx.Sampler, draw_list_vbuf : sokol_gfx.Buffer, draw_list_ibuf : sokol_gfx.Buffer, @@ -130,9 +131,14 @@ font_provider_startup :: proc() min_filter = Filter.NEAREST, mag_filter = Filter.NEAREST, mipmap_filter = Filter.NONE, - wrap_u = Wrap.CLAMP_TO_EDGE, - wrap_v = Wrap.CLAMP_TO_EDGE, + // wrap_u = Wrap.CLAMP_TO_EDGE, + // wrap_v = Wrap.CLAMP_TO_EDGE, + wrap_u = .REPEAT, + wrap_v = .REPEAT, + min_lod = -1000.0, + max_lod = 1000.0, border_color = BorderColor.OPAQUE_BLACK, + compare = .NEVER }) verify( sokol_gfx.query_sampler_state( gfx_sampler) < ResourceState.FAILED, "Failed to make gfx_sampler" ) @@ -141,32 +147,32 @@ font_provider_startup :: proc() vs_layout : VertexLayoutState { using vs_layout - attrs[ATTR_ve_render_glyph_vs_v_position] = VertexAttributeState { - format = VertexFormat.FLOAT2, + attrs[ATTR_ve_render_glyph_vs_v_elem] = VertexAttributeState { + format = VertexFormat.FLOAT4, offset = 0, buffer_index = 0, } - attrs[ATTR_ve_render_glyph_vs_v_texture] = VertexAttributeState { - format = VertexFormat.FLOAT2, - offset = size_of(Vec2), - buffer_index = 0, - } + // attrs[ATTR_ve_render_glyph_vs_v_texture] = VertexAttributeState { + // format = VertexFormat.FLOAT2, + // offset = size_of(Vec2), + // buffer_index = 0, + // } buffers[0] = VertexBufferLayoutState { - stride = size_of(Vec2) * 2, + stride = size_of([4]f32), step_func = VertexStep.PER_VERTEX } } color_target := ColorTargetState { pixel_format = .R8, - // write_mask = + write_mask = .RGBA, blend = BlendState { enabled = true, src_factor_rgb = .ONE_MINUS_DST_COLOR, dst_factor_rgb = .ONE_MINUS_SRC_COLOR, op_rgb = BlendOp.ADD, - src_factor_alpha = BlendFactor.ONE, - dst_factor_alpha = BlendFactor.ZERO, + src_factor_alpha = .ONE_MINUS_DST_ALPHA, + dst_factor_alpha = .ONE_MINUS_SRC_ALPHA, op_alpha = BlendOp.ADD, }, } @@ -181,10 +187,11 @@ font_provider_startup :: proc() color_count = 1, depth = { pixel_format = .DEPTH, - // compare = .ALWAYS, + compare = .ALWAYS, + write_enabled = true, }, cull_mode = .NONE, - // sample_count = 1, + sample_count = 1, // label = }) verify( sokol_gfx.query_pipeline_state(glyph_pipeline) < ResourceState.FAILED, "Failed to make glyph_pipeline" ) @@ -240,7 +247,7 @@ font_provider_startup :: proc() load_action = .LOAD, store_action = .STORE, // clear_value = {0.01,0.01,0.01,1}, - clear_value = {0.00, 0.00, 0.00, 0.00}, + clear_value = {0.10, 0.10, 0.10, 1.00}, } } } @@ -257,32 +264,32 @@ font_provider_startup :: proc() vs_layout : VertexLayoutState { using vs_layout - attrs[ATTR_ve_blit_atlas_vs_v_position] = VertexAttributeState { - format = VertexFormat.FLOAT2, + attrs[ATTR_ve_blit_atlas_vs_v_elem] = VertexAttributeState { + format = VertexFormat.FLOAT4, offset = 0, buffer_index = 0, } - attrs[ATTR_ve_blit_atlas_vs_v_texture] = VertexAttributeState { - format = VertexFormat.FLOAT2, - offset = size_of(Vec2), - buffer_index = 0, - } + // attrs[ATTR_ve_blit_atlas_vs_v_texture] = VertexAttributeState { + // format = VertexFormat.FLOAT2, + // offset = size_of(Vec2), + // buffer_index = 0, + // } buffers[0] = VertexBufferLayoutState { - stride = size_of(Vec2) * 2, + stride = size_of([4]f32), step_func = VertexStep.PER_VERTEX } } color_target := ColorTargetState { pixel_format = .R8, - // write_mask = + write_mask = .RGBA, blend = BlendState { enabled = true, src_factor_rgb = .SRC_ALPHA, dst_factor_rgb = .ONE_MINUS_SRC_ALPHA, op_rgb = BlendOp.ADD, - src_factor_alpha = BlendFactor.ONE, - dst_factor_alpha = BlendFactor.ZERO, + src_factor_alpha = .SRC_ALPHA, + dst_factor_alpha = .ONE_MINUS_SRC_ALPHA, op_alpha = BlendOp.ADD, }, } @@ -298,9 +305,10 @@ font_provider_startup :: proc() depth = { pixel_format = .DEPTH, compare = .ALWAYS, + write_enabled = true, }, cull_mode = .NONE, - // sample_count = 1, + sample_count = 1, }) } @@ -334,6 +342,19 @@ font_provider_startup :: proc() }) verify( sokol_gfx.query_image_state(atlas_rt_depth) < ResourceState.FAILED, "Failed to make atlas_rt_depth") + glyph_rt_sampler = sokol_gfx.make_sampler( SamplerDescription { + min_filter = Filter.NEAREST, + mag_filter = Filter.NEAREST, + mipmap_filter = Filter.NONE, + wrap_u = .CLAMP_TO_EDGE, + wrap_v = .CLAMP_TO_EDGE, + min_lod = -1000.0, + max_lod = 1000.0, + border_color = BorderColor.OPAQUE_BLACK, + compare = .NEVER + }) + verify( sokol_gfx.query_sampler_state( gfx_sampler) < ResourceState.FAILED, "Failed to make gfx_sampler" ) + color_attach := AttachmentDesc { image = atlas_rt_color, // mip_level = 1, @@ -352,9 +373,9 @@ font_provider_startup :: proc() atlas_action := PassAction { colors = { 0 = { - load_action = .LOAD, + load_action = .DONTCARE, store_action = .STORE, - clear_value = {0, 0, 0, 0.0}, + clear_value = {0.01, 0.01, 0.01, 1.0}, } } } @@ -371,32 +392,32 @@ font_provider_startup :: proc() vs_layout : VertexLayoutState { using vs_layout - attrs[ATTR_ve_draw_text_vs_v_position] = VertexAttributeState { - format = VertexFormat.FLOAT2, + attrs[ATTR_ve_draw_text_vs_v_elem] = VertexAttributeState { + format = VertexFormat.FLOAT4, offset = 0, buffer_index = 0, } - attrs[ATTR_ve_draw_text_vs_v_texture] = VertexAttributeState { - format = VertexFormat.FLOAT2, - offset = size_of(Vec2), - buffer_index = 0, - } + // attrs[ATTR_ve_draw_text_vs_v_texture] = VertexAttributeState { + // format = VertexFormat.FLOAT2, + // offset = size_of(Vec2), + // buffer_index = 0, + // } buffers[0] = VertexBufferLayoutState { - stride = size_of(Vec2) * 2, + stride = size_of([4]f32), step_func = VertexStep.PER_VERTEX } } color_target := ColorTargetState { pixel_format = app_env.defaults.color_format, - // write_mask = + write_mask = .RGBA, blend = BlendState { enabled = true, src_factor_rgb = .SRC_ALPHA, dst_factor_rgb = .ONE_MINUS_SRC_ALPHA, op_rgb = BlendOp.ADD, - src_factor_alpha = BlendFactor.ONE, - dst_factor_alpha = BlendFactor.ZERO, + src_factor_alpha = .SRC_ALPHA, + dst_factor_alpha = .ONE_MINUS_SRC_ALPHA, op_alpha = BlendOp.ADD, }, } @@ -413,6 +434,7 @@ font_provider_startup :: proc() depth = { pixel_format = app_env.defaults.depth_format, compare = .ALWAYS, + write_enabled = true, }, cull_mode = .NONE, }) @@ -424,9 +446,9 @@ font_provider_startup :: proc() screen_action := PassAction { colors = { 0 = { - load_action = .LOAD, + load_action = .CLEAR, store_action = .STORE, - clear_value = {0.0,0.0,0.0,0.0}, + clear_value = {0.0,0.0,0.0,1.0}, } } } diff --git a/code/sectr/shaders/simple_font_glyph.odin b/code/sectr/shaders/simple_font_glyph.odin index f3f6ad1..dfb0b58 100644 --- a/code/sectr/shaders/simple_font_glyph.odin +++ b/code/sectr/shaders/simple_font_glyph.odin @@ -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 glsl410: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 hlsl4 --format=sokol_odin Overview: ========= @@ -52,84 +52,6 @@ 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) { @@ -172,7 +94,7 @@ font_glyph_fs_source_glsl410 := [292]u8 { } */ @(private) -font_glyph_vs_source_hlsl5 := [803]u8 { +font_glyph_vs_source_hlsl4 := [803]u8 { 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x66,0x6f,0x6e,0x74,0x5f,0x67,0x6c,0x79, 0x70,0x68,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, @@ -262,7 +184,7 @@ font_glyph_vs_source_hlsl5 := [803]u8 { } */ @(private) -font_glyph_fs_source_hlsl5 := [658]u8 { +font_glyph_fs_source_hlsl4 := [658]u8 { 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x66,0x6f,0x6e,0x74,0x5f,0x67,0x6c,0x79, 0x70,0x68,0x5f,0x66,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, @@ -310,45 +232,18 @@ 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 desc.attrs[1].sem_name = "TEXCOORD" desc.attrs[1].sem_index = 1 - desc.vs.source = transmute(cstring)&font_glyph_vs_source_hlsl5 - desc.vs.d3d11_target = "vs_5_0" + desc.vs.source = transmute(cstring)&font_glyph_vs_source_hlsl4 + desc.vs.d3d11_target = "vs_4_0" desc.vs.entry = "main" desc.vs.uniform_blocks[0].size = 64 desc.vs.uniform_blocks[0].layout = .STD140 - desc.fs.source = transmute(cstring)&font_glyph_fs_source_hlsl5 - desc.fs.d3d11_target = "ps_5_0" + desc.fs.source = transmute(cstring)&font_glyph_fs_source_hlsl4 + desc.fs.d3d11_target = "ps_4_0" desc.fs.entry = "main" desc.fs.uniform_blocks[0].size = 16 desc.fs.uniform_blocks[0].layout = .STD140 diff --git a/code/sectr/shaders/ve_blit_atlas.odin b/code/sectr/shaders/ve_blit_atlas.odin index dda129f..8f2dafe 100644 --- a/code/sectr/shaders/ve_blit_atlas.odin +++ b/code/sectr/shaders/ve_blit_atlas.odin @@ -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 glsl410: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 hlsl4 --format=sokol_odin --module =vefc_blit_atlas Overview: ========= @@ -14,8 +14,7 @@ import sg "thirdparty:sokol/gfx" Get shader desc: ve_blit_atlas_shader_desc(sg.query_backend()) Vertex shader: ve_blit_atlas_vs Attributes: - ATTR_ve_blit_atlas_vs_v_position => 0 - ATTR_ve_blit_atlas_vs_v_texture => 1 + ATTR_ve_blit_atlas_vs_v_elem => 0 Fragment shader: ve_blit_atlas_fs Uniform block 've_blit_atlas_fs_params': Odin struct: Ve_Blit_Atlas_Fs_Params @@ -32,8 +31,7 @@ import sg "thirdparty:sokol/gfx" Image: ve_blit_atlas_src_texture Sampler: ve_blit_atlas_src_sampler */ -ATTR_ve_blit_atlas_vs_v_position :: 0 -ATTR_ve_blit_atlas_vs_v_texture :: 1 +ATTR_ve_blit_atlas_vs_v_elem :: 0 SLOT_ve_blit_atlas_fs_params :: 0 SLOT_ve_blit_atlas_src_texture :: 0 SLOT_ve_blit_atlas_src_sampler :: 0 @@ -43,213 +41,14 @@ 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; - static float2 v_texture; - static float2 v_position; + static float4 v_elem; struct SPIRV_Cross_Input { - float2 v_position : TEXCOORD0; - float2 v_texture : TEXCOORD1; + float4 v_elem : TEXCOORD0; }; struct SPIRV_Cross_Output @@ -260,14 +59,13 @@ ve_blit_atlas_fs_source_glsl410 := [1716]u8 { void vert_main() { - uv = v_texture; - gl_Position = float4(v_position, 0.0f, 1.0f); + uv = v_elem.zw; + gl_Position = float4(v_elem.xy, 0.0f, 1.0f); } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { - v_texture = stage_input.v_texture; - v_position = stage_input.v_position; + v_elem = stage_input.v_elem; vert_main(); SPIRV_Cross_Output stage_output; stage_output.gl_Position = gl_Position; @@ -276,55 +74,48 @@ ve_blit_atlas_fs_source_glsl410 := [1716]u8 { } */ @(private) -ve_blit_atlas_vs_source_hlsl5 := [675]u8 { +ve_blit_atlas_vs_source_hlsl4 := [560]u8 { 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,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61, - 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x74,0x65,0x78, - 0x74,0x75,0x72,0x65,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,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,0x5f,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,0x5f,0x74,0x65,0x78,0x74, - 0x75,0x72,0x65,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,0x32,0x20,0x75,0x76,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,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,0x66, - 0x6c,0x6f,0x61,0x74,0x34,0x28,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,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,0x76, - 0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65, - 0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x76, - 0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,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, - 0x20,0x3d,0x20,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, + 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x5f,0x65,0x6c,0x65, + 0x6d,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,0x76,0x5f,0x65,0x6c,0x65,0x6d, + 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,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,0x75,0x76,0x20,0x3d,0x20,0x76, + 0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x7a,0x77,0x3b,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,0x76,0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x78,0x79,0x2c,0x20,0x30,0x2e, + 0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,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,0x76,0x5f,0x65,0x6c,0x65, + 0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e, + 0x76,0x5f,0x65,0x6c,0x65,0x6d,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,0x20,0x3d,0x20, + 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, + } /* cbuffer ve_blit_atlas_fs_params : register(b0) { - int _83_region : packoffset(c0); + int _84_region : packoffset(c0); }; Texture2D ve_blit_atlas_src_texture : register(t0); @@ -350,27 +141,26 @@ ve_blit_atlas_vs_source_hlsl5 := [675]u8 { void frag_main() { - uint _88 = uint(_83_region); - bool _89 = _88 == 0u; - bool _98; - if (!_89) + bool _92 = _84_region == 0; + bool _100; + if (!_92) { - _98 = _88 == 1u; + _100 = _84_region == 1; } else { - _98 = _89; + _100 = _92; } - bool _107; - if (!_98) + bool _108; + if (!_100) { - _107 = _88 == 2u; + _108 = _84_region == 2; } else { - _107 = _98; + _108 = _100; } - if (_107) + if (_108) { float2 param = uv + float2(-0.00048828125f, -0.0029296875f); float2 param_1 = float2(0.00048828125f, 0.001953125f); @@ -384,7 +174,7 @@ ve_blit_atlas_vs_source_hlsl5 := [675]u8 { } else { - frag_color = float4(0.0f, 0.0f, 0.0f, 1.0f); + frag_color = float4(1.0f, 0.0f, 0.0f, 0.0500000007450580596923828125f); } } @@ -398,11 +188,11 @@ ve_blit_atlas_vs_source_hlsl5 := [675]u8 { } */ @(private) -ve_blit_atlas_fs_source_hlsl5 := [2150]u8 { +ve_blit_atlas_fs_source_hlsl4 := [2167]u8 { 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f, 0x61,0x74,0x6c,0x61,0x73,0x5f,0x66,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,0x69,0x6e,0x74,0x20,0x5f,0x38,0x33,0x5f,0x72,0x65,0x67, + 0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x5f,0x38,0x34,0x5f,0x72,0x65,0x67, 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,0x54,0x65,0x78,0x74,0x75,0x72, 0x65,0x32,0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x3e,0x20,0x76,0x65,0x5f,0x62, @@ -452,125 +242,102 @@ ve_blit_atlas_fs_source_hlsl5 := [2150]u8 { 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,0x66,0x72,0x61,0x67,0x5f,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,0x5f,0x38,0x33,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e, - 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, + 0x7b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x39,0x32,0x20,0x3d, + 0x20,0x5f,0x38,0x34,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d,0x3d,0x20,0x30, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30,0x30,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x39,0x32,0x29,0x0a,0x20, + 0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30, + 0x30,0x20,0x3d,0x20,0x5f,0x38,0x34,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d, + 0x3d,0x20,0x31,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,0x30,0x20,0x3d,0x20,0x5f,0x39,0x32,0x3b,0x0a,0x20,0x20, + 0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30, + 0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x31,0x30,0x30, + 0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x5f,0x31,0x30,0x38,0x20,0x3d,0x20,0x5f,0x38,0x34,0x5f,0x72,0x65,0x67,0x69,0x6f, + 0x6e,0x20,0x3d,0x3d,0x20,0x32,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,0x66,0x6c, - 0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x75,0x76,0x20, - 0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x34, - 0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x32, - 0x39,0x32,0x39,0x36,0x38,0x37,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, - 0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, - 0x31,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30, - 0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31, - 0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, - 0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32, - 0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30, - 0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c,0x20, + 0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x38,0x20,0x3d,0x20,0x5f,0x31,0x30,0x30, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28, + 0x5f,0x31,0x30,0x38,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d, + 0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d, + 0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20, 0x2d,0x30,0x2e,0x30,0x30,0x32,0x39,0x32,0x39,0x36,0x38,0x37,0x35,0x66,0x29,0x3b, 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20, - 0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, + 0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, 0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c, 0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x37,0x33,0x32,0x34,0x32, - 0x31,0x38,0x37,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35, - 0x36,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66, - 0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x20,0x3d,0x20, + 0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c, + 0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30, + 0x36,0x32,0x35,0x66,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x32,0x39,0x32,0x39,0x36, + 0x38,0x37,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66, + 0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20, 0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32, 0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31, 0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c, - 0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x20,0x3d,0x20,0x75, - 0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30, - 0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30, - 0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, + 0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x75, + 0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30, + 0x30,0x37,0x33,0x32,0x34,0x32,0x31,0x38,0x37,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30, + 0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61, + 0x6d,0x5f,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30, + 0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30, + 0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x37,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30, - 0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30, - 0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, - 0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20, - 0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30, - 0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x32,0x35,0x66,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,0x66, - 0x6c,0x6f,0x61,0x74,0x34,0x28,0x30,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x30,0x66, - 0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x7d,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,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f, - 0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,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,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72, - 0x61,0x67,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, + 0x5f,0x36,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, + 0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66, + 0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29, + 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, + 0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74, + 0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66, + 0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b, + 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, + 0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x31,0x2e,0x30, + 0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x30, + 0x2e,0x32,0x35,0x66,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,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x31,0x2e,0x30,0x66, + 0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e, + 0x30,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x37,0x34,0x35,0x30,0x35,0x38,0x30, + 0x35,0x39,0x36,0x39,0x32,0x33,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x7d,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,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65, + 0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,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,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66, + 0x72,0x61,0x67,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, } 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 - desc.attrs[1].sem_name = "TEXCOORD" - desc.attrs[1].sem_index = 1 - desc.vs.source = transmute(cstring)&ve_blit_atlas_vs_source_hlsl5 - desc.vs.d3d11_target = "vs_5_0" + desc.vs.source = transmute(cstring)&ve_blit_atlas_vs_source_hlsl4 + desc.vs.d3d11_target = "vs_4_0" desc.vs.entry = "main" - desc.fs.source = transmute(cstring)&ve_blit_atlas_fs_source_hlsl5 - desc.fs.d3d11_target = "ps_5_0" + desc.fs.source = transmute(cstring)&ve_blit_atlas_fs_source_hlsl4 + desc.fs.d3d11_target = "ps_4_0" desc.fs.entry = "main" desc.fs.uniform_blocks[0].size = 16 desc.fs.uniform_blocks[0].layout = .STD140 diff --git a/code/sectr/shaders/ve_blit_atlas.shdc.glsl b/code/sectr/shaders/ve_blit_atlas.shdc.glsl index ac499b8..4856481 100644 --- a/code/sectr/shaders/ve_blit_atlas.shdc.glsl +++ b/code/sectr/shaders/ve_blit_atlas.shdc.glsl @@ -21,29 +21,30 @@ uniform ve_blit_atlas_fs_params { float down_sample( vec2 uv, vec2 texture_size ) { float value = - texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 0.0, 0.0 ) * texture_size ).x * 0.25 - + texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 0.0, 1.0 ) * texture_size ).x * 0.25 - + texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 1.0, 0.0 ) * texture_size ).x * 0.25 - + texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 1.0, 1.0 ) * texture_size ).x * 0.25; + texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 0.0f, 0.0f ) * texture_size ).x * 0.25f + + texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 0.0f, 1.0f ) * texture_size ).x * 0.25f + + texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 1.0f, 0.0f ) * texture_size ).x * 0.25f + + texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 1.0f, 1.0f ) * texture_size ).x * 0.25f; return value; } void main() { // TODO(Ed): The original author made these consts, I want to instead expose as uniforms... - const vec2 texture_size = 1.0 / vec2( 2048, 512 ); // VEFontCache.Context.buffer_width/buffer_height - if ( region == 0u || region == 1u || region == 2u ) + const vec2 texture_size = 1.0f / vec2( 2048.0f, 512.0f ); // VEFontCache.Context.buffer_width/buffer_height + int something = region; + if ( region == 0 || region == 1 || region == 2 ) { float alpha = - down_sample( uv + vec2( -1.0, -1.5 ) * texture_size, texture_size ) * 0.25 - + down_sample( uv + vec2( 0.5, -1.5 ) * texture_size, texture_size ) * 0.25 - + down_sample( uv + vec2( -1.5, 0.5 ) * texture_size, texture_size ) * 0.25 - + down_sample( uv + vec2( 0.5, 0.5 ) * texture_size, texture_size ) * 0.25; - frag_color = vec4( 1.0, 1.0, 1.0, alpha ); + down_sample( uv + vec2( -1.0f, -1.5f ) * texture_size, texture_size ) * 0.25f + + down_sample( uv + vec2( 0.5f, -1.5f ) * texture_size, texture_size ) * 0.25f + + down_sample( uv + vec2( -1.5f, 0.5f ) * texture_size, texture_size ) * 0.25f + + down_sample( uv + vec2( 0.5f, 0.5f ) * texture_size, texture_size ) * 0.25f; + frag_color = vec4( 1.0f, 1.0f, 1.0f, alpha ); } else { - frag_color = vec4( 0, 0, 0, 1.0 ); + frag_color = vec4( 1.0f, 0.0f, 0.0f, 0.05f ); } } @end diff --git a/code/sectr/shaders/ve_draw_text.odin b/code/sectr/shaders/ve_draw_text.odin index a3a5fce..1330e84 100644 --- a/code/sectr/shaders/ve_draw_text.odin +++ b/code/sectr/shaders/ve_draw_text.odin @@ -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 glsl410: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 hlsl4 --format=sokol_odin --module =vefc_draw_text Overview: ========= @@ -14,8 +14,7 @@ import sg "thirdparty:sokol/gfx" Get shader desc: ve_draw_text_shader_desc(sg.query_backend()) Vertex shader: ve_draw_text_vs Attributes: - ATTR_ve_draw_text_vs_v_position => 0 - ATTR_ve_draw_text_vs_v_texture => 1 + ATTR_ve_draw_text_vs_v_elem => 0 Fragment shader: ve_draw_text_fs Uniform block 've_draw_text_fs_params': Odin struct: Ve_Draw_Text_Fs_Params @@ -32,8 +31,7 @@ import sg "thirdparty:sokol/gfx" Image: ve_draw_text_src_texture Sampler: ve_draw_text_src_sampler */ -ATTR_ve_draw_text_vs_v_position :: 0 -ATTR_ve_draw_text_vs_v_texture :: 1 +ATTR_ve_draw_text_vs_v_elem :: 0 SLOT_ve_draw_text_fs_params :: 0 SLOT_ve_draw_text_src_texture :: 0 SLOT_ve_draw_text_src_sampler :: 0 @@ -44,137 +42,14 @@ 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; - static float2 v_texture; - static float2 v_position; + static float4 v_elem; struct SPIRV_Cross_Input { - float2 v_position : TEXCOORD0; - float2 v_texture : TEXCOORD1; + float4 v_elem : TEXCOORD0; }; struct SPIRV_Cross_Output @@ -185,14 +60,13 @@ ve_draw_text_fs_source_glsl410 := [931]u8 { void vert_main() { - uv = v_texture; - gl_Position = float4((v_position * 2.0f) - 1.0f.xx, 0.0f, 1.0f); + uv = v_elem.zw; + gl_Position = float4((v_elem.xy * 2.0f) - 1.0f.xx, 0.0f, 1.0f); } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { - v_texture = stage_input.v_texture; - v_position = stage_input.v_position; + v_elem = stage_input.v_elem; vert_main(); SPIRV_Cross_Output stage_output; stage_output.gl_Position = gl_Position; @@ -201,51 +75,44 @@ ve_draw_text_fs_source_glsl410 := [931]u8 { } */ @(private) -ve_draw_text_vs_source_hlsl5 := [694]u8 { +ve_draw_text_vs_source_hlsl4 := [579]u8 { 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,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61, - 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x74,0x65,0x78, - 0x74,0x75,0x72,0x65,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,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,0x5f,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,0x5f,0x74,0x65,0x78,0x74, - 0x75,0x72,0x65,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,0x32,0x20,0x75,0x76,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,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,0x66, - 0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x20,0x2a,0x20,0x32,0x2e,0x30,0x66,0x29,0x20,0x2d,0x20,0x31,0x2e,0x30,0x66, - 0x2e,0x78,0x78,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,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,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3d,0x20,0x73,0x74, - 0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x76,0x5f,0x74,0x65,0x78,0x74, - 0x75,0x72,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74, - 0x69,0x6f,0x6e,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75, - 0x74,0x2e,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,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,0x20,0x3d,0x20,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, + 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x5f,0x65,0x6c,0x65, + 0x6d,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,0x76,0x5f,0x65,0x6c,0x65,0x6d, + 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,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,0x75,0x76,0x20,0x3d,0x20,0x76, + 0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x7a,0x77,0x3b,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,0x76,0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x78,0x79,0x20,0x2a,0x20, + 0x32,0x2e,0x30,0x66,0x29,0x20,0x2d,0x20,0x31,0x2e,0x30,0x66,0x2e,0x78,0x78,0x2c, + 0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,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,0x76,0x5f, + 0x65,0x6c,0x65,0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70, + 0x75,0x74,0x2e,0x76,0x5f,0x65,0x6c,0x65,0x6d,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, + 0x20,0x3d,0x20,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, } /* cbuffer ve_draw_text_fs_params : register(b0) @@ -273,11 +140,11 @@ ve_draw_text_vs_source_hlsl5 := [694]u8 { void frag_main() { float alpha = ve_draw_text_src_texture.Sample(ve_draw_text_src_sampler, uv).x; - if (uint(_31_down_sample) == 1u) + if (_31_down_sample == 1) { alpha = 0.25f * (((ve_draw_text_src_texture.Sample(ve_draw_text_src_sampler, uv + float2(-0.000244140625f, -0.0009765625f)).x + ve_draw_text_src_texture.Sample(ve_draw_text_src_sampler, uv + float2(-0.000244140625f, 0.0009765625f)).x) + ve_draw_text_src_texture.Sample(ve_draw_text_src_sampler, uv + float2(0.000244140625f, -0.0009765625f)).x) + ve_draw_text_src_texture.Sample(ve_draw_text_src_sampler, uv + float2(0.000244140625f, 0.0009765625f)).x); } - frag_color = float4(_31_colour.xyz, _31_colour.w * alpha); + frag_color = float4(_31_colour.xyz, mad(_31_colour.w, alpha, 0.0500000007450580596923828125f)); } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) @@ -290,7 +157,7 @@ ve_draw_text_vs_source_hlsl5 := [694]u8 { } */ @(private) -ve_draw_text_fs_source_hlsl5 := [1303]u8 { +ve_draw_text_fs_source_hlsl4 := [1333]u8 { 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f, 0x74,0x65,0x78,0x74,0x5f,0x66,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, @@ -324,95 +191,70 @@ ve_draw_text_fs_source_hlsl5 := [1303]u8 { 0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,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,0x5f,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,0x66,0x20,0x2a,0x20,0x28,0x28,0x28,0x76, + 0x28,0x5f,0x33,0x31,0x5f,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65, + 0x20,0x3d,0x3d,0x20,0x31,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,0x66,0x20,0x2a,0x20,0x28,0x28,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, + 0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,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,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30, + 0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c,0x20, + 0x2d,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29,0x29, + 0x2e,0x78,0x20,0x2b,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,0x2e,0x53,0x61, + 0x6d,0x70,0x6c,0x65,0x28,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,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30, + 0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30, + 0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29,0x29,0x2e,0x78,0x29,0x20, + 0x2b,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,0x2e,0x53,0x61,0x6d,0x70,0x6c, + 0x65,0x28,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,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34, + 0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x30,0x39, + 0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29,0x29,0x2e,0x78,0x29,0x20,0x2b,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,0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,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,0x66,0x6c, - 0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34, - 0x30,0x36,0x32,0x35,0x66,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36, - 0x35,0x36,0x32,0x35,0x66,0x29,0x29,0x2e,0x78,0x20,0x2b,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,0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,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,0x66,0x6c,0x6f,0x61,0x74, - 0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32, - 0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35, - 0x66,0x29,0x29,0x2e,0x78,0x29,0x20,0x2b,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,0x2e,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,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,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30, - 0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c,0x20, - 0x2d,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29,0x29, - 0x2e,0x78,0x29,0x20,0x2b,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,0x2e,0x53, - 0x61,0x6d,0x70,0x6c,0x65,0x28,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,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30, - 0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30, - 0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,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,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f, - 0x33,0x31,0x5f,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f, - 0x33,0x31,0x5f,0x63,0x6f,0x6c,0x6f,0x75,0x72,0x2e,0x77,0x20,0x2a,0x20,0x61,0x6c, - 0x70,0x68,0x61,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,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65, - 0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,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,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66, - 0x72,0x61,0x67,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, + 0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30, + 0x36,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36, + 0x32,0x35,0x66,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,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x5f,0x33,0x31,0x5f,0x63,0x6f,0x6c,0x6f, + 0x75,0x72,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x6d,0x61,0x64,0x28,0x5f,0x33,0x31,0x5f, + 0x63,0x6f,0x6c,0x6f,0x75,0x72,0x2e,0x77,0x2c,0x20,0x61,0x6c,0x70,0x68,0x61,0x2c, + 0x20,0x30,0x2e,0x30,0x35,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x37,0x34,0x35,0x30, + 0x35,0x38,0x30,0x35,0x39,0x36,0x39,0x32,0x33,0x38,0x32,0x38,0x31,0x32,0x35,0x66, + 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,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69, + 0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,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,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x72,0x61, + 0x67,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, } 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 - desc.attrs[1].sem_name = "TEXCOORD" - desc.attrs[1].sem_index = 1 - desc.vs.source = transmute(cstring)&ve_draw_text_vs_source_hlsl5 - desc.vs.d3d11_target = "vs_5_0" + desc.vs.source = transmute(cstring)&ve_draw_text_vs_source_hlsl4 + desc.vs.d3d11_target = "vs_4_0" desc.vs.entry = "main" - desc.fs.source = transmute(cstring)&ve_draw_text_fs_source_hlsl5 - desc.fs.d3d11_target = "ps_5_0" + desc.fs.source = transmute(cstring)&ve_draw_text_fs_source_hlsl4 + desc.fs.d3d11_target = "ps_4_0" desc.fs.entry = "main" desc.fs.uniform_blocks[0].size = 32 desc.fs.uniform_blocks[0].layout = .STD140 diff --git a/code/sectr/shaders/ve_draw_text.shdc.glsl b/code/sectr/shaders/ve_draw_text.shdc.glsl index 8b36707..c740192 100644 --- a/code/sectr/shaders/ve_draw_text.shdc.glsl +++ b/code/sectr/shaders/ve_draw_text.shdc.glsl @@ -4,14 +4,15 @@ @header import sg "thirdparty:sokol/gfx" @vs ve_draw_text_vs -in vec2 v_position; -in vec2 v_texture; +// in vec2 v_position; +// in vec2 v_texture; +in vec4 v_elem; out vec2 uv; void main() { - uv = v_texture; - gl_Position = vec4( v_position.xy * 2.0 - 1.0, 0.0, 1.0 ); + uv = v_elem.zw; + gl_Position = vec4( v_elem.xy * 2.0f - 1.0f, 0.0f, 1.0f ); } @end @@ -30,17 +31,17 @@ uniform ve_draw_text_fs_params { void main() { float alpha = texture(sampler2D( ve_draw_text_src_texture, ve_draw_text_src_sampler ), uv ).x; - if ( down_sample == 1u ) + if ( down_sample == 1 ) { // TODO(Ed): The original author made these consts, I want to instead expose as uniforms... - const vec2 texture_size = 1.0 / vec2( 2048.0, 512.0 ); // VEFontCache.Context.buffer_width/buffer_height + const vec2 texture_size = 1.0f / vec2( 2048.0f, 512.0f ); // VEFontCache.Context.buffer_width/buffer_height alpha = - texture(sampler2D( ve_draw_text_src_texture, ve_draw_text_src_sampler), uv + vec2( -0.5, -0.5) * texture_size ).x * 0.25 - + texture(sampler2D( ve_draw_text_src_texture, ve_draw_text_src_sampler), uv + vec2( -0.5, 0.5) * texture_size ).x * 0.25 - + texture(sampler2D( ve_draw_text_src_texture, ve_draw_text_src_sampler), uv + vec2( 0.5, -0.5) * texture_size ).x * 0.25 - + texture(sampler2D( ve_draw_text_src_texture, ve_draw_text_src_sampler), uv + vec2( 0.5, 0.5) * texture_size ).x * 0.25; + (texture(sampler2D( ve_draw_text_src_texture, ve_draw_text_src_sampler), uv + vec2( -0.5f, -0.5f) * texture_size ).x * 0.25f) + + (texture(sampler2D( ve_draw_text_src_texture, ve_draw_text_src_sampler), uv + vec2( -0.5f, 0.5f) * texture_size ).x * 0.25f) + + (texture(sampler2D( ve_draw_text_src_texture, ve_draw_text_src_sampler), uv + vec2( 0.5f, -0.5f) * texture_size ).x * 0.25f) + + (texture(sampler2D( ve_draw_text_src_texture, ve_draw_text_src_sampler), uv + vec2( 0.5f, 0.5f) * texture_size ).x * 0.25f); } - frag_color = vec4( colour.xyz, colour.a * alpha ); + frag_color = vec4( colour.xyz, colour.a * alpha + 0.05f ); } @end diff --git a/code/sectr/shaders/ve_render_glyph.odin b/code/sectr/shaders/ve_render_glyph.odin index 9fd0aef..fa19ac3 100644 --- a/code/sectr/shaders/ve_render_glyph.odin +++ b/code/sectr/shaders/ve_render_glyph.odin @@ -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 glsl410: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 hlsl4 --format=sokol_odin --module =vefc_render_glyph Overview: ========= @@ -14,77 +14,18 @@ import sg "thirdparty:sokol/gfx" Get shader desc: ve_render_glyph_shader_desc(sg.query_backend()) Vertex shader: ve_render_glyph_vs Attributes: - ATTR_ve_render_glyph_vs_v_position => 0 - ATTR_ve_render_glyph_vs_v_texture => 1 + ATTR_ve_render_glyph_vs_v_elem => 0 Fragment shader: ve_render_glyph_fs */ -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, -} +ATTR_ve_render_glyph_vs_v_elem :: 0 /* static float4 gl_Position; static float2 uv; - static float2 v_texture; - static float2 v_position; + static float4 v_elem; struct SPIRV_Cross_Input { - float2 v_position : TEXCOORD0; - float2 v_texture : TEXCOORD1; + float4 v_elem : TEXCOORD0; }; struct SPIRV_Cross_Output @@ -95,14 +36,13 @@ ve_render_glyph_fs_source_glsl410 := [136]u8 { void vert_main() { - uv = v_texture; - gl_Position = float4(v_position, 0.0f, 1.0f); + uv = v_elem.zw; + gl_Position = float4(v_elem.xy, 0.0f, 1.0f); } SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { - v_texture = stage_input.v_texture; - v_position = stage_input.v_position; + v_elem = stage_input.v_elem; vert_main(); SPIRV_Cross_Output stage_output; stage_output.gl_Position = gl_Position; @@ -111,50 +51,43 @@ ve_render_glyph_fs_source_glsl410 := [136]u8 { } */ @(private) -ve_render_glyph_vs_source_hlsl5 := [675]u8 { +ve_render_glyph_vs_source_hlsl4 := [560]u8 { 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,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61, - 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x76,0x5f,0x74,0x65,0x78, - 0x74,0x75,0x72,0x65,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f, - 0x61,0x74,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,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,0x5f,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,0x5f,0x74,0x65,0x78,0x74, - 0x75,0x72,0x65,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,0x32,0x20,0x75,0x76,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,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,0x66, - 0x6c,0x6f,0x61,0x74,0x34,0x28,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,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,0x76, - 0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65, - 0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x76,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x76, - 0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,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, - 0x20,0x3d,0x20,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, + 0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x76,0x5f,0x65,0x6c,0x65, + 0x6d,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,0x76,0x5f,0x65,0x6c,0x65,0x6d, + 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,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,0x75,0x76,0x20,0x3d,0x20,0x76, + 0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x7a,0x77,0x3b,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,0x76,0x5f,0x65,0x6c,0x65,0x6d,0x2e,0x78,0x79,0x2c,0x20,0x30,0x2e, + 0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,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,0x76,0x5f,0x65,0x6c,0x65, + 0x6d,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e, + 0x76,0x5f,0x65,0x6c,0x65,0x6d,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,0x20,0x3d,0x20, + 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, + } /* static float4 frag_color; @@ -185,7 +118,7 @@ ve_render_glyph_vs_source_hlsl5 := [675]u8 { } */ @(private) -ve_render_glyph_fs_source_hlsl5 := [427]u8 { +ve_render_glyph_fs_source_hlsl4 := [427]u8 { 0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72, 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x73,0x74,0x61,0x74,0x69,0x63, 0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x73,0x74,0x72, @@ -218,23 +151,14 @@ 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 - desc.attrs[1].sem_name = "TEXCOORD" - desc.attrs[1].sem_index = 1 - desc.vs.source = transmute(cstring)&ve_render_glyph_vs_source_hlsl5 - desc.vs.d3d11_target = "vs_5_0" + desc.vs.source = transmute(cstring)&ve_render_glyph_vs_source_hlsl4 + desc.vs.d3d11_target = "vs_4_0" desc.vs.entry = "main" - desc.fs.source = transmute(cstring)&ve_render_glyph_fs_source_hlsl5 - desc.fs.d3d11_target = "ps_5_0" + desc.fs.source = transmute(cstring)&ve_render_glyph_fs_source_hlsl4 + desc.fs.d3d11_target = "ps_4_0" desc.fs.entry = "main" } return desc diff --git a/code/sectr/shaders/ve_source_shared.shdc.glsl b/code/sectr/shaders/ve_source_shared.shdc.glsl index 8c158b9..5f68d92 100644 --- a/code/sectr/shaders/ve_source_shared.shdc.glsl +++ b/code/sectr/shaders/ve_source_shared.shdc.glsl @@ -1,9 +1,10 @@ -in vec2 v_position; -in vec2 v_texture; +// in vec2 v_position; +// in vec2 v_texture; +in vec4 v_elem; out vec2 uv; void main() { - uv = v_texture; - gl_Position = vec4( v_position.xy, 0.0, 1.0 ); + uv = v_elem.zw; + gl_Position = vec4( v_elem.xy, 0.0, 1.0 ); } diff --git a/scripts/compile_shaders.ps1 b/scripts/compile_shaders.ps1 index b0ed0e5..3853ac7 100644 --- a/scripts/compile_shaders.ps1 +++ b/scripts/compile_shaders.ps1 @@ -32,8 +32,8 @@ $flag_format_odin = '--format=sokol_odin' $flag_module = '--module' push-location $path_shaders -& $sokol_shdc --input $shadersrc_simple_font_glyph --output $shaderout_simple_font_glyph --slang 'glsl410:hlsl5' $flag_format_odin -& $sokol_shdc --input $shadersrc_ve_blit_atlas --output $shaderout_ve_blit_atlas --slang 'glsl410:hlsl5' $flag_format_odin $flag_module='vefc_blit_atlas' -& $sokol_shdc --input $shadersrc_ve_render_glyph --output $shaderout_ve_render_glyph --slang 'glsl410:hlsl5' $flag_format_odin $flag_module='vefc_render_glyph' -& $sokol_shdc --input $shadersrc_ve_draw_text --output $shaderout_ve_draw_text --slang 'glsl410:hlsl5' $flag_format_odin $flag_module='vefc_draw_text' +& $sokol_shdc --input $shadersrc_simple_font_glyph --output $shaderout_simple_font_glyph --slang 'hlsl4' $flag_format_odin +& $sokol_shdc --input $shadersrc_ve_blit_atlas --output $shaderout_ve_blit_atlas --slang 'hlsl4' $flag_format_odin $flag_module='vefc_blit_atlas' +& $sokol_shdc --input $shadersrc_ve_render_glyph --output $shaderout_ve_render_glyph --slang 'hlsl4' $flag_format_odin $flag_module='vefc_render_glyph' +& $sokol_shdc --input $shadersrc_ve_draw_text --output $shaderout_ve_draw_text --slang 'hlsl4' $flag_format_odin $flag_module='vefc_draw_text' pop-location