Skip to content

make_game: rebuild bvh_shaders cache when cached index has 0 translated programs - #8142

Closed
Faterek wants to merge 1 commit into
ProjectLeonida:mainfrom
Faterek:fix-bvh-empty-cache
Closed

Faterek wants to merge 1 commit into
ProjectLeonida:mainfrom
Faterek:fix-bvh-empty-cache

Conversation

@Faterek

@Faterek Faterek commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Claim: #8047 (comment)
Depends on: none

Summary

bvh_shaders() (make_game.py:1498) reused a cached <work>/shaders/spirv/bvh/index.json whenever bvh_programs() returned a truthy tuple — including when 0 programs had usable entries (empty {}, all-error entries with no fssm_sha256, or an empty extraction index []). That returned early and reported 0 of N even though the fresh-build check at make_game.py:1522 treats len(programs[1]) == len(programs[0]) as a failure (and fspx_shaders() already refuses to cache {}).

Credit to @shdann for catching the same pattern during review of #7746.

  • make_game.py: require len(programs[1]) < len(programs[0]) before reusing cached BVH outputs, matching the fresh-build check.
  • tests/test_bvh_shaders_stage.py: add BvhStage.test_empty_cached_index_is_rebuilt covering empty {}, all-error index.json, and empty extraction index.json ([]) rebuilding on the first retry and reusing on the second.

Testing

  • python3 -m compileall -q make_game.py tools tests — pass
  • python3 -I make_game.py --help — pass
  • python3 -I tests/test_bvh_shaders_stage.py -v — 14/14 OK (verified new test fails on parent dde82f27e where retry 0 runs [] and logs 0 of 3)
  • python3 -I tests/test_fspx_shaders_stage.py — 22/22 OK
  • python3 -I scripts/check_no_game_data.py make_game.py tests/test_bvh_shaders_stage.py — pass
  • No game files or GPU used (Python 3.14 on Linux 7.3.4).

AI-assisted.

@Zhenyettta

Copy link
Copy Markdown

Windows verification of 374a8a3b9 with CPython 3.15.2 and synthetic fixtures: python -I tests/test_bvh_shaders_stage.py passed 14/14, including rebuilding an unusable cache on the first retry and reusing the repaired cache on the second. The neighboring python -I tests/test_fspx_shaders_stage.py suite passed 22/22. CPU only, GPU/driver N/A. AI-assisted.

@garuspl

garuspl commented Nov 23, 2026

Copy link
Copy Markdown

Tested 374a8a3 on Windows 11 (CPU only, no GPU needed): pass

Windows 11 Pro, Python 3.14.7, no GPU or game files involved; pytest/numpy/Pillow pinned from tests/requirements.txt in a fresh venv. Method: PR head merged onto main d9aa42a, the PR's test files run with python -m pytest before and after the merge, plus python -m compileall -q on the changed files (clean).

  • tests/test_bvh_shaders_stage.py: main 13 passed; with the PR 14 passed.

AI-assisted (Claude Code, Claude Opus 5.5).

@Atomic258

Copy link
Copy Markdown
Contributor

Tested 374a8a3b on Windows Server 2022, CPython 3.13.12: pass

  • python -I tests/test_bvh_shaders_stage.py -> OK

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

@rideinstead

Copy link
Copy Markdown

✅ Automated security review: CLEAN (commit 374a8a3b)

  • No findings.

Scope: static analysis of added diff lines only; no code was executed. Please review findings manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants