Fixed blur effects at screen edge #29
+20
-11
@@ -765,11 +765,14 @@ compute_backdrop_group_work_region :: proc(
|
|||||||
max_x += halo_logical
|
max_x += halo_logical
|
||||||
max_y += halo_logical
|
max_y += halo_logical
|
||||||
|
|
||||||
// Convert to physical pixels and clamp to swapchain bounds.
|
// Clamp the min corner to 0, but let the max corner's 6σ halo extend past the swapchain edge
|
||||||
phys_min_x := math.max(min_x * dpi, 0)
|
// into the working texture's unused area (at factor > 1), capped to the texture extent. Keeps
|
||||||
phys_min_y := math.max(min_y * dpi, 0)
|
// the composite's bilinear upsample off the unwritten texels just past a clamped edge.
|
||||||
phys_max_x := math.min(max_x * dpi, f32(swapchain_width))
|
downsample_factor := compute_backdrop_downsample_factor(sigma_logical)
|
||||||
phys_max_y := math.min(max_y * dpi, f32(swapchain_height))
|
phys_min_x := max(min_x * dpi, 0)
|
||||||
|
phys_min_y := max(min_y * dpi, 0)
|
||||||
|
phys_max_x := min(max_x * dpi, f32(swapchain_width * downsample_factor))
|
||||||
|
phys_max_y := min(max_y * dpi, f32(swapchain_height * downsample_factor))
|
||||||
|
|
||||||
if phys_max_x <= phys_min_x || phys_max_y <= phys_min_y do return 0, 0, 0, 0
|
if phys_max_x <= phys_min_x || phys_max_y <= phys_min_y do return 0, 0, 0, 0
|
||||||
|
|
||||||
@@ -868,12 +871,18 @@ run_backdrop_bracket :: proc(
|
|||||||
working_w := (region_w + downsample_factor - 1) / downsample_factor
|
working_w := (region_w + downsample_factor - 1) / downsample_factor
|
||||||
working_h := (region_h + downsample_factor - 1) / downsample_factor
|
working_h := (region_h + downsample_factor - 1) / downsample_factor
|
||||||
|
|
||||||
// Working textures are sized at min factor (2). At factor=4 we have only half the texture
|
// Clamp to the full texture extent (not cached/factor): the working textures are full
|
||||||
// area available in each axis. Clamp to the texture extent for either case.
|
// swapchain res, so a factor-N group's halo can spill into the unused remainder. Writing it
|
||||||
wt_w := pipeline.cached_width / downsample_factor
|
// keeps the composite's bilinear upsample off unwritten texels at the right/bottom edge.
|
||||||
wt_h := pipeline.cached_height / downsample_factor
|
texture_width := pipeline.cached_width
|
||||||
if working_x + working_w > wt_w do working_w = wt_w - working_x
|
texture_height := pipeline.cached_height
|
||||||
if working_y + working_h > wt_h do working_h = wt_h - working_y
|
// Skip fully off-screen groups; also guards the unsigned clamps below from underflow.
|
||||||
|
if working_x >= texture_width || working_y >= texture_height {
|
||||||
|
i = group_end
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if working_x + working_w > texture_width do working_w = texture_width - working_x
|
||||||
|
if working_y + working_h > texture_height do working_h = texture_height - working_y
|
||||||
if working_w == 0 || working_h == 0 {
|
if working_w == 0 || working_h == 0 {
|
||||||
i = group_end
|
i = group_end
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user