mirror of
https://github.com/Ed94/VEFontCache-Odin.git
synced 2025-09-17 16:01:04 -07:00
update sokol (views update for gfx was breaking change)
This commit is contained in:
@@ -13,14 +13,20 @@ Context :: struct {
|
||||
screen_shader : gfx.Shader,
|
||||
|
||||
// ve.glyph_buffer.(width, height), R8
|
||||
glyph_rt_color : gfx.Image,
|
||||
glyph_rt_depth : gfx.Image,
|
||||
glyph_rt_sampler : gfx.Sampler,
|
||||
glyph_rt_color : gfx.Image,
|
||||
glyph_rt_depth : gfx.Image,
|
||||
glyph_rt_view_color : gfx.View,
|
||||
glyph_rt_view_depth : gfx.View,
|
||||
glyph_rt_view_texture : gfx.View,
|
||||
glyph_rt_sampler : gfx.Sampler,
|
||||
|
||||
// ve.atlas.(width, height), R8
|
||||
atlas_rt_color : gfx.Image,
|
||||
atlas_rt_depth : gfx.Image,
|
||||
atlas_rt_sampler : gfx.Sampler,
|
||||
atlas_rt_color : gfx.Image,
|
||||
atlas_rt_depth : gfx.Image,
|
||||
atlas_rt_view_color : gfx.View,
|
||||
atlas_rt_view_depth : gfx.View,
|
||||
atlas_rt_view_texture : gfx.View,
|
||||
atlas_rt_sampler : gfx.Sampler,
|
||||
|
||||
glyph_pipeline : gfx.Pipeline,
|
||||
atlas_pipeline : gfx.Pipeline,
|
||||
@@ -33,7 +39,6 @@ Context :: struct {
|
||||
|
||||
setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index_cap : u64 )
|
||||
{
|
||||
Attachment_Desc :: gfx.Attachment_Desc
|
||||
Blend_Factor :: gfx.Blend_Factor
|
||||
Blend_Op :: gfx.Blend_Op
|
||||
Blend_State :: gfx.Blend_State
|
||||
@@ -43,18 +48,21 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
Color_Target_State :: gfx.Color_Target_State
|
||||
Filter :: gfx.Filter
|
||||
Image_Desc :: gfx.Image_Desc
|
||||
Image_View_Desc :: gfx.Image_View_Desc
|
||||
Image_Usage :: gfx.Image_Usage
|
||||
Pass_Action :: gfx.Pass_Action
|
||||
Range :: gfx.Range
|
||||
Resource_State :: gfx.Resource_State
|
||||
Sampler_Description :: gfx.Sampler_Desc
|
||||
Wrap :: gfx.Wrap
|
||||
Texture_View_Desc :: gfx.Texture_View_Desc
|
||||
Vertex_Attribute_State :: gfx.Vertex_Attr_State
|
||||
Vertex_Buffer_Layout_State :: gfx.Vertex_Buffer_Layout_State
|
||||
Vertex_Index_Type :: gfx.Index_Type
|
||||
Vertex_Format :: gfx.Vertex_Format
|
||||
Vertex_Layout_State :: gfx.Vertex_Layout_State
|
||||
Vertex_Step :: gfx.Vertex_Step
|
||||
View_Desc :: gfx.View_Desc
|
||||
|
||||
backend := gfx.query_backend()
|
||||
app_env := glue.environment()
|
||||
@@ -134,7 +142,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
{
|
||||
ctx.glyph_rt_color = gfx.make_image( Image_Desc {
|
||||
type = ._2D,
|
||||
usage = Image_Usage { render_attachment = true, immutable = true },
|
||||
usage = Image_Usage { color_attachment = true, immutable = true },
|
||||
width = i32(ve_ctx.glyph_buffer.size.x),
|
||||
height = i32(ve_ctx.glyph_buffer.size.y),
|
||||
num_slices = 1,
|
||||
@@ -146,7 +154,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
|
||||
ctx.glyph_rt_depth = gfx.make_image( Image_Desc {
|
||||
type = ._2D,
|
||||
usage = Image_Usage { render_attachment = true, immutable = true },
|
||||
usage = Image_Usage { depth_stencil_attachment = true, immutable = true },
|
||||
width = i32(ve_ctx.glyph_buffer.size.x),
|
||||
height = i32(ve_ctx.glyph_buffer.size.y),
|
||||
num_slices = 1,
|
||||
@@ -169,19 +177,27 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
})
|
||||
assert( gfx.query_sampler_state( ctx.glyph_rt_sampler) < Resource_State.FAILED, "Failed to make atlas_rt_sampler" )
|
||||
|
||||
color_attach := Attachment_Desc {
|
||||
color_attach := Image_View_Desc {
|
||||
image = ctx.glyph_rt_color,
|
||||
}
|
||||
|
||||
glyph_attachments := gfx.make_attachments({
|
||||
colors = {
|
||||
0 = color_attach,
|
||||
},
|
||||
depth_stencil = {
|
||||
image = ctx.glyph_rt_depth,
|
||||
},
|
||||
depth_attach := Image_View_Desc {
|
||||
image = ctx.glyph_rt_depth,
|
||||
}
|
||||
texture_attach := Texture_View_Desc {
|
||||
image = ctx.glyph_rt_color,
|
||||
}
|
||||
ctx.glyph_rt_view_color = gfx.make_view({
|
||||
color_attachment = color_attach,
|
||||
})
|
||||
assert( gfx.query_attachments_state(glyph_attachments) < Resource_State.FAILED, "Failed to make glyph_attachments" )
|
||||
assert( gfx.query_view_state(ctx.glyph_rt_view_color) < Resource_State.FAILED, "Failed to make glyph_rt_view_color" )
|
||||
ctx.glyph_rt_view_depth = gfx.make_view({
|
||||
depth_stencil_attachment = depth_attach,
|
||||
})
|
||||
assert( gfx.query_view_state(ctx.glyph_rt_view_depth) < Resource_State.FAILED, "Failed to make glyph_rt_view_depth" )
|
||||
ctx.glyph_rt_view_texture = gfx.make_view({
|
||||
texture = texture_attach,
|
||||
})
|
||||
assert( gfx.query_view_state(ctx.glyph_rt_view_texture) < Resource_State.FAILED, "Failed to make glyph_rt_view_texture" )
|
||||
|
||||
glyph_action := Pass_Action {
|
||||
colors = {
|
||||
@@ -205,8 +221,10 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
|
||||
ctx.glyph_pass = gfx.Pass {
|
||||
action = glyph_action,
|
||||
attachments = glyph_attachments,
|
||||
// label =
|
||||
attachments = {
|
||||
colors = { ctx.glyph_rt_view_color, {}, {}, {} },
|
||||
depth_stencil = ctx.glyph_rt_view_depth,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +284,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
{
|
||||
ctx.atlas_rt_color = gfx.make_image( Image_Desc {
|
||||
type = ._2D,
|
||||
usage = { render_attachment = true, immutable = true },
|
||||
usage = { color_attachment = true, immutable = true },
|
||||
width = i32(ve_ctx.atlas.size.x),
|
||||
height = i32(ve_ctx.atlas.size.y),
|
||||
num_slices = 1,
|
||||
@@ -280,7 +298,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
|
||||
ctx.atlas_rt_depth = gfx.make_image( Image_Desc {
|
||||
type = ._2D,
|
||||
usage = { render_attachment = true, immutable = true },
|
||||
usage = { depth_stencil_attachment = true, immutable = true },
|
||||
width = i32(ve_ctx.atlas.size.x),
|
||||
height = i32(ve_ctx.atlas.size.y),
|
||||
num_slices = 1,
|
||||
@@ -304,19 +322,27 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
})
|
||||
assert( gfx.query_sampler_state( ctx.atlas_rt_sampler) < Resource_State.FAILED, "Failed to make atlas_rt_sampler" )
|
||||
|
||||
color_attach := Attachment_Desc {
|
||||
color_attach := Image_View_Desc {
|
||||
image = ctx.atlas_rt_color,
|
||||
}
|
||||
|
||||
atlas_attachments := gfx.make_attachments({
|
||||
colors = {
|
||||
0 = color_attach,
|
||||
},
|
||||
depth_stencil = {
|
||||
image = ctx.atlas_rt_depth,
|
||||
},
|
||||
depth_attach := Image_View_Desc {
|
||||
image = ctx.atlas_rt_depth,
|
||||
}
|
||||
texture_attach := Texture_View_Desc {
|
||||
image = ctx.atlas_rt_color,
|
||||
}
|
||||
ctx.atlas_rt_view_color = gfx.make_view({
|
||||
color_attachment = color_attach,
|
||||
})
|
||||
assert( gfx.query_attachments_state(atlas_attachments) < Resource_State.FAILED, "Failed to make atlas_attachments")
|
||||
assert( gfx.query_view_state(ctx.atlas_rt_view_color) < Resource_State.FAILED, "Failed to make ctx.atlas_rt_view_color")
|
||||
ctx.atlas_rt_view_depth = gfx.make_view({
|
||||
depth_stencil_attachment = depth_attach,
|
||||
})
|
||||
assert( gfx.query_view_state(ctx.atlas_rt_view_depth) < Resource_State.FAILED, "Failed to make ctx.atlas_rt_view_depth")
|
||||
ctx.atlas_rt_view_texture = gfx.make_view({
|
||||
texture = texture_attach,
|
||||
})
|
||||
assert( gfx.query_view_state(ctx.atlas_rt_view_texture) < Resource_State.FAILED, "Failed to make atlas_rt_view_texture" )
|
||||
|
||||
atlas_action := Pass_Action {
|
||||
colors = {
|
||||
@@ -338,9 +364,12 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
}
|
||||
}
|
||||
|
||||
ctx.atlas_pass = gfx.Pass {
|
||||
action = atlas_action,
|
||||
attachments = atlas_attachments,
|
||||
ctx.atlas_pass = gfx.Pass {
|
||||
action = atlas_action,
|
||||
attachments = {
|
||||
colors = { ctx.atlas_rt_view_color, {}, {}, {} },
|
||||
depth_stencil = ctx.atlas_rt_view_depth,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,8 +567,8 @@ render_text_layer :: proc( screen_extent : ve.Vec2, ve_ctx : ^ve.Context, ctx :
|
||||
},
|
||||
index_buffer = ctx.draw_list_ibuf,
|
||||
index_buffer_offset = 0,
|
||||
images = { IMG_blit_atlas_src_texture = ctx.glyph_rt_color, },
|
||||
samplers = { SMP_blit_atlas_src_sampler = ctx.glyph_rt_sampler, },
|
||||
views = { VIEW_blit_atlas_src_texture = ctx.glyph_rt_view_texture, },
|
||||
samplers = { SMP_blit_atlas_src_sampler = ctx.glyph_rt_sampler, },
|
||||
})
|
||||
|
||||
// 3. Use the atlas (.Target) or the glyph buffer (.Target_Unchached) to then render the text.
|
||||
@@ -559,7 +588,7 @@ render_text_layer :: proc( screen_extent : ve.Vec2, ve_ctx : ^ve.Context, ctx :
|
||||
|
||||
gfx.apply_pipeline( ctx.screen_pipeline )
|
||||
|
||||
src_rt := ctx.atlas_rt_color
|
||||
src_rt := ctx.atlas_rt_view_texture
|
||||
src_sampler := ctx.atlas_rt_sampler
|
||||
|
||||
fs_target_uniform := Draw_Text_Fs_Params {
|
||||
@@ -570,7 +599,7 @@ render_text_layer :: proc( screen_extent : ve.Vec2, ve_ctx : ^ve.Context, ctx :
|
||||
|
||||
if draw_call.pass == .Target_Uncached {
|
||||
// fs_target_uniform.over_sample = 1.0
|
||||
src_rt = ctx.glyph_rt_color
|
||||
src_rt = ctx.glyph_rt_view_texture
|
||||
src_sampler = ctx.glyph_rt_sampler
|
||||
}
|
||||
gfx.apply_uniforms( UB_draw_text_fs_params, Range { & fs_target_uniform, size_of(Draw_Text_Fs_Params) })
|
||||
@@ -584,8 +613,8 @@ render_text_layer :: proc( screen_extent : ve.Vec2, ve_ctx : ^ve.Context, ctx :
|
||||
},
|
||||
index_buffer = ctx.draw_list_ibuf,
|
||||
index_buffer_offset = 0,
|
||||
images = { IMG_draw_text_src_texture = src_rt, },
|
||||
samplers = { SMP_draw_text_src_sampler = src_sampler, },
|
||||
views = { VIEW_draw_text_src_texture = src_rt, },
|
||||
samplers = { SMP_draw_text_src_sampler = src_sampler, },
|
||||
})
|
||||
}
|
||||
|
||||
|
@@ -21,11 +21,11 @@ import sg "thirdparty:sokol/gfx"
|
||||
Uniform block 'blit_atlas_fs_params':
|
||||
Odin struct: Blit_Atlas_Fs_Params
|
||||
Bind slot: UB_blit_atlas_fs_params => 0
|
||||
Image 'blit_atlas_src_texture':
|
||||
Texture 'blit_atlas_src_texture':
|
||||
Image type: ._2D
|
||||
Sample type: .FLOAT
|
||||
Multisampled: false
|
||||
Bind slot: IMG_blit_atlas_src_texture => 0
|
||||
Bind slot: VIEW_blit_atlas_src_texture => 0
|
||||
Sampler 'blit_atlas_src_sampler':
|
||||
Type: .FILTERING
|
||||
Bind slot: SMP_blit_atlas_src_sampler => 0
|
||||
@@ -33,7 +33,7 @@ import sg "thirdparty:sokol/gfx"
|
||||
ATTR_blit_atlas_v_position :: 0
|
||||
ATTR_blit_atlas_v_texture :: 1
|
||||
UB_blit_atlas_fs_params :: 0
|
||||
IMG_blit_atlas_src_texture :: 0
|
||||
VIEW_blit_atlas_src_texture :: 0
|
||||
SMP_blit_atlas_src_sampler :: 0
|
||||
Blit_Atlas_Fs_Params :: struct #align(16) {
|
||||
using _: struct #packed {
|
||||
@@ -1228,7 +1228,7 @@ blit_atlas_vs_source_wgsl := [626]u8 {
|
||||
|
||||
@binding(64) @group(1) var blit_atlas_src_texture : texture_2d<f32>;
|
||||
|
||||
@binding(80) @group(1) var blit_atlas_src_sampler : sampler;
|
||||
@binding(65) @group(1) var blit_atlas_src_sampler : sampler;
|
||||
|
||||
var<private> uv_1 : vec2f;
|
||||
|
||||
@@ -1353,7 +1353,7 @@ blit_atlas_fs_source_wgsl := [3476]u8 {
|
||||
0x72,0x20,0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,
|
||||
0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75,
|
||||
0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x62,0x69,
|
||||
0x6e,0x64,0x69,0x6e,0x67,0x28,0x38,0x30,0x29,0x20,0x40,0x67,0x72,0x6f,0x75,0x70,
|
||||
0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,0x35,0x29,0x20,0x40,0x67,0x72,0x6f,0x75,0x70,
|
||||
0x28,0x31,0x29,0x20,0x76,0x61,0x72,0x20,0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,
|
||||
0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x3a,
|
||||
0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,
|
||||
@@ -1576,16 +1576,16 @@ blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.uniform_blocks[0].glsl_uniforms[2].type = .INT
|
||||
desc.uniform_blocks[0].glsl_uniforms[2].array_count = 0
|
||||
desc.uniform_blocks[0].glsl_uniforms[2].glsl_name = "_20.region"
|
||||
desc.images[0].stage = .FRAGMENT
|
||||
desc.images[0].multisampled = false
|
||||
desc.images[0].image_type = ._2D
|
||||
desc.images[0].sample_type = .FLOAT
|
||||
desc.views[0].texture.stage = .FRAGMENT
|
||||
desc.views[0].texture.image_type = ._2D
|
||||
desc.views[0].texture.sample_type = .FLOAT
|
||||
desc.views[0].texture.multisampled = false
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.image_sampler_pairs[0].glsl_name = "blit_atlas_src_texture_blit_atlas_src_sampler"
|
||||
desc.texture_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.texture_sampler_pairs[0].view_slot = 0
|
||||
desc.texture_sampler_pairs[0].sampler_slot = 0
|
||||
desc.texture_sampler_pairs[0].glsl_name = "blit_atlas_src_texture_blit_atlas_src_sampler"
|
||||
case .GLES3:
|
||||
desc.vertex_func.source = transmute(cstring)&blit_atlas_vs_source_glsl300es
|
||||
desc.vertex_func.entry = "main"
|
||||
@@ -1607,16 +1607,16 @@ blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.uniform_blocks[0].glsl_uniforms[2].type = .INT
|
||||
desc.uniform_blocks[0].glsl_uniforms[2].array_count = 0
|
||||
desc.uniform_blocks[0].glsl_uniforms[2].glsl_name = "_20.region"
|
||||
desc.images[0].stage = .FRAGMENT
|
||||
desc.images[0].multisampled = false
|
||||
desc.images[0].image_type = ._2D
|
||||
desc.images[0].sample_type = .FLOAT
|
||||
desc.views[0].texture.stage = .FRAGMENT
|
||||
desc.views[0].texture.image_type = ._2D
|
||||
desc.views[0].texture.sample_type = .FLOAT
|
||||
desc.views[0].texture.multisampled = false
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.image_sampler_pairs[0].glsl_name = "blit_atlas_src_texture_blit_atlas_src_sampler"
|
||||
desc.texture_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.texture_sampler_pairs[0].view_slot = 0
|
||||
desc.texture_sampler_pairs[0].sampler_slot = 0
|
||||
desc.texture_sampler_pairs[0].glsl_name = "blit_atlas_src_texture_blit_atlas_src_sampler"
|
||||
case .D3D11:
|
||||
desc.vertex_func.source = transmute(cstring)&blit_atlas_vs_source_hlsl4
|
||||
desc.vertex_func.d3d11_target = "vs_4_0"
|
||||
@@ -1634,17 +1634,17 @@ blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
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.views[0].texture.stage = .FRAGMENT
|
||||
desc.views[0].texture.image_type = ._2D
|
||||
desc.views[0].texture.sample_type = .FLOAT
|
||||
desc.views[0].texture.multisampled = false
|
||||
desc.views[0].texture.hlsl_register_t_n = 0
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.samplers[0].hlsl_register_s_n = 0
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.texture_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.texture_sampler_pairs[0].view_slot = 0
|
||||
desc.texture_sampler_pairs[0].sampler_slot = 0
|
||||
case .METAL_MACOS:
|
||||
desc.vertex_func.source = transmute(cstring)&blit_atlas_vs_source_metal_macos
|
||||
desc.vertex_func.entry = "main0"
|
||||
@@ -1656,17 +1656,17 @@ blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.uniform_blocks[0].layout = .STD140
|
||||
desc.uniform_blocks[0].size = 16
|
||||
desc.uniform_blocks[0].msl_buffer_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].msl_texture_n = 0
|
||||
desc.views[0].texture.stage = .FRAGMENT
|
||||
desc.views[0].texture.image_type = ._2D
|
||||
desc.views[0].texture.sample_type = .FLOAT
|
||||
desc.views[0].texture.multisampled = false
|
||||
desc.views[0].texture.msl_texture_n = 0
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.samplers[0].msl_sampler_n = 0
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.texture_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.texture_sampler_pairs[0].view_slot = 0
|
||||
desc.texture_sampler_pairs[0].sampler_slot = 0
|
||||
case .WGPU:
|
||||
desc.vertex_func.source = transmute(cstring)&blit_atlas_vs_source_wgsl
|
||||
desc.vertex_func.entry = "main"
|
||||
@@ -1678,17 +1678,17 @@ blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.uniform_blocks[0].layout = .STD140
|
||||
desc.uniform_blocks[0].size = 16
|
||||
desc.uniform_blocks[0].wgsl_group0_binding_n = 8
|
||||
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].wgsl_group1_binding_n = 64
|
||||
desc.views[0].texture.stage = .FRAGMENT
|
||||
desc.views[0].texture.image_type = ._2D
|
||||
desc.views[0].texture.sample_type = .FLOAT
|
||||
desc.views[0].texture.multisampled = false
|
||||
desc.views[0].texture.wgsl_group1_binding_n = 64
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.samplers[0].wgsl_group1_binding_n = 80
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.samplers[0].wgsl_group1_binding_n = 65
|
||||
desc.texture_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.texture_sampler_pairs[0].view_slot = 0
|
||||
desc.texture_sampler_pairs[0].sampler_slot = 0
|
||||
}
|
||||
return desc
|
||||
}
|
||||
|
@@ -21,11 +21,11 @@ import sg "thirdparty:sokol/gfx"
|
||||
Uniform block 'draw_text_fs_params':
|
||||
Odin struct: Draw_Text_Fs_Params
|
||||
Bind slot: UB_draw_text_fs_params => 0
|
||||
Image 'draw_text_src_texture':
|
||||
Texture 'draw_text_src_texture':
|
||||
Image type: ._2D
|
||||
Sample type: .FLOAT
|
||||
Multisampled: false
|
||||
Bind slot: IMG_draw_text_src_texture => 0
|
||||
Bind slot: VIEW_draw_text_src_texture => 0
|
||||
Sampler 'draw_text_src_sampler':
|
||||
Type: .FILTERING
|
||||
Bind slot: SMP_draw_text_src_sampler => 0
|
||||
@@ -33,7 +33,7 @@ import sg "thirdparty:sokol/gfx"
|
||||
ATTR_draw_text_v_position :: 0
|
||||
ATTR_draw_text_v_texture :: 1
|
||||
UB_draw_text_fs_params :: 0
|
||||
IMG_draw_text_src_texture :: 0
|
||||
VIEW_draw_text_src_texture :: 0
|
||||
SMP_draw_text_src_sampler :: 0
|
||||
Draw_Text_Fs_Params :: struct #align(16) {
|
||||
using _: struct #packed {
|
||||
@@ -699,7 +699,7 @@ draw_text_vs_source_wgsl := [664]u8 {
|
||||
|
||||
@binding(64) @group(1) var draw_text_src_texture : texture_2d<f32>;
|
||||
|
||||
@binding(80) @group(1) var draw_text_src_sampler : sampler;
|
||||
@binding(65) @group(1) var draw_text_src_sampler : sampler;
|
||||
|
||||
var<private> uv : vec2f;
|
||||
|
||||
@@ -768,7 +768,7 @@ draw_text_fs_source_wgsl := [1825]u8 {
|
||||
0x72,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,
|
||||
0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75,0x72,
|
||||
0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x40,0x62,0x69,0x6e,
|
||||
0x64,0x69,0x6e,0x67,0x28,0x38,0x30,0x29,0x20,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,
|
||||
0x64,0x69,0x6e,0x67,0x28,0x36,0x35,0x29,0x20,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,
|
||||
0x31,0x29,0x20,0x76,0x61,0x72,0x20,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,
|
||||
0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x3a,0x20,0x73,
|
||||
0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
|
||||
@@ -886,16 +886,16 @@ draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 2
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "draw_text_fs_params"
|
||||
desc.images[0].stage = .FRAGMENT
|
||||
desc.images[0].multisampled = false
|
||||
desc.images[0].image_type = ._2D
|
||||
desc.images[0].sample_type = .FLOAT
|
||||
desc.views[0].texture.stage = .FRAGMENT
|
||||
desc.views[0].texture.image_type = ._2D
|
||||
desc.views[0].texture.sample_type = .FLOAT
|
||||
desc.views[0].texture.multisampled = false
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.image_sampler_pairs[0].glsl_name = "draw_text_src_texture_draw_text_src_sampler"
|
||||
desc.texture_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.texture_sampler_pairs[0].view_slot = 0
|
||||
desc.texture_sampler_pairs[0].sampler_slot = 0
|
||||
desc.texture_sampler_pairs[0].glsl_name = "draw_text_src_texture_draw_text_src_sampler"
|
||||
case .GLES3:
|
||||
desc.vertex_func.source = transmute(cstring)&draw_text_vs_source_glsl300es
|
||||
desc.vertex_func.entry = "main"
|
||||
@@ -911,16 +911,16 @@ draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 2
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "draw_text_fs_params"
|
||||
desc.images[0].stage = .FRAGMENT
|
||||
desc.images[0].multisampled = false
|
||||
desc.images[0].image_type = ._2D
|
||||
desc.images[0].sample_type = .FLOAT
|
||||
desc.views[0].texture.stage = .FRAGMENT
|
||||
desc.views[0].texture.image_type = ._2D
|
||||
desc.views[0].texture.sample_type = .FLOAT
|
||||
desc.views[0].texture.multisampled = false
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.image_sampler_pairs[0].glsl_name = "draw_text_src_texture_draw_text_src_sampler"
|
||||
desc.texture_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.texture_sampler_pairs[0].view_slot = 0
|
||||
desc.texture_sampler_pairs[0].sampler_slot = 0
|
||||
desc.texture_sampler_pairs[0].glsl_name = "draw_text_src_texture_draw_text_src_sampler"
|
||||
case .D3D11:
|
||||
desc.vertex_func.source = transmute(cstring)&draw_text_vs_source_hlsl4
|
||||
desc.vertex_func.d3d11_target = "vs_4_0"
|
||||
@@ -938,17 +938,17 @@ draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
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.views[0].texture.stage = .FRAGMENT
|
||||
desc.views[0].texture.image_type = ._2D
|
||||
desc.views[0].texture.sample_type = .FLOAT
|
||||
desc.views[0].texture.multisampled = false
|
||||
desc.views[0].texture.hlsl_register_t_n = 0
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.samplers[0].hlsl_register_s_n = 0
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.texture_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.texture_sampler_pairs[0].view_slot = 0
|
||||
desc.texture_sampler_pairs[0].sampler_slot = 0
|
||||
case .METAL_MACOS:
|
||||
desc.vertex_func.source = transmute(cstring)&draw_text_vs_source_metal_macos
|
||||
desc.vertex_func.entry = "main0"
|
||||
@@ -960,17 +960,17 @@ draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.uniform_blocks[0].layout = .STD140
|
||||
desc.uniform_blocks[0].size = 32
|
||||
desc.uniform_blocks[0].msl_buffer_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].msl_texture_n = 0
|
||||
desc.views[0].texture.stage = .FRAGMENT
|
||||
desc.views[0].texture.image_type = ._2D
|
||||
desc.views[0].texture.sample_type = .FLOAT
|
||||
desc.views[0].texture.multisampled = false
|
||||
desc.views[0].texture.msl_texture_n = 0
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.samplers[0].msl_sampler_n = 0
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.texture_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.texture_sampler_pairs[0].view_slot = 0
|
||||
desc.texture_sampler_pairs[0].sampler_slot = 0
|
||||
case .WGPU:
|
||||
desc.vertex_func.source = transmute(cstring)&draw_text_vs_source_wgsl
|
||||
desc.vertex_func.entry = "main"
|
||||
@@ -982,17 +982,17 @@ draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
|
||||
desc.uniform_blocks[0].layout = .STD140
|
||||
desc.uniform_blocks[0].size = 32
|
||||
desc.uniform_blocks[0].wgsl_group0_binding_n = 8
|
||||
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].wgsl_group1_binding_n = 64
|
||||
desc.views[0].texture.stage = .FRAGMENT
|
||||
desc.views[0].texture.image_type = ._2D
|
||||
desc.views[0].texture.sample_type = .FLOAT
|
||||
desc.views[0].texture.multisampled = false
|
||||
desc.views[0].texture.wgsl_group1_binding_n = 64
|
||||
desc.samplers[0].stage = .FRAGMENT
|
||||
desc.samplers[0].sampler_type = .FILTERING
|
||||
desc.samplers[0].wgsl_group1_binding_n = 80
|
||||
desc.image_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.image_sampler_pairs[0].image_slot = 0
|
||||
desc.image_sampler_pairs[0].sampler_slot = 0
|
||||
desc.samplers[0].wgsl_group1_binding_n = 65
|
||||
desc.texture_sampler_pairs[0].stage = .FRAGMENT
|
||||
desc.texture_sampler_pairs[0].view_slot = 0
|
||||
desc.texture_sampler_pairs[0].sampler_slot = 0
|
||||
}
|
||||
return desc
|
||||
}
|
||||
|
@@ -205,7 +205,7 @@ init :: proc "c" ()
|
||||
sampler_pool_size = 64,
|
||||
shader_pool_size = 32,
|
||||
pipeline_pool_size = 64,
|
||||
attachments_pool_size = 16,
|
||||
view_pool_size = 16,
|
||||
uniform_buffer_size = 4 * mem.Megabyte,
|
||||
max_commit_listeners = 1024,
|
||||
allocator = { sokol_gfx_alloc, sokol_gfx_free, nil },
|
||||
|
42
thirdparty/sokol/.github/workflows/main.yml
vendored
42
thirdparty/sokol/.github/workflows/main.yml
vendored
@@ -57,24 +57,24 @@ jobs:
|
||||
cd ..
|
||||
- name: build
|
||||
run: |
|
||||
./odin build examples/blend -debug
|
||||
./odin build examples/bufferoffsets -debug
|
||||
./odin build examples/clear -debug
|
||||
./odin build examples/cube -debug
|
||||
./odin build examples/debugtext -debug
|
||||
./odin build examples/debugtext-print -debug
|
||||
./odin build examples/debugtext-userfont -debug
|
||||
./odin build examples/instancing -debug
|
||||
./odin build examples/mrt -debug
|
||||
./odin build examples/noninterleaved -debug
|
||||
./odin build examples/offscreen -debug
|
||||
./odin build examples/quad -debug
|
||||
./odin build examples/saudio -debug
|
||||
./odin build examples/sgl -debug
|
||||
./odin build examples/sgl-context -debug
|
||||
./odin build examples/sgl-points -debug
|
||||
./odin build examples/shapes -debug
|
||||
./odin build examples/texcube -debug
|
||||
./odin build examples/triangle -debug
|
||||
./odin build examples/vertexpull -debug
|
||||
./odin build examples/instancing-compute -debug
|
||||
./odin build examples/blend -strict-style -debug
|
||||
./odin build examples/bufferoffsets -strict-style -debug
|
||||
./odin build examples/clear -strict-style -debug
|
||||
./odin build examples/cube -strict-style -debug
|
||||
./odin build examples/debugtext -strict-style -debug
|
||||
./odin build examples/debugtext-print -strict-style -debug
|
||||
./odin build examples/debugtext-userfont -strict-style -debug
|
||||
./odin build examples/instancing -strict-style -debug
|
||||
./odin build examples/mrt -strict-style -debug
|
||||
./odin build examples/noninterleaved -strict-style -debug
|
||||
./odin build examples/offscreen -strict-style -debug
|
||||
./odin build examples/quad -strict-style -debug
|
||||
./odin build examples/saudio -strict-style -debug
|
||||
./odin build examples/sgl -strict-style -debug
|
||||
./odin build examples/sgl-context -strict-style -debug
|
||||
./odin build examples/sgl-points -strict-style -debug
|
||||
./odin build examples/shapes -strict-style -debug
|
||||
./odin build examples/texcube -strict-style -debug
|
||||
./odin build examples/triangle -strict-style -debug
|
||||
./odin build examples/vertexpull -strict-style -debug
|
||||
./odin build examples/instancing-compute -strict-style -debug
|
||||
|
40
thirdparty/sokol/README.md
vendored
40
thirdparty/sokol/README.md
vendored
@@ -32,26 +32,26 @@ On Linux install the following packages: libglu1-mesa-dev, mesa-common-dev, xorg
|
||||
|
||||
3. Build and run the samples:
|
||||
```
|
||||
odin run ../examples/clear -debug
|
||||
odin run ../examples/triangle -debug
|
||||
odin run ../examples/quad -debug
|
||||
odin run ../examples/bufferoffsets -debug
|
||||
odin run ../examples/cube -debug
|
||||
odin run ../examples/noninterleaved -debug
|
||||
odin run ../examples/texcube -debug
|
||||
odin run ../examples/shapes -debug
|
||||
odin run ../examples/offscreen -debug
|
||||
odin run ../examples/instancing -debug
|
||||
odin run ../examples/mrt -debug
|
||||
odin run ../examples/blend -debug
|
||||
odin run ../examples/debugtext -debug
|
||||
odin run ../examples/debugtext-print -debug
|
||||
odin run ../examples/debugtext-userfont -debug
|
||||
odin run ../examples/saudio -debug
|
||||
odin run ../examples/sgl -debug
|
||||
odin run ../examples/sgl-points -debug
|
||||
odin run ../examples/sgl-context -debug
|
||||
odin run ../examples/vertexpull -debug
|
||||
odin run ../examples/clear -strict-style -debug
|
||||
odin run ../examples/triangle -strict-style -debug
|
||||
odin run ../examples/quad -strict-style -debug
|
||||
odin run ../examples/bufferoffsets -strict-style -debug
|
||||
odin run ../examples/cube -strict-style -debug
|
||||
odin run ../examples/noninterleaved -strict-style -debug
|
||||
odin run ../examples/texcube -strict-style -debug
|
||||
odin run ../examples/shapes -strict-style -debug
|
||||
odin run ../examples/offscreen -strict-style -debug
|
||||
odin run ../examples/instancing -strict-style -debug
|
||||
odin run ../examples/mrt -strict-style -debug
|
||||
odin run ../examples/blend -strict-style -debug
|
||||
odin run ../examples/debugtext -strict-style -debug
|
||||
odin run ../examples/debugtext-print -strict-style -debug
|
||||
odin run ../examples/debugtext-userfont -strict-style -debug
|
||||
odin run ../examples/saudio -strict-style -debug
|
||||
odin run ../examples/sgl -strict-style -debug
|
||||
odin run ../examples/sgl-points -strict-style -debug
|
||||
odin run ../examples/sgl-context -strict-style -debug
|
||||
odin run ../examples/vertexpull -strict-style -debug
|
||||
```
|
||||
|
||||
By default, the backend 3D API will be selected based on the target platform:
|
||||
|
93
thirdparty/sokol/app/app.odin
vendored
93
thirdparty/sokol/app/app.odin
vendored
@@ -66,18 +66,30 @@ package sokol_app
|
||||
|
||||
Link with the following system libraries:
|
||||
|
||||
- on macOS with Metal: Cocoa, QuartzCore, Metal, MetalKit
|
||||
- on macOS with GL: Cocoa, QuartzCore, OpenGL
|
||||
- on iOS with Metal: Foundation, UIKit, Metal, MetalKit
|
||||
- on iOS with GL: Foundation, UIKit, OpenGLES, GLKit
|
||||
- on Linux with EGL: X11, Xi, Xcursor, EGL, GL (or GLESv2), dl, pthread, m(?)
|
||||
- on Linux with GLX: X11, Xi, Xcursor, GL, dl, pthread, m(?)
|
||||
- on macOS:
|
||||
- all backends: Foundation, Cocoa, QuartzCore
|
||||
- with SOKOL_METAL: Metal, MetalKit
|
||||
- with SOKOL_GLCORE: OpenGL
|
||||
- with SOKOL_WGPU: a WebGPU implementation library (tested with webgpu_dawn)
|
||||
- on iOS:
|
||||
- all backends: Foundation, UIKit
|
||||
- with SOKOL_METAL: Metal, MetalKit
|
||||
- with SOKOL_GLES3: OpenGLES, GLKit
|
||||
- on Linux:
|
||||
- all backends: X11, Xi, Xcursor, dl, pthread, m
|
||||
- with SOKOL_GLCORE: GL
|
||||
- with SOKOL_GLES3: GLESv2
|
||||
- with SOKOL_WGPU: a WebGPU implementation library (tested with webgpu_dawn)
|
||||
- with EGL: EGL
|
||||
- on Android: GLESv3, EGL, log, android
|
||||
- on Windows with the MSVC or Clang toolchains: no action needed, libs are defined in-source via pragma-comment-lib
|
||||
- on Windows with MINGW/MSYS2 gcc: compile with '-mwin32' so that _WIN32 is defined
|
||||
- link with the following libs: -lkernel32 -luser32 -lshell32
|
||||
- additionally with the GL backend: -lgdi32
|
||||
- additionally with the D3D11 backend: -ld3d11 -ldxgi
|
||||
- on Windows:
|
||||
- with MSVC or Clang: library dependencies are defined via `#pragma comment`
|
||||
- with SOKOL_WGPU: a WebGPU implementation library (tested with webgpu_dawn)
|
||||
- with MINGW/MSYS2 gcc:
|
||||
- compile with '-mwin32' so that _WIN32 is defined
|
||||
- link with the following libs: -lkernel32 -luser32 -lshell32
|
||||
- additionally with the GL backend: -lgdi32
|
||||
- additionally with the D3D11 backend: -ld3d11 -ldxgi
|
||||
|
||||
On Linux, you also need to use the -pthread compiler and linker option, otherwise weird
|
||||
things will happen, see here for details: https://github.com/floooh/sokol/issues/376
|
||||
@@ -87,7 +99,7 @@ package sokol_app
|
||||
On Emscripten:
|
||||
- for WebGL2: add the linker option `-s USE_WEBGL2=1`
|
||||
- for WebGPU: compile and link with `--use-port=emdawnwebgpu`
|
||||
(for more exotic situations, read: https://dawn.googlesource.com/dawn/+/refs/heads/main/src/emdawnwebgpu/pkg/README.md)
|
||||
(for more exotic situations read: https://dawn.googlesource.com/dawn/+/refs/heads/main/src/emdawnwebgpu/pkg/README.md)
|
||||
|
||||
FEATURE OVERVIEW
|
||||
================
|
||||
@@ -95,11 +107,12 @@ package sokol_app
|
||||
implements the 'application-wrapper' parts of a 3D application:
|
||||
|
||||
- a common application entry function
|
||||
- creates a window and 3D-API context/device with a 'default framebuffer'
|
||||
- creates a window and 3D-API context/device with a swapchain
|
||||
surface, depth-stencil-buffer surface and optionally MSAA surface
|
||||
- makes the rendered frame visible
|
||||
- provides keyboard-, mouse- and low-level touch-events
|
||||
- platforms: MacOS, iOS, HTML5, Win32, Linux/RaspberryPi, Android
|
||||
- 3D-APIs: Metal, D3D11, GL4.1, GL4.3, GLES3, WebGL, WebGL2, NOAPI
|
||||
- 3D-APIs: Metal, D3D11, GL4.1, GL4.3, GLES3, WebGL2, WebGPU, NOAPI
|
||||
|
||||
FEATURE/PLATFORM MATRIX
|
||||
=======================
|
||||
@@ -109,6 +122,7 @@ package sokol_app
|
||||
gles3/webgl2 | --- | --- | YES(2)| YES | YES | YES
|
||||
metal | --- | YES | --- | YES | --- | ---
|
||||
d3d11 | YES | --- | --- | --- | --- | ---
|
||||
webgpu | YES(4) | YES(4)| YES(4)| NO | NO | YES
|
||||
noapi | YES | TODO | TODO | --- | TODO | ---
|
||||
KEY_DOWN | YES | YES | YES | SOME | TODO | YES
|
||||
KEY_UP | YES | YES | YES | SOME | TODO | YES
|
||||
@@ -134,7 +148,7 @@ package sokol_app
|
||||
IME | TODO | TODO? | TODO | ??? | TODO | ???
|
||||
key repeat flag | YES | YES | YES | --- | --- | YES
|
||||
windowed | YES | YES | YES | --- | --- | YES
|
||||
fullscreen | YES | YES | YES | YES | YES | ---
|
||||
fullscreen | YES | YES | YES | YES | YES | YES(3)
|
||||
mouse hide | YES | YES | YES | --- | --- | YES
|
||||
mouse lock | YES | YES | YES | --- | --- | YES
|
||||
set cursor type | YES | YES | YES | --- | --- | YES
|
||||
@@ -148,6 +162,9 @@ package sokol_app
|
||||
|
||||
(1) macOS has no regular window icons, instead the dock icon is changed
|
||||
(2) supported with EGL only (not GLX)
|
||||
(3) fullscreen in the browser not supported on iphones
|
||||
(4) WebGPU on native desktop platforms should be considered experimental
|
||||
and mainly useful for debugging and benchmarking
|
||||
|
||||
STEP BY STEP
|
||||
============
|
||||
@@ -687,8 +704,7 @@ package sokol_app
|
||||
const size_t num_bytes = response->data.size;
|
||||
// and the pointer to the data (same as 'buf' in the fetch-call):
|
||||
const void* ptr = response->data.ptr;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// on error check the error code:
|
||||
switch (response->error_code) {
|
||||
case SAPP_HTML5_FETCH_ERROR_BUFFER_TOO_SMALL:
|
||||
@@ -865,6 +881,15 @@ package sokol_app
|
||||
To check if the application window is currently in fullscreen mode,
|
||||
call sapp_is_fullscreen().
|
||||
|
||||
On the web, sapp_desc.fullscreen will have no effect, and the application
|
||||
will always start in non-fullscreen mode. Call sapp_toggle_fullscreen()
|
||||
from within or 'near' an input event to switch to fullscreen programatically.
|
||||
Note that on the web, the fullscreen state may change back to windowed at
|
||||
any time (either because the browser had rejected switching into fullscreen,
|
||||
or the user leaves fullscreen via Esc), this means that the result
|
||||
of sapp_is_fullscreen() may change also without calling sapp_toggle_fullscreen()!
|
||||
|
||||
|
||||
WINDOW ICON SUPPORT
|
||||
===================
|
||||
Some sokol_app.h backends allow to change the window icon programmatically:
|
||||
@@ -1408,6 +1433,10 @@ foreign sokol_app_clib {
|
||||
set_mouse_cursor :: proc(cursor: Mouse_Cursor) ---
|
||||
// get current mouse cursor type
|
||||
get_mouse_cursor :: proc() -> Mouse_Cursor ---
|
||||
// associate a custom mouse cursor image to a sapp_mouse_cursor enum entry
|
||||
bind_mouse_cursor_image :: proc(cursor: Mouse_Cursor, #by_ptr desc: Image_Desc) -> Mouse_Cursor ---
|
||||
// restore the sapp_mouse_cursor enum entry to it's default system appearance
|
||||
unbind_mouse_cursor_image :: proc(cursor: Mouse_Cursor) ---
|
||||
// return the userdata pointer optionally provided in sapp_desc
|
||||
userdata :: proc() -> rawptr ---
|
||||
// return a copy of the sapp_desc structure
|
||||
@@ -1775,16 +1804,18 @@ Range :: struct {
|
||||
/*
|
||||
sapp_image_desc
|
||||
|
||||
This is used to describe image data to sokol_app.h (at first, window
|
||||
icons, later maybe cursor images).
|
||||
This is used to describe image data to sokol_app.h (window icons and cursor images).
|
||||
|
||||
Note that the actual image pixel format depends on the use case:
|
||||
The pixel format is RGBA8.
|
||||
|
||||
- window icon pixels are RGBA8
|
||||
cursor_hotspot_x and _y are used only for cursors, to define which pixel
|
||||
of the image should be aligned with the mouse position.
|
||||
*/
|
||||
Image_Desc :: struct {
|
||||
width : c.int,
|
||||
height : c.int,
|
||||
cursor_hotspot_x : c.int,
|
||||
cursor_hotspot_y : c.int,
|
||||
pixels : Range,
|
||||
}
|
||||
|
||||
@@ -1852,6 +1883,7 @@ Log_Item :: enum i32 {
|
||||
WIN32_REGISTER_RAW_INPUT_DEVICES_FAILED_MOUSE_LOCK,
|
||||
WIN32_REGISTER_RAW_INPUT_DEVICES_FAILED_MOUSE_UNLOCK,
|
||||
WIN32_GET_RAW_INPUT_DATA_FAILED,
|
||||
WIN32_DESTROYICON_FOR_CURSOR_FAILED,
|
||||
LINUX_GLX_LOAD_LIBGL_FAILED,
|
||||
LINUX_GLX_LOAD_ENTRY_POINTS_FAILED,
|
||||
LINUX_GLX_EXTENSION_NOT_FOUND,
|
||||
@@ -1910,6 +1942,9 @@ Log_Item :: enum i32 {
|
||||
ANDROID_NATIVE_ACTIVITY_ONCREATE,
|
||||
ANDROID_CREATE_THREAD_PIPE_FAILED,
|
||||
ANDROID_NATIVE_ACTIVITY_CREATE_SUCCESS,
|
||||
WGPU_DEVICE_LOST,
|
||||
WGPU_DEVICE_LOG,
|
||||
WGPU_DEVICE_UNCAPTURED_ERROR,
|
||||
WGPU_SWAPCHAIN_CREATE_SURFACE_FAILED,
|
||||
WGPU_SWAPCHAIN_SURFACE_GET_CAPABILITIES_FAILED,
|
||||
WGPU_SWAPCHAIN_CREATE_DEPTH_STENCIL_TEXTURE_FAILED,
|
||||
@@ -2036,5 +2071,21 @@ Mouse_Cursor :: enum i32 {
|
||||
RESIZE_NESW,
|
||||
RESIZE_ALL,
|
||||
NOT_ALLOWED,
|
||||
CUSTOM_0,
|
||||
CUSTOM_1,
|
||||
CUSTOM_2,
|
||||
CUSTOM_3,
|
||||
CUSTOM_4,
|
||||
CUSTOM_5,
|
||||
CUSTOM_6,
|
||||
CUSTOM_7,
|
||||
CUSTOM_8,
|
||||
CUSTOM_9,
|
||||
CUSTOM_10,
|
||||
CUSTOM_11,
|
||||
CUSTOM_12,
|
||||
CUSTOM_13,
|
||||
CUSTOM_14,
|
||||
CUSTOM_15,
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,16 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
sokol_tools_root=../sokol-tools-bin
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "usage: ./build_shaders.sh [path-to-sokol-shdc]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shdc="$1"
|
||||
|
||||
build_shader() {
|
||||
name=$1
|
||||
dir=examples/$name
|
||||
if [[ $(arch) =~ "arm64" ]]
|
||||
then
|
||||
shdc=$sokol_tools_root/bin/osx_arm64/sokol-shdc
|
||||
else
|
||||
shdc=$sokol_tools_root/bin/osx/sokol-shdc
|
||||
fi
|
||||
echo $dir
|
||||
$shdc -i $dir/shader.glsl -o $dir/shader.odin -l glsl430:metal_macos:hlsl5 -f sokol_odin
|
||||
}
|
2005
thirdparty/sokol/c/sokol_app.h
vendored
2005
thirdparty/sokol/c/sokol_app.h
vendored
File diff suppressed because it is too large
Load Diff
7
thirdparty/sokol/c/sokol_audio.h
vendored
7
thirdparty/sokol/c/sokol_audio.h
vendored
@@ -695,6 +695,10 @@ inline void saudio_setup(const saudio_desc& desc) { return saudio_setup(&desc);
|
||||
#if defined(SOKOL_DUMMY_BACKEND)
|
||||
#define _SAUDIO_NOTHREADS (1)
|
||||
#elif defined(_SAUDIO_WINDOWS)
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||
#endif
|
||||
#define _SAUDIO_WINTHREADS (1)
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
@@ -740,6 +744,9 @@ inline void saudio_setup(const saudio_desc& desc) { return saudio_setup(&desc);
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4505) /* unreferenced local function has been removed */
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#elif defined(_SAUDIO_APPLE)
|
||||
#define _SAUDIO_PTHREADS (1)
|
||||
#include <pthread.h>
|
||||
|
33
thirdparty/sokol/c/sokol_debugtext.h
vendored
33
thirdparty/sokol/c/sokol_debugtext.h
vendored
@@ -3958,6 +3958,7 @@ typedef struct {
|
||||
uint32_t init_cookie;
|
||||
sdtx_desc_t desc;
|
||||
sg_image font_img;
|
||||
sg_view font_view;
|
||||
sg_sampler font_smp;
|
||||
sg_shader shader;
|
||||
uint32_t fmt_buf_size;
|
||||
@@ -4368,21 +4369,21 @@ static void _sdtx_setup_common(void) {
|
||||
shd_desc.attrs[1].hlsl_sem_index = 1;
|
||||
shd_desc.attrs[2].hlsl_sem_name = "TEXCOORD";
|
||||
shd_desc.attrs[2].hlsl_sem_index = 2;
|
||||
shd_desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT;
|
||||
shd_desc.images[0].image_type = SG_IMAGETYPE_2D;
|
||||
shd_desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT;
|
||||
shd_desc.images[0].hlsl_register_t_n = 0;
|
||||
shd_desc.images[0].msl_texture_n = 0;
|
||||
shd_desc.images[0].wgsl_group1_binding_n = 64;
|
||||
shd_desc.views[0].texture.stage = SG_SHADERSTAGE_FRAGMENT;
|
||||
shd_desc.views[0].texture.image_type = SG_IMAGETYPE_2D;
|
||||
shd_desc.views[0].texture.sample_type = SG_IMAGESAMPLETYPE_FLOAT;
|
||||
shd_desc.views[0].texture.hlsl_register_t_n = 0;
|
||||
shd_desc.views[0].texture.msl_texture_n = 0;
|
||||
shd_desc.views[0].texture.wgsl_group1_binding_n = 64;
|
||||
shd_desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
|
||||
shd_desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
|
||||
shd_desc.samplers[0].hlsl_register_s_n = 0;
|
||||
shd_desc.samplers[0].msl_sampler_n = 0;
|
||||
shd_desc.samplers[0].wgsl_group1_binding_n = 80;
|
||||
shd_desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
|
||||
shd_desc.image_sampler_pairs[0].image_slot = 0;
|
||||
shd_desc.image_sampler_pairs[0].sampler_slot = 0;
|
||||
shd_desc.image_sampler_pairs[0].glsl_name = "tex_smp";
|
||||
shd_desc.texture_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
|
||||
shd_desc.texture_sampler_pairs[0].view_slot = 0;
|
||||
shd_desc.texture_sampler_pairs[0].sampler_slot = 0;
|
||||
shd_desc.texture_sampler_pairs[0].glsl_name = "tex_smp";
|
||||
#if defined(SOKOL_GLCORE)
|
||||
shd_desc.vertex_func.source = (const char*)_sdtx_vs_source_glsl410;
|
||||
shd_desc.fragment_func.source = (const char*)_sdtx_fs_source_glsl410;
|
||||
@@ -4428,7 +4429,7 @@ static void _sdtx_setup_common(void) {
|
||||
}
|
||||
}
|
||||
|
||||
// create font texture and sampler
|
||||
// create font image, texture view and sampler
|
||||
sg_image_desc img_desc;
|
||||
_sdtx_clear(&img_desc, sizeof(img_desc));
|
||||
img_desc.width = 256 * 8;
|
||||
@@ -4439,6 +4440,13 @@ static void _sdtx_setup_common(void) {
|
||||
_sdtx.font_img = sg_make_image(&img_desc);
|
||||
SOKOL_ASSERT(SG_INVALID_ID != _sdtx.font_img.id);
|
||||
|
||||
sg_view_desc view_desc;
|
||||
_sdtx_clear(&view_desc, sizeof(view_desc));
|
||||
view_desc.texture.image = _sdtx.font_img;
|
||||
view_desc.label = "sdtx-font-texture-view";
|
||||
_sdtx.font_view = sg_make_view(&view_desc);
|
||||
SOKOL_ASSERT(SG_INVALID_ID != _sdtx.font_view.id);
|
||||
|
||||
sg_sampler_desc smp_desc;
|
||||
_sdtx_clear(&smp_desc, sizeof(smp_desc));
|
||||
smp_desc.min_filter = SG_FILTER_NEAREST;
|
||||
@@ -4455,6 +4463,7 @@ static void _sdtx_setup_common(void) {
|
||||
static void _sdtx_discard_common(void) {
|
||||
sg_push_debug_group("sokol-debugtext");
|
||||
sg_destroy_sampler(_sdtx.font_smp);
|
||||
sg_destroy_view(_sdtx.font_view);
|
||||
sg_destroy_image(_sdtx.font_img);
|
||||
sg_destroy_shader(_sdtx.shader);
|
||||
if (_sdtx.fmt_buf) {
|
||||
@@ -4613,7 +4622,7 @@ SOKOL_API_IMPL void _sdtx_draw_layer(_sdtx_context_t* ctx, int layer_id) {
|
||||
sg_bindings bindings;
|
||||
_sdtx_clear(&bindings, sizeof(bindings));
|
||||
bindings.vertex_buffers[0] = ctx->vbuf;
|
||||
bindings.images[0] = _sdtx.font_img;
|
||||
bindings.views[0] = _sdtx.font_view;
|
||||
bindings.samplers[0] = _sdtx.font_smp;
|
||||
sg_apply_bindings(&bindings);
|
||||
for (int cmd_index = 0; cmd_index < ctx->commands.next; cmd_index++) {
|
||||
|
6214
thirdparty/sokol/c/sokol_gfx.h
vendored
6214
thirdparty/sokol/c/sokol_gfx.h
vendored
File diff suppressed because it is too large
Load Diff
72
thirdparty/sokol/c/sokol_gl.h
vendored
72
thirdparty/sokol/c/sokol_gl.h
vendored
@@ -233,9 +233,9 @@
|
||||
|
||||
sgl_enable_texture()
|
||||
sgl_disable_texture()
|
||||
sgl_texture(sg_image img, sg_sampler smp)
|
||||
sgl_texture(sg_view tex_view, sg_sampler smp)
|
||||
|
||||
NOTE: the img and smp handles can be invalid (SG_INVALID_ID), in this
|
||||
NOTE: the tex_view and smp handles can be invalid (SG_INVALID_ID), in this
|
||||
case, sokol-gl will fall back to the internal default (white) texture
|
||||
and sampler.
|
||||
|
||||
@@ -865,7 +865,7 @@ SOKOL_GL_API_DECL void sgl_scissor_rect(int x, int y, int w, int h, bool origin_
|
||||
SOKOL_GL_API_DECL void sgl_scissor_rectf(float x, float y, float w, float h, bool origin_top_left);
|
||||
SOKOL_GL_API_DECL void sgl_enable_texture(void);
|
||||
SOKOL_GL_API_DECL void sgl_disable_texture(void);
|
||||
SOKOL_GL_API_DECL void sgl_texture(sg_image img, sg_sampler smp);
|
||||
SOKOL_GL_API_DECL void sgl_texture(sg_view tex_view, sg_sampler smp);
|
||||
SOKOL_GL_API_DECL void sgl_layer(int layer_id);
|
||||
|
||||
/* pipeline stack functions */
|
||||
@@ -2767,7 +2767,7 @@ typedef enum {
|
||||
|
||||
typedef struct {
|
||||
sg_pipeline pip;
|
||||
sg_image img;
|
||||
sg_view view;
|
||||
sg_sampler smp;
|
||||
int base_vertex;
|
||||
int num_vertices;
|
||||
@@ -2837,7 +2837,7 @@ typedef struct {
|
||||
uint32_t rgba;
|
||||
float point_size;
|
||||
_sgl_primitive_type_t cur_prim_type;
|
||||
sg_image cur_img;
|
||||
sg_view cur_view;
|
||||
sg_sampler cur_smp;
|
||||
bool texturing_enabled;
|
||||
bool matrix_dirty; /* reset in sgl_end(), set in any of the matrix stack functions */
|
||||
@@ -2866,6 +2866,7 @@ typedef struct {
|
||||
uint32_t init_cookie;
|
||||
sgl_desc_t desc;
|
||||
sg_image def_img; // a default white texture
|
||||
sg_view def_view; // ...and the texture view for the default image
|
||||
sg_sampler def_smp; // a default sampler
|
||||
sg_shader shd; // same shader for all contexts
|
||||
sgl_context def_ctx_id;
|
||||
@@ -3305,7 +3306,7 @@ static void _sgl_init_context(sgl_context ctx_id, const sgl_context_desc_t* in_d
|
||||
ctx->desc = _sgl_context_desc_defaults(in_desc);
|
||||
// NOTE: frame_id must be non-zero, so that updates trigger in first frame
|
||||
ctx->frame_id = 1;
|
||||
ctx->cur_img = _sgl.def_img;
|
||||
ctx->cur_view = _sgl.def_view;
|
||||
ctx->cur_smp = _sgl.def_smp;
|
||||
|
||||
// allocate buffers and pools
|
||||
@@ -3756,10 +3757,18 @@ static void _sgl_setup_common(void) {
|
||||
_sgl.def_img = sg_make_image(&img_desc);
|
||||
SOKOL_ASSERT(SG_INVALID_ID != _sgl.def_img.id);
|
||||
|
||||
sg_view_desc view_desc;
|
||||
_sgl_clear(&view_desc, sizeof(view_desc));
|
||||
view_desc.texture.image = _sgl.def_img;
|
||||
view_desc.label = "sgl-default-texture-view";
|
||||
_sgl.def_view = sg_make_view(&view_desc);
|
||||
SOKOL_ASSERT(SG_INVALID_ID != _sgl.def_view.id);
|
||||
|
||||
sg_sampler_desc smp_desc;
|
||||
_sgl_clear(&smp_desc, sizeof(smp_desc));
|
||||
smp_desc.min_filter = SG_FILTER_NEAREST;
|
||||
smp_desc.mag_filter = SG_FILTER_NEAREST;
|
||||
smp_desc.label = "sgl-default-sampler";
|
||||
_sgl.def_smp = sg_make_sampler(&smp_desc);
|
||||
SOKOL_ASSERT(SG_INVALID_ID != _sgl.def_smp.id);
|
||||
|
||||
@@ -3786,21 +3795,21 @@ static void _sgl_setup_common(void) {
|
||||
shd_desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "vs_params";
|
||||
shd_desc.uniform_blocks[0].glsl_uniforms[0].type = SG_UNIFORMTYPE_FLOAT4;
|
||||
shd_desc.uniform_blocks[0].glsl_uniforms[0].array_count = 8;
|
||||
shd_desc.images[0].stage = SG_SHADERSTAGE_FRAGMENT;
|
||||
shd_desc.images[0].image_type = SG_IMAGETYPE_2D;
|
||||
shd_desc.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT;
|
||||
shd_desc.images[0].hlsl_register_t_n = 0;
|
||||
shd_desc.images[0].msl_texture_n = 0;
|
||||
shd_desc.images[0].wgsl_group1_binding_n = 64;
|
||||
shd_desc.views[0].texture.stage = SG_SHADERSTAGE_FRAGMENT;
|
||||
shd_desc.views[0].texture.image_type = SG_IMAGETYPE_2D;
|
||||
shd_desc.views[0].texture.sample_type = SG_IMAGESAMPLETYPE_FLOAT;
|
||||
shd_desc.views[0].texture.hlsl_register_t_n = 0;
|
||||
shd_desc.views[0].texture.msl_texture_n = 0;
|
||||
shd_desc.views[0].texture.wgsl_group1_binding_n = 64;
|
||||
shd_desc.samplers[0].stage = SG_SHADERSTAGE_FRAGMENT;
|
||||
shd_desc.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING;
|
||||
shd_desc.samplers[0].hlsl_register_s_n = 0;
|
||||
shd_desc.samplers[0].msl_sampler_n = 0;
|
||||
shd_desc.samplers[0].wgsl_group1_binding_n = 80;
|
||||
shd_desc.image_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
|
||||
shd_desc.image_sampler_pairs[0].image_slot = 0;
|
||||
shd_desc.image_sampler_pairs[0].sampler_slot = 0;
|
||||
shd_desc.image_sampler_pairs[0].glsl_name = "tex_smp";
|
||||
shd_desc.texture_sampler_pairs[0].stage = SG_SHADERSTAGE_FRAGMENT;
|
||||
shd_desc.texture_sampler_pairs[0].view_slot = 0;
|
||||
shd_desc.texture_sampler_pairs[0].sampler_slot = 0;
|
||||
shd_desc.texture_sampler_pairs[0].glsl_name = "tex_smp";
|
||||
shd_desc.label = "sgl-shader";
|
||||
#if defined(SOKOL_GLCORE)
|
||||
shd_desc.vertex_func.source = (const char*)_sgl_vs_source_glsl410;
|
||||
@@ -3843,6 +3852,7 @@ static void _sgl_setup_common(void) {
|
||||
// discard resources which are shared between all contexts
|
||||
static void _sgl_discard_common(void) {
|
||||
sg_push_debug_group("sokol-gl");
|
||||
sg_destroy_view(_sgl.def_view);
|
||||
sg_destroy_image(_sgl.def_img);
|
||||
sg_destroy_sampler(_sgl.def_smp);
|
||||
sg_destroy_shader(_sgl.shd);
|
||||
@@ -3859,7 +3869,7 @@ static void _sgl_draw(_sgl_context_t* ctx, int layer_id) {
|
||||
sg_push_debug_group("sokol-gl");
|
||||
|
||||
uint32_t cur_pip_id = SG_INVALID_ID;
|
||||
uint32_t cur_img_id = SG_INVALID_ID;
|
||||
uint32_t cur_tex_id = SG_INVALID_ID;
|
||||
uint32_t cur_smp_id = SG_INVALID_ID;
|
||||
int cur_uniform_index = -1;
|
||||
|
||||
@@ -3895,16 +3905,16 @@ static void _sgl_draw(_sgl_context_t* ctx, int layer_id) {
|
||||
if (args->pip.id != cur_pip_id) {
|
||||
sg_apply_pipeline(args->pip);
|
||||
cur_pip_id = args->pip.id;
|
||||
/* when pipeline changes, also need to re-apply uniforms and bindings */
|
||||
cur_img_id = SG_INVALID_ID;
|
||||
// when pipeline changes, also need to re-apply uniforms and bindings
|
||||
cur_tex_id = SG_INVALID_ID;
|
||||
cur_smp_id = SG_INVALID_ID;
|
||||
cur_uniform_index = -1;
|
||||
}
|
||||
if ((cur_img_id != args->img.id) || (cur_smp_id != args->smp.id)) {
|
||||
ctx->bind.images[0] = args->img;
|
||||
if ((cur_tex_id != args->view.id) || (cur_smp_id != args->smp.id)) {
|
||||
ctx->bind.views[0] = args->view;
|
||||
ctx->bind.samplers[0] = args->smp;
|
||||
sg_apply_bindings(&ctx->bind);
|
||||
cur_img_id = args->img.id;
|
||||
cur_tex_id = args->view.id;
|
||||
cur_smp_id = args->smp.id;
|
||||
}
|
||||
if (cur_uniform_index != args->uniform_index) {
|
||||
@@ -3912,7 +3922,7 @@ static void _sgl_draw(_sgl_context_t* ctx, int layer_id) {
|
||||
sg_apply_uniforms(0, &ub_range);
|
||||
cur_uniform_index = args->uniform_index;
|
||||
}
|
||||
/* FIXME: what if number of vertices doesn't match the primitive type? */
|
||||
// FIXME: what if number of vertices doesn't match the primitive type?
|
||||
if (args->num_vertices > 0) {
|
||||
sg_draw(args->base_vertex, args->num_vertices, 1);
|
||||
}
|
||||
@@ -4147,7 +4157,7 @@ SOKOL_API_IMPL void sgl_defaults(void) {
|
||||
ctx->rgba = 0xFFFFFFFF;
|
||||
ctx->point_size = 1.0f;
|
||||
ctx->texturing_enabled = false;
|
||||
ctx->cur_img = _sgl.def_img;
|
||||
ctx->cur_view = _sgl.def_view;
|
||||
ctx->cur_smp = _sgl.def_smp;
|
||||
sgl_load_default_pipeline();
|
||||
_sgl_identity(_sgl_matrix_texture(ctx));
|
||||
@@ -4233,17 +4243,17 @@ SOKOL_API_IMPL void sgl_disable_texture(void) {
|
||||
ctx->texturing_enabled = false;
|
||||
}
|
||||
|
||||
SOKOL_API_IMPL void sgl_texture(sg_image img, sg_sampler smp) {
|
||||
SOKOL_API_IMPL void sgl_texture(sg_view tex_view, sg_sampler smp) {
|
||||
SOKOL_ASSERT(_SGL_INIT_COOKIE == _sgl.init_cookie);
|
||||
_sgl_context_t* ctx = _sgl.cur_ctx;
|
||||
if (!ctx) {
|
||||
return;
|
||||
}
|
||||
SOKOL_ASSERT(!ctx->in_begin);
|
||||
if (SG_INVALID_ID != img.id) {
|
||||
ctx->cur_img = img;
|
||||
if (SG_INVALID_ID != tex_view.id) {
|
||||
ctx->cur_view = tex_view;
|
||||
} else {
|
||||
ctx->cur_img = _sgl.def_img;
|
||||
ctx->cur_view = _sgl.def_view;
|
||||
}
|
||||
if (SG_INVALID_ID != smp.id) {
|
||||
ctx->cur_smp = smp;
|
||||
@@ -4339,7 +4349,7 @@ SOKOL_API_IMPL void sgl_end(void) {
|
||||
|
||||
// check if command can be merged with current command
|
||||
sg_pipeline pip = _sgl_get_pipeline(ctx->pip_stack[ctx->pip_tos], ctx->cur_prim_type);
|
||||
sg_image img = ctx->texturing_enabled ? ctx->cur_img : _sgl.def_img;
|
||||
sg_view view = ctx->texturing_enabled ? ctx->cur_view : _sgl.def_view;
|
||||
sg_sampler smp = ctx->texturing_enabled ? ctx->cur_smp : _sgl.def_smp;
|
||||
_sgl_command_t* cur_cmd = _sgl_cur_command(ctx);
|
||||
bool merge_cmd = false;
|
||||
@@ -4349,7 +4359,7 @@ SOKOL_API_IMPL void sgl_end(void) {
|
||||
(ctx->cur_prim_type != SGL_PRIMITIVETYPE_LINE_STRIP) &&
|
||||
(ctx->cur_prim_type != SGL_PRIMITIVETYPE_TRIANGLE_STRIP) &&
|
||||
!matrix_dirty &&
|
||||
(cur_cmd->args.draw.img.id == img.id) &&
|
||||
(cur_cmd->args.draw.view.id == view.id) &&
|
||||
(cur_cmd->args.draw.smp.id == smp.id) &&
|
||||
(cur_cmd->args.draw.pip.id == pip.id))
|
||||
{
|
||||
@@ -4366,7 +4376,7 @@ SOKOL_API_IMPL void sgl_end(void) {
|
||||
SOKOL_ASSERT(ctx->uniforms.next > 0);
|
||||
cmd->cmd = SGL_COMMAND_DRAW;
|
||||
cmd->layer_id = ctx->layer_id;
|
||||
cmd->args.draw.img = img;
|
||||
cmd->args.draw.view = view;
|
||||
cmd->args.draw.smp = smp;
|
||||
cmd->args.draw.pip = _sgl_get_pipeline(ctx->pip_stack[ctx->pip_tos], ctx->cur_prim_type);
|
||||
cmd->args.draw.base_vertex = ctx->base_vertex;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1224
thirdparty/sokol/gfx/gfx.odin
vendored
1224
thirdparty/sokol/gfx/gfx.odin
vendored
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6
thirdparty/sokol/gl/gl.odin
vendored
6
thirdparty/sokol/gl/gl.odin
vendored
@@ -234,9 +234,9 @@ package sokol_gl
|
||||
|
||||
sgl_enable_texture()
|
||||
sgl_disable_texture()
|
||||
sgl_texture(sg_image img, sg_sampler smp)
|
||||
sgl_texture(sg_view tex_view, sg_sampler smp)
|
||||
|
||||
NOTE: the img and smp handles can be invalid (SG_INVALID_ID), in this
|
||||
NOTE: the tex_view and smp handles can be invalid (SG_INVALID_ID), in this
|
||||
case, sokol-gl will fall back to the internal default (white) texture
|
||||
and sampler.
|
||||
|
||||
@@ -804,7 +804,7 @@ foreign sokol_gl_clib {
|
||||
scissor_rectf :: proc(x: f32, y: f32, w: f32, h: f32, origin_top_left: bool) ---
|
||||
enable_texture :: proc() ---
|
||||
disable_texture :: proc() ---
|
||||
texture :: proc(img: sg.Image, smp: sg.Sampler) ---
|
||||
texture :: proc(tex_view: sg.View, smp: sg.Sampler) ---
|
||||
layer :: proc(#any_int layer_id: c.int) ---
|
||||
// pipeline stack functions
|
||||
load_default_pipeline :: proc() ---
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
thirdparty/sokol/sokol_dll_windows_x64_gl_debug.dll
vendored
BIN
thirdparty/sokol/sokol_dll_windows_x64_gl_debug.dll
vendored
Binary file not shown.
BIN
thirdparty/sokol/sokol_dll_windows_x64_gl_debug.exp
vendored
BIN
thirdparty/sokol/sokol_dll_windows_x64_gl_debug.exp
vendored
Binary file not shown.
BIN
thirdparty/sokol/sokol_dll_windows_x64_gl_debug.lib
vendored
BIN
thirdparty/sokol/sokol_dll_windows_x64_gl_debug.lib
vendored
Binary file not shown.
BIN
thirdparty/sokol/sokol_dll_windows_x64_gl_debug.pdb
vendored
BIN
thirdparty/sokol/sokol_dll_windows_x64_gl_debug.pdb
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
thirdparty/stb/lib/stb_truetype.lib
vendored
BIN
thirdparty/stb/lib/stb_truetype.lib
vendored
Binary file not shown.
Reference in New Issue
Block a user