From the PR (The Legend of Zelda: Echoes of Wisdom, 1.1.0, on the Mac):
- A view whose level count runs past the texture's levels gets the levels it has, as deko3d's descriptor writer clips the maximum level (the game views levels 1 + 7 of a seven-level texture, which Metal's validation refuses); a base level past them is an empty slot (red line 109).
- tex_by_id composes the descriptor's swizzle with the format's mapping (nvn_fmt_to_mtl: alpha 1 for RGBX-type formats, red and blue swapped for the RGB565 family), which was computed and never applied: the hearts' RGB565 mask drew as red rectangles.
On top of the PR:
- The red / blue swap is for bits in the guest's order, so it applies only to a texture uploaded from guest memory (an NvPkg in the serial table) or read from it in place (a texture on a pool buffer). What Metal renders or clears into a 16-bit texture is in Metal's order: with the PR, a target cleared to red sampled blue.
- Metal gives a swizzled view only the read usage (a base of usage 0x7, its swizzled view 0x1), and the image binder sent such a slot to the dummy image: with the PR every RGBX8 / RGB565 image lost its writes (red line 32). An image takes no channel mapping, as a Vulkan storage image view must have the identity swizzle, so img_fit gives the slot the same view without one (kept in the slot's image view, as for a class change).
- The on-chip read merge needs the sampled view's swizzle to be plain: a tile read takes no channel mapping, so an RGBX attachment merged into the next pass read its stored alpha.
- Graphics tests: 13 of the 27 had stopped building. Every test that includes nvn_mtl.m now links hle_nvn.c, the large host stack and weak host stubs (t_host_stubs.c) through one Makefile variable, the tests that stubbed prog_key for want of hle_nvn.c drop the stub, t_present_crop / t_mip_extent rename hle_nvn.c's static g_ft (nvn_mtl.m has one too), and the budget test gets DM_GAME.
t_view_swizzle (203 checks) reads the mappings back from the GPU through tex_by_id: the PR's cases, now with uploaded textures for the swap, plus RGB565 / BGR565 targets Metal cleared to red (red, no view) and an RGBX8 image (sampled alpha 1, writes through img_fit's view stored as written); without the upload rule it fails 9. t_view_levels 34 checks. Every graphics test builds; the ones still failing fail the same with main's nvn_mtl.m: t_refl 2 (reflection samples in a local cache), t_reorder_chain 30, t_mip_extent 2, t_rt_range 4 to 8 per mode, t_pfv 1, t_rt_range_ro (a missing JSON file).
Co-authored-by: nocmt <26828323+nocmt@users.noreply.github.com>