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 /make_game.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 'make_game.py')
| -rw-r--r-- | make_game.py | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/make_game.py b/make_game.py index ff5ff7676..6ec27e33d 100644 --- a/make_game.py +++ b/make_game.py | |||
| @@ -73,6 +73,7 @@ from mc_command import mc_command # noqa: E402 | |||
| 73 | import leonida_tui # noqa: E402 | 73 | import leonida_tui # noqa: E402 |
| 74 | from shader_stage_manifest import shader_stems # noqa: E402 | 74 | from shader_stage_manifest import shader_stems # noqa: E402 |
| 75 | from replace_retry import replace as replace_retry # noqa: E402 | 75 | from replace_retry import replace as replace_retry # noqa: E402 |
| 76 | from stale_build import newer_sources # noqa: E402 | ||
| 76 | 77 | ||
| 77 | VERSIONS = os.path.join(ROOT, "game") | 78 | VERSIONS = os.path.join(ROOT, "game") |
| 78 | STAGES = ["check", "shaders", "assets", "runtime", "pipelines"] | 79 | STAGES = ["check", "shaders", "assets", "runtime", "pipelines"] |
| @@ -900,12 +901,16 @@ def preflight(stages: list, work: str, wav: bool = False, runtime_build: str | N | |||
| 900 | "Free some space or choose another drive with --work." + hint) | 901 | "Free some space or choose another drive with --work." + hint) |
| 901 | if os.name != "nt" and not runtime_build and any(s in WINDOWS_ONLY for s in stages): | 902 | if os.name != "nt" and not runtime_build and any(s in WINDOWS_ONLY for s in stages): |
| 902 | cross_configure() | 903 | cross_configure() |
| 903 | if "pipelines" in stages and os.name != "nt" and not pipeline_check_exe(): | 904 | if "pipelines" in stages and os.name != "nt": |
| 904 | build_pipeline_check(jobs) | 905 | checker = pipeline_check_exe() |
| 905 | if not pipeline_check_exe(): | 906 | # A checker built before a pull is rebuilt too; cmake --build only recompiles what changed. Without CMake |
| 906 | fail("vk_pipeline_check built, but not as runtime/build/linux/vk_pipeline_check (a multi-config " | 907 | # the pipelines stage says it is out of date and uses it. |
| 907 | "generator puts it in a subfolder): unset CMAKE_GENERATOR if it names one, delete " | 908 | if not checker or (stale_checker(checker) and shutil.which("cmake")): |
| 908 | "runtime/build/linux and run the build again.") | 909 | build_pipeline_check(jobs) |
| 910 | if not pipeline_check_exe(): | ||
| 911 | fail("vk_pipeline_check built, but not as runtime/build/linux/vk_pipeline_check (a multi-config " | ||
| 912 | "generator puts it in a subfolder): unset CMAKE_GENERATOR if it names one, delete " | ||
| 913 | "runtime/build/linux and run the build again.") | ||
| 909 | if "assets" in stages: | 914 | if "assets" in stages: |
| 910 | ensure_submodule() | 915 | ensure_submodule() |
| 911 | 916 | ||
| @@ -2369,6 +2374,18 @@ def pipeline_check_exe(runtime_build: str | None = None) -> str | None: | |||
| 2369 | return next((p for p in found if os.path.isfile(p) and (windows or os.access(p, os.X_OK))), None) | 2374 | return next((p for p in found if os.path.isfile(p) and (windows or os.access(p, os.X_OK))), None) |
| 2370 | 2375 | ||
| 2371 | 2376 | ||
| 2377 | def stale_checker(exe: str) -> list: | ||
| 2378 | """The sources of vk_pipeline_check changed after `exe` was built, when `exe` is in this checkout's runtime/build. | ||
| 2379 | A checker from elsewhere (--runtime-build) isn't compared: its time stamp says nothing about these sources.""" | ||
| 2380 | build = os.path.abspath(os.path.join(ROOT, "runtime", "build")) | ||
| 2381 | try: | ||
| 2382 | if os.path.commonpath([build, os.path.abspath(exe)]) != build: | ||
| 2383 | return [] | ||
| 2384 | except ValueError: # another drive | ||
| 2385 | return [] | ||
| 2386 | return newer_sources(exe, ROOT, "vk_pipeline_check") | ||
| 2387 | |||
| 2388 | |||
| 2372 | def require_translated_shaders(work: str) -> str: | 2389 | def require_translated_shaders(work: str) -> str: |
| 2373 | spirv = os.path.join(work, "shaders", "spirv") | 2390 | spirv = os.path.join(work, "shaders", "spirv") |
| 2374 | index = os.path.join(spirv, "index.json") | 2391 | index = os.path.join(spirv, "index.json") |
| @@ -2394,6 +2411,13 @@ def pipelines(work: str, out: str, jobs: "int | None" = None, *, runtime_build: | |||
| 2394 | fail("vk_pipeline_check wasn't built. With CMake 3.24+, a C++20 compiler and the Vulkan headers and " | 2411 | fail("vk_pipeline_check wasn't built. With CMake 3.24+, a C++20 compiler and the Vulkan headers and " |
| 2395 | "loader installed, run: cmake -S runtime -B runtime/build/linux && " | 2412 | "loader installed, run: cmake -S runtime -B runtime/build/linux && " |
| 2396 | "cmake --build runtime/build/linux --parallel") | 2413 | "cmake --build runtime/build/linux --parallel") |
| 2414 | newer = stale_checker(exe) | ||
| 2415 | if newer: | ||
| 2416 | rebuild = ("run the runtime stage with VULKAN_SDK set" if os.name == "nt" else | ||
| 2417 | "cmake --build runtime/build/linux --target vk_pipeline_check") | ||
| 2418 | more = f" and {len(newer) - 3} more" if len(newer) > 3 else "" | ||
| 2419 | log(f"pipelines: WARNING: {exe} is older than {', '.join(newer[:3])}{more}, so it is not this checkout's " | ||
| 2420 | f"checker; to rebuild it, {rebuild}") | ||
| 2397 | spirv = require_translated_shaders(work) | 2421 | spirv = require_translated_shaders(work) |
| 2398 | log("pipelines: creating every shader module and pipeline (compute and graphics) on this GPU") | 2422 | log("pipelines: creating every shader module and pipeline (compute and graphics) on this GPU") |
| 2399 | os.makedirs(out, exist_ok=True) | 2423 | os.makedirs(out, exist_ok=True) |