From 03b5cff006c19bbf3740041b72136821f44950fb Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 3 Dec 2026 14:31:09 -0800 Subject: [PATCH] Runtime README: KosmicKrisp's answer for a texture over host memory with render-target usage A texture over a buffer in host memory's import, on an integrated or CPU device, lies in place where the device's external image query for host memory's handle answers a linear image of the texture's format, usage and flags; otherwise it is the counted copy at each use. On the Apple M3 Max (KosmicKrisp, Mesa 26.3.1), the textures with render-target usage in a consumer's walk were the copy. The known gap of memory blocks said why in one clause (the Mac driver makes no linear colour attachment with or without a handle); it now names the query's answer and the shapes it was asked for, and says the copy is chosen by that query alone. The ruling: the copy is the device's form under rule 2 (a missing feature of the driver, not a bug), with no code change. The answer, asked of KosmicKrisp with the runtime's own parameters for each of the four kinds of texture with render-target usage the walk made over host memory (R8Unorm 1920 by 1080 and RG8Unorm 960 by 540, ShaderRead and RenderTarget; RGBA8Unorm at 18, 24, 36 and 48 pixels, ShaderRead, ShaderWrite and RenderTarget; RGBA16Float at 16 to 1024 pixels, ShaderRead and RenderTarget): vkGetPhysicalDeviceImageFormatProperties2 for linear tiling, usage transfer source and destination, sampled and colour attachment (and storage for the written one), mutable format with the sRGB sibling's format list where the format has one, and VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT answers VK_ERROR_FORMAT_NOT_SUPPORTED for each, and so it does without the handle and without the format list. Without colour-attachment usage (transfer source and destination and sampled), it answers each format importable, compatible (0x180), not dedicated-only, up to 16384 by 16384 and one layer; dropping sampled instead leaves it refused. The README's prose carries no lab job id (scripts/api-docs refuses one), so the job is cited here alone. runtime-sources.sha256 does not move: the README is not among its inputs. Verified: - m3-max-85644, the Apple M3 Max (KosmicKrisp, Mesa 26.3.1, Vulkan 1.4.363, an integrated device with VK_EXT_external_memory_host): a query program (no test) asked the answers above. - On the CPU with no device, at this commit: scripts/api-docs's prose check (its job-id grep over the runtime README, API.md, REPLAY-STREAM.md and VALIDATION.md) finds nothing; the runtime-sources hash computed from the validation build's input list equals the pinned one; the README's readers in the tests (its Floor section, its Enabled, not stated table, and its section of what the consumer implements) read sections this change does not touch. --- crates/metal2vulkan-runtime/README.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index a582b7a47..262ede962 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -1585,15 +1585,23 @@ exported block, an exported surface in either form, and a Direct3D 11 import. memory's handle a linear image of every format and usage it offers one of without a handle. So that copy stays where the linear tiling offers no image of the format and usage at all, as over a Shared block, and on the Mac driver (KosmicKrisp) for every texture with render-target usage, - since it makes no linear colour attachment with or without a handle. In a consumer's walk on the - Apple M3 Max at this form, 29 textures over host memory lay in place, and host memory's 2,327 - counted copies, 982.3 MB with the in-place textures' restore pairs among them, were at least 906 - MB (92%) of textures with render-target usage; six kinds read by shaders alone, of at most 32 KB - each, carry the rest, at most 76 MB. Those pages are the Mac and Windows hosts' imports by - address and, on Linux, pages not imported as a dma-buf (on the RTX 3090, all of them; on the - Iris Xe, those one dma-buf cannot hold, Imported blocks). Documented Metal asks for no call - before a CPU write to a Shared buffer reaches a texture over it, so the runtime has no call to - hold a copy for. + since it makes no linear colour attachment with or without a handle. On the Apple M3 Max + (KosmicKrisp, Mesa 26.3.1), the query for a linear image with the runtime's own usage, colour + attachment among it, and flags answers `VK_ERROR_FORMAT_NOT_SUPPORTED`, with host memory's + handle and without it, for the four kinds of texture with render-target usage that a consumer's + walk made over host memory: R8Unorm at 1920 by 1080 and RG8Unorm at 960 by 540, read and + rendered; RGBA8Unorm at 18, 24, 36 and 48 pixels, read, written and rendered; RGBA16Float at 16 + to 1024 pixels, read and rendered. Without colour-attachment usage it answers each of the four + formats importable, compatible and not dedicated-only, up to 16384 by 16384. So each such + texture is the counted copy at each use there, chosen by that query alone. In a consumer's walk + on the Apple M3 Max at this form, 29 textures over host memory lay in place, and host memory's + 2,327 counted copies, 982.3 MB with the in-place textures' restore pairs among them, were at + least 906 MB (92%) of textures with render-target usage; six kinds read by shaders alone, of at + most 32 KB each, carry the rest, at most 76 MB. Those pages are the Mac and Windows hosts' + imports by address and, on Linux, pages not imported as a dma-buf (on the RTX 3090, all of them; + on the Iris Xe, those one dma-buf cannot hold, Imported blocks). Documented Metal asks for no + call before a CPU write to a Shared buffer reaches a texture over it, so the runtime has no call + to hold a copy for. - A texture over a buffer in a dma-buf's one import is the counted copy too on a device that offers no linear image for a dma-buf import without a dedicated allocation (Imported blocks). On the Radeon 780M (RADV) the external image query refuses the dma-buf handle with linear