A render target's channel-order sibling views are views of its image

A pass rendering into a BGRA8Unorm or BGRA8Unorm_sRGB view of an
RGBA8Unorm texture made without PixelFormatView usage (and the same for
BGRA8Unorm and the sRGB twins) rendered through a shadow image of the
view's format, copied in before the pass and back after it
(shadowed-texture-view, about 50-95 us a command buffer at 64x64): the
texture's image was mutable only for its sRGB twin's formats, so Vulkan
made no view of it in the sibling's format.

Basis, documented on both sides:
- Vulkan: VkImageFormatListCreateInfo (core 1.2), pViewFormats
  "specifying all formats which can be used when creating views of this
  image", with MUTABLE_FORMAT; the formats are of one class.
- Metal: MTLTextureUsage.pixelFormatView, "Don't set this option if your
  texture view only converts between linear space and sRGB. For example,
  if your texture uses the rgba8Unorm pixel format and your texture view
  uses bgra8Unorm_srgb." Plain Metal makes the BGRA8Unorm view too and
  renders through it (its API validation stops it; view_attachments).

Change (image_plan.rs): a color texture of those four formats with
RenderTarget usage lists, besides its sRGB twin's views, the views of
its sibling and the sibling's twin (reordered_views, reordered_formats),
in the single-sample and the multisample plan; a word attachment's view
is left out as for the twin. A texture that renders nothing lists none:
its sibling views already read the image through a swizzle. The view's
other uses then view the image too (takes_views_of).

Compression: expected, not measured. Mesa's sources suggest RADV before
GFX11 keeps no DCC for a list whose formats' channel orders differ, ANV
keeps CCS_E for formats of the same channel bits, RADV GFX11+ keeps DCC
for any list; NVIDIA documents nothing. The A/B lane
view_attachments::reordered_view_render_costs (the parent commit)
measures it per driver.

Tests: image_plan::render_targets_take_their_channel_order_sibling_s_views
(every committed profile: the sibling and its twin taken where the
device renders them directly, none for a texture that only reads, none
for RGBA16Float); runtime_lane::view_attachments::
a_render_target_s_reordered_views_render_in_place (draws through both
views, Metal's bytes, no shadowed-texture-view).
Docs: the ShadowedTextureView notice (degradation.rs, API.md), the
FAST-PATHS view bullet, view_shadow.rs.

Verified: not yet built.
This commit is contained in:
Anees Iqbal committed 2026-11-12 03:56:51 -08:00
1 parent 99d83d06f4
commit cdcd787fb8
7 files changed
+159 -15

No files matched your search

+4 -2
View File
@@ -2632,8 +2632,10 @@ bound.
is an image of its own, a shadow of the viewed image's texels, where that image takes no Vulkan
view of its format: a view of another component layout on a device whose Vulkan views reinterpret
no image's components (a portability subset without `imageViewFormatReinterpretation`, or an
adopted device whose consumer did not say it enabled it), or a view of another format than the
texture's own and its sRGB twin's of a texture made without `PixelFormatView` usage. A view in
adopted device whose consumer did not say it enabled it), or a view of a texture made without
`PixelFormatView` usage in another format than the texture's own, its sRGB twin's and, where the
texture renders and is `RGBA8Unorm`, `BGRA8Unorm` or a twin of one, its channel-order sibling's
and that sibling's twin's. A view in
other channels of its image's bits (an `A8Unorm` view of an `R8Unorm` texture) is the image
itself to its bindings, through a swizzle, and takes a shadow only for a pass that renders into
it: Vulkan views the image in no format of the view's. Cost: its texels are copied from its