diff --git a/src/gfx.c b/src/gfx.c index 47bc8bb..3eccdaf 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -83,8 +83,8 @@ void gfx_init(const gfx_desc_t* desc) { sg_pipeline_desc pip_desc_alpha = { .layout = { .attrs = { - [ATTR_vs_pos] = { .format = SG_VERTEXFORMAT_USHORT2N }, - [ATTR_vs_uv] = { .format = SG_VERTEXFORMAT_USHORT2N } + [0] = { .format = SG_VERTEXFORMAT_USHORT2N }, + [1] = { .format = SG_VERTEXFORMAT_USHORT2N } }, }, .shader = sg_make_shader(shd_alpha_shader_desc(sg_query_backend())), @@ -186,12 +186,10 @@ void gfx_draw(void) { if (gfx.layer_visible[i] && (gfx.layers[i].vb.id != SG_INVALID_ID)) { sg_apply_bindings(&(sg_bindings){ .vertex_buffers[0] = gfx.layers[i].vb, - .vs = { - .images[SLOT_palette_tex] = gfx.img, - .samplers[SLOT_palette_smp] = gfx.smp, - } + .images[IMG_palette_tex] = gfx.img, + .samplers[SMP_palette_smp] = gfx.smp, }); - sg_apply_uniforms(SG_SHADERSTAGE_VS, SLOT_vs_params, &SG_RANGE(vs_params)); + sg_apply_uniforms(UB_vs_params, &SG_RANGE(vs_params)); sg_draw(0, gfx.layers[i].num_elms, 1); } } diff --git a/src/gfx.glsl b/src/gfx.glsl index e5615ad..fca0873 100644 --- a/src/gfx.glsl +++ b/src/gfx.glsl @@ -6,7 +6,7 @@ @ctype vec2 float2_t @vs vs -uniform vs_params { +layout(binding=0) uniform vs_params { vec4 color0; vec2 half_size; vec2 offset; @@ -15,10 +15,10 @@ uniform vs_params { const float max_nodes = 8192.0; -uniform texture2D palette_tex; -uniform sampler palette_smp; -in vec2 pos; -in vec2 uv; +layout(binding=0) uniform texture2D palette_tex; +layout(binding=0) uniform sampler palette_smp; +layout(location=0) in vec2 pos; +layout(location=1) in vec2 uv; out vec4 color; void main() {