mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-19 16:20:01 -04:00
Triforce v0.2.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
34
tests/test_keep_rendered.py
Normal file
34
tests/test_keep_rendered.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""Compile and run the rule for how long an unused texture the GPU drew is kept (gpu/vk/keep_rendered.h; no game/GPU)."""
|
||||
import argparse
|
||||
import subprocess
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
RUN_ALL_ARGS = ["--cxx", "g++"]
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def check_source():
|
||||
"""The eviction pass still takes its time from the rule, and the switch back is still read"""
|
||||
src = (ROOT / "gpu/vk/vk_texture.cpp").read_text(encoding="utf-8")
|
||||
for needle in ('#include "keep_rendered.h"', "keep_rendered::presents(known, used, allowed, keep_over_only)",
|
||||
'getenv("RX_VK_KEEP_RENDERED_OVER")', "frame_no - last < keep_rendered"):
|
||||
if needle not in src:
|
||||
raise SystemExit("vk_texture.cpp no longer has: " + needle)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--cxx", default="g++")
|
||||
args = parser.parse_args()
|
||||
check_source()
|
||||
with tempfile.TemporaryDirectory(prefix="keep-rendered-") as tmp:
|
||||
exe = Path(tmp) / "keep-rendered"
|
||||
subprocess.run([args.cxx, "-std=c++20", "-Wall", "-Wextra", "-Werror",
|
||||
str(ROOT / "tests/test_keep_rendered.cpp"), "-o", str(exe)], check=True)
|
||||
subprocess.run([str(exe)], check=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user