Commit Graph
9437 Commits
Author SHA1 Message Date
Anees Iqbal 0c9db49765 Bless at 3c52ee1cf1: opened chains, MoltenVK's two contexts enable imageView2DOn3DImage
3c52ee1cf1 put imageView2DOn3DImage in floor::PORTABILITY, so a device that lists
VK_KHR_portability_subset enables it. The committed MoltenVK M3 profile is such a device: its
device and restricted contexts each enable one member more (77 and 75), which moved their
pinned chains, and every_committed_profiles_context_enables_its_pinned_chain failed on
development (job m3-max-73486, the one red of that suite run). No other profile lists the
portability subset, so no other row moved.

Verified: job m3-max-73498 (msi) ran bless_opened_chains at 3c52ee1cf1; its diff is these two
rows alone, and the pinned-chain test then passed.
2026-11-24 01:44:51 -08:00
Anees Iqbal 3c52ee1cf1 Render pass: a colour attachment renders one depth plane of a 3D texture's level
What: RenderPassColorAttachmentDescriptor takes `depth_plane` (Metal's `depthPlane`). A 3D
texture of RenderTarget usage is made 2D-array-compatible (VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT,
in its image format query too: Plan::flags, from the image's type and its colour attachment usage,
no query). attachment_view then takes the plane of a 3D texture's level as a 2D view of that one
layer (base layer = depthPlane, at the level), checked against the level's depth
(Refusal::AttachmentPlace past it). Every barrier on a 3D texture's image (its attachment's, its
copies' and its moves', texture::barrier_layers) names the image's layers as 0 and
VK_REMAINING_ARRAY_LAYERS, so each moves every plane of the level it names. Before, every such pass
was Gap::RenderPass of RenderPassKind::TextureType.

Still TextureType: a 3D texture in a layered pass (renderTargetArrayLength 2 or more), a depth or
stencil attachment of a 3D texture, a 3D resolve texture, and a resolve's depth plane but 0. A draw
that reads, through a shadow (a device without the attachment feedback loop), a 3D texture whose
plane its pass renders is Gap::Draw of DrawKind::AttachmentRead: a shadow's copies are of layers.
The floor asks a device that lists VK_KHR_portability_subset for imageView2DOn3DImage too
(VUID-VkImageCreateInfo-imageView2DOn3DImage-04459), as it asks multisampleArrayImage.

Why: a guest route meets the refusal. A browser's GL layer clears every 3D texture of an RGB-family
format (RGB8, RGB16F) at creation through a pass on each plane, to set the alpha it emulates; it
also renders into a plane for framebufferTextureLayer(TEXTURE_3D, k) then a clear or a draw, for a
level sampled before a full upload, and for copyTexSubImage3D. The consumer's route showed the key
at 205c8d2398 ("a render pass with TextureType is not built", colour 0 RGBA8Unorm Type3D 32x32x4,
usage 0x7, Managed), and every route that renders into a 3D texture read 0.

Metal (MTLRenderPass.h): `depthPlane` is "The depth plane of the texture to be used for rendering.
Default is zero."; Apple's page for the property, as fetched: "If the texture isn't a 3D texture,
then Metal ignores this property." Every Mac renders into a 3D texture's plane, with nothing to ask,
so it is built.

Vulkan (1.4.366): VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT "specifies that the image can be used to
create a VkImageView of type VK_IMAGE_VIEW_TYPE_2D or VK_IMAGE_VIEW_TYPE_2D_ARRAY" (core since 1.1);
the image is 3D (VUID-VkImageCreateInfo-flags-00950) and not sparse (-09403); the format query takes
the same flags (Image Creation Limits). The view is 2D, one level
(VUID-VkImageViewCreateInfo-image-04970), its base layer below the level's depth (-02724, -02725),
of an image made with the flag (-06728).
Such a view "can be used as a framebuffer attachment that refers only to the specified range of
slices of the selected mip level" (VkImageSubresourceRange). Dynamic rendering refuses only a 3D
view type (VUID-VkRenderingAttachmentInfo-imageView-12470). The runtime does not enable
maintenance9, so a barrier on the image moves the whole level
(VUID-VkImageMemoryBarrier2-subresourceRange-01488); with maintenance9 its layers would name depth
slices (-maintenance9-10798), and the layer count that names the whole level either way is
VK_REMAINING_ARRAY_LAYERS, which the validation layer asks for on such an image
(WARNING-VkImageSubresourceRange-layerCount-compatibility, met on lavapipe with layerCount 1, job
m3-max-73446). Load and store "only update values within the defined render area" of the view's
plane. The view is bound to no descriptor
(VUID-VkDescriptorImageInfo-descriptorType-06713).

Portability: KosmicKrisp, Mesa 26.3.1's source (src/kosmickrisp/vulkan), names no portability
subset, so the M3 device is not asked: a source read, unaudited at run time. MoltenVK reports
imageView2DOn3DImage (profiles/moltenvk-m3.json) and is below the floor anyway.

Conformance: the suite's `layered-attachment-places` crosses `depthPlane` over a 3D target of three
planes, recorded on Metal. Its runtime side now sets a colour attachment's `depth_plane` (a depth or
stencil attachment's plane stays Unavailable), and its twelve known-gaps-rt.tsv rows go.
docs/REFUSALS.md, docs/METAL-COVERAGE.md (depthPlane implemented), docs/CONFORMANCE-COVERAGE.md and
api_signatures.tsv are regenerated.

Tests:
- tests::depth_planes (device cfgs): RGBA8Unorm and RGBA16Float, ShaderRead | ShaderWrite |
  RenderTarget, Managed, an 8 x 8 x 4 texture of two levels (the second 4 x 4 x 2) and an 8 x 8 x 1
  one, every plane written first by replace_region. One command buffer: level 0's plane 2 cleared
  and drawn, level 1's plane 1 cleared and drawn, level 0's plane 0 loaded and drawn, level 0's
  plane 1 cleared alone, the one-deep texture cleared and drawn; every plane of both levels copied
  out and sampled at each texel's centre through a nearest sampler state (level 1 through a 3D view
  of it). A plane past level 1's depth is AttachmentPlace, a pass of two layers TextureType.
  tests::layouts records each rendering's colour attachment's view type and range and its image's
  type and create flags, which the cell asserts and prints.
- tests::floor: the portability features asked and enabled include imageView2DOn3DImage.
- The validation layer, which every device test runs under and which fails a test on any warning,
  holds the barriers: without barrier_layers the cell drew
  WARNING-VkImageSubresourceRange-layerCount-compatibility on lavapipe (job m3-max-73446).

Verified (tree of this commit, run as f748e9e8d2 on development 6047a2d8b6):
- msi, lavapipe (Mesa 26.2.4), job m3-max-73464: fmt, clippy (no cfg, m2v_gpu, m2v_cpu_icd),
  rustdoc, the refusal, signature, Metal-coverage and conformance-coverage checks all exit 0; the
  runtime's suite under the validation layer 734 passed, 3 skipped (the cell among them); the
  conformance crate's suite 1037 passed; `conformance replay --cpu` exit 0, the ledger exact,
  layered-attachment-places "announced" (the native-nan-encoding degrade notice alone).
- One leg a vendor, a nextest archive and the conformance command built on msi (job
  m3-max-73466), under the Khronos validation layer 1.4.363.0: the cell (its form printed: a 2D
  view, base layer the plane, at the level, of a 3D image made with 2D_ARRAY_COMPATIBLE, 0x28 for
  RGBA8Unorm with MUTABLE_FORMAT, 0x20 for RGBA16Float; every plane of both levels and of the
  one-deep texture exact, copied out and sampled), the blit, floor, layouts, layered, no
  attachment, over, pass, render, resolve, shadow, texture, view and depth/stencil route and copy
  families (123 tests), and `conformance replay --gpu` (exit 0, the ledger exact,
  layered-attachment-places "announced" as on lavapipe):
  - Intel Iris Xe (ANV, Mesa 26.2.6), job m3-max-73476: cell passed, 123 passed, replay exit 0.
  - AMD Radeon 780M (RADV PHOENIX, Mesa 26.2.6), job m3-max-73477: cell passed, 123 passed,
    replay exit 0. (The XTX's node was held by another job for 47 more minutes.)
  - NVIDIA RTX 3090 (620.70.06), job m3-max-73478: cell passed, 123 passed, replay exit 0.
2026-11-24 01:35:19 -08:00
Anees Iqbal 6047a2d8b6 Runtime: whether a declaration covers a held attachment is settled as declarations and moves are made, and a draw tests it alone
What: Declarations::held answers whether a read declaration of the encoder covers an attachment
or resolve its pass holds out of its home layout (Pass::held). use_resource sets it for a read
of a held attachment's hazard id (the texture, a view of its image, or the buffer it lies over
in place), use_heap for a new heap a held attachment lies in, and the feedback moves for a
newly held attachment an earlier declaration covers. A draw counts in
Metrics::unslotted_attachment_reads where the answer is set and it may read beyond its slots
(its pipeline reads unbound, or an indirect command buffer's execution), testing the flag first,
in place of the walk of the pass's attachments against the declarations that every draw ran.
The answer only grows within an encoder: declarations are never withdrawn (a re-declaration
merges accesses), an attachment's layout leaves home only through the feedback moves and returns
only at the encoder's end, and a new pass is a new encoder with no declarations, so it equals
the walk's at every draw. The README's encoder-call contract says so.

Why: 78998777a2 moved the check into every draw and cost draw_2000 11.0 user-space instructions
a draw on the encoding thread, though no draw of it reads beyond its slots. Measured with a
probe harness (not landed) that counts the harness thread's instructions over each draw call
alone, 20 runs x 2 rounds per arm, order reversed in the second, RTX 5080 Laptop (NVIDIA
615.71.09, no layer), job m3-max-73399: ec9e2771d0 1,002.8 a draw (runs 1,002.8-1,003.0),
2c95b330e5 1,001.9 (3b76e461a2 alone does not build), 78998777a2 1,012.8, 205c8d2398 1,012.8,
205c8d2398 with 78998777a2 reverted 1,001.9; bind_2000 2,123.2 / 2,131.2 the same way. A
pipeline that reads beyond its slots paid the whole walk on every draw.

Budget: the test every_device_walks_no_attachment_at_a_draw_after_no_change counts the walks of
the pass's attachments (pass::TARGET_WALKS, test builds only) over 64 draws after the first since
a change: none for a pipeline that reads nothing beyond its slots, before and after the target is
declared read, and none for the argument-buffer pipeline, whose 65 draws each count one
unslotted attachment read. Without the change the last 64 draws walk 64 times.

How verified: the job ids of the check, the 5080 instruction arms and the AMD held_loop_reads leg
are in the lane's report to the lander.
2026-11-24 01:16:11 -08:00
Anees Iqbal 99293cc265 Conformance: Metal's times for the Depth32Float_Stencil8 copy case, kept in its recording
`conformance times --runs 8 --write depth-stencil-copies-d32s8`, built --release, was run on the
reference M3 Max (job m3-max-73405, at the case's tree plus the regenerated coverage doc). It
added one time record to the recording and changed nothing else, which a comparison of the JSON
keys before and after confirmed: the keys format, case, suite_version and answers are equal, and
times is the one key added, holding one record (native Metal, 8 rounds). Without it,
times::every_case_is_timed failed (job m3-max-73383).
2026-11-24 01:06:20 -08:00
Anees Iqbal 50a851487c Conformance: a copy between two Depth32Float_Stencil8 textures, recorded on Metal
What: the case depth-stencil-copies-d32s8 (cases/depth_stencil_copies.rs), its recording from the
M3, and docs/CONFORMANCE-COVERAGE.md regenerated with it. Two 8 x 4 Depth32Float_Stencil8 textures
of ShaderRead | RenderTarget | PixelFormatView usage, private. Each plane of each is written from a
buffer through the plane options, every texel a depth and a stencil of its own, the two textures'
apart. One copyFromTexture:...toTexture:... moves 5 x 2 texels from the source's (1, 1) to the
destination's (2, 2). Both planes of both textures are then copied out through the plane options
and read: four byte sites, laid out in the textures' rows.

Why: the runtime now copies such a texture whole, both aspects in each vkCmdCopyImage region,
because Metal's texture-to-texture copy takes no plane option. The case puts that to Metal and
holds the runtime to Metal's own bytes. The unit test the_recorded_copy_moved_both_planes holds
the recording to the host's model, so a release in which Metal moves one plane alone shows as a
failing test naming the site. The case declares the restricted-depth-upload notice allowance, as
format_copies does: the depth planes take their bytes from a buffer, and every depth written lies
in [0, 1], so the note moves no byte the case reads.

Verified:
- Job m3-max-73350 (Apple M3 Max, macOS 27.0.1) ran `conformance record
  depth-stencil-copies-d32s8`. Plain Metal: 3 runs, one outcome, status Completed. The
  destination's region holds the source's depth and stencil, every other texel of both textures
  is what was written. The validated leg ran. An earlier attempt, m3-max-73338, ended in its build
  (the compiler cache's daemon) before any Metal call.
- Job m3-max-73383 (msi, lavapipe, Khronos validation layer 1.4.363.0) at the case and its
  recording, the coverage doc regenerated in the job:
  - coverage.py wrote docs/CONFORMANCE-COVERAGE.md, the one committed here (187 case modules,
    1333 recordings, depth_stencil_copies one case, every field compared);
  - fmt; clippy of metal2vulkan-conformance plain, --cfg m2v_gpu and --cfg m2v_cpu_icd;
  - the case's three unit tests passed, the_recorded_copy_moved_both_planes among them;
  - rustdoc -D warnings; coverage.py --check;
  - `conformance replay --cpu depth-stencil-copies-d32s8` exited 0: verdict announced, every
    byte site Metal's, the one difference the restricted-depth-upload notice the case declares
    (its allowance fired);
  - the conformance suite on lavapipe under the validation layer: 1038 run, 1037 passed. The one
    failure was times::every_case_is_timed (the new recording held no timing), which the next
    commit, Metal's times for this case, answers.
2026-11-24 01:06:14 -08:00
Anees Iqbal 35fcaa9de4 Runtime README: the stencil-export known gap names the WebGL operation that reaches it
On a device without VK_EXT_shader_stencil_export (NVIDIA's 615 and 620 drivers on the cards run),
a fragment function's [[stencil]] output is refused at creation. A read of the public GL-on-Metal
layer's Metal back end shows a WebGL 2 page reaches that refusal: the layer copies stencil for
blitFramebuffer with STENCIL_BUFFER_BIT by a draw whose fragment function writes [[stencil]],
and it takes that path on a Metal device it does not take for an Intel or NVIDIA GPU. The known
gap now says so, where a user reads it. No behaviour changes; the refusal stays a known gap (a
second form chosen by that extension's query is not built).

Verified: cargo fmt; the docs check follows on development.
2026-11-24 00:54:42 -08:00
Anees Iqbal 205c8d2398 Tests: a rendered depth-and-stencil view copied into level 0 of a six-level texture, then sampled
What: tests::depth_stencil_route, a device cell (--cfg m2v_gpu or m2v_cpu_icd) of the guest route
that met Gap::TextureCopy, in the shape the consumer reported: a page's GL layer gives a drawn
Depth32Float_Stencil8 texture more levels by copying its level 0 into a new texture, then samples
it.

- A 32 x 32 Depth32Float_Stencil8 texture of one level, ShaderRead | RenderTarget |
  PixelFormatView, Private, and a view of it of the same format over level 0 and slice 0. One pass
  takes the view as its depth and its stencil attachment, Clear and Store: the stencil cleared to
  0x5a, and one draw of the owned depth_fill pair writing each quadrant's depth (0.2, 0.4, 0.6,
  0.8) under an always-passing depth test that writes.
- One blit encoder copies the view's level 0 into level 0 of a new six-level texture of the same
  usage and storage, then five never-written one-level textures, 16 x 16 down to 1 x 1, into
  levels 1 to 5, and reads level 0's two planes back through the plane options.
- A view of the six-level texture over its six levels, swizzled (R, 0, 0, 1), is sampled at each
  texel centre of level 0 by the owned rrp_mirror_clamp fixture: raw through texture2d<float>
  and a nearest sampler, and through depth2d<float> and a sampler comparing LessEqual at 0.5.

Every texel is exact: each depth bit for bit and the stencil 0x5a; each raw answer (depth, 0, 0,
1); each compared answer 1 where 0.5 <= depth and 0 elsewhere. tests::layouts records six
vkCmdCopyImage into the six-level texture, the first from the parent's image (the view's image is
asserted to be its parent's), the rest from the small ones, each TRANSFER_SRC_OPTIMAL to
TRANSFER_DST_OPTIMAL with one region of DEPTH | STENCIL on both sides. The run prints the formats,
aspects and layouts it recorded.

Why: the plain cell copies between textures made as such; the route copies from a view that is
an attachment of the pass before it, into one level of a mipmapped texture, and samples the
result through a swizzled view and a comparison sampler. A copy from a view needs nothing the
form lacks: a view's copy side is its parent's image at the view's base level and slice.

Verified: job m3-max-73322 (msi, lavapipe, Khronos validation layer 1.4.363.0) exited 0 at every
step: fmt; clippy of metal2vulkan-runtime plain, --cfg m2v_gpu and --cfg m2v_cpu_icd; rustdoc -D
warnings; refusal_surface.py --check; the rt suite on lavapipe under the validation layer, 732
passed, 3 skipped, this cell among them, no validation error; the lane's tests, 29 passed. The
per-vendor runs follow on the cards.
2026-11-24 00:36:40 -08:00
Anees Iqbal 95d350e606 Blit: a copy between textures of a format of depth and stencil both copies both aspects in each region
What: BlitCommandEncoder::copy_from_texture of Depth32Float_Stencil8 into Depth32Float_Stencil8
was Gap::TextureCopy. texture_copy refused a source with no copy unit, and copy_unit gives a
format of depth and stencil both none, since no buffer copy takes both aspects in one region.
Now a single-sample texture whose Metal aspects are depth and stencil copies in regions of
texels, each vkCmdCopyImage region naming DEPTH | STENCIL on both sides. The same structural rule
covers Depth24Unorm_Stencil8 where the device holds it (D24_UNORM_S8_UINT, its one made form).
copy_unit is unchanged: a buffer copy of such a format still takes a plane option.

Why: a guest route meets the refusal. A browser's GL layer re-makes a depth-and-stencil texture's
storage by copying level 0 into a new texture, and the refused copy left the new texture reading
0. Documented Metal copies the whole pixel: MTLBlitCommandEncoder.h's
copyFromTexture:...toTexture:... is "Copy a rectangle of pixels between textures" and takes no
option; Apple's page for MTLPixelFormat.depth32Float_stencil8 calls it "A 40-bit combined depth
and stencil pixel format"; MTLBlitOption.depthFromDepthStencil "copies the depth portion of a
combined depth and stencil texture to or from a buffer" and is listed for the two buffer copies
alone.

Vulkan (1.4.366, section 26.3): VkImageSubresourceLayers::aspectMask is "a combination of
VkImageAspectFlagBits, selecting the color, depth and/or stencil aspects to be copied". The two
masks match (VUID-vkCmdCopyImage-pRegions-12201), name aspects both images have (-00142, -00143),
and the formats are one (-01548). Every image the runtime makes has the transfer usages, which
its image format query checked (-06662, -06663). The layouts are TRANSFER_SRC_OPTIMAL and
TRANSFER_DST_OPTIMAL, or GENERAL within one subresource (-09460). The copy's barriers already name
every aspect of the image. Depth32Float_Stencil8 has one candidate format, D32_SFLOAT_S8_UINT, so
no usage gives two textures of it two formats: the refusal on the route was the missing unit, not
the gap's second condition.

A copy within one such texture takes the existing slab cut by texel shift, which needs no unit:
regions apart in one command in the general layout, overlapping regions in slabs, the far end of
the shift first. A texture in place over a buffer never has such a format (Buffer::new_texture
refuses a format of other than one color texel an element), so the in-place arm keeps the unit's
texel bytes. Still Gap::TextureCopy: a multisample texture, one pixel format in two Vulkan
formats, a 1D texture with another type, a texture buffer. error.rs's gap doc and the runtime
README's copy section say so. docs/REFUSALS.md does not change: its row quotes the gap's first
sentence, which stands, and refusal_surface.py --check passed.

Tests:
- tests::blit, a_format_of_depth_and_stencil_both_copies_both_aspects_in_each_region (host): a
  copy between two such textures and within one, regions apart and overlapping, each region of
  both aspects; Depth32Float_Stencil8 at 4 samples stays the gap.
- tests::depth_stencil_copy (device cfgs): Depth32Float_Stencil8 at 300 x 150, Private, render
  target and shader read. A pass clears both textures; blits write a region of the source's depth
  (i / 65536) and an overlapping region of its stencil (varied bytes). One encoder copies a
  region from the source into the destination, then a region of the destination into another
  apart from it, then a region onto itself shifted (1, 2). Both planes of both textures read back
  through the plane options are the host's model, every texel. The same at 4 x 150 for
  Depth24Unorm_Stencil8 where the device holds it, else SKIPPED with the format query's answers.
  Its depth is read through the owned depth_fill fixture's depth_fill_read before and after the
  copies, as no buffer copy takes it.
- tests::layouts records vkCmdClearDepthStencilImage, with which the runtime zeroes each placed
  depth-and-stencil image (it was on the unrecorded list, which panicked on it). It also keeps
  each vkCmdCopyImage's regions' aspects. The cell asserts the recorded aspects and layouts and
  prints them with the formats.

Verified:
- Job m3-max-73313 (msi, lavapipe, Khronos validation layer 1.4.363.0) ran the cell exact:
  - "Depth32FloatStencil8 in VK_FORMAT_D32_SFLOAT_S8_UINT ..., 300 x 150: 32 vkCmdCopyImage,
    every region VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT from and to; between the
    textures VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL to VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, within
    the destination VK_IMAGE_LAYOUT_GENERAL (apart 1 command, overlapping 30 in slabs); both
    planes of both textures exact, 45000 texels each";
  - Depth24Unorm_Stencil8 in VK_FORMAT_D24_UNORM_S8_UINT, 5 commands, 600 texels each exact.
  Its one red was clippy under the device cfgs (chunks_exact in the test), fixed here.
- Job m3-max-73314 (msi, this tree) exited 0 at every step:
  - fmt;
  - clippy plain, --cfg m2v_gpu and --cfg m2v_cpu_icd;
  - rustdoc -D warnings;
  - refusal_surface.py --check;
  - the rt suite on lavapipe under the validation layer: 731 passed, 3 skipped, 0 validation
    errors;
  - the lane's tests: 29 passed.
- The translator crates are untouched, so Device::new's modules, refusals and notes cannot change.
2026-11-24 00:32:28 -08:00
Anees Iqbal 5dd21ff1ae Runtime README: an encoder call's one reference count change is a command buffer keeping a fence
The "Encoder calls" section said an encoder call makes no reference count change. update_fence and
wait_for_fence clone the fence's Arc the first time a command buffer's encoders name that fence
(fence.rs Fences::update and Fences::wait, kept in the command buffer, command.rs). The section now
says so. The code is unchanged: it is one atomic per fence a command buffer, about 280 a frame in a
compositor frame of 140 render encoders with one update and one wait each.

Found by a read of rt's per-frame work (no job). Verified: cargo fmt; the docs check follows on
development.
2026-11-24 00:18:12 -08:00
Anees Iqbal 931e44f4ca Tests: the 10-bit step note takes the words as four-byte chunks
clippy's chunks_exact_to_as_chunks failed the device cfgs (--cfg m2v_gpu and --cfg m2v_cpu_icd)
on ae425d92ed's steps_off, which walked the words with chunks_exact(4). It now walks
as_chunks::<4>, and channels10 takes a [u8; 4], so the word needs no conversion that can fail.
The output is the same.

Verified: cargo fmt. At ae425d92ed, which only differs in this walk, every cell was exact on
lavapipe and on the 780M under AMDVLK and RADV. On this commit the clippy run in every cfg,
lavapipe and the 780M run again.
2026-11-23 23:45:42 -08:00
Anees Iqbal ae425d92ed Tests: every 10-bit write of the render cells is k / 1023, and a 10-bit cell that is not exact says how many steps off it read
Rounding the read (1accf8c75f) left lavapipe's 2560x1600 BGR10A2Unorm screen as it was: 773
where 772 was expected, the first at (772, 0), at 3,553,017 of 4,096,000 texels. So the read
was exact, and 1accf8c75f's reading of the cause was wrong. The write is what moves:
lavapipe's A2R10G10B10 target stores the quarter-step write (k + 0.25) / 1023 as k + 1 once k
reaches about 767. Its stores in the runs of 171d81e6f6, b8ccc837a8 and 1accf8c75f all fit the
integer part of f * 1024, which stores k / 1023 as k. R3's RGB10A2Unorm cells passed with the
quarter step because their channels stay below 259. AMDVLK and RADV stored both forms as k.

Vulkan pins only an exactly integral r: convertFloatToUint "returns one of the two unsigned
binary integer values with exactly b bits which are closest to the floating-point value r", and
"If r is equal to an integer, then that integer value must be returned" (Conversion From
Floating-Point to Normalized Fixed-Point). Neither form is guaranteed, so the cells rely on each
device's rounding of what they write, and now with one form a width: every 10-bit write (the
pattern, unorm10_pair for R3 and unorm10_one for the screen, the clears, and loop_one's
complement) is k / 1023, and k / 3 for alpha; every 8- and 16-bit write keeps its quarter step.
loop_one takes its width's part of a step from buffer 0's third float4. The compares stay
exact: a one-step tolerance would hide a read one texel off in x, since red is x.

A device that stores a form otherwise fails a cell by its own rounding, not by a wrong texel.
Each 10-bit cell that is not exact (R3's first sample and its three reads, the screen's copy-out
and its sampled read) now prints the first wrong texel's word and channels as read and as
wanted, the difference in steps, and how many wrong texels are one step off at most in every
channel. The module doc states what the cells rely on.

Verified: cargo fmt. lavapipe, the 780M under AMDVLK and RADV, then the Windows host's UHD 630
rerun on this commit.
2026-11-23 23:43:40 -08:00
Anees Iqbal 1accf8c75f Tests: the screen cell's loop rounds what it read to the channel's step before writing its complement
The quarter step of b8ccc837a8 moved lavapipe's 2560x1600 BGR10A2Unorm screen from 250 to 773
(772 expected) at 3,553,017 of 4,096,000 texels: lavapipe's sampled 10-bit value is off by more
than a quarter step, though less than half of one, as its sampled reads of RGB10A2Unorm, which
round v * 1023 + 0.5, are exact. Vulkan allows either nearest value on the write
(convertFloatToUint "returns one of the two unsigned binary integer values with exactly b bits
which are closest to the floating-point value r"), so the cell may depend on neither the read's
last bits nor the write's rounding.

loop_one now takes each channel's largest value L, rounds the read v to its step,
k = uint(v L + 0.5), as the packed readers do, and writes (L - k + 0.25) / L: the complement of
the value it read, exact on any device whose read lies within half a step and whichever of the
two nearest values its write takes.

Verified: cargo fmt. The 780M under AMDVLK and RADV and lavapipe rerun on this commit, then the
Windows host.
2026-11-23 23:33:48 -08:00
Anees Iqbal b8ccc837a8 Tests: the screen cell's loop writes its complement a quarter step above, so either rounding lands on it
On lavapipe the 2560x1600 BGR10A2Unorm screen's loop wrote red 250 where 251 was expected at
1,258,012 of 4,096,000 texels: 1 - 772/1023 is a hair under 251/1023 there, and lavapipe stores
the lower of the two nearest values. Vulkan allows that: convertFloatToUint "returns one of the two
unsigned binary integer values with exactly b bits which are closest to the floating-point value
r. Implementations should round to nearest" (Conversion From Floating-Point to Normalized
Fixed-Point). AMDVLK and RADV stored 251.

The loop now takes 1 + 0.25 / (the channel's largest value) less what it read, the same quarter
step the pattern's (k + 0.25) / largest takes, so the complement (largest - k + 0.25) / largest
lands on largest - k whether the device rounds to the nearest value or down; at k = 0 it clamps
to 1, the largest value.

Verified: cargo fmt. The 780M under AMDVLK and RADV and lavapipe rerun on this commit, then the
Windows host.
2026-11-23 23:31:50 -08:00
Anees Iqbal 171d81e6f6 Tests: icon layers cleared and drawn in part, and screens sampled through their view in their own pass
A guest draws its icons through Private targets of rt's own: BGRA8Unorm at 256x128 and at
256x192 of three levels and RGBA16Unorm at 256x128, each cleared by a pass of one attachment and
drawn into; and into 2560x1600 BGRA8Unorm and BGR10A2Unorm screens rendered through an
own-format view, loaded, whose draws sample the view while it is the pass's attachment. No cell
had these shapes: the loop cell stops at 1024x1024 and renders into the texture itself.

every_device_draws_icon_layers_in_part_after_a_clear_every_texel blits the complement into each
layer, clears it and draws the pattern into a rectangle that leaves 37 to 45 texels of the clear
on each side; level 0 is copied out and sampled (RGBA16Unorm in two reads), every texel
compared. every_device_samples_a_screen_through_its_view_in_its_own_pass_every_texel blits the
complement into each screen, then through its view loads it, draws the pattern into the same
rectangle and after a memory barrier samples the view at each pixel's centre, writing the
complement of what it read; copied out and sampled through the view, every texel compared, each
line with the device's form and the pass's attachment_loop_reads and attachment_read_copies.

Verified: cargo fmt. The device runs (the 780M under AMDVLK and RADV, lavapipe, the Windows
host) follow on this commit.
2026-11-23 23:29:57 -08:00
Anees Iqbal 2f06447cd1 Tests: two-target passes that sample each target in their own pass, every texel
A guest's icon renderer draws into an RGBA16Float target and an RG16Float one in one pass and
samples each while it is the pass's attachment: at 256x256 through the RGBA16Float texture's
own-format view, then blits that texture into a Private buffer in rows of 2048 bytes; and at
448x256, loading the RGBA16Float target. No cell had a second attachment, RG16Float, a read of
attachment 1, or the download into a Private buffer.

every_device_samples_both_targets_of_a_two_target_pass_in_it_every_texel draws the float pattern
into both targets, cut to a rectangle that leaves 37 to 45 texels of attachment 0's clear (or
load) on each side, then after a memory barrier samples attachment 0, or in another pass
attachment 1, at each pixel's centre and writes the complement of what it read; attachment 1's
red and green land in attachment 0. Attachment 0's texture is copied out, attachment 0 sampled,
and the 256x256 texture downloaded into a Private buffer and copied out of it, every texel
compared. Each line names the device's form (feedback loop or shadow copies) and the pass's
attachment_loop_reads and attachment_read_copies.

real_size_overs.rs shares its float pattern, its halves and floats, and its float shaders
(pub(crate)), which the new cell reads through.

Verified: cargo fmt. The device runs (the 780M under AMDVLK and RADV, lavapipe, the Windows
host) follow on this commit.
2026-11-23 23:23:36 -08:00
Anees Iqbal f0dcdf5adc Tests: the block-render cell names image layouts and feature bits without ash's Debug
ash builds without its debug feature here, so vk::ImageLayout and vk::FormatFeatureFlags2 have no
Debug: the cell names the layouts a pass and a home take, else prints the number, and the
missing linear features as hex.

Verified: cargo fmt; the 780M build of the previous commit stopped on these two formats alone.
2026-11-23 23:16:16 -08:00
Anees Iqbal 0bbc369c2b Tests: render targets over one Shared block, cleared and drawn in part, every texel
No test rendered into a texture over a buffer at an icon's size: the real-size cells read such
textures, and over_aliases.rs renders a 1000x3 one. A guest's icon renderer clears and draws
into textures over one 16 MiB Shared block, synchronizes them and reads the bytes on the CPU.

real_size_renders.rs: every_device_renders_icon_targets_over_one_shared_block_every_texel makes,
in one Shared block, after the CPU wrote the complement into their rows, BGRA8Unorm 256x256
rows 1024 (read, write, render target), R8Unorm 256x256 rows 256 (also pixel format view, with
an A8Unorm view) and RGB10A2Unorm 258x258 rows 1280, side by side at 4 KiB places, then two more
over the bytes of the BGRA8Unorm one once it is released. Each is sampled, drawn by a pass whose
attachment 0 it is (Clear/Store) and attachment 1 a Private RG16Float target of its size
(DontCare/DontCare, and Clear/DontCare for one), one draw cut to a rectangle that leaves 37, 41,
45 and 39 texels of the clear, then synchronizeResource. Three reads, each a cell: the block's
bytes on the CPU, a blit into another buffer, and sampling (and the A8Unorm view); then the
block's bytes outside the texels; at the end the whole block. Each line names the form (in
place with the linear image's pitch, offset and size, or copied for its cause with the linear
tiling's missing features), the layout the pass renders in, the home between commands, the
pass's areas and the over-copies counted.

Verified: cargo fmt. The device runs (the 780M under AMDVLK and RADV, lavapipe, the Windows
host) follow on this commit.
2026-11-23 23:14:41 -08:00
Anees Iqbal 78998777a2 Runtime: every draw that may read beyond its slots checks for a held attachment it declared, not only draws that look at their reaches again
aab995f44d ran the check in draw_reaches, which a draw enters only where it reads
an attachment through a slot, reaches Managed memory or textures over buffers. A
draw through an argument buffer alone never entered it, and the held-loop-reads
test read 0 where it wants 1 (lavapipe job m3-max-73034, RADV 780M job
m3-max-73035). The check now runs in the draw itself, after the draw's own
feedback moves are recorded, so it sees the layout the draw reads in.
2026-11-23 21:54:23 -08:00
Anees Iqbal 2c95b330e5 Runtime: the unslotted-attachment-read check reads the heap block's own id and lets go of the pass before the draw is recorded
ae4dfd67b9 did not build: memory::Block keeps its id under its memory, and the
pass borrowed for the check was held by the resolves iterator past the draw's
mutable borrows. The check now runs in its own block. Verified by the clippy,
lavapipe and RADV 780M jobs named with this branch's report.
2026-11-23 21:54:23 -08:00
Anees Iqbal 3b76e461a2 rt: count draws that may read their own pass's attachment beyond their slots; the known gap in the README
What: Metrics::unslotted_attachment_reads counts a draw whose functions may read beyond their slots
(Draws::reads_unbound, or an indirect command buffer's execution) while a use_resource read or a
use_heap of the encoder covers a texture that is an attachment of the pass (a target or, in a
resolving pass, a resolve) out of its home layout. The check walks at most the pass's attachments
and the encoder's declarations, allocates nothing, and runs only for such draws; use_heap now
records its blocks, and a texture answers the block of the heap its image lies in. The replay's
counts line carries the counter. The README's known gaps of render encoders say that such a read
names a descriptor whose layout differs from the image's, which Vulkan leaves undefined
(VUID-vkCmdDraw-imageLayout-00344), that the counter counts it, and that the image is back home once
the pass ends. The held-loop-reads test asserts one in each pass that reads the attachment through
its argument buffer (after a slot's read moved it to the feedback layout, and alone, in the
attachment layout) and none for the control, whose entry names a texture that is no attachment.

Why: the ruling is rung 4 of the workaround ladder. A home in the feedback layout for every colour
render target turns compression off on RADV (radv_layout_dcc_compressed and its HTILE and FMASK
counterparts), a loss on every AMD render target; VK_KHR_unified_image_layouts would be a
query-chosen tenth form. The validation layer cannot see the mismatch: core validation checks only
statically accessed elements, and GPU-assisted validation's descriptor layout check is off in the
layer's source. So the gap is recorded and the counter tells whether a guest meets it.

How verified: the job ids of fmt, clippy (plain, m2v_gpu, m2v_cpu_icd), lavapipe and the 780M's
device suite under RADV are reported to the lander.
2026-11-23 21:54:23 -08:00
Anees Iqbal a79c6eef2a Tests: the held-loop-reads test draws a control through an entry naming a green texture first
What: the same argument-buffer draw, through an entry naming a green texture, into the target's
first pixel; the pixel must be green. So the fragment function runs and reads the texture its entry
names, and a layer that checks only the descriptors a shader accessed sees the target's read.

How verified: the lavapipe run with GPU-assisted validation is reported with its job id.
2026-11-23 21:54:23 -08:00
Anees Iqbal d94b8f76fb Tests: a draw reaches its pass's attachment through an argument buffer, after a slot's read and alone
What: a device test that renders into a shader-read target and, in the same pass, draws with
resident_draws' rd_entry functions, which sample the target through the resource ID an argument
buffer holds: once after own_pixel_fragment read the target through a slot (the feedback move on a
device with the loop) and once in a pass of its own. It checks each pass's
Metrics::attachment_loop_reads (one, then none) and prints the device's attachment reads and loop.

Why: set 1's sampled element names the image's home layout while the pass holds the image in the
attachment or feedback layout (VUID-vkCmdDraw-imageLayout-00344, -None-09600). The test is the
reproduction; the layer's messages fail it.

How verified: the lavapipe run is reported with its job id.
2026-11-23 21:54:23 -08:00
Anees Iqbal ec9e2771d0 Tests: icon textures over a Shared block, refilled by the CPU and sampled each frame, name the form each took
BGRA8Unorm at 48x48, 76x76, 108x108 and 256x256 and RGBA16Float at 48x48 and 384x384, in tight
rows over a Shared block of rt's own, read by shaders: the CPU writes the pattern, its complement
and the pattern before three frames, each frame sampled and every texel compared. Each cell names
how the texture holds its texels: copied for its cause, or in place with the row pitch and offset
vkGetImageSubresourceLayout reports for its linear image, beside the buffer's rows; the other
over-texture tests print the same.
2026-11-23 21:34:20 -08:00
Anees Iqbal 928740ee2d Tests: the icon over-textures at the consumer's icon shapes too
Textures over a buffer at 48x48, 76x76 and 108x108 BGRA8Unorm and 48x48 RGBA16Float in tight
rows, and 1024x1024 BGRA8Unorm in rows of 10,240 bytes (2,560 texels, wider than the texture)
with render-target usage beside shader reads, each over host memory's import and over a Shared
block, read as the other icon shapes are: the complement sampled, then the pattern sampled,
read(), copied out and sampled again, and the buffer's bytes after. Each shape now carries its
descriptor's usage.
2026-11-23 21:33:06 -08:00
Anees Iqbal 01b6f08ae7 Tests: the float picture's two writers are chosen by a flag, not an array of closures
clippy (-D warnings, m2v_gpu and m2v_cpu_icd) refused the array's type as too complex (job
m3-max-72965).
2026-11-23 21:22:53 -08:00
Anees Iqbal b2852a7e67 Tests: textures over a buffer at icon and picture sizes, an attachment sampled in its own pass, and a 4K float picture copied out, every texel compared
No device test read a texture over a buffer in its copied form past 64x8, sampled a render target
in its own pass past 8x8, or copied out a float picture past 1024 texels wide. These tests
(tests/real_size_overs.rs) do, with real_size.rs's readers and cells:

- textures over a buffer in host memory's import and in a Shared block of rt's own, BGRA8Unorm
  at 256x256 and 1024x1024 and RGBA16Float at 256x256, in tight rows and in rows 64 bytes wider
  from 192 bytes in, and BGRA8Unorm at 3840x2160 (rows 15,360) and 2845x1600 (rows 11,392):
  the CPU writes the complement and a sampled read takes it, then the CPU writes the pattern
  and sampling, read(), a blit out and sampling again each read every texel, and the buffer's
  bytes are compared after; each texture's form (in place, or copied for its cause) and its
  over-copies are printed;
- BGRA8Unorm and RGBA16Float render targets at 256x256 and 1024x1024 sampled at each pixel's
  centre in their own pass, after a clear and after a draw of the pattern and a memory
  barrier, each writing the read's complement; each cell names the loop form (feedback loop or
  shadow copies) and the pass's attachment_loop_reads and attachment_read_copies;
- an RGBA16Float 3840x2160 texture written by a render pass and by a kernel over its
  complement, copied out into a Shared buffer and into a 64,804 KiB buffer over host memory;
- a device-free test that the float pattern (each channel 1 + k/1024) names its texel, is
  exact in a half and a float, and differs from its complement in every channel.
2026-11-23 21:22:53 -08:00
Anees Iqbal d623db00bd Tests: the real-size Direct3D 11 planes' textures take the consumer's plane usage
The consumer's planes are textures of ShaderRead | RenderTarget | PixelFormatView usage (its
exported.rs PLANE_USAGE, 0x1 | 0x4 | 0x10). The cell's descriptors had ShaderRead alone, so the old
form's format list was only the image's and the view's formats, and OLD-B made the same image as
the import (m3-max-72949). With PixelFormatView the old form lists every format the texture views
as, so OLD-B now carries the long list the import made before, beside the import's own.

Verified: cargo fmt only; the Windows build and the host run follow as potluck jobs.
2026-11-23 21:19:24 -08:00
Anees Iqbal 3e303fde15 Tests: the real-size cell names the old form's source, 3073230664's d3d11.rs
The old form's usage and list are recomputed from import_d3d11_surface in
crates/metal2vulkan-runtime/src/d3d11.rs at 3073230664 (its WANTED usage and plane_list); the
comment now names that file and commit, so the test's old values can be checked against them.

Verified: cargo fmt only; a comment.
2026-11-23 21:17:52 -08:00
Anees Iqbal 83410f374b Tests: the real-size Direct3D 11 planes are made with the consumer's bind flags
dotsspec's helper takes the texture's bind flags; the real-size cell passes its BIND (0x28), as
the consumer makes the planes. Found by the Windows build of 22c0d3276e (m3-max-72941).

Verified: cargo fmt only; the Windows build follows.
2026-11-23 21:17:52 -08:00
Anees Iqbal 473ffd63f5 Tests: Direct3D 11 planes at a picture's real size, the import and the old form side by side
The Direct3D 11 import was read right only at 64x32 and 32x16. A lattice of right texels one
per 64x32, one 4 KiB block of a 16-bit plane, can only show at a real size. The import now
makes each plane's image of the usage its texture's bind flags give and lists no long format
list; this cell says on one driver, in one run, whether that is what reads a plane right.

Under m2v_gpu on Windows, on every device: the 16-bit picture (luma R16_UNORM 3840x2160, chroma
R32_UINT 1920x1080 viewed RG16Unorm) and the 8-bit one (R8_UNORM, R16_UINT viewed RG8Unorm), made
as the consumer makes them (default usage, BindFlags 0x28, MiscFlags SHARED | SHARED_NTHANDLE, no
keyed mutex) and imported with an index each. Direct3D 11 draws each plane's complement and then
its words (real_size.rs's position hash) through a render target view in the texture's own
format. Then, in this order, each read printed as it reads and compared, the test failing on any
texel wrong: rt samples every texel, reads it through read(), copies it out, samples it again;
Direct3D 11 reads it back through a staging copy; rt samples it a third time. Rt samples first
because a read can repair what it measures. Then Direct3D 11 draws the complement and rt's next
sample must read it.

Then two images over the same textures in the old form (development at 3073230664, recomputed in
the test and made by d3d11_plane_texture), each after a fresh draw so its first read follows one:
OLD-A, the import's usage plus storage where the old form took it, with the import's list; OLD-B,
the import's usage with the old form's long mutable list. Each is sampled once, every texel, and
printed with its usage and list, not asserted, and only read while it lives.

Verified: cargo fmt only; the Windows build and run follow as potluck jobs.
2026-11-23 21:17:52 -08:00
Anees Iqbal 4ff39956ce Runtime: a render pipeline's stages reach the driver with their specialization constants fixed
The follow-up to the compute pipelines' literal form, through the same pass.
A render content made each stage's shader module from the translator's words
and handed each graphics VkPipeline a VkSpecializationInfo with the stage's
sample count and amplification count. Now each stage's module is made once,
with the content, from metal2vulkan::pipeline::specialize(words, values),
values being those two constants by SpecId. Every graphics VkPipeline of the
content is created with no specialization. A constant of another key is still
refused as before (RenderPipelineKind::Specialization). A pass refusal releases
the stages made so far and returns Error::Translation.

render::Module drops its constants and values, stage_infos drops its
specializations parameter, and tests/subgroup_sizes.rs follows. rt's README
bullet on per-create specialized modules now covers render stages.

Verified by: the check job and the states-only play named in the landing
message. Every draw test exercises the new module path.
2026-11-23 21:17:29 -08:00
Anees Iqbal 439f94b6d7 Tests: rt's own picture planes are made in their images' formats and read through views
The planes test made each plane in the format the picture views it as, so on every platform but
Windows nothing read Plane::image, and clippy under m2v_gpu and m2v_cpu_icd stopped at the dead
field (aa4d376365). The consumer's chroma is an R32_UINT texture viewed RG16Unorm (R16_UINT viewed
RG8Unorm in the 8-bit picture), so the planes test now makes each plane's texture for its views
in the image's format (with PixelFormatView usage where the formats differ), writes it there by
blit, and reads it through a view at an index in the view's format: the same view rt makes over
an imported plane.

Verified: cargo fmt; clippy (plain, m2v_gpu, m2v_cpu_icd) and the lavapipe run follow as a potluck
job, the Windows build as another.
2026-11-23 21:14:34 -08:00
Anees Iqbal 8f6a6ad058 Tests: real-size readers, every texel compared, and rt's own picture planes at 3840x2160
A picture's planes were read right in tests only at 64x64 and below, and no device test compared
a texture past 1024 texels wide. The real-size tests share their readers here (tests/real_size.rs):

- two owned kernels, `packed_read` (`read()`) and `packed_sample` (nearest, normalized, at each
  texel's centre), each packing a texel's channels into a word, one thread a texel in 16x16
  threadgroups; a blit of the whole texture out; each read lands in a buffer first filled with
  the complement of the bytes it should read, so a word no thread wrote is wrong, and a driver
  that runs one thread a workgroup fails;
- one printed line a cell: exact, or the wrong texels' count, the first, and how many are right
  and where the first of those are; the test fails at the end if any cell is not exact;
- the agreed colour pattern (red x, green y, blue their high bits, alpha x ^ y, at 8 and 10 bits)
  and its complement, with a device-free test that it names its texel and that the complement
  differs in every channel.

On every device of the cfg's kind, the 16-bit picture (luma R16Unorm 3840x2160, chroma RG16Unorm
1920x1080) and the 8-bit one (R8Unorm, RG8Unorm) as rt's own textures: each plane written by a
blit of its complement, then of its words (a hash of the position), then read by sampling, by
read(), by a blit out and by sampling again, every texel compared.

Verified: cargo fmt only; the build and the lavapipe run follow as a potluck job.
2026-11-23 21:14:34 -08:00
Anees Iqbal b68b31b54a rt: the image's listed formats are read by the Direct3D 11 device tests alone, which build on Windows under m2v_gpu
What: the test accessor image_view_formats is compiled where its one caller is, the Direct3D 11
picture tests (Windows, m2v_gpu); under m2v_gpu elsewhere and under m2v_cpu_icd it was dead code.

How verified: job m3-max-72921's clippy at 000a0d2138 failed on it under m2v_gpu and m2v_cpu_icd
(host and windows-gnullvm); the checks rerun on this commit.
2026-11-23 21:13:23 -08:00
Anees Iqbal b573e68c11 rt: a Direct3D 11 plane's texture is made by one function of an explicit usage and format list
What: import_d3d11_surface derives every plane's usage and list first (d3d11_plane_form, from
the bind flags and the descriptor, its refusals before any plane is made), then makes each plane's
texture through d3d11_plane_texture(plane, usage, list, unit): the image of the plane's format
with that usage, mutable over that list where it is not empty, imported, bound, and the texture
over it under the plane's descriptor at its index. A plane's error drops the textures made before
it, which frees their images. A test can call the same function with other values, so a cell can
make an image the old way over the same Direct3D 11 texture and read it beside the import's,
with nothing of the old form in product code. docs/REFUSALS.md names the new site functions.

Docs: a plane is viewed in place in the image's own format, the descriptor's and the descriptor's
sRGB sibling. A view in another format has no in-place form on the import
(Gap::TextureView of SurfacePixelFormat), and the consumer takes the copy form of the same call
for it, a counted copy of the plane: the README's plane paragraph and a new entry in the known
gaps of memory blocks say so.

Correction to d310504408: it says the import never receives a view in another format. The
consumer does view a drawn plane (PixelFormatView) on the import itself in any format the guest
asks (surface_shapes.rs:233 and 247-257), so the narrow list does refuse views a guest reaches.
The ruling: the narrow list stays, and the consumer routes a texture over a drawn plane viewed in
another format to its counted copy shape.

Still owed on the same principle: the chroma's uint/unorm pair (R16_UINT under RG8Unorm, R32_UINT
under RG16Unorm) is the one reliance left past the texture Direct3D 11 made, besides the sRGB
sibling and the feedback usage. It is its own row, behind the diagnostic, and goes once the
consumer makes chroma R8G8_UNORM or R16G16_UNORM.

How verified: refusal_surface.py --check passes here. The Windows cross-build, the runtime's
checks, and the device run on the lab's Windows host (red at the parent, green here) are reported
with their job ids to the lander.
2026-11-23 21:13:22 -08:00
Anees Iqbal cd820256e0 rt: the Direct3D 11 usage test compares the usage past the bind flags with 0
What: the usage test's assert_eq! had lost its right-hand side (a stray comma where the 0 was), so
the Windows test build of 341c76960b failed to compile (the module builds only for Windows under
m2v_gpu or m2v_cpu_icd, so the host's clippy did not see it). It now compares the image's usage
past what the bind flags give with 0.

Why the list refuses nothing a guest reaches: 62c860ccb5 lists only the plane's own format, the
descriptor's and (341c76960b) the descriptor's sRGB sibling. Before it, a plane whose descriptor
asked PixelFormatView listed every same-size colour format Metal views it as, wherever the import
query took the list: the 10-bit luma (R16_UNORM) too was mutable with R16Uint, R16Sint, R16Snorm,
R16Float, the RG8 forms and the packed 16-bit forms, beside the STORAGE that 62c860ccb5 names. A
view in those formats is now Gap::TextureView of SurfacePixelFormat. The consumer views a texture
over a drawn plane in its own format or its sRGB sibling only (shapes.rs:22-25 at 360eef13fa), and
any other format goes to a shape of its own (shapes.rs:25-27), so the import never receives a view
in R16Uint, RG8Uint or a packed form. After this form the 10-bit luma is the Direct3D 11
description: not mutable, no storage.

How verified: the Windows cross-build of this tip compiles the test (341c76960b's did not, job
m3-max-72907). The device run on the lab's Windows host, red at the parent and green here, and the
runtime's checks are reported with their job ids to the lander.
2026-11-23 21:13:22 -08:00
Anees Iqbal 4ac7e7d4fb rt: a Direct3D 11 plane keeps its descriptor's sRGB sibling in its list; the views test covers a 10-bit luma
What: forward from 0c5794eec3. A plane's image lists, beside its own format and the descriptor's
where they differ, the descriptor's sRGB sibling (R8Unorm_sRGB of an 8-bit luma) where the device
holds it as a view of the plane's texture and the import query takes the list with the image's
usage, as before 0c5794eec3; the other formats a PixelFormatView texture views it as stay out, so
a 10-bit luma (R16Unorm, no sibling) lists none and is not mutable.

Why: two places remain where rt's image asks beyond the texture Direct3D 11 made, each with its
reason. (1) The chroma's uint/unorm pair (R16_UINT under RG8Unorm, R32_UINT under RG16Unorm):
rt's texture reads the texture's bits as two channels; it goes once the consumer makes chroma
R8G8_UNORM or R16G16_UNORM. (2) The 8-bit sRGB sibling: a guest may view an 8-bit plane through
it, and dropping it would add a refusal a guest can reach. The attachment feedback loop's usage,
where the guest's descriptor asks it, is the one usage beside the bind flags' (0c5794eec3).

Tests: the views test now imports three planes with ShaderRead | RenderTarget | PixelFormatView
usage (an 8-bit luma, a chroma, a 10-bit luma R16_UNORM): each lists no format past its own, the
descriptor's and the sibling, the chroma lists its pair, the 10-bit luma lists none, and a view
in a third format (R8Uint, RG8Uint, R16Uint) is Gap::TextureView of SurfacePixelFormat.
2026-11-23 21:13:22 -08:00
Anees Iqbal 1a289658e6 rt: a Direct3D 11 plane's image takes the usage its texture's BindFlags give, and lists no format past its own and its texture's
What: D3d11Plane gains bind_flags, the D3D11_TEXTURE2D_DESC BindFlags the consumer made the
texture with. The plane's VkImage takes copied from and into (Direct3D 11 copies any default-usage
texture with no bind flag), sampled for SHADER_RESOURCE, rendered for RENDER_TARGET and storage
for UNORDERED_ACCESS, each where the view format holds it and the import query offers it; no
longer storage, rendering and sampling whatever the texture was made with. The image lists its
own format and the descriptor's alone (mutable for the uint/unorm chroma pair, not mutable where
they are one): the sRGB-sibling and PixelFormatView list of c669ef7246 goes, so an 8-bit luma is
no longer mutable. A texture whose uses ask more (ShaderWrite on a texture made without
UNORDERED_ACCESS) is Gap::SurfaceUsage; a view of a third format is Gap::TextureView of
SurfacePixelFormat, as before where the import refused the list. The attachment feedback loop's
usage stays where the plane's descriptor asks it and the import offers it: the one usage the
Direct3D 11 description has no counterpart for, asked only by the guest's descriptor.

Why: Vulkan promises nothing for an image over memory another API made with other parameters.
VUID-VkImportMemoryWin32HandleInfoKHR-handleType-09861 asks only that the handle type is
importable for the image's parameters, and the query that answers IMPORTABLE takes no handle. For
a handle Vulkan exported the import must be "identical to the image associated with the imported
memory" (VUID-VkMemoryDedicatedAllocateInfo-image-01876); Android and QNX buffers must be
"equivalent"; for Direct3D's the spec states no rule ("beyond the scope of this specification"),
and section 12.11's consistent reading rests on aliases of the same creation parameters
(ALIAS_BIT, implied by an external handle type). The consumer makes its video planes
RENDER_TARGET | SHADER_RESOURCE, typed; rt made the 10-bit luma (R16_UNORM, the 16-bpp plane whose
4 KiB block is the 64 x 32 lattice on the owner's AMD Windows login picture) with STORAGE beyond
that, and 8-bit planes and chroma mutable with formats Direct3D never cast to. On AMD the usage
and mutability decide swizzle and DCC.

How verified: see the job ids below.
2026-11-23 21:13:22 -08:00
Anees Iqbal 1318c483b8 Translator: specialize writes a LocalSize mode's sizes through get_mut
clippy's indexing_slicing, which crates/metal2vulkan/src/spirv denies outside
tests, refused the slice that 15ebc7346c wrote the composite's values through
(check job m3-max-72869, clippy plain and --cfg m2v_gpu). The sizes now go
through get_mut, which a mode of six words always passes, and a miss is a
refusal by name.
2026-11-23 20:59:02 -08:00
Anees Iqbal 6458c28545 Translator: specialize and its tests in cargo fmt's layout
Format only: the two layouts check job m3-max-72869's fmt step printed for
15ebc7346c, applied as printed.
2026-11-23 20:59:02 -08:00
Anees Iqbal 5c1a4aabe6 Translator: specialize gives a LocalSize mode beside the WorkgroupSize composite the composite's values
The pass refused any module that had a LocalSize execution mode beside its
WorkgroupSize composite. Such a module is valid: the WorkgroupSize built-in
"takes precedence over any LocalSize or LocalSizeId execution mode" (vkspec,
the WorkgroupSize built-in), and glslang writes both when a shader uses
local_size_x_id. rt's hand-made test kernels (tests/kernels.rs) are glslang
output of that shape. In check job m3-max-72835 the pass refused every one of
them, and 38 of rt's 714 lavapipe device tests failed with "specialize: a
WorkgroupSize ... beside a local-size mode". kernel_variants and the
compute-encoder tests were among them.

The one LocalSize mode now takes the composite's values, which is what the
precedence rule already makes the module run with. A module without a mode
still gets one after its entry point. A second LocalSize mode, or a LocalSize
mode of other than three sizes, is refused by name. The format fix the check's
fmt step asked for is in the same file.

Test: a_local_size_mode_beside_the_workgroup_composite_takes_its_values adds
a LocalSize 1 1 1 mode to the deep kernel. Specialized at 8x4x2, the module
must hold exactly one mode, LocalSize 8 4 2, and pass spirv-val under Vulkan
1.2 and 1.3. A copy with two modes must be refused by name. The next check
job runs it, with rt's lavapipe device suite.
2026-11-23 20:59:02 -08:00
Anees Iqbal 54aaeb556b Tests: the helper's code digest at HELPER_VERSION 2, and the signature table without From<Unmade>
The literal form changed the stage helper's code: it no longer reads or
applies specialization data, and HELPER_VERSION went to 2. The digest pin in
rt's tests/stage.rs now holds the new code's digest. Check job m3-max-72835
printed that digest in
an_ended_breach_holds_to_its_helper_version_and_is_a_miss_below_it
(left: (2, "c7b4dec4...")).

The same change deleted rt's private Unmade enum and its From impl on Error.
The signature table had recorded that impl because it is an impl on a public
type. Nothing breaks for a consumer: Unmade was crate-private, so no consumer
could name it. The table's line goes; the_public_signatures_are_the_committed_table
in job 72835 listed it as the only removal.
2026-11-23 20:59:01 -08:00
Anees Iqbal 0630c1d9a7 Translator: specialize refuses an instruction it would leave half specialized
pipeline::specialize copied every instruction outside its list as it was. An
OpExecutionModeId (a LocalSizeId mode among them) beside a WorkgroupSize
composite would leave the entry point with two sizes, and an OpDecorationGroup
could carry a SpecId the pass never reads, so that constant would keep its
default. The translator writes neither, so the pass now refuses both with an
Error::Internal that names the instruction. An OpSpecConstantOp of an opcode
outside SpecOp was already refused; its refusal now names the opcode.

Op::ExecutionModeId and Op::DecorationGroup move into every build, and
ExecutionMode::LocalSizeId into test builds. Both come through
scripts/regen-spirv-grammar's items.txt and a regeneration from Khronos's
grammar (vulkan-sdk-1.4.341.0); table.rs comes out unchanged.

Test: a_module_of_an_instruction_the_pass_does_not_specialize_is_refused takes
the deep kernel with an OpExecutionModeId LocalSizeId of its LocalSize
constants, with an OpDecorationGroup, and with an OpSpecConstantOp turned to
ISub. Each must be refused, and the refusal must name the instruction. The
next check job runs it.
2026-11-23 20:59:01 -08:00
Anees Iqbal fdeac08272 Translator: specialize reads its opcodes from a list of the library's own, not the test-only word conversion
The first check (job m3-max-72828) did not compile the library: Op::from_u32 and
Op::ExecutionModeId exist in test builds only (spv.rs, items.txt). The pass now finds each
instruction's opcode in the fifteen it reads, all of them library values, and no longer looks
for a LocalSizeId mode, which the translator never writes.
2026-11-23 20:59:01 -08:00
Anees Iqbal 737906832c Runtime: a compute pipeline's module reaches the driver with every specialization constant fixed, its workgroup size the entry point's LocalSize literals
Every compute VkPipeline rt makes is now created from a shader module of its own, made of the
kernel's words with each specialization constant the plain constant of its value and destroyed
once the create returns; the create names no VkSpecializationInfo. Vulkan defines specialization
as exactly this conversion (VUID-VkPipelineShaderStageCreateInfo-pSpecializationInfo-06849), so
what a kernel computes is unchanged; what changes is that no driver is handed a specialization
constant to size a workgroup or an array from.

- Translator: pipeline::specialize(words, values) (spirv::specialize). OpSpecConstant,
  OpSpecConstantTrue/False become OpConstant/OpConstantTrue/False of the given value or the
  default; each OpSpecConstantOp becomes the constant it computes (SpecOp::eval, now product code,
  and SpecOp::opcode, which the serializer shares); OpSpecConstantComposite becomes
  OpConstantComposite; the SpecId decorations go; a WorkgroupSize composite loses its BuiltIn
  decoration and the entry point takes its values as OpExecutionMode LocalSize. The translator's
  output is unchanged (no SEMANTICS_VERSION bump).
- rt: Kernel holds its words (Code::Module(Arc<[u32]>)) instead of a VkShaderModule made at
  Kernel::new; Kernel::make specializes per variant and makes, uses and destroys the module.
  Heavy kernels specialize the same way: the stage request carries the specialized words and no
  ids or data (WIRE_VERSION 3), and the helper compiles them as they are (HELPER_VERSION 2).
  Lowered::Failed and Unmade go: nothing creates a shader module at Kernel::new now.
- Tests: serializer tests specialize (a deep kernel's spec constants, its bool, two Workgroup
  arrays sized by OpSpecConstantOps: values given and defaults, spirv-val under Vulkan 1.2 and
  1.3); rt deep_threadgroups a_kernel_reaches_the_driver_with_its_workgroup_size_as_literals.
- Docs: API.md (section 3), rt README.
2026-11-23 20:59:01 -08:00
Anees Iqbal 3073230664 Tests: the flat-grid guard's arms store to a buffer of their own
The guard's kernel stored its arms' values at b0[p + 4096] and the
shuffle's result at b0[p]. With that store the kernel observes its
threadgroup partition, so its flat variant of the call's threadgroups is
refused on every committed and derived profile
(Unsupported{GpuEncodedIndirectCommands, NotRepresentable}, the
partition gate in pipeline/compile.rs; m3-max-72860 listed
all 45). No flat module reached the comparison, so the guard failed its
final count at the fix and at the parent alike (m3-max-72826).

The arms now store to b1[p], a second buffer parameter, which the
lockstep analysis takes as an object apart from b0. The shuffle still
follows the merge of the parity selection.

Verified: cargo fmt only; the diagnostic and the check job follow.
2026-11-23 20:57:09 -08:00
Anees Iqbal 6a56458fdb Tests: the flat-grid guard's reading states its result type
0157be9ead left the closure's error type to inference through `?`, which
rustc cannot settle (E0282, m3-max-72858). The closure now
names `Result<(&'static str, Reconvergence, bool), String>`.

Verified: cargo fmt only; the diagnostic job follows.
2026-11-23 20:57:09 -08:00
Anees Iqbal bd2b63779f Tests: the flat-grid guard names each profile that refuses the flat variant
The guard counted the flat modules per mode and skipped a profile whose
flat variant the translator refuses without saying why; check
m3-max-72826 at b7d60720d2 failed its final count with no reason shown.
The flat variant's refusal now goes into the failure message, with the
profile's stem, and the doc no longer states a cause for the committed
profiles' refusals that no run showed.

Verified: cargo fmt only; the diagnostic and check jobs follow.
2026-11-23 20:57:08 -08:00
Anees Iqbal f7b83c7fe3 Tests: the flat-grid guard clears quad control with maximal reconvergence
VK_KHR_shader_quad_control requires maximal reconvergence, so a description listing quad control
without it is invalid (device::enables::check_invariants), and the guard's derived device failed
to build at 7dd248d489 (check job m3-max-72800). The derived descriptions now clear
shaderQuadControl with shaderMaximalReconvergence, and a description that still fails names
itself.
2026-11-23 20:57:08 -08:00
Anees Iqbal 45f7389c93 Tests: the flat-grid guard also derives each committed profile without maximal reconvergence
No committed profile without maximal reconvergence takes a flat variant of the call's
threadgroups (it needs device addresses and full subgroups), so the guard's last assertion, that
some profile without it compiled one, failed at 557798fc88 (check job m3-max-72785) though every
flat module it compiled stated the profile's mode. The guard now also derives each committed
description with shaderMaximalReconvergence cleared, and with it and
shaderSubgroupUniformControlFlow cleared, and asserts the flat module on each: MaximallyReconvergesKHR
and Guaranteed with maximal reconvergence, SubgroupUniformControlFlowKHR with ImplementationDefined
and DeviceReconvergence with only that, and no mode with ImplementationDefined and the note with
neither; and that each of the three kinds compiled at least once.
2026-11-23 20:57:08 -08:00