mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-21 12:29:43 -10:00
With Integer Scale Axis set to Y + X (or any of the modes that touch X),
the horizontal multiplier was applied to the aspect-corrected width
rather than the frame's own width. A 256x224 Snes9x frame with its core
aspect of 64:49 is 293 wide after correction, so at 1080p the scaler
picked 293 x 4 = 1172 wide over 224 x 4 = 896 high: a 4.58x horizontal
scale, pixel columns alternating 4 and 5 wide, and the fraction the
statistics overlay shows as Scale X/Y. It now picks 1280x896, 5x/4x.
The "reset width to exact width" step used to read the frame cache
fields directly. When those became a local snapshot (69efa8a894) the
reset started reading content_width/content_height, which by that point
hold the aspect-corrected width and the rotated height. The frame's
size is now kept in its own pair and the reset reads that; rotated
content takes the frame height as its width, as it did before.
Driver-agnostic: the scaler is in video_driver.c, so d3d11, Vulkan and
the rest all showed it.
Regression test: samples/gfx/integer_scale_axis runs the scaler out of
video_driver.c (extracted by awk, as asio_clock does) over a sweep of
viewports, frame sizes, axis and scaling modes, rotated and hi-res
content, and checks each drawn size is a whole multiple of the frame
size; the first check is the reported 1080p 256x224 case. On the old
code it fails 386 of 778 checks, reporting 1172x896 for the report
case; on the new code all 783 pass. Wired into CI Linux samples/gfx
under ASan + UBSan.
Reported-by: sonninnos
18 lines
672 B
Awk
18 lines
672 B
Awk
# Pulls the viewport parameter snapshot and the integer scaler out of
|
|
# gfx/video_driver.c, so integer_scale_axis_test.c runs the driver's
|
|
# own code rather than a copy of it.
|
|
{ sub(/\r$/, "") }
|
|
/^struct video_vp_param_snap$/ { sn = 1 }
|
|
sn { snap = snap $0 "\n"; if ($0 ~ /^};/) sn = 0; next }
|
|
/^static void video_viewport_get_scaled_integer\($/ { fn = 1 }
|
|
fn { body = body $0 "\n"; if ($0 ~ /^}/) fn = 0; next }
|
|
END {
|
|
if (snap == "" || body == "")
|
|
{
|
|
print "extract_integer.awk: an anchor in video_driver.c has moved" > "/dev/stderr"
|
|
exit 1
|
|
}
|
|
print "/* Generated from gfx/video_driver.c by extract_integer.awk. */"
|
|
printf "%s\n%s", snap, body
|
|
}
|