Commit Graph
2 Commits
Author SHA1 Message Date
Anees Iqbal b302389a95 🐛 Send x86-64 textures' swizzles to the host
The x86-64 AppleParavirtGPUMetal plugin's -[PGSerializer
supportsSwizzledTextures] and -[PGSerializer supportsTextureDescriptor2]
read flags nothing in that plugin sets (the arm64 plugin sets them from the
guest's features), so both answer NO. Every texture then goes to the host in
the first descriptor form, which has no swizzle and 8 bits of usage, and a
texture made with a swizzle reads unswizzled. macOS 26's Clear and Tinted
icon styles draw their glyphs from RG8Unorm luminance-alpha textures
swizzled (R, R, R, G); unswizzled they read (L, A, 0, 1), and the white
glyphs come out yellow.

Version 245, which the kext negotiates, has both features, and the host
reads the second forms at any version. A third UserPatch makes both getters
answer YES, so the plugin sends every texture in the second form, as the
arm64 plugin does. In an x86-64 macOS 26 guest on a reims-vgpu Vulkan host,
an RG8Unorm texture swizzled (R, R, R, G), over an 'LA08' surface or of its
own, now samples (0.2, 0.2, 0.2, 0.4) as Metal does, not (0.2, 0.4, 0, 1),
and Clear and Tinted draw their glyphs white.

A swizzled texture view still reads unswizzled: the plugin serializes every
view without its swizzle, and sending it needs new code, not a getter.
2026-10-16 16:14:46 +03:00
Anees Iqbal 5405b2d13b 🆕 Put a guest kext for reims-vgpu's GPU in the OpenCore image
x86-64 macOS guests drive reims-vgpu's GPU through AppleParavirtGPU.kext,
whose setupVersion asks for binary version 6 and turns every later feature
off; arm64 guests ask for 245. ReimsVgpu.kext (kext/), a Lilu plugin,
routes setupVersion to ask for 245 and set its features, and leaves the
driver's own negotiation to a host that does not store it. It also patches
what the x86-64 driver and its Metal plugin hardcode where arm64's ask the
device:

- AppleParavirtResourceHeap::addObject adds a two-plane D32S8 or X32S8
  texture as type 12, as arm64 does, not as type 2, which the host reads as
  one plane and faults on.
- -[AppleParavirtDevice featureProfile] returns 10001, not 10000, adding
  the Mac2 and Common3 families that ANGLE's Metal backend, so
  GPU-accelerated Chrome, needs.
- -[AppleParavirtTexture initTiledWithBuffer:...] no longer refuses
  SkyLight's tiles of a window wider than 2048 px, whose real bytes fit;
  the host accepts them from their real footprint (reims-vgpu's fdf661fee).

The plugin's bytes are patched through UserPatch, since Lilu's own user
patcher is off from macOS 11: it routes _cs_validate_page and rewrites a
page after the kernel has validated its pristine bytes, so code signing
does not notice and no other binary is touched.

The image carries the kext with Lilu 1.7.2's RELEASE build, pinned by
SHA-256 and cached like OpenCore, and loads both on macOS 26 alone (Darwin
25), so every other macOS boots with no kexts, as before. --no-kexts leaves
them out.

A kext builds on a Mac alone, and reims-util builds anywhere, so the built
kext is kept in the repository at kext/ReimsVgpu.kext and included in the
binary. kext/Makefile writes it there, against a DEBUG Lilu.kext and
MacKernelSDK, with the build date Lilu's plugin_start.cpp stamps pinned so
the same sources build the same bytes, and writes kext/sources.sha256,
which a test checks the sources against. The built kext holds Lilu's
plugin_start.cpp, so Lilu's BSD-3-Clause license is kept beside ours.
kext/probes/features.m prints what Metal's device answers in a guest.

Moved from reims-vgpu, where it was ec923f9f9, 4a4a882fb and 2e564d3f8 on
steelbrain/x86-metal-lilu.

Checked on msi-laptop (RTX 5080, macOS 26.6.1 guest): the host stores 245
and the desktop comes up; chrome://gpu reports hardware acceleration; a
clear to a D32S8 target that faulted the host completes. ocvalidate
(OpenCore 1.0.8) finds no issues in the image's config.plist, and the
kexts in the image match the built kext and Lilu's release byte for byte.
Not yet booted from a reims-util image.
2026-10-13 19:10:51 +03:00