Skip to content

mesh_compute_vs: -h/--help prints usage, a missing spirv dir is an error - #1507

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
pratikphophaliya:mesh-compute-vs-args
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
pratikphophaliya:mesh-compute-vs-args

Conversation

@pratikphophaliya

@pratikphophaliya pratikphophaliya commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #1380 (comment)

What and why

python -I tools/mesh_compute_vs.py --help took --help as the spirv dir, found no index.json and exited 0 with no output. A path that doesn't exist did the same, so a typo looked like a successful run with nothing to do. Same bug #1379 fixed in bary_fallback_gs.py; I flagged this one on #1290, which has since merged without it.

Also touches tools/mesh_compute_vs.py: #1407 (shader generation, lines ~12 and ~110-170) and #1428 (stdout reconfigure under __main__). Neither changes main()'s argument handling; git merge-tree against both PR heads is clean.

Tested

  • python -I tests/test_mesh_compute_vs.py: 10 tests OK. The two new tests (test_help_prints_usage, test_a_missing_directory_is_one_error_line) fail 3 times against current main and pass with the fix.
  • python -m pytest -q tests/test_mesh_compute.py: 9 passed, 13 skipped (the skips need llvm-mc).
  • python -m compileall -q make_game.py tools tests: clean.
  • Windows 11, Python 3.14.2, SPIRV-Tools from Vulkan SDK 1.4.363.0. No GPU needed for this change.

AI-assisted (Claude Code).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: no translator rule changed.)

`mesh_compute_vs.py --help` took `--help` as the spirv dir, found no index.json and exited 0 with no output;
a path that does not exist did the same, so a typo looked like a successful run with nothing to do.
-h/--help now print the docstring and exit 0, and a path that is not a directory is one ERROR line and
exit 1, like the tool's other errors. build_for_index / write_for_index are unchanged. Same fix as ItsNotRexed#1379
for bary_fallback_gs.py.

@x2Tweek x2Tweek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified independently at head 57e426f4 (base bb2e1842), Windows 11, Python 3.15 (python -I, isolated mode):

  • python -I tests/test_mesh_compute_vs.py -v → 10/10 OK (0.178s), including the two new tests.
  • python -I -m compileall -q tools/mesh_compute_vs.py tests/test_mesh_compute_vs.py → clean (exit 0).
  • Negative control: detached worktree at base bb2e1842 with the PR's tests/test_mesh_compute_vs.py copied in → exactly 3 failures on the two new tests (test_help_prints_usage for both -h and --help subtests, and test_a_missing_directory_is_one_error_line — build_for_index was called once where it must not be), all other 8 tests still pass.
  • Code review: the -h/--help check runs before the argc check and prints __doc__ to stdout with exit 0; the os.path.isdir guard runs before build_for_index so no partial output is written and the error is a single ERROR: <dir>: not a directory line on stderr with exit 1 — consistent with the error style already established in this tool and with the fix from #1379.
  • Note: the sibling tests/test_mesh_compute.py suite requires pytest, which is not installed in my environment, so I did not run it here; the diff does not touch that file or anything it imports.

No GPU involvement — this is a pure CLI-argument fix. LGTM.

(AI-assisted review: I ran the listed commands and the negative control locally and report the results above.)

@ItsNotRexed
ItsNotRexed merged commit 8fe3641 into ItsNotRexed:main Nov 22, 2026
10 of 11 checks passed
@pratikphophaliya
pratikphophaliya deleted the mesh-compute-vs-args branch November 22, 2026 12:46
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.

3 participants