metal: refuse a shader converter older than 3.0 (#295) #351
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/351"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by tiagonogueiraa-bit on 2026-11-27T13:43:21Z.
Refs #295
Cause. Before 3.0, Apple's Metal Shader Converter takes every 1D and 2D texture as an array type. Its 2.1 manual says so under "Texture arrays", and the 3.0 changelog lists "Default support for non-array texture types". The host binds a 2D texture as a plain 2D view, which is what 3.0 and later expect. Through an older converter, a compute shader's writes to such a texture are dropped and the texture stays zero, with no refusal and no GPU error. That matches the loading screen in #295: panels drawn, no art. Unreal Engine 5.6's copy (
D3DRendererMetal-30.2) is older than Apple's 2.1 (31.2), so it belongs to the generation before 3.0.Measured with Apple's own releases (each
.pkgexpanded, loaded throughVICTORY_MSC_DYLIB). M-series Mac, macOS 27.2,cargo test -p victory-gpuon mainb639c17:D3DRendererMetala_texture_compute_writes_is_copied_back_into_title_memory. It failed 3 times in 3 runs on 2.1 and on 1.1, and passed 3 of 3 on 3.0 and 4.0 beta 3. On 2.1 the texture reads back all zero: 16,256 of 16,384 bytes differ, and 0 bytes are nonzero.create_texture_viewmaking 2D views as 2D arrays (an experiment, not in this PR), the same test passes on 2.1 and fails on 3.0.Change.
Msc::openrefuses a converter that lacksIRCompilerSetFunctionConstantResourceSpace. 3.0 added that export: 3.0 and 4.0 beta 3 have it, and 1.0, 1.1 and 2.1 do not. The C API has no version call, and the Mach-O version is 0.0.0, so exports are the only reliable sign.try_open_defaultnow logs once why no converter was loaded (metal: no shader converter: ...).native-setup.shwarns about an older converter (checked withnm -gU).docs/native-host.mdgives the cause and these numbers.What it does not change. A converter of 3.0 or newer loads exactly as before, so the 3.0 and 4.0 beta 3 runs above are unchanged. The path still decides only the existing warning about a non-default copy. Making array views for an older converter instead would also work. It is not done here, because every 2D view and directly bound texture would need the other type, for a converter Apple has replaced. Say if you prefer that route.
Checks.
cargo test -p victory-hle -p victory -p victory-gpu -p victory-metal -p xtask: 580 passed, 0 failed, 7 ignored.cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings: clean.cargo xtask policy: ok.msc::tests::a_converter_older_than_3_is_refused_by_its_exports.No game data was used for any of this. I don't have Unreal's copy to run it directly. @Olima34, for the board.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T16:15:13Z.
Merged in
4cf84c83. Before pushing I ran the tests (native arm64), Windows clippy, the policy check, a release build, and one headless game run of the exact tree (170 s, Series S): menus at 30 fps, the world entered at about 81 s and kept presenting to the end at about 1 frame a second, 0 GPU errors, no crash. The converter here is 3.0 or newer, so I did not see the refusal itself. Thanks.