Files
reims-vgpu/docs
Anees Iqbal 96864ba166 🐛 Present the guest's class of Mac to the runtime, not the host's
metal2vulkan gives a few answers the way the class of Mac a device
presents gives them (DeviceOptions::mac_class): what a new Private texture
reads before anything writes it, the encoding a GPU blit through a
texture Metal compresses writes, a half NaN clear's sign, and how far a
Clear load reaches past the render area in a pass of one layer without a
draw call. The library declared no class, so every device presented its
host GPU's: an arm64 guest on a Linux host got an Intel or AMD Mac's
answers, and an x86-64 guest on a Mac host Apple silicon's, the M3's
magenta fresh pattern among them, where the Intel UHD 630 and the AMD
Radeon Pro 5300M read zero.

A graphics device now tells its platform the guest's architecture before
it opens its GPU device (ApiPlatform::present_guest), and the Vulkan
platform declares the guest's class for every device of the process
(GuestArch::mac_class, present_mac_class): Apple silicon for an arm64
guest, an Intel or AMD Mac for an x86-64 guest. The runtime fixes a
device's class as it makes it and keeps one device per physical device
and options, so the class is the process's, fixed by its first
declaration, or left to each GPU where the options were read first; the
platform warns where it is not the guest's. QEMU makes every
reims-graphics-pci of a process for its target's architecture
(target_aarch64() in reims-graphics-pci.c), and rvg_graphics_device_create
is its first call into the library, so its guests get their own class.

What the guest sees change:
- An x86-64 guest on a Mac host (MoltenVK; development and tests only): a
  new Private texture reads zero where it read Metal's fixed pattern (the
  runtime fills it with zeros, WorkCounts::private_textures_zero_filled);
  blits through a texture Metal compresses keep their bytes, but where
  MoltenVK's own copies still rewrite RG11B10Float and RGB9E5Float; a half
  NaN clear goes through half; a Clear load in a pass of one layer without
  a draw call clears the whole level.
- An arm64 guest on a Linux host (TCG today, KVM on arm64 hosts later):
  the reverse. A new Private texture Metal keeps compressed reads Metal's
  fixed pattern (opaque magenta in RGBA8Unorm) and any other zero, where
  it held what its memory held; the runtime writes the pattern as the
  texture's first move, and announces fresh-pattern-zeroed where the
  device cannot write it exactly. Blits through such a texture write the
  canonical BGRA10_XR, RG11B10Float NaN and RGB9E5Float encodings, a half
  NaN clear keeps its sign in a pass without a draw call, and that pass's
  Clear load clears an uncompressed texture over the render area's 32x32
  tiles.
- x86-64 guests on Linux and arm64 guests on a Mac: nothing; the host
  GPU's class was the guest's already.
The device info is unchanged: Metal has no property for the class, and
both guests keep the host GPU's name and no Apple family, the lane's own
limit.

No test held the host GPU's class through a graphics device: every
reims-vgpu and reims-vgpu-c test passes unchanged on the M3 Max, where
the x86-64 guests' devices now present an Intel or AMD Mac. The Vulkan
crate's tests make their devices with no graphics device, so they keep
the host GPU's class, the M3's Metal their reference; ff4185d73, which
declared an Intel or AMD Mac for every device, broke three of them. New
tests: the guest's class decides the answers whatever the host GPU (each
architecture in a child process: a new Private RGBA8Unorm render target
reads the pattern for arm64, and zero or no fill for x86-64), and the
process's class is fixed by its first declaration.
2026-11-12 00:07:04 -08:00
..