DPI scaling fixes
This commit is contained in:
@@ -24,12 +24,12 @@
|
||||
layout(location = 0) out vec2 p_local;
|
||||
// f_color: tint, unpacked from primitive.color. Only meaningful in mode 1.
|
||||
layout(location = 1) out mediump vec4 f_color;
|
||||
// f_half_size: RRect half extents in physical pixels (mode 1 only).
|
||||
layout(location = 2) flat out vec2 f_half_size;
|
||||
// f_radii: per-corner radii in physical pixels (mode 1 only).
|
||||
layout(location = 3) flat out vec4 f_radii;
|
||||
// f_half_feather: SDF anti-aliasing feather (mode 1 only).
|
||||
layout(location = 4) flat out float f_half_feather;
|
||||
// f_half_size_ppx: RRect half extents in physical pixels (mode 1 only).
|
||||
layout(location = 2) flat out vec2 f_half_size_ppx;
|
||||
// f_radii_ppx: per-corner radii in physical pixels (mode 1 only).
|
||||
layout(location = 3) flat out vec4 f_radii_ppx;
|
||||
// f_half_feather_ppx: SDF anti-aliasing feather in physical pixels (mode 1 only).
|
||||
layout(location = 4) flat out float f_half_feather_ppx;
|
||||
|
||||
// --- Uniforms (set 1) ---
|
||||
// Backdrop pipeline's own uniform block — distinct from the main pipeline's
|
||||
@@ -53,10 +53,10 @@ layout(set = 1, binding = 0) uniform Uniforms {
|
||||
// edge effects (e.g. liquid-glass-style refraction outlines) would be a dedicated
|
||||
// primitive type with its own pipeline rather than a flag bit here.
|
||||
struct Gaussian_Blur_Primitive {
|
||||
vec4 bounds; // 0-15: min_xy, max_xy (world-space)
|
||||
vec4 radii; // 16-31: per-corner radii (physical px)
|
||||
vec2 half_size; // 32-39: RRect half extents (physical px)
|
||||
float half_feather; // 40-43: SDF anti-aliasing feather (physical px)
|
||||
vec4 bounds; // 0-15: min_xy, max_xy (world-space, logical px)
|
||||
vec4 radii_ppx; // 16-31: per-corner radii
|
||||
vec2 half_size_ppx; // 32-39: RRect half extents
|
||||
float half_feather_ppx; // 40-43: SDF anti-aliasing feather
|
||||
uint color; // 44-47: tint, packed RGBA u8x4
|
||||
};
|
||||
|
||||
@@ -78,9 +78,9 @@ void main() {
|
||||
// Mode 0 doesn't read the per-primitive varyings; zero-init for safety.
|
||||
p_local = vec2(0.0);
|
||||
f_color = vec4(0.0);
|
||||
f_half_size = vec2(0.0);
|
||||
f_radii = vec4(0.0);
|
||||
f_half_feather = 0.0;
|
||||
f_half_size_ppx = vec2(0.0);
|
||||
f_radii_ppx = vec4(0.0);
|
||||
f_half_feather_ppx = 0.0;
|
||||
} else {
|
||||
// ---- Mode 1: V-composite instanced unit-quad over Gaussian_Blur_Primitive ----
|
||||
Gaussian_Blur_Primitive p = primitives[gl_InstanceIndex];
|
||||
@@ -101,9 +101,9 @@ void main() {
|
||||
p_local = (world_pos - center) * dpi_scale;
|
||||
|
||||
f_color = unpackUnorm4x8(p.color);
|
||||
f_half_size = p.half_size;
|
||||
f_radii = p.radii;
|
||||
f_half_feather = p.half_feather;
|
||||
f_half_size_ppx = p.half_size_ppx;
|
||||
f_radii_ppx = p.radii_ppx;
|
||||
f_half_feather_ppx = p.half_feather_ppx;
|
||||
|
||||
gl_Position = projection * vec4(world_pos * dpi_scale, 0.0, 1.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user