Texture Rendering (#9)

Co-authored-by: Zachary Levy <zachary@sunforge.is>
Reviewed-on: #9
This commit was merged in pull request #9.
This commit is contained in:
2026-04-22 00:05:08 +00:00
parent 64de816647
commit 0d424cbd6e
19 changed files with 1765 additions and 357 deletions

View File

@@ -12,6 +12,7 @@ layout(location = 2) out vec4 f_params;
layout(location = 3) out vec4 f_params2;
layout(location = 4) flat out uint f_kind_flags;
layout(location = 5) flat out float f_rotation;
layout(location = 6) flat out vec4 f_uv_rect;
// ---------- Uniforms (single block — avoids spirv-cross reordering on Metal) ----------
layout(set = 1, binding = 0) uniform Uniforms {
@@ -29,6 +30,7 @@ struct Primitive {
float _pad; // 28-31: alignment padding
vec4 params; // 32-47: shape params part 1
vec4 params2; // 48-63: shape params part 2
vec4 uv_rect; // 64-79: u_min, v_min, u_max, v_max
};
layout(std430, set = 0, binding = 0) readonly buffer Primitives {
@@ -45,6 +47,7 @@ void main() {
f_params2 = vec4(0.0);
f_kind_flags = 0u;
f_rotation = 0.0;
f_uv_rect = vec4(0.0, 0.0, 1.0, 1.0);
gl_Position = projection * vec4(v_position * dpi_scale, 0.0, 1.0);
} else {
@@ -61,6 +64,7 @@ void main() {
f_params2 = p.params2;
f_kind_flags = p.kind_flags;
f_rotation = p.rotation;
f_uv_rect = p.uv_rect;
gl_Position = projection * vec4(world_pos * dpi_scale, 0.0, 1.0);
}