Files
metal2vulkan/docs
Anees Iqbal 3619e37540 RUNTIME 2482: Texture::view_placement answers what a view would be, by the decision its making takes
The consumer will make an IOSurface plane's device cache one optimal Private texture, every
texture over the plane a view of it, and needs to know before it makes a view whether the
runtime would make it a Vulkan view of the image or a view shadow (which it sends to its own
fallback instead).

What: `Texture::view_placement(pixel_format)` answers `ViewPlacement` (`Image`,
`ImageThroughSwizzle`, `Shadow(ViewShadowReason)`, `OverBytes`), or the error
`new_texture_view` would refuse the view with. The decision is factored, not copied:
`Texture::checked_view` holds the checks `view_as` ran inline (Metal's rules, rotation, X32,
buffer slices, decoded twins), `Texture::view_hold` decides the storage (shared, through a
swizzle, the viewed image, a shadow and why, storage over the bytes), and
`Device::view_shadow_plan` / `shadow_plan` hold the shadow's refusals `image_shadow` checked
while making. `view_as` and the query call the same three. `image_plan::views_missed` replaces
`takes_views_of` and names why an image takes no view (another compatibility class, or not in
its list); `Device::view_apart` replaces `image_takes_view` and puts the device's missing
reinterpretation first; the `shadowed-texture-view` notice's reason now follows that reason
(it chose by the texture's PixelFormatView usage before).

Tests: `view_placement_device` (runtime, device cfgs) sweeps 10 texture formats x 5 usages x
24 view formats, checks the query moves no count and matches the view made (by
`view_shadows`, `views_through_swizzle` and the handed-out image), and names the consumer's
cases. `plane_device_cache` (validation lane): a 300x200 BGRA8Unorm Private texture round-trips
between no-copy buffers at offset 48 and pitch 1232 with every other byte kept; a clear through
its sRGB view then a copy through its own-format view in the next encoder, tracked and
untracked with a fence, read the clear with no hazard under synchronization validation, and the
unordered control is reported as a read after write.

Documented in the runtime README; the signature table blessed (10 rows); REFUSALS regenerated.
RUNTIME_VERSION 2482.

Verified: msi job m3-max-37961 at c2f0c96d3c: clippy -p metal2vulkan-runtime -p
metal2vulkan-validation --all-targets --all-features --cfg m2v_cpu_icd -D warnings 0; the lavapipe
tests, plain and --cfg m2v_gpu clippy and rustdoc follow on development. The hazard tracker keys a
view's uses on its image (texture.rs view_as shares the Arc<Image>; bound_use/image_use key on
image.identity.key), so the order across views needed no fix.
2026-11-16 14:48:17 -08:00
..