Skip to content

make_game: --bary-fallback and --mesh-compute on by themselves where the GPU lacks the feature - #4772

Open
DaniSBR1 wants to merge 2 commits into
ItsNotRexed:mainfrom
DaniSBR1:pr-make-game-auto
Open

DaniSBR1 wants to merge 2 commits into
ItsNotRexed:mainfrom
DaniSBR1:pr-make-game-auto

Conversation

@DaniSBR1

@DaniSBR1 DaniSBR1 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in #4683 (#4683 (comment)), new BUILD item.

What and why

make_game.py already turns on --f16-interp-fallback and --pc-tail-ubo where the runtime's GPU needs them. --bary-fallback and --mesh-compute still had to be passed by hand. A build for a GPU without VK_KHR_fragment_shader_barycentric or VK_EXT_mesh_shader (RDNA1 on AMD's Windows driver and on RADV, NVIDIA Pascal) made without them can't draw those shaders. With the runtime halves (#4309 for the barycentric GS, #4408 for mesh as compute), these two flags are what such a GPU needs. @kapitche's sweep (#4628) shows the cost of leaving the flag off: 207 of the 480 sampled pixel shaders couldn't be created on an Intel UHD 770, because the corpus was translated with BaryCoordKHR.

  • tools/vk_subgroup_info.py reports fragment_shader_barycentric and mesh_shader: the feature bits, each only where the device also lists its extension, as the runtime checks.
    • The extension check matters: AMD's Windows driver (26.11.2) fills VkPhysicalDeviceMeshShaderFeaturesEXT with ones on an RX 5700 XT, which has no VK_EXT_mesh_shader. Read alone, the bit says the GPU has mesh shaders.
    • A failed extension enumeration leaves both fields null (unknown), not false, so it can't turn the fallbacks on by mistake (found by @shdann).
    • per_vertex_inputs is unchanged.
  • make_game.py turns --bary-fallback and --mesh-compute on where the runtime's GPU lacks the feature, from one probe, as it does for the other two flags.
    • A probe that can't tell keeps what the last translation was made with, so a failed probe doesn't translate the corpus again (keep_recorded_fallback).
    • An explicit flag stays on whatever the GPU has.
    • --mesh-compute is decided before wave64_settings, which depends on it, and before the push-constant check (152 bytes with it).
  • The two flags' --help and the README say they turn on by themselves.

Tests

  • tests/test_vk_subgroup_info.py (51 pass): the two fields with and without their extensions, including the RDNA1 case of a mesh bit without VK_EXT_mesh_shader, and a failed enumeration leaving both unknown. The fake Vulkan checks the extra struct in the features chain.
  • tests/test_make_game_translator_flags.py (30 pass): each flag follows the device, explicit flags win, wave64_settings gets mesh_compute=True, --mesh-compute at 144 push-constant bytes also turns on --pc-tail-ubo, and a probe that can't tell keeps both flags of the last translation.
  • All of tests/test_make_game*.py (360 pass, 1 skipped), the docs and text tests, compileall and make_game.py --help pass.
  • On an RX 5700 XT (AMD 26.11.2, Windows 11): the probe reports neither feature, so both flags turn on. Before the extension check it reported mesh_shader: true.

I'll rebase around #4696 and #4715, which also touch tools/vk_subgroup_info.py.

No game files were used. AI-assisted (Claude Code).

…the GPU lacks the feature

tools/vk_subgroup_info.py reports fragment_shader_barycentric and mesh_shader: the feature bits, each only where
the device also lists its extension, as the runtime checks. AMD's Windows driver (26.11.2) fills
VkPhysicalDeviceMeshShaderFeaturesEXT with ones on an RX 5700 XT, which has no VK_EXT_mesh_shader.
per_vertex_inputs is unchanged.

make_game.py turns --bary-fallback and --mesh-compute on where the runtime's GPU lacks fragmentShaderBarycentric
or meshShader, from one probe, as it does for --f16-interp-fallback and --pc-tail-ubo. A probe that can't tell
keeps what the last translation used. --mesh-compute is decided before wave64_settings, which depends on it, and
before the push-constant check (152 bytes with it).

Tests: test_vk_subgroup_info.py (the two fields, extension gating, the RDNA1 case), test_make_game_translator_flags.py
(each flag follows the device, explicit flags win, the order against wave64 and --pc-tail-ubo, a failed probe keeps
both). On an RX 5700 XT (AMD 26.11.2, Windows 11) the probe reports neither feature, so both flags turn on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Kam471 Kam471 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.

Ran this at 17d40e2f3 on Windows 11: pytest tests/test_make_game_argparse.py tests/test_make_game_translator_flags.py tests/test_vk_subgroup_info.py -q -> 116 passed, 100 subtests passed; git diff --check clean.

vk_subgroup_info now reports the barycentric and mesh-shader feature support, and make_game enables --bary-fallback and --mesh-compute by themselves on a GPU that lacks the feature (an explicit choice still wins); the README and tests are updated.

Overlap: #4762 adds only the automatic --bary-fallback and conflicts with this branch in make_game.py (git merge-tree refs/remotes/pr/4772 refs/remotes/pr/4762 -> exit 1). This PR is the broader version (bary + mesh, with the probe fields); #4762 should probably close in its favor.

@shdann

shdann commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

At 17d40e2f, a failed Vulkan extension query turns on both shader fallbacks. This can trigger a second translation on a device that supports both features.

I used the PR's fake Vulkan 1.3 device with both feature bits and both extension names. A successful query gives True True (). When extension enumeration returns VK_ERROR_OUT_OF_HOST_MEMORY (−1), the same device gives False False ('--bary-fallback', '--mesh-compute'). The expected result is an unknown capability for each feature. On this empty work folder, that should retain the empty flag tuple. On an existing translation, it should use the recorded flags.

device_extensions returns an empty set for both a successful empty list and an enumeration failure. Please preserve that distinction when computing the new fields.

Save this as probe.py and run python -I probe.py from the checkout root:

import sys
from pathlib import Path
from unittest.mock import patch
sys.path.insert(0,str(Path("tests").resolve()))
import test_vk_subgroup_info as t, test_make_game_translator_flags as m
device=t.FakeDevice(mesh_shader=True,fragment_shader_barycentric=True,extension_names=(b"VK_EXT_mesh_shader",b"VK_KHR_fragment_shader_barycentric"))
def probe():
    vk=t.FakeVulkan(devices=[device])
    with patch.object(t.vk_info,"load_vulkan",return_value=vk):
        r=t.vk_info.query()
        case=m.MainWiringTest()
        try: print(r["fragment_shader_barycentric"],r["mesh_shader"],case.run_main(features=r)[1])
        finally: case.doCleanups()
probe()
with patch.object(t.FakeVulkan,"_enumerate_device_extension_properties",return_value=-1):
    probe()

All 116 focused tests pass on Windows 11. With successful live queries, the RTX 4090 reports both features. The AMD Radeon iGPU reports barycentric support only.

AI-assisted.

Fix verified at 8e2b1d7 on Windows 11. The same probe now returns None for both features when enumeration fails. The translation flag tuple stays empty. All 117 focused tests pass on CPython 3.14.7. The live query gives the same feature results on both adapters.

…unknown

device_extensions returned an empty set both for a device without extensions and for a failed
vkEnumerateDeviceExtensionProperties, so a failed query read as "neither feature" and make_game turned both
fallbacks on, translating the corpus again on a GPU that has both (found by shdann on ItsNotRexed#4772).
query_device_extensions returns None on a failure; fragment_shader_barycentric and mesh_shader are then null,
which make_game treats as unknown (it keeps the flags of the last translation). device_extensions is unchanged
for the Vulkan 1.2 device check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@editrice

Copy link
Copy Markdown

At head 17d40e2f, automatic --bary-fallback and --mesh-compute activates translated shader contracts that the runtime on main cannot consume yet. runtime/src and runtime/shims do not reference bary_fallback_input or mesh_compute; the runtime halves are still open in #4309 (pass-through GS) and #4408 (mesh dispatch/barrier/draw, itself dependent on #1712 and #3777). The PR body mentions those halves, but this branch is based on main and has no Depends on: entries. Merging it alone changes the default build for RDNA1/Pascal to shaders those devices still cannot draw. Please make the runtime PRs explicit merge dependencies, or defer automatic activation until they land, and add an end-to-end synthetic build/runtime regression for the fallback paths. AI-assisted review; no game files used.

@DaniSBR1

Copy link
Copy Markdown
Contributor Author

Thanks for the runs and the review.

Re-tested: tests/test_vk_subgroup_info.py (51), all of tests/test_make_game*.py (360, 1 skipped), and the docs and text tests pass. On the RX 5700 XT the live probe still reports neither feature, so both flags turn on.

AI-assisted (Claude Code).

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.

4 participants