Add the rule that pairs a skinned draw with last frame's draw of the same mesh, and its check.

A draw is known by its mesh and program and by its number among the frame's draws with that key, counted in the order of the command stream. It is paired with none when the key is new, was drawn another number of times, has a palette of another size, or has its palette at neither of the two addresses that place last had.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-12 20:03:15 -05:00
parent 0b0920c54a
commit 6e9d9fca5f
3 changed files with 323 additions and 0 deletions

41
tests/skin_pair_check.py Normal file
View File

@@ -0,0 +1,41 @@
"""Build and run tests/skin_pair_check.c: runtime/skin_pair.h, which decides the draw of last frame a skinned
character's draw continues (the same key twice in a frame, a character that appears, one that leaves, two that change
places, a palette that changes size).
No GPU, no game files, any Python.
Usage: skin_pair_check.py
"""
import os
import shutil
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
MSYS_BIN = Path(r'C:\msys64\ucrt64\bin')
def compiler():
"""$CC, else MSYS2 UCRT64's clang, else clang on PATH (as tests/fg_reset_check.py picks it)."""
if os.environ.get('CC'):
return os.environ['CC']
if os.name == 'nt' and (MSYS_BIN / 'clang.exe').exists():
return str(MSYS_BIN / 'clang.exe')
return shutil.which('clang') or 'clang'
def main():
work = ROOT / 'build' / 'test' / 'skin_pair'
work.mkdir(parents=True, exist_ok=True)
exe = work / ('skin_pair_check.exe' if os.name == 'nt' else 'skin_pair_check')
env = dict(os.environ)
if os.name == 'nt' and MSYS_BIN.exists():
env['PATH'] = str(MSYS_BIN) + os.pathsep + env.get('PATH', '')
subprocess.check_call([compiler(), '-std=gnu11', '-O1', '-Wall', '-Werror', '-I', str(ROOT / 'runtime'),
str(ROOT / 'tests' / 'skin_pair_check.c'), '-o', str(exe), '-lm'], env=env)
return subprocess.run([str(exe)], env=env).returncode
if __name__ == '__main__':
sys.exit(main())