Files
PS5_RetroArch/tests/test_core_frame.py
T
Mihawk 3aad94459d Withdraw the red/blue compensations and relink against the migrated driver
Build the frontend against ../PS5_Vulkan 8b311e3 and remove the changes that
existed only because that driver could not sample the frontend's own byte order.

Driver review (8b311e3, "Migrate the driver to ps5-opengl 0.3.0's compiler fork,
and close the console SIGFPE at its owner"): driver/ps5vk_image.c is not touched,
VK_FORMAT_B8G8R8A8_UNORM still carries SAMPLED_IMAGE_BIT with the 8_8_8_8_UNORM
word and the ZYXW selectors, and the format audit's counts are unchanged (179
required, 58 reported, 0 missing, 55 conditional, split 0/0/0/0/0), so the fetch
order this port depends on survived the migration. What did change there is the
compiler tree (ps5-opengl 0.3.0's opengnm-psbc, metadata v14), the compute
dispatch words, a null shader module in ps5vk_compile_stage that faulted every
meta clear/blit/resolve, and a driver-owned 32 MiB compile stack. The console
SIGFPE of round 15 was the probe's own unfilled std::array row, not ACO:
symbolization had missed the PIE load base.

Withdrawn: 0014's format substitution (its usage mask stays), 0075's core-frame
RGBA upload and 0077's menu colour and cached-frame ownership.
tools/apply-port-patches.py grew an 0083 group and a WITHDRAWN tuple that
exchanges each named insertion for the upstream text it replaced, so a tree that
already carries the insertion and a fresh one converge - checked by patching a
copy of vendor/retroarch's gfx/drivers/vulkan.c and the withdrawn build/ra-conf
and comparing (identical). src/core_frame_ps5.cpp no longer converts channels,
four tests assert the core's own bytes instead of the conversion's output, two new
tests pin the mechanism, and the patch-count pin moved 179 -> 185. Kept: 0027/0055
(the 16-bit RGUI frame, still converted by hand into R8G8B8A8 because a B4G4R4A4
view with a B/R swizzle is refused), 0015 (upstream's own VK_REMAP_TO_TEXFMT) and
0081 (upstream's TODO: supports_rgba follows the order a caller asked for).

Command and result:
  PS5_VULKAN_DIR=$PWD/build/frozen-driver \
  PS5_VULKAN_ICD=$PWD/build/frozen-driver/build/driver/ps5/libvulkan.so.1 \
  bash tools/verify.sh
  -> format PASS (1s), unit PASS (12s, 75 tests), build PASS (247s),
     integration PASS (10s), evidence PASS (0s),
     verify: PASS (format unit build integration evidence)

Artifact: dist/PPSA99169/eboot.bin, 34,703,515 bytes, sha256 82534b86..., title
identity f9e4ea6c..., two consecutive runs byte-identical. The four driver
archives were frozen into build/frozen-driver/ before the build and re-hashed
unchanged after it, and the identity was recomputed from tools/build-title.sh's
own input list against those hashes and matched, so the eboot names the driver it
carries. Record: evidence/driver-1.0-native-byte-order/.

Four runs preceded the green one: unit (three new markers did not appear in their
own replacements and the count pin was stale), build (the frozen tree's .deps/work
symlink was one level short), a run interrupted when 8b311e3 landed, and evidence
(the new step directory had no capture/expectation yet). Logs:
build/verify-native-byte-order-first-run.log, -second-run.log,
-third-run-killed.log, -gates-4-of-5.log.

Not verified on the console: the colours of this build are the owner's check, and
the withdrawn path is the one that was accepted before. The command is recorded in
docs/ACTIVE.md.
2026-09-20 20:39:18 -04:00

40 lines
2.0 KiB
Python

"""Verify the padded source quad's UVs across width and transition changes."""
import ctypes
from pathlib import Path
import subprocess
import tempfile
import unittest
ROOT = Path(__file__).resolve().parent.parent
class CoreFrame(unittest.TestCase):
def test_padded_source_sampling_across_core_transitions(self):
with tempfile.TemporaryDirectory() as td:
wrapper = Path(td) / 'quad.cpp'
wrapper.write_text('#include "' + str(ROOT / 'src/core_frame_ps5.cpp') + '"\n'
'extern "C" void quad(float *v, unsigned w, unsigned p) '
'{ ps5_core_source_quad(v, w, p); }\n')
lib = Path(td) / 'quad.so'
subprocess.run(['c++', '-shared', '-fPIC', '-Wall', '-Wextra', '-Werror',
str(wrapper), '-o', str(lib)], check=True)
quad = ctypes.CDLL(str(lib)).quad
quad.argtypes = [ctypes.POINTER(ctypes.c_float), ctypes.c_uint, ctypes.c_uint]
# FCEUmm -> no content -> GBA -> GB -> no content -> FCEUmm.
for width, physical in [(256, 256), (4, 128), (240, 256),
(160, 192), (4, 128), (256, 256)]:
vertices = (ctypes.c_float * 48)()
quad(vertices, width, physical)
for base in (0, 24):
uv = [(vertices[i + 2], vertices[i + 3])
for i in range(base, base + 24, 4)]
right = ctypes.c_float(width / physical).value
self.assertEqual(uv, [(0, 0), (0, 1), (right, 0),
(right, 0), (0, 1), (right, 1)])
# At every output pixel centre, nearest sampling stays in
# initialized content, never the poisoned row padding.
samples = [int(((x + 0.5) / 1920) * right * physical)
for x in range(1920)]
self.assertEqual(min(samples), 0)
self.assertEqual(max(samples), width - 1)