diff options
| author | Yash Dubey <yash.dubey803at@gmail.com> | 2026-11-24 07:35:50 +0530 |
|---|---|---|
| committer | Yash Dubey <yash.dubey803at@gmail.com> | 2026-11-24 07:35:50 +0530 |
| commit | dfd239266fd62e1fbbfcf264e9bb4e5c8e8dc801 (patch) | |
| tree | 0fb3fbb22dda6a8b3af3b30b0fc3bcc1a23480f6 /tools/first_light.py | |
| parent | 9ec34cdff41b19d7671bc260e5f40dc69790d905 (diff) | |
make_game, first_light: a vk_pipeline_check or vk_harness older than its sources is rebuilt or reported, not reused silently
Diffstat (limited to 'tools/first_light.py')
| -rw-r--r-- | tools/first_light.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/first_light.py b/tools/first_light.py index 7ce4c8a7d..75d14d7af 100644 --- a/tools/first_light.py +++ b/tools/first_light.py | |||
| @@ -50,6 +50,8 @@ TOOLS = os.path.dirname(os.path.abspath(__file__)) | |||
| 50 | ROOT = os.path.dirname(TOOLS) | 50 | ROOT = os.path.dirname(TOOLS) |
| 51 | sys.path.insert(0, os.path.join(ROOT, "runtime", "test", "shaders")) | 51 | sys.path.insert(0, os.path.join(ROOT, "runtime", "test", "shaders")) |
| 52 | from compute_fixture import find_test_program # noqa: E402 | 52 | from compute_fixture import find_test_program # noqa: E402 |
| 53 | sys.path.insert(0, TOOLS) # python -I leaves the script's own folder off sys.path | ||
| 54 | from stale_build import newer_sources # noqa: E402 | ||
| 53 | 55 | ||
| 54 | DEFAULT_VS = "VS_main_170e32e6_Wrapped" | 56 | DEFAULT_VS = "VS_main_170e32e6_Wrapped" |
| 55 | DEFAULT_PS = "$PS_Rage_Untextured_14f8529b_Wrapped" | 57 | DEFAULT_PS = "$PS_Rage_Untextured_14f8529b_Wrapped" |
| @@ -584,6 +586,24 @@ def uv_probes(vertices, indices, width: int, height: int, limit: int = 4) -> lis | |||
| 584 | return found | 586 | return found |
| 585 | 587 | ||
| 586 | 588 | ||
| 589 | def warn_if_stale(harness: str) -> str: | ||
| 590 | """`harness`, after a warning when it is a build in this checkout's runtime/build older than vk_harness's sources | ||
| 591 | (a pull since it was built): it would draw with the old harness and say nothing. A harness outside runtime/build | ||
| 592 | (--harness or LEONIDA_VK_HARNESS naming another folder) isn't compared.""" | ||
| 593 | build = os.path.abspath(os.path.join(ROOT, "runtime", "build")) | ||
| 594 | try: | ||
| 595 | ours = os.path.commonpath([build, os.path.abspath(harness)]) == build | ||
| 596 | except ValueError: # another drive | ||
| 597 | ours = False | ||
| 598 | newer = newer_sources(harness, ROOT, "vk_harness") if ours else [] | ||
| 599 | if newer: | ||
| 600 | more = f" and {len(newer) - 3} more" if len(newer) > 3 else "" | ||
| 601 | print(f"WARNING: {harness} is older than {', '.join(newer[:3])}{more}; rebuild it " | ||
| 602 | f"(cmake --build <build folder> --target vk_harness) to draw with this checkout's harness", | ||
| 603 | file=sys.stderr) | ||
| 604 | return harness | ||
| 605 | |||
| 606 | |||
| 587 | def find_harness(explicit: str | None) -> str: | 607 | def find_harness(explicit: str | None) -> str: |
| 588 | executable = "vk_harness.exe" if os.name == "nt" else "vk_harness" | 608 | executable = "vk_harness.exe" if os.name == "nt" else "vk_harness" |
| 589 | build = os.path.join(ROOT, "runtime", "build") | 609 | build = os.path.join(ROOT, "runtime", "build") |
| @@ -594,11 +614,11 @@ def find_harness(explicit: str | None) -> str: | |||
| 594 | *(os.path.join(folder, executable) for folder in build_dirs), | 614 | *(os.path.join(folder, executable) for folder in build_dirs), |
| 595 | ): | 615 | ): |
| 596 | if candidate and os.path.isfile(candidate): | 616 | if candidate and os.path.isfile(candidate): |
| 597 | return candidate | 617 | return warn_if_stale(candidate) |
| 598 | for folder in build_dirs: | 618 | for folder in build_dirs: |
| 599 | configured = find_test_program(folder, "vk_harness") | 619 | configured = find_test_program(folder, "vk_harness") |
| 600 | if configured: | 620 | if configured: |
| 601 | return os.path.join(configured, executable) | 621 | return warn_if_stale(os.path.join(configured, executable)) |
| 602 | raise SystemExit( | 622 | raise SystemExit( |
| 603 | "vk_harness not found: build runtime/build/linux or runtime/build/windows (target vk_harness), " | 623 | "vk_harness not found: build runtime/build/linux or runtime/build/windows (target vk_harness), " |
| 604 | "or set --harness/LEONIDA_VK_HARNESS" | 624 | "or set --harness/LEONIDA_VK_HARNESS" |