mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-20 00:29:57 -04:00
Triforce v0.2.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
33
tests/test_vram_pressure.py
Normal file
33
tests/test_vram_pressure.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""Compile and run the write-back shadows' rules near the VRAM limit (gpu/vk/vram_pressure.h; no game/GPU required), and check
|
||||
that vk_memory.cpp still judges the shadows by what is really allocated, with the switch back to the driver's count alone."""
|
||||
import argparse
|
||||
import subprocess
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def check_source():
|
||||
src = (ROOT / "gpu/vk/vk_memory.cpp").read_text(encoding="utf-8")
|
||||
for needle in ('#include "vram_pressure.h"', 'getenv("RX_VK_SHADOW_RAW")',
|
||||
"vram_pressure::shadow_fits(n, used, allowed, block_free)",
|
||||
"vram_pressure::shadows_go(used, allowed, block_free)"):
|
||||
if needle not in src:
|
||||
raise SystemExit("vk_memory.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="vram-pressure-") as tmp:
|
||||
exe = Path(tmp) / "vram-pressure"
|
||||
subprocess.run([args.cxx, "-std=c++20", "-Wall", "-Wextra", "-Werror",
|
||||
str(ROOT / "tests/test_vram_pressure.cpp"), "-o", str(exe)], check=True)
|
||||
subprocess.run([str(exe)], check=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user