Correcting sokol-shdc naming...

@module doesn't work on all uniforms.. making it useless
This commit is contained in:
2025-02-13 16:08:52 -05:00
parent 10080190c8
commit d806fc6083
9 changed files with 51 additions and 50 deletions

View File

@@ -59,7 +59,7 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
backend := gfx.query_backend()
app_env := glue.environment()
ctx.glyph_shader = gfx.make_shader(render_glyph_shader_desc(backend) )
ctx.glyph_shader = gfx.make_shader(ve_render_glyph_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) )
@@ -83,12 +83,12 @@ setup_gfx_objects :: proc( ctx : ^Context, ve_ctx : ^ve.Context, vert_cap, index
{
vs_layout : Vertex_Layout_State
{
vs_layout.attrs[ATTR_render_glyph_v_position] = Vertex_Attribute_State {
vs_layout.attrs[ATTR_ve_render_glyph_v_position] = Vertex_Attribute_State {
format = Vertex_Format.FLOAT2,
offset = 0,
buffer_index = 0,
}
vs_layout.attrs[ATTR_render_glyph_v_texture] = Vertex_Attribute_State {
vs_layout.attrs[ATTR_ve_render_glyph_v_texture] = Vertex_Attribute_State {
format = Vertex_Format.FLOAT2,
offset = size_of(ve.Vec2),
buffer_index = 0,

View File

@@ -6,14 +6,14 @@ import sg "thirdparty:sokol/gfx"
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
Cmdline:
sokol-shdc --input C:\projects\VEFontCache-Odin\backend\sokol\blit_atlas.shdc.glsl --output C:\projects\VEFontCache-Odin\backend\sokol\blit_atlas.odin --slang glsl410:glsl300es:hlsl4:metal_macos:wgsl --format=sokol_odin --module =blit_atlas
sokol-shdc --input C:\projects\VEFontCache-Odin\backend\sokol\blit_atlas.shdc.glsl --output C:\projects\VEFontCache-Odin\backend\sokol\blit_atlas.odin --slang glsl410:glsl300es:hlsl4:metal_macos:wgsl --format=sokol_odin
Overview:
=========
Shader program: 've_blit_atlas':
Get shader desc: ve_blit_atlas_shader_desc(sg.query_backend())
Vertex Shader: ve_blit_atlas_vs
Fragment Shader: ve_blit_atlas_fs
Vertex Shader: blit_atlas_vs
Fragment Shader: blit_atlas_fs
Attributes:
ATTR_ve_blit_atlas_v_position => 0
ATTR_ve_blit_atlas_v_texture => 1
@@ -57,7 +57,7 @@ Ve_Blit_Atlas_Fs_Params :: struct #align(16) {
*/
@(private="file")
ve_blit_atlas_vs_source_glsl410 := [235]u8 {
blit_atlas_vs_source_glsl410 := [235]u8 {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61,
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,
@@ -147,7 +147,7 @@ ve_blit_atlas_vs_source_glsl410 := [235]u8 {
*/
@(private="file")
ve_blit_atlas_fs_source_glsl410 := [1954]u8 {
blit_atlas_fs_source_glsl410 := [1954]u8 {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x73,0x74,
0x72,0x75,0x63,0x74,0x20,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,
0x61,0x73,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,
@@ -287,7 +287,7 @@ ve_blit_atlas_fs_source_glsl410 := [1954]u8 {
*/
@(private="file")
ve_blit_atlas_vs_source_glsl300es := [217]u8 {
blit_atlas_vs_source_glsl300es := [217]u8 {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,
0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
@@ -378,7 +378,7 @@ ve_blit_atlas_vs_source_glsl300es := [217]u8 {
*/
@(private="file")
ve_blit_atlas_fs_source_glsl300es := [2078]u8 {
blit_atlas_fs_source_glsl300es := [2078]u8 {
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
@@ -546,7 +546,7 @@ ve_blit_atlas_fs_source_glsl300es := [2078]u8 {
}
*/
@(private="file")
ve_blit_atlas_vs_source_hlsl4 := [705]u8 {
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,
0x63,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x75,0x76,0x3b,0x0a,0x73,0x74,0x61,
@@ -681,7 +681,7 @@ ve_blit_atlas_vs_source_hlsl4 := [705]u8 {
}
*/
@(private="file")
ve_blit_atlas_fs_source_hlsl4 := [2383]u8 {
blit_atlas_fs_source_hlsl4 := [2383]u8 {
0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,
0x61,0x74,0x6c,0x61,0x73,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,
0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,
@@ -860,7 +860,7 @@ ve_blit_atlas_fs_source_hlsl4 := [2383]u8 {
*/
@(private="file")
ve_blit_atlas_vs_source_metal_macos := [473]u8 {
blit_atlas_vs_source_metal_macos := [473]u8 {
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
@@ -976,7 +976,7 @@ ve_blit_atlas_vs_source_metal_macos := [473]u8 {
*/
@(private="file")
ve_blit_atlas_fs_source_metal_macos := [2713]u8 {
blit_atlas_fs_source_metal_macos := [2713]u8 {
0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x63,0x6c,0x61,0x6e,0x67,0x20,0x64,0x69,
0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x20,0x69,0x67,0x6e,0x6f,0x72,0x65,0x64,
0x20,0x22,0x2d,0x57,0x6d,0x69,0x73,0x73,0x69,0x6e,0x67,0x2d,0x70,0x72,0x6f,0x74,
@@ -1185,7 +1185,7 @@ ve_blit_atlas_fs_source_metal_macos := [2713]u8 {
*/
@(private="file")
ve_blit_atlas_vs_source_wgsl := [698]u8 {
blit_atlas_vs_source_wgsl := [698]u8 {
0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,
@@ -1373,7 +1373,7 @@ ve_blit_atlas_vs_source_wgsl := [698]u8 {
*/
@(private="file")
ve_blit_atlas_fs_source_wgsl := [4360]u8 {
blit_atlas_fs_source_wgsl := [4360]u8 {
0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20,
0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f,
0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,
@@ -1653,9 +1653,9 @@ ve_blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
desc.label = "ve_blit_atlas_shader"
#partial switch backend {
case .GLCORE:
desc.vertex_func.source = transmute(cstring)&ve_blit_atlas_vs_source_glsl410
desc.vertex_func.source = transmute(cstring)&blit_atlas_vs_source_glsl410
desc.vertex_func.entry = "main"
desc.fragment_func.source = transmute(cstring)&ve_blit_atlas_fs_source_glsl410
desc.fragment_func.source = transmute(cstring)&blit_atlas_fs_source_glsl410
desc.fragment_func.entry = "main"
desc.attrs[0].glsl_name = "v_position"
desc.attrs[1].glsl_name = "v_texture"
@@ -1682,9 +1682,9 @@ ve_blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
desc.image_sampler_pairs[0].sampler_slot = 0
desc.image_sampler_pairs[0].glsl_name = "ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler"
case .GLES3:
desc.vertex_func.source = transmute(cstring)&ve_blit_atlas_vs_source_glsl300es
desc.vertex_func.source = transmute(cstring)&blit_atlas_vs_source_glsl300es
desc.vertex_func.entry = "main"
desc.fragment_func.source = transmute(cstring)&ve_blit_atlas_fs_source_glsl300es
desc.fragment_func.source = transmute(cstring)&blit_atlas_fs_source_glsl300es
desc.fragment_func.entry = "main"
desc.attrs[0].glsl_name = "v_position"
desc.attrs[1].glsl_name = "v_texture"
@@ -1711,10 +1711,10 @@ ve_blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
desc.image_sampler_pairs[0].sampler_slot = 0
desc.image_sampler_pairs[0].glsl_name = "ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler"
case .D3D11:
desc.vertex_func.source = transmute(cstring)&ve_blit_atlas_vs_source_hlsl4
desc.vertex_func.source = transmute(cstring)&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.source = transmute(cstring)&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"
@@ -1737,9 +1737,9 @@ ve_blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
desc.image_sampler_pairs[0].image_slot = 0
desc.image_sampler_pairs[0].sampler_slot = 0
case .METAL_MACOS:
desc.vertex_func.source = transmute(cstring)&ve_blit_atlas_vs_source_metal_macos
desc.vertex_func.source = transmute(cstring)&blit_atlas_vs_source_metal_macos
desc.vertex_func.entry = "main0"
desc.fragment_func.source = transmute(cstring)&ve_blit_atlas_fs_source_metal_macos
desc.fragment_func.source = transmute(cstring)&blit_atlas_fs_source_metal_macos
desc.fragment_func.entry = "main0"
desc.uniform_blocks[0].stage = .FRAGMENT
desc.uniform_blocks[0].layout = .STD140
@@ -1757,9 +1757,9 @@ ve_blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
desc.image_sampler_pairs[0].image_slot = 0
desc.image_sampler_pairs[0].sampler_slot = 0
case .WGPU:
desc.vertex_func.source = transmute(cstring)&ve_blit_atlas_vs_source_wgsl
desc.vertex_func.source = transmute(cstring)&blit_atlas_vs_source_wgsl
desc.vertex_func.entry = "main"
desc.fragment_func.source = transmute(cstring)&ve_blit_atlas_fs_source_wgsl
desc.fragment_func.source = transmute(cstring)&blit_atlas_fs_source_wgsl
desc.fragment_func.entry = "main"
desc.uniform_blocks[0].stage = .FRAGMENT
desc.uniform_blocks[0].layout = .STD140

View File

@@ -1,13 +1,14 @@
@module ve_blit_atlas
// module naming rules are currently dumb with shdc rn...
// @module ve_blit_atlas
@header package ve_sokol
@header import sg "thirdparty:sokol/gfx"
@vs ve_blit_atlas_vs
@vs blit_atlas_vs
@include ./source_shared.shdc.glsl
@end
@fs ve_blit_atlas_fs
@fs blit_atlas_fs
in vec2 uv;
out vec4 frag_color;
@@ -54,4 +55,4 @@ void main()
}
@end
@program ve_blit_atlas ve_blit_atlas_vs ve_blit_atlas_fs
@program ve_blit_atlas blit_atlas_vs blit_atlas_fs

View File

@@ -6,7 +6,7 @@ import sg "thirdparty:sokol/gfx"
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
Cmdline:
sokol-shdc --input C:\projects\VEFontCache-Odin\backend\sokol\draw_text.shdc.glsl --output C:\projects\VEFontCache-Odin\backend\sokol\draw_text.odin --slang glsl410:glsl300es:hlsl4:metal_macos:wgsl --format=sokol_odin --module =draw_text
sokol-shdc --input C:\projects\VEFontCache-Odin\backend\sokol\draw_text.shdc.glsl --output C:\projects\VEFontCache-Odin\backend\sokol\draw_text.odin --slang glsl410:glsl300es:hlsl4:metal_macos:wgsl --format=sokol_odin
Overview:
=========

View File

@@ -1,4 +1,5 @@
@module ve_draw_text
// module naming rules are currently dumb with shdc rn...
// @module ve_draw_text
@header package ve_sokol
@header import sg "thirdparty:sokol/gfx"

View File

@@ -6,21 +6,21 @@ import sg "thirdparty:sokol/gfx"
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
Cmdline:
sokol-shdc --input C:\projects\VEFontCache-Odin\backend\sokol\render_glyph.shdc.glsl --output C:\projects\VEFontCache-Odin\backend\sokol\render_glyph.odin --slang glsl410:glsl300es:hlsl4:metal_macos:wgsl --format=sokol_odin --module =render_glyph
sokol-shdc --input C:\projects\VEFontCache-Odin\backend\sokol\render_glyph.shdc.glsl --output C:\projects\VEFontCache-Odin\backend\sokol\render_glyph.odin --slang glsl410:glsl300es:hlsl4:metal_macos:wgsl --format=sokol_odin
Overview:
=========
Shader program: 'render_glyph':
Get shader desc: render_glyph_shader_desc(sg.query_backend())
Shader program: 've_render_glyph':
Get shader desc: ve_render_glyph_shader_desc(sg.query_backend())
Vertex Shader: render_glyph_vs
Fragment Shader: render_glyph_fs
Attributes:
ATTR_render_glyph_v_position => 0
ATTR_render_glyph_v_texture => 1
ATTR_ve_render_glyph_v_position => 0
ATTR_ve_render_glyph_v_texture => 1
Bindings:
*/
ATTR_render_glyph_v_position :: 0
ATTR_render_glyph_v_texture :: 1
ATTR_ve_render_glyph_v_position :: 0
ATTR_ve_render_glyph_v_texture :: 1
/*
#version 410
@@ -509,9 +509,9 @@ render_glyph_fs_source_wgsl := [361]u8 {
0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
}
render_glyph_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
ve_render_glyph_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc {
desc: sg.Shader_Desc
desc.label = "render_glyph_shader"
desc.label = "ve_render_glyph_shader"
#partial switch backend {
case .GLCORE:
desc.vertex_func.source = transmute(cstring)&render_glyph_vs_source_glsl410

View File

@@ -1,4 +1,5 @@
@module render_glyph
// module naming rules are currently dumb with shdc rn...
// @module render_glyph
@header package ve_sokol
@header import sg "thirdparty:sokol/gfx"
@@ -17,4 +18,4 @@ void main()
}
@end
@program render_glyph render_glyph_vs render_glyph_fs
@program ve_render_glyph render_glyph_vs render_glyph_fs

View File

@@ -24,7 +24,7 @@ $flag_format_odin = '--format=sokol_odin'
$flag_module = '--module'
push-location $path_backend_sokol
& $sokol_shdc --input $shadersrc_blit_atlas --output $shaderout_blit_atlas --slang 'glsl410:glsl300es:hlsl4:metal_macos:wgsl' $flag_format_odin $flag_module='blit_atlas'
& $sokol_shdc --input $shadersrc_render_glyph --output $shaderout_render_glyph --slang 'glsl410:glsl300es:hlsl4:metal_macos:wgsl' $flag_format_odin $flag_module='render_glyph'
& $sokol_shdc --input $shadersrc_draw_text --output $shaderout_draw_text --slang 'glsl410:glsl300es:hlsl4:metal_macos:wgsl' $flag_format_odin $flag_module='draw_text'
& $sokol_shdc --input $shadersrc_blit_atlas --output $shaderout_blit_atlas --slang 'glsl410:glsl300es:hlsl4:metal_macos:wgsl' $flag_format_odin
& $sokol_shdc --input $shadersrc_render_glyph --output $shaderout_render_glyph --slang 'glsl410:glsl300es:hlsl4:metal_macos:wgsl' $flag_format_odin
& $sokol_shdc --input $shadersrc_draw_text --output $shaderout_draw_text --slang 'glsl410:glsl300es:hlsl4:metal_macos:wgsl' $flag_format_odin
pop-location

View File

@@ -27,10 +27,8 @@ Parser_Kind :: enum u32 {
Parser_Font_Info :: struct {
label : string,
kind : Parser_Kind,
using _ : struct #raw_union {
stbtt_info : stbtt.fontinfo,
// freetype_info : freetype.Face
},
stbtt_info : stbtt.fontinfo,
// freetype_info : freetype.Face
data : []byte,
}