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
+6 -6
View File
@@ -40,9 +40,9 @@ const uint MAX_KERNEL_PAIRS = 32;
// --- Inputs from vertex shader ---
layout(location = 0) in vec2 p_local;
layout(location = 1) in mediump vec4 f_color;
layout(location = 2) flat in vec2 f_half_size;
layout(location = 3) flat in vec4 f_radii;
layout(location = 4) flat in float f_half_feather;
layout(location = 2) flat in vec2 f_half_size_ppx;
layout(location = 3) flat in vec4 f_radii_ppx;
layout(location = 4) flat in float f_half_feather_ppx;
// --- Output ---
layout(location = 0) out vec4 out_color;
@@ -123,15 +123,15 @@ void main() {
// ---- Mode 1: composite per-primitive.
// RRect SDF — early discard for fragments well outside the masked region.
float d = sdRoundedBox(p_local, f_half_size, f_radii);
if (d > f_half_feather) {
float d = sdRoundedBox(p_local, f_half_size_ppx, f_radii_ppx);
if (d > f_half_feather_ppx) {
discard;
}
// fwidth-based normalization for AA (matches main pipeline approach).
float grad_magnitude = max(fwidth(d), 1e-6);
float d_n = d / grad_magnitude;
float h_n = f_half_feather / grad_magnitude;
float h_n = f_half_feather_ppx / grad_magnitude;
// Sample the fully-blurred working-res texture. gl_FragCoord is full-res; convert to
// working-res UV via inv_downsample_factor. No kernel is applied — the H+V blur passes