DPI scaling fixes

This commit is contained in:
Zachary Levy
2026-05-05 14:45:34 -07:00
parent e8ffa28de3
commit 4e15f831de
19 changed files with 509 additions and 368 deletions
+18 -18
View File
@@ -55,18 +55,18 @@ struct Uniforms
struct Gaussian_Blur_Primitive
{
float4 bounds;
float4 radii;
float2 half_size;
float half_feather;
float4 radii_ppx;
float2 half_size_ppx;
float half_feather_ppx;
uint color;
};
struct Gaussian_Blur_Primitive_1
{
float4 bounds;
float4 radii;
float2 half_size;
float half_feather;
float4 radii_ppx;
float2 half_size_ppx;
float half_feather_ppx;
uint color;
};
@@ -81,9 +81,9 @@ struct main0_out
{
float2 p_local [[user(locn0)]];
float4 f_color [[user(locn1)]];
float2 f_half_size [[user(locn2)]];
float4 f_radii [[user(locn3)]];
float f_half_feather [[user(locn4)]];
float2 f_half_size_ppx [[user(locn2)]];
float4 f_radii_ppx [[user(locn3)]];
float f_half_feather_ppx [[user(locn4)]];
float4 gl_Position [[position]];
};
@@ -96,26 +96,26 @@ vertex main0_out main0(constant Uniforms& _13 [[buffer(0)]], const device Gaussi
out.gl_Position = float4(ndc, 0.0, 1.0);
out.p_local = float2(0.0);
out.f_color = float4(0.0);
out.f_half_size = float2(0.0);
out.f_radii = float4(0.0);
out.f_half_feather = 0.0;
out.f_half_size_ppx = float2(0.0);
out.f_radii_ppx = float4(0.0);
out.f_half_feather_ppx = 0.0;
}
else
{
Gaussian_Blur_Primitive p;
p.bounds = _69.primitives[int(gl_InstanceIndex)].bounds;
p.radii = _69.primitives[int(gl_InstanceIndex)].radii;
p.half_size = _69.primitives[int(gl_InstanceIndex)].half_size;
p.half_feather = _69.primitives[int(gl_InstanceIndex)].half_feather;
p.radii_ppx = _69.primitives[int(gl_InstanceIndex)].radii_ppx;
p.half_size_ppx = _69.primitives[int(gl_InstanceIndex)].half_size_ppx;
p.half_feather_ppx = _69.primitives[int(gl_InstanceIndex)].half_feather_ppx;
p.color = _69.primitives[int(gl_InstanceIndex)].color;
float2 corner = _97[int(gl_VertexIndex)];
float2 world_pos = mix(p.bounds.xy, p.bounds.zw, corner);
float2 center = (p.bounds.xy + p.bounds.zw) * 0.5;
out.p_local = (world_pos - center) * _13.dpi_scale;
out.f_color = unpack_unorm4x8_to_float(p.color);
out.f_half_size = p.half_size;
out.f_radii = p.radii;
out.f_half_feather = p.half_feather;
out.f_half_size_ppx = p.half_size_ppx;
out.f_radii_ppx = p.radii_ppx;
out.f_half_feather_ppx = p.half_feather_ppx;
out.gl_Position = _13.projection * float4(world_pos * _13.dpi_scale, 0.0, 1.0);
}
return out;