mirror of
https://github.com/Ed94/VEFontCache-Odin.git
synced 2025-08-05 14:42:42 -07:00
compiling.. borken tho...
This commit is contained in:
@@ -60,7 +60,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
app_env := glue.environment()
|
||||
|
||||
ctx.glyph_shader = gfx.make_shader(render_glyph_shader_desc(backend) )
|
||||
ctx.atlas_shader = gfx.make_shader(blit_atlas_shader_desc(backend) )
|
||||
ctx.atlas_shader = gfx.make_shader(ve_blit_atlas_shader_desc(backend) )
|
||||
ctx.screen_shader = gfx.make_shader(ve_draw_text_shader_desc(backend) )
|
||||
|
||||
ctx.draw_list_vbuf = gfx.make_buffer( Buffer_Desciption {
|
||||
@@ -75,7 +75,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
usage = Buffer_Usage.STREAM,
|
||||
type = Buffer_Type.INDEXBUFFER,
|
||||
})
|
||||
assert( gfx.query_buffer_state( draw_list_ibuf) < Resource_State.FAILED, "Failed to make draw_list_iubuf" )
|
||||
assert( gfx.query_buffer_state( ctx.draw_list_ibuf) < Resource_State.FAILED, "Failed to make draw_list_iubuf" )
|
||||
|
||||
Image_Filter := Filter.LINEAR
|
||||
|
||||
@@ -114,8 +114,8 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
},
|
||||
}
|
||||
|
||||
glyph_pipeline = gfx.make_pipeline({
|
||||
shader = glyph_shader,
|
||||
ctx.glyph_pipeline = gfx.make_pipeline({
|
||||
shader = ctx.glyph_shader,
|
||||
layout = vs_layout,
|
||||
index_type = Vertex_Index_Type.UINT32,
|
||||
colors = {
|
||||
@@ -130,29 +130,29 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
cull_mode = .NONE,
|
||||
sample_count = 1,
|
||||
})
|
||||
assert( gfx.query_pipeline_state(glyph_pipeline) < Resource_State.FAILED, "Failed to make glyph_pipeline" )
|
||||
assert( gfx.query_pipeline_state(ctx.glyph_pipeline) < Resource_State.FAILED, "Failed to make glyph_pipeline" )
|
||||
}
|
||||
|
||||
// glyph_pass
|
||||
{
|
||||
glyph_rt_color = gfx.make_image( Image_Desc {
|
||||
ctx.glyph_rt_color = gfx.make_image( Image_Desc {
|
||||
type = ._2D,
|
||||
render_target = true,
|
||||
width = i32(ve_ctx.glyph_buffer.width),
|
||||
height = i32(ve_ctx.glyph_buffer.height),
|
||||
width = i32(ve_ctx.glyph_buffer.size.x),
|
||||
height = i32(ve_ctx.glyph_buffer.size.y),
|
||||
num_slices = 1,
|
||||
num_mipmaps = 1,
|
||||
usage = .IMMUTABLE,
|
||||
pixel_format = .R8,
|
||||
sample_count = 1,
|
||||
})
|
||||
assert( gfx.query_image_state(glyph_rt_color) < Resource_State.FAILED, "Failed to make glyph_pipeline" )
|
||||
assert( gfx.query_image_state(ctx.glyph_rt_color) < Resource_State.FAILED, "Failed to make glyph_pipeline" )
|
||||
|
||||
glyph_rt_depth = gfx.make_image( Image_Desc {
|
||||
ctx.glyph_rt_depth = gfx.make_image( Image_Desc {
|
||||
type = ._2D,
|
||||
render_target = true,
|
||||
width = i32(ve_ctx.glyph_buffer.width),
|
||||
height = i32(ve_ctx.glyph_buffer.height),
|
||||
width = i32(ve_ctx.glyph_buffer.size.x),
|
||||
height = i32(ve_ctx.glyph_buffer.size.y),
|
||||
num_slices = 1,
|
||||
num_mipmaps = 1,
|
||||
usage = .IMMUTABLE,
|
||||
@@ -160,22 +160,22 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
sample_count = 1,
|
||||
})
|
||||
|
||||
glyph_rt_sampler = gfx.make_sampler( Sampler_Description {
|
||||
ctx.glyph_rt_sampler = gfx.make_sampler( Sampler_Description {
|
||||
min_filter = Image_Filter,
|
||||
mag_filter = Image_Filter,
|
||||
mipmap_filter = Filter.NEAREST,
|
||||
wrap_u = .CLAMP_TO_EDGE,
|
||||
wrap_v = .CLAMP_TO_EDGE,
|
||||
min_lod = -1000.0,
|
||||
max_lod = 1000.0,
|
||||
min_lod = -1.0,
|
||||
max_lod = 1.0,
|
||||
border_color = Border_Color.OPAQUE_BLACK,
|
||||
compare = .NEVER,
|
||||
max_anisotropy = 1,
|
||||
})
|
||||
assert( gfx.query_sampler_state( glyph_rt_sampler) < Resource_State.FAILED, "Failed to make atlas_rt_sampler" )
|
||||
assert( gfx.query_sampler_state( ctx.glyph_rt_sampler) < Resource_State.FAILED, "Failed to make atlas_rt_sampler" )
|
||||
|
||||
color_attach := Attachment_Desc {
|
||||
image = glyph_rt_color,
|
||||
image = ctx.glyph_rt_color,
|
||||
}
|
||||
|
||||
glyph_attachments := gfx.make_attachments({
|
||||
@@ -183,7 +183,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
0 = color_attach,
|
||||
},
|
||||
depth_stencil = {
|
||||
image = glyph_rt_depth,
|
||||
image = ctx.glyph_rt_depth,
|
||||
},
|
||||
})
|
||||
assert( gfx.query_attachments_state(glyph_attachments) < Resource_State.FAILED, "Failed to make glyph_attachments" )
|
||||
@@ -208,7 +208,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
}
|
||||
}
|
||||
|
||||
glyph_pass = gfx.Pass {
|
||||
ctx.glyph_pass = gfx.Pass {
|
||||
action = glyph_action,
|
||||
attachments = glyph_attachments,
|
||||
// label =
|
||||
@@ -220,12 +220,12 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
vs_layout : Vertex_Layout_State
|
||||
{
|
||||
using vs_layout
|
||||
attrs[ATTR_blit_atlas_v_position] = Vertex_Attribute_State {
|
||||
attrs[ATTR_ve_blit_atlas_v_position] = Vertex_Attribute_State {
|
||||
format = Vertex_Format.FLOAT2,
|
||||
offset = 0,
|
||||
buffer_index = 0,
|
||||
}
|
||||
attrs[ATTR_blit_atlas_v_texture] = Vertex_Attribute_State {
|
||||
attrs[ATTR_ve_blit_atlas_v_texture] = Vertex_Attribute_State {
|
||||
format = Vertex_Format.FLOAT2,
|
||||
offset = size_of(ve.Vec2),
|
||||
buffer_index = 0,
|
||||
@@ -250,8 +250,8 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
},
|
||||
}
|
||||
|
||||
atlas_pipeline = gfx.make_pipeline({
|
||||
shader = atlas_shader,
|
||||
ctx.atlas_pipeline = gfx.make_pipeline({
|
||||
shader = ctx.atlas_shader,
|
||||
layout = vs_layout,
|
||||
index_type = Vertex_Index_Type.UINT32,
|
||||
colors = {
|
||||
@@ -270,11 +270,11 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
|
||||
// atlas_pass
|
||||
{
|
||||
atlas_rt_color = gfx.make_image( Image_Desc {
|
||||
ctx.atlas_rt_color = gfx.make_image( Image_Desc {
|
||||
type = ._2D,
|
||||
render_target = true,
|
||||
width = i32(ve_ctx.atlas.width),
|
||||
height = i32(ve_ctx.atlas.height),
|
||||
width = i32(ve_ctx.atlas.size.x),
|
||||
height = i32(ve_ctx.atlas.size.y),
|
||||
num_slices = 1,
|
||||
num_mipmaps = 1,
|
||||
usage = .IMMUTABLE,
|
||||
@@ -283,22 +283,22 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
// TODO(Ed): Setup labels for debug tracing/logging
|
||||
// label =
|
||||
})
|
||||
assert( gfx.query_image_state(atlas_rt_color) < Resource_State.FAILED, "Failed to make atlas_rt_color")
|
||||
assert( gfx.query_image_state(ctx.atlas_rt_color) < Resource_State.FAILED, "Failed to make atlas_rt_color")
|
||||
|
||||
atlas_rt_depth = gfx.make_image( Image_Desc {
|
||||
ctx.atlas_rt_depth = gfx.make_image( Image_Desc {
|
||||
type = ._2D,
|
||||
render_target = true,
|
||||
width = i32(ve_ctx.atlas.width),
|
||||
height = i32(ve_ctx.atlas.height),
|
||||
width = i32(ve_ctx.atlas.size.x),
|
||||
height = i32(ve_ctx.atlas.size.y),
|
||||
num_slices = 1,
|
||||
num_mipmaps = 1,
|
||||
usage = .IMMUTABLE,
|
||||
pixel_format = .DEPTH,
|
||||
sample_count = 1,
|
||||
})
|
||||
assert( gfx.query_image_state(atlas_rt_depth) < Resource_State.FAILED, "Failed to make atlas_rt_depth")
|
||||
assert( gfx.query_image_state(ctx.atlas_rt_depth) < Resource_State.FAILED, "Failed to make atlas_rt_depth")
|
||||
|
||||
atlas_rt_sampler = gfx.make_sampler( Sampler_Description {
|
||||
ctx.atlas_rt_sampler = gfx.make_sampler( Sampler_Description {
|
||||
min_filter = Image_Filter,
|
||||
mag_filter = Image_Filter,
|
||||
mipmap_filter = Filter.NEAREST,
|
||||
@@ -310,10 +310,10 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
compare = .NEVER,
|
||||
max_anisotropy = 1,
|
||||
})
|
||||
assert( gfx.query_sampler_state( atlas_rt_sampler) < Resource_State.FAILED, "Failed to make atlas_rt_sampler" )
|
||||
assert( gfx.query_sampler_state( ctx.atlas_rt_sampler) < Resource_State.FAILED, "Failed to make atlas_rt_sampler" )
|
||||
|
||||
color_attach := Attachment_Desc {
|
||||
image = atlas_rt_color,
|
||||
image = ctx.atlas_rt_color,
|
||||
}
|
||||
|
||||
atlas_attachments := gfx.make_attachments({
|
||||
@@ -321,7 +321,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
0 = color_attach,
|
||||
},
|
||||
depth_stencil = {
|
||||
image = atlas_rt_depth,
|
||||
image = ctx.atlas_rt_depth,
|
||||
},
|
||||
})
|
||||
assert( gfx.query_attachments_state(atlas_attachments) < Resource_State.FAILED, "Failed to make atlas_attachments")
|
||||
@@ -346,7 +346,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
}
|
||||
}
|
||||
|
||||
atlas_pass = gfx.Pass {
|
||||
ctx.atlas_pass = gfx.Pass {
|
||||
action = atlas_action,
|
||||
attachments = atlas_attachments,
|
||||
}
|
||||
@@ -357,12 +357,12 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
vs_layout : Vertex_Layout_State
|
||||
{
|
||||
using vs_layout
|
||||
attrs[ATTR_draw_text_v_position] = Vertex_Attribute_State {
|
||||
attrs[ATTR_ve_draw_text_v_position] = Vertex_Attribute_State {
|
||||
format = Vertex_Format.FLOAT2,
|
||||
offset = 0,
|
||||
buffer_index = 0,
|
||||
}
|
||||
attrs[ATTR_draw_text_v_texture] = Vertex_Attribute_State {
|
||||
attrs[ATTR_ve_draw_text_v_texture] = Vertex_Attribute_State {
|
||||
format = Vertex_Format.FLOAT2,
|
||||
offset = size_of(ve.Vec2),
|
||||
buffer_index = 0,
|
||||
@@ -387,8 +387,8 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
},
|
||||
}
|
||||
|
||||
screen_pipeline = gfx.make_pipeline({
|
||||
shader = screen_shader,
|
||||
ctx.screen_pipeline = gfx.make_pipeline({
|
||||
shader = ctx.screen_shader,
|
||||
layout = vs_layout,
|
||||
index_type = Vertex_Index_Type.UINT32,
|
||||
colors = {
|
||||
@@ -403,7 +403,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
},
|
||||
cull_mode = .NONE,
|
||||
})
|
||||
assert( gfx.query_pipeline_state(screen_pipeline) < Resource_State.FAILED, "Failed to make screen_pipeline" )
|
||||
assert( gfx.query_pipeline_state(ctx.screen_pipeline) < Resource_State.FAILED, "Failed to make screen_pipeline" )
|
||||
}
|
||||
|
||||
// screen_pass
|
||||
@@ -438,7 +438,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
|
||||
}
|
||||
}
|
||||
|
||||
screen_pass = gfx.Pass {
|
||||
ctx.screen_pass = gfx.Pass {
|
||||
action = screen_action,
|
||||
}
|
||||
}
|
||||
@@ -483,8 +483,8 @@ render_text_layer :: proc( screen_extent : ve.Vec2, ve_ctx : ^ve.Context, ctx :
|
||||
continue
|
||||
}
|
||||
|
||||
width := ve_ctx.glyph_buffer.width
|
||||
height := ve_ctx.glyph_buffer.height
|
||||
width := ve_ctx.glyph_buffer.size.x
|
||||
height := ve_ctx.glyph_buffer.size.y
|
||||
|
||||
pass := glyph_pass
|
||||
if draw_call.clear_before_draw {
|
||||
@@ -518,8 +518,8 @@ render_text_layer :: proc( screen_extent : ve.Vec2, ve_ctx : ^ve.Context, ctx :
|
||||
continue
|
||||
}
|
||||
|
||||
width := ve_ctx.atlas.width
|
||||
height := ve_ctx.atlas.height
|
||||
width := ve_ctx.atlas.size.x
|
||||
height := ve_ctx.atlas.size.y
|
||||
|
||||
pass := atlas_pass
|
||||
if draw_call.clear_before_draw {
|
||||
@@ -534,8 +534,8 @@ render_text_layer :: proc( screen_extent : ve.Vec2, ve_ctx : ^ve.Context, ctx :
|
||||
gfx.apply_pipeline( atlas_pipeline )
|
||||
|
||||
fs_uniform := Ve_Blit_Atlas_Fs_Params {
|
||||
glyph_buffer_size = glyph_buf_size,
|
||||
over_sample = glyph_buffer.over_sample.x,
|
||||
glyph_buffer_size = ve.vec2(ve_ctx.glyph_buffer.size),
|
||||
over_sample = ve_ctx.glyph_buffer.over_sample.x,
|
||||
region = cast(i32) draw_call.region,
|
||||
}
|
||||
gfx.apply_uniforms( UB_ve_blit_atlas_fs_params, Range { & fs_uniform, size_of(Ve_Blit_Atlas_Fs_Params) })
|
||||
@@ -575,7 +575,7 @@ render_text_layer :: proc( screen_extent : ve.Vec2, ve_ctx : ^ve.Context, ctx :
|
||||
|
||||
fs_target_uniform := Ve_Draw_Text_Fs_Params {
|
||||
// glyph_buffer_size = glyph_buf_size,
|
||||
over_sample = glyph_buffer.over_sample.x,
|
||||
over_sample = ve_ctx.glyph_buffer.over_sample.x,
|
||||
colour = draw_call.colour,
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
@header import sg "thirdparty:sokol/gfx"
|
||||
|
||||
@vs ve_blit_atlas_vs
|
||||
@include ./ve_source_shared.shdc.glsl
|
||||
@include ./source_shared.shdc.glsl
|
||||
@end
|
||||
|
||||
@fs ve_blit_atlas_fs
|
||||
|
Reference in New Issue
Block a user