Files
metal2vulkan/docs
Anees Iqbal e8418615f1 Translator: a storage slot its function only queries binds a swizzled texture unswizzled
A guest's OpenCL kernel that only queries a write-only image Apple's OpenCL binds as a swizzled
view (CL_BGRA over an RGBA8Unorm view, and on an M3 Max every CL_UNORM_INT8 order but RGBA and
RGBx) failed: the plan joins a storage slot to the swizzled-storage variant only where its
function reads or writes texels, so a query-only slot kept the texture's swizzle on its storage
view, which Vulkan cannot swizzle, and the runtime refused the binding
(NotImplemented(TextureSwizzle)). The guest then read zeros.

A query reads no texel, and what it answers (the view's size, levels and layers; an OpenCL
image's order and data type, which the third hidden buffer holds) no swizzle reaches. Measured
on an M3 Max, macOS 27.0.1 (probe opencl_swizzled_images, job m3-max-16336): plain Metal's
get_width/get_height of a swizzled view at an access::write slot answer the view's size, and
OpenCL mode's width, height, order and data-type queries answer the size and the hidden words,
on every swizzle measured. So the plan now binds such a slot's storage view with no swizzle
(ImageViewDesc::shader_swizzle, under no variant): exact.

The same probe confirms the rest of the contract the crate already builds, in plain Metal and
OpenCL mode alike: reads (read(), read_write, sample, read_imagef with and without a sampler)
answer the swizzled texel, and writes (access::write, read_write, write_imagef) store it with
the swizzle undone. The channel order table and the swizzle never both apply: the table answers
queries only, the swizzle moves texels only.

Docs: ImageViewDesc::shader_swizzle, the runtime's binding_view and view_plan, docs/API.md's
OpenCL-mode images. REFUSALS.md regenerated, unchanged.

SEMANTICS_VERSION 2033.
2026-11-11 09:37:09 -08:00
..