Test: native-wide surface identical with the high-resolution window

gl_scale_invariance_test also mirrors margin-reaching draws (flat, gouraud,
textured, a line across both margins) into a 16:9 native-wide surface and
requires its full dump at internal resolution to match between the
full-VRAM and windowed runs at the same scale. This covers the wide passes'
sample-grid shift in windowed mode and the centre blit from the window;
dropping the shift switch fails it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shokunin
2026-09-26 02:56:06 -07:00
parent 9bb983208e
commit b3fc8ce7a2
2 changed files with 30 additions and 7 deletions
+8 -7
View File
@@ -4,7 +4,8 @@ The fixture runs once per internal scale; the guest-visible (native) VRAM
digest must be identical at every scale, and each run checks line thickness
at internal resolution. Window runs (PSX_GL_HIRES_WINDOW=1) keep VRAM at 1x
and only the frame at S: their native digest must match too, and their frame
at internal resolution must equal the full-VRAM surface's at the same scale.
and native-wide (16:9) surface at internal resolution must equal the
full-VRAM run's at the same scale.
An 18x window run is 8K past a 16384 texture limit. Two clamp runs check that
an over-limit request (32x, and a tiny memory budget) stays on GL.
@@ -38,8 +39,8 @@ def parse_run(stdout):
return int(summary[1]), int(summary[2]), digest[1] if digest else None
def parse_hires(stdout):
m = re.search(r"^hires=([0-9a-f]{16})$", stdout, re.M)
def parse_hires(stdout, key="hires"):
m = re.search(r"^" + key + r"=([0-9a-f]{16})$", stdout, re.M)
return m[1] if m else None
@@ -126,7 +127,7 @@ def main():
if r.returncode or not parsed or parsed[1]:
ok = False
digests[("full", s)] = parsed[2] if parsed else None
hires_full[s] = parse_hires(r.stdout)
hires_full[s] = (parse_hires(r.stdout), parse_hires(r.stdout, "wide"))
env = os.environ.copy()
wenv = dict(env)
wenv["PSX_GL_HIRES_WINDOW"] = "1"
@@ -138,10 +139,10 @@ def main():
if r.returncode or not parsed or parsed[1]:
ok = False
digests[("window", s)] = parsed[2] if parsed else None
h = parse_hires(r.stdout)
h = (parse_hires(r.stdout), parse_hires(r.stdout, "wide"))
if s in hires_full and hires_full[s] != h:
print(f"FAIL window {s}x frame differs from the full-VRAM surface at {s}x:",
h, hires_full[s])
print(f"FAIL window {s}x frame/wide surface differ from the full-VRAM "
f"surface at {s}x:", h, hires_full[s])
ok = False
if not digests_agree(digests):
print("FAIL native VRAM digest differs across scales/modes:", digests)
+22
View File
@@ -199,9 +199,31 @@ int main(int argc, char **argv) {
}
uint64_t hires = n ? fnv(img, (size_t)fw * fh * 4, 0xcbf29ce484222325ull) : 0;
free(img);
/* Native-wide surface (16:9 on the 320 frame: 426 wide, 53 each side) at
* the same scale: margin-reaching draws are mirrored into it and its
* centre comes from the frame (the window in "window" mode). */
glb_wide_configure(426, 53);
glb_wide_set_target(0);
glb_set_draw_area(0, 0, 319, 239);
glb_draw_flat_rect(-40, 20, 90, 30, 0x5ad6); /* into the left margin */
glb_draw_gouraud_triangle(250, 60, 0x001f, 372, 90, 0x7c00, 280, 150, 0x03e0); /* right */
glb_draw_textured_rect(300, 160, 64, 40, 0, 0, 512, 256, 0x0008); /* textured, right */
glb_draw_line(-30, 225, 350, 225, 0x7fff); /* line across both */
glb_set_draw_area(0, 0, 1023, 511);
uint64_t wide = 0;
{
int ww = 426 * scale, wh = 512 * scale, gw = 0, gh = 0;
uint32_t *wb = (uint32_t *)malloc((size_t)ww * wh * 4);
int got = wb ? glb_wide_dump_full(wb, ww * wh, &gw, &gh, 0) : 0;
check(got == ww * wh && gw == ww && gh == wh, "wide surface dump size");
if (got) wide = fnv(wb, (size_t)ww * wh * 4, 0xcbf29ce484222325ull);
free(wb);
}
check(glGetError() == GL_NO_ERROR, "GL error");
printf("digest=%016llx\n", (unsigned long long)digest);
printf("hires=%016llx\n", (unsigned long long)hires);
printf("wide=%016llx\n", (unsigned long long)wide);
printf("checks=%d failures=%d\n", checks, failures);
gl_renderer_shutdown();
SDL_DestroyWindow(win);