Fixes for nov 7 breaking changes to sokol_gfx
This commit is contained in:
parent
109d2b0ff1
commit
36678c1127
@ -52,7 +52,7 @@ sokol_app_cleanup_callback :: proc "c" () {
|
||||
log("sokol_app: Confirmed cleanup")
|
||||
}
|
||||
|
||||
sokol_app_alloc :: proc "c" ( size : u64, user_data : rawptr ) -> rawptr {
|
||||
sokol_app_alloc :: proc "c" ( size : uint, user_data : rawptr ) -> rawptr {
|
||||
context = get_state().sokol_context
|
||||
block, error := alloc( int(size), allocator = persistent_slab_allocator() )
|
||||
ensure(error == AllocatorError.None, "sokol_app allocation failed")
|
||||
@ -235,7 +235,7 @@ sokol_app_event_callback :: proc "c" (sokol_event : ^sokol_app.Event)
|
||||
|
||||
#region("Sokol GFX")
|
||||
|
||||
sokol_gfx_alloc :: proc "c" ( size : u64, user_data : rawptr ) -> rawptr {
|
||||
sokol_gfx_alloc :: proc "c" ( size : uint, user_data : rawptr ) -> rawptr {
|
||||
context = get_state().sokol_context
|
||||
block, error := alloc( int(size), allocator = persistent_slab_allocator() )
|
||||
ensure(error == AllocatorError.None, "sokol_gfx allocation failed")
|
||||
|
@ -223,7 +223,7 @@ render_mode_screenspace :: proc( screen_extent : Extents2, screen_ui : ^UI_State
|
||||
debug_text("Mouse Position (Workspace View): %0.2f", screen_to_ws_view_pos(input.mouse.pos) )
|
||||
}
|
||||
|
||||
if false
|
||||
if true
|
||||
{
|
||||
ui := & project.workspace.ui
|
||||
|
||||
@ -243,7 +243,7 @@ render_mode_screenspace :: proc( screen_extent : Extents2, screen_ui : ^UI_State
|
||||
}
|
||||
}
|
||||
|
||||
if false
|
||||
if true
|
||||
{
|
||||
ui := & screen_ui
|
||||
|
||||
@ -260,7 +260,7 @@ render_mode_screenspace :: proc( screen_extent : Extents2, screen_ui : ^UI_State
|
||||
}
|
||||
}
|
||||
|
||||
if false {
|
||||
if true {
|
||||
state.config.font_size_canvas_scalar = 1.5
|
||||
zoom_adjust_size := 16 * state.project.workspace.cam.zoom
|
||||
over_sample := f32(state.config.font_size_canvas_scalar)
|
||||
@ -301,8 +301,8 @@ render_text_layer :: proc( screen_extent : Vec2, ve_ctx : ^ve.Context, render :
|
||||
|
||||
vbuf_layer_slice, ibuf_layer_slice, calls_layer_slice := ve.get_draw_list_layer( ve_ctx )
|
||||
|
||||
vbuf_ve_range := Range{ raw_data(vbuf_layer_slice), cast(u64) len(vbuf_layer_slice) * size_of(ve.Vertex) }
|
||||
ibuf_ve_range := Range{ raw_data(ibuf_layer_slice), cast(u64) len(ibuf_layer_slice) * size_of(u32) }
|
||||
vbuf_ve_range := Range{ raw_data(vbuf_layer_slice), cast(uint) len(vbuf_layer_slice) * size_of(ve.Vertex) }
|
||||
ibuf_ve_range := Range{ raw_data(ibuf_layer_slice), cast(uint) len(ibuf_layer_slice) * size_of(u32) }
|
||||
|
||||
gfx.append_buffer( draw_list_vbuf, vbuf_ve_range )
|
||||
gfx.append_buffer( draw_list_ibuf, ibuf_ve_range )
|
||||
@ -353,7 +353,6 @@ render_text_layer :: proc( screen_extent : Vec2, ve_ctx : ^ve.Context, render :
|
||||
},
|
||||
index_buffer = draw_list_ibuf,
|
||||
index_buffer_offset = 0,//i32(draw_call.start_index) * size_of(u32),
|
||||
fs = {},
|
||||
}
|
||||
gfx.apply_bindings( bindings )
|
||||
|
||||
@ -381,7 +380,7 @@ render_text_layer :: proc( screen_extent : Vec2, ve_ctx : ^ve.Context, render :
|
||||
gfx.apply_pipeline( atlas_pipeline )
|
||||
|
||||
fs_uniform := Ve_Blit_Atlas_Fs_Params { region = cast(i32) draw_call.region }
|
||||
gfx.apply_uniforms( ShaderStage.FS, SLOT_ve_blit_atlas_fs_params, Range { & fs_uniform, size_of(Ve_Blit_Atlas_Fs_Params) })
|
||||
gfx.apply_uniforms( UB_ve_blit_atlas_fs_params, Range { & fs_uniform, size_of(Ve_Blit_Atlas_Fs_Params) })
|
||||
|
||||
gfx.apply_bindings(Bindings {
|
||||
vertex_buffers = {
|
||||
@ -392,10 +391,8 @@ render_text_layer :: proc( screen_extent : Vec2, ve_ctx : ^ve.Context, render :
|
||||
},
|
||||
index_buffer = draw_list_ibuf,
|
||||
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 = glyph_rt_sampler, },
|
||||
},
|
||||
images = { IMG_ve_blit_atlas_src_texture = glyph_rt_color, },
|
||||
samplers = { SMP_ve_blit_atlas_src_sampler = glyph_rt_sampler, },
|
||||
})
|
||||
|
||||
// 3. Use the atlas to then render the text.
|
||||
@ -428,7 +425,7 @@ render_text_layer :: proc( screen_extent : Vec2, ve_ctx : ^ve.Context, render :
|
||||
src_rt = glyph_rt_color
|
||||
src_sampler = glyph_rt_sampler
|
||||
}
|
||||
gfx.apply_uniforms( ShaderStage.FS, SLOT_ve_draw_text_fs_params, Range { & fs_target_uniform, size_of(Ve_Draw_Text_Fs_Params) })
|
||||
gfx.apply_uniforms( UB_ve_draw_text_fs_params, Range { & fs_target_uniform, size_of(Ve_Draw_Text_Fs_Params) })
|
||||
|
||||
gfx.apply_bindings(Bindings {
|
||||
vertex_buffers = {
|
||||
@ -439,10 +436,8 @@ render_text_layer :: proc( screen_extent : Vec2, ve_ctx : ^ve.Context, render :
|
||||
},
|
||||
index_buffer = draw_list_ibuf,
|
||||
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 = src_sampler, },
|
||||
},
|
||||
images = { IMG_ve_draw_text_src_texture = src_rt, },
|
||||
samplers = { SMP_ve_draw_text_src_sampler = src_sampler, },
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ FontID :: struct {
|
||||
FontDef :: struct {
|
||||
path_file : string,
|
||||
default_size : i32,
|
||||
size_table : [Font_Largest_Px_Size / Font_Size_Interval] ve.FontID,
|
||||
size_table : [Font_Largest_Px_Size / Font_Size_Interval] ve.Font_ID,
|
||||
}
|
||||
|
||||
FontProviderContext :: struct
|
||||
@ -114,7 +114,7 @@ font_load :: proc(path_file : string,
|
||||
|
||||
Font_Use_Default_Size :: f32(0.0)
|
||||
|
||||
font_provider_resolve_draw_id :: proc( id : FontID, size := Font_Use_Default_Size ) -> (ve_id :ve.FontID, resolved_size : i32)
|
||||
font_provider_resolve_draw_id :: proc( id : FontID, size := Font_Use_Default_Size ) -> (ve_id :ve.Font_ID, resolved_size : i32)
|
||||
{
|
||||
provider_data := get_state().font_provider_ctx; using provider_data
|
||||
|
||||
|
@ -87,12 +87,12 @@ font_provider_setup_sokol_gfx_objects :: proc( ctx : ^VE_RenderData, ve_ctx : ve
|
||||
vs_layout : VertexLayoutState
|
||||
{
|
||||
using vs_layout
|
||||
attrs[ATTR_ve_render_glyph_vs_v_position] = VertexAttributeState {
|
||||
attrs[ATTR_ve_render_glyph_v_position] = VertexAttributeState {
|
||||
format = VertexFormat.FLOAT2,
|
||||
offset = 0,
|
||||
buffer_index = 0,
|
||||
}
|
||||
attrs[ATTR_ve_render_glyph_vs_v_texture] = VertexAttributeState {
|
||||
attrs[ATTR_ve_render_glyph_v_texture] = VertexAttributeState {
|
||||
format = VertexFormat.FLOAT2,
|
||||
offset = size_of(Vec2),
|
||||
buffer_index = 0,
|
||||
@ -226,12 +226,12 @@ font_provider_setup_sokol_gfx_objects :: proc( ctx : ^VE_RenderData, ve_ctx : ve
|
||||
vs_layout : VertexLayoutState
|
||||
{
|
||||
using vs_layout
|
||||
attrs[ATTR_ve_blit_atlas_vs_v_position] = VertexAttributeState {
|
||||
attrs[ATTR_ve_blit_atlas_v_position] = VertexAttributeState {
|
||||
format = VertexFormat.FLOAT2,
|
||||
offset = 0,
|
||||
buffer_index = 0,
|
||||
}
|
||||
attrs[ATTR_ve_blit_atlas_vs_v_texture] = VertexAttributeState {
|
||||
attrs[ATTR_ve_blit_atlas_v_texture] = VertexAttributeState {
|
||||
format = VertexFormat.FLOAT2,
|
||||
offset = size_of(Vec2),
|
||||
buffer_index = 0,
|
||||
@ -365,12 +365,12 @@ font_provider_setup_sokol_gfx_objects :: proc( ctx : ^VE_RenderData, ve_ctx : ve
|
||||
vs_layout : VertexLayoutState
|
||||
{
|
||||
using vs_layout
|
||||
attrs[ATTR_ve_draw_text_vs_v_position] = VertexAttributeState {
|
||||
attrs[ATTR_ve_draw_text_v_position] = VertexAttributeState {
|
||||
format = VertexFormat.FLOAT2,
|
||||
offset = 0,
|
||||
buffer_index = 0,
|
||||
}
|
||||
attrs[ATTR_ve_draw_text_vs_v_texture] = VertexAttributeState {
|
||||
attrs[ATTR_ve_draw_text_v_texture] = VertexAttributeState {
|
||||
format = VertexFormat.FLOAT2,
|
||||
offset = size_of(Vec2),
|
||||
buffer_index = 0,
|
||||
|
@ -12,31 +12,29 @@ import sg "thirdparty:sokol/gfx"
|
||||
=========
|
||||
Shader program: 've_blit_atlas':
|
||||
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
|
||||
Fragment shader: ve_blit_atlas_fs
|
||||
Uniform block 've_blit_atlas_fs_params':
|
||||
Odin struct: Ve_Blit_Atlas_Fs_Params
|
||||
Bind slot: SLOT_ve_blit_atlas_fs_params => 0
|
||||
Image 've_blit_atlas_src_texture':
|
||||
Image type: ._2D
|
||||
Sample type: .FLOAT
|
||||
Multisampled: false
|
||||
Bind slot: SLOT_ve_blit_atlas_src_texture => 0
|
||||
Sampler 've_blit_atlas_src_sampler':
|
||||
Type: .FILTERING
|
||||
Bind slot: SLOT_ve_blit_atlas_src_sampler => 0
|
||||
Image Sampler Pair 've_blit_atlas_src_texture_ve_blit_atlas_src_sampler':
|
||||
Image: ve_blit_atlas_src_texture
|
||||
Sampler: ve_blit_atlas_src_sampler
|
||||
Vertex Shader: ve_blit_atlas_vs
|
||||
Fragment Shader: ve_blit_atlas_fs
|
||||
Attributes:
|
||||
ATTR_ve_blit_atlas_v_position => 0
|
||||
ATTR_ve_blit_atlas_v_texture => 1
|
||||
Bindings:
|
||||
Uniform block 've_blit_atlas_fs_params':
|
||||
Odin struct: Ve_Blit_Atlas_Fs_Params
|
||||
Bind slot: UB_ve_blit_atlas_fs_params => 0
|
||||
Image 've_blit_atlas_src_texture':
|
||||
Image type: ._2D
|
||||
Sample type: .FLOAT
|
||||
Multisampled: false
|
||||
Bind slot: IMG_ve_blit_atlas_src_texture => 0
|
||||
Sampler 've_blit_atlas_src_sampler':
|
||||
Type: .FILTERING
|
||||
Bind slot: SMP_ve_blit_atlas_src_sampler => 0
|
||||
*/
|
||||
ATTR_ve_blit_atlas_vs_v_position :: 0
|
||||
ATTR_ve_blit_atlas_vs_v_texture :: 1
|
||||
SLOT_ve_blit_atlas_fs_params :: 0
|
||||
SLOT_ve_blit_atlas_src_texture :: 0
|
||||
SLOT_ve_blit_atlas_src_sampler :: 0
|
||||
ATTR_ve_blit_atlas_v_position :: 0
|
||||
ATTR_ve_blit_atlas_v_texture :: 1
|
||||
UB_ve_blit_atlas_fs_params :: 0
|
||||
IMG_ve_blit_atlas_src_texture :: 0
|
||||
SMP_ve_blit_atlas_src_sampler :: 0
|
||||
Ve_Blit_Atlas_Fs_Params :: struct #align(16) {
|
||||
using _: struct #packed {
|
||||
region: i32,
|
||||
@ -78,7 +76,7 @@ Ve_Blit_Atlas_Fs_Params :: struct #align(16) {
|
||||
return stage_output;
|
||||
}
|
||||
*/
|
||||
@(private)
|
||||
@(private="file")
|
||||
ve_blit_atlas_vs_source_hlsl4 := [705]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,
|
||||
@ -201,7 +199,7 @@ ve_blit_atlas_vs_source_hlsl4 := [705]u8 {
|
||||
return stage_output;
|
||||
}
|
||||
*/
|
||||
@(private)
|
||||
@(private="file")
|
||||
ve_blit_atlas_fs_source_hlsl4 := [2140]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,
|
||||
@ -343,27 +341,31 @@ ve_blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.label = "ve_blit_atlas_shader"
|
||||
#partial switch backend {
|
||||
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_hlsl4
|
||||
desc.vs.d3d11_target = "vs_4_0"
|
||||
desc.vs.entry = "main"
|
||||
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
|
||||
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.vertex_func.source = transmute(cstring)&ve_blit_atlas_vs_source_hlsl4
|
||||
desc.vertex_func.d3d11_target = "vs_4_0"
|
||||
desc.vertex_func.entry = "main"
|
||||
desc.fragment_func.source = transmute(cstring)&ve_blit_atlas_fs_source_hlsl4
|
||||
desc.fragment_func.d3d11_target = "ps_4_0"
|
||||
desc.fragment_func.entry = "main"
|
||||
desc.attrs[0].hlsl_sem_name = "TEXCOORD"
|
||||
desc.attrs[0].hlsl_sem_index = 0
|
||||
desc.attrs[1].hlsl_sem_name = "TEXCOORD"
|
||||
desc.attrs[1].hlsl_sem_index = 1
|
||||
desc.uniform_blocks[0].stage = .FRAGMENT
|
||||
desc.uniform_blocks[0].layout = .STD140
|
||||
desc.uniform_blocks[0].size = 16
|
||||
desc.uniform_blocks[0].hlsl_register_b_n = 0
|
||||
desc.images[0].stage = .FRAGMENT
|
||||
desc.images[0].multisampled = false
|
||||
desc.images[0].image_type = ._2D
|
||||
desc.images[0].sample_type = .FLOAT
|
||||
desc.images[0].hlsl_register_t_n = 0
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.samplers[0].hlsl_register_s_n = 0
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
}
|
||||
return desc
|
||||
}
|
||||
|
@ -11,10 +11,10 @@
|
||||
in vec2 uv;
|
||||
out vec4 frag_color;
|
||||
|
||||
uniform texture2D ve_blit_atlas_src_texture;
|
||||
uniform sampler ve_blit_atlas_src_sampler;
|
||||
layout(binding = 0) uniform texture2D ve_blit_atlas_src_texture;
|
||||
layout(binding = 0) uniform sampler ve_blit_atlas_src_sampler;
|
||||
|
||||
uniform ve_blit_atlas_fs_params {
|
||||
layout(binding = 0) uniform ve_blit_atlas_fs_params {
|
||||
int region;
|
||||
};
|
||||
|
||||
|
@ -12,31 +12,29 @@ import sg "thirdparty:sokol/gfx"
|
||||
=========
|
||||
Shader program: 've_draw_text':
|
||||
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
|
||||
Fragment shader: ve_draw_text_fs
|
||||
Uniform block 've_draw_text_fs_params':
|
||||
Odin struct: Ve_Draw_Text_Fs_Params
|
||||
Bind slot: SLOT_ve_draw_text_fs_params => 0
|
||||
Image 've_draw_text_src_texture':
|
||||
Image type: ._2D
|
||||
Sample type: .FLOAT
|
||||
Multisampled: false
|
||||
Bind slot: SLOT_ve_draw_text_src_texture => 0
|
||||
Sampler 've_draw_text_src_sampler':
|
||||
Type: .FILTERING
|
||||
Bind slot: SLOT_ve_draw_text_src_sampler => 0
|
||||
Image Sampler Pair 've_draw_text_src_texture_ve_draw_text_src_sampler':
|
||||
Image: ve_draw_text_src_texture
|
||||
Sampler: ve_draw_text_src_sampler
|
||||
Vertex Shader: ve_draw_text_vs
|
||||
Fragment Shader: ve_draw_text_fs
|
||||
Attributes:
|
||||
ATTR_ve_draw_text_v_position => 0
|
||||
ATTR_ve_draw_text_v_texture => 1
|
||||
Bindings:
|
||||
Uniform block 've_draw_text_fs_params':
|
||||
Odin struct: Ve_Draw_Text_Fs_Params
|
||||
Bind slot: UB_ve_draw_text_fs_params => 0
|
||||
Image 've_draw_text_src_texture':
|
||||
Image type: ._2D
|
||||
Sample type: .FLOAT
|
||||
Multisampled: false
|
||||
Bind slot: IMG_ve_draw_text_src_texture => 0
|
||||
Sampler 've_draw_text_src_sampler':
|
||||
Type: .FILTERING
|
||||
Bind slot: SMP_ve_draw_text_src_sampler => 0
|
||||
*/
|
||||
ATTR_ve_draw_text_vs_v_position :: 0
|
||||
ATTR_ve_draw_text_vs_v_texture :: 1
|
||||
SLOT_ve_draw_text_fs_params :: 0
|
||||
SLOT_ve_draw_text_src_texture :: 0
|
||||
SLOT_ve_draw_text_src_sampler :: 0
|
||||
ATTR_ve_draw_text_v_position :: 0
|
||||
ATTR_ve_draw_text_v_texture :: 1
|
||||
UB_ve_draw_text_fs_params :: 0
|
||||
IMG_ve_draw_text_src_texture :: 0
|
||||
SMP_ve_draw_text_src_sampler :: 0
|
||||
Ve_Draw_Text_Fs_Params :: struct #align(16) {
|
||||
using _: struct #packed {
|
||||
down_sample: i32,
|
||||
@ -79,7 +77,7 @@ Ve_Draw_Text_Fs_Params :: struct #align(16) {
|
||||
return stage_output;
|
||||
}
|
||||
*/
|
||||
@(private)
|
||||
@(private="file")
|
||||
ve_draw_text_vs_source_hlsl4 := [724]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,
|
||||
@ -170,7 +168,7 @@ ve_draw_text_vs_source_hlsl4 := [724]u8 {
|
||||
return stage_output;
|
||||
}
|
||||
*/
|
||||
@(private)
|
||||
@(private="file")
|
||||
ve_draw_text_fs_source_hlsl4 := [1296]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,
|
||||
@ -260,27 +258,31 @@ ve_draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.label = "ve_draw_text_shader"
|
||||
#partial switch backend {
|
||||
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_hlsl4
|
||||
desc.vs.d3d11_target = "vs_4_0"
|
||||
desc.vs.entry = "main"
|
||||
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
|
||||
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.vertex_func.source = transmute(cstring)&ve_draw_text_vs_source_hlsl4
|
||||
desc.vertex_func.d3d11_target = "vs_4_0"
|
||||
desc.vertex_func.entry = "main"
|
||||
desc.fragment_func.source = transmute(cstring)&ve_draw_text_fs_source_hlsl4
|
||||
desc.fragment_func.d3d11_target = "ps_4_0"
|
||||
desc.fragment_func.entry = "main"
|
||||
desc.attrs[0].hlsl_sem_name = "TEXCOORD"
|
||||
desc.attrs[0].hlsl_sem_index = 0
|
||||
desc.attrs[1].hlsl_sem_name = "TEXCOORD"
|
||||
desc.attrs[1].hlsl_sem_index = 1
|
||||
desc.uniform_blocks[0].stage = .FRAGMENT
|
||||
desc.uniform_blocks[0].layout = .STD140
|
||||
desc.uniform_blocks[0].size = 32
|
||||
desc.uniform_blocks[0].hlsl_register_b_n = 0
|
||||
desc.images[0].stage = .FRAGMENT
|
||||
desc.images[0].multisampled = false
|
||||
desc.images[0].image_type = ._2D
|
||||
desc.images[0].sample_type = .FLOAT
|
||||
desc.images[0].hlsl_register_t_n = 0
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.samplers[0].hlsl_register_s_n = 0
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
}
|
||||
return desc
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ void main()
|
||||
in vec2 uv;
|
||||
out vec4 frag_color;
|
||||
|
||||
uniform texture2D ve_draw_text_src_texture;
|
||||
uniform sampler ve_draw_text_src_sampler;
|
||||
layout(binding = 0) uniform texture2D ve_draw_text_src_texture;
|
||||
layout(binding = 0) uniform sampler ve_draw_text_src_sampler;
|
||||
|
||||
uniform ve_draw_text_fs_params {
|
||||
layout(binding = 0) uniform ve_draw_text_fs_params {
|
||||
int down_sample;
|
||||
vec4 colour;
|
||||
};
|
||||
|
@ -12,14 +12,15 @@ import sg "thirdparty:sokol/gfx"
|
||||
=========
|
||||
Shader program: 've_render_glyph':
|
||||
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
|
||||
Fragment shader: ve_render_glyph_fs
|
||||
Vertex Shader: ve_render_glyph_vs
|
||||
Fragment Shader: ve_render_glyph_fs
|
||||
Attributes:
|
||||
ATTR_ve_render_glyph_v_position => 0
|
||||
ATTR_ve_render_glyph_v_texture => 1
|
||||
Bindings:
|
||||
*/
|
||||
ATTR_ve_render_glyph_vs_v_position :: 0
|
||||
ATTR_ve_render_glyph_vs_v_texture :: 1
|
||||
ATTR_ve_render_glyph_v_position :: 0
|
||||
ATTR_ve_render_glyph_v_texture :: 1
|
||||
/*
|
||||
static float4 gl_Position;
|
||||
static float2 uv;
|
||||
@ -55,7 +56,7 @@ ATTR_ve_render_glyph_vs_v_texture :: 1
|
||||
return stage_output;
|
||||
}
|
||||
*/
|
||||
@(private)
|
||||
@(private="file")
|
||||
ve_render_glyph_vs_source_hlsl4 := [705]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,
|
||||
@ -131,7 +132,7 @@ ve_render_glyph_vs_source_hlsl4 := [705]u8 {
|
||||
return stage_output;
|
||||
}
|
||||
*/
|
||||
@(private)
|
||||
@(private="file")
|
||||
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,
|
||||
@ -166,16 +167,16 @@ ve_render_glyph_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.label = "ve_render_glyph_shader"
|
||||
#partial switch backend {
|
||||
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_hlsl4
|
||||
desc.vs.d3d11_target = "vs_4_0"
|
||||
desc.vs.entry = "main"
|
||||
desc.fs.source = transmute(cstring)&ve_render_glyph_fs_source_hlsl4
|
||||
desc.fs.d3d11_target = "ps_4_0"
|
||||
desc.fs.entry = "main"
|
||||
desc.vertex_func.source = transmute(cstring)&ve_render_glyph_vs_source_hlsl4
|
||||
desc.vertex_func.d3d11_target = "vs_4_0"
|
||||
desc.vertex_func.entry = "main"
|
||||
desc.fragment_func.source = transmute(cstring)&ve_render_glyph_fs_source_hlsl4
|
||||
desc.fragment_func.d3d11_target = "ps_4_0"
|
||||
desc.fragment_func.entry = "main"
|
||||
desc.attrs[0].hlsl_sem_name = "TEXCOORD"
|
||||
desc.attrs[0].hlsl_sem_index = 0
|
||||
desc.attrs[1].hlsl_sem_name = "TEXCOORD"
|
||||
desc.attrs[1].hlsl_sem_index = 1
|
||||
}
|
||||
return desc
|
||||
}
|
||||
|
Binary file not shown.
@ -32,7 +32,6 @@ $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 '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'
|
||||
|
Loading…
Reference in New Issue
Block a user