From 85e34d3080624ec7220fed9ad17c1eee37fc81da Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 25 Nov 2026 16:51:51 -0800 Subject: [PATCH] Translator: delete the pulled-vertex-buffer variant VariantKey::pulled_vertex_buffers had no product setter: every product path builds VariantKey::new(), so the layouts it named were always empty and its form (item 7 of pipeline::link::vertex: pull the remaining fixed-function attributes of the named layouts) ran only under tests. Deleted with it: RenderLinkInputs::pulled_vertex_buffers (set only from the key), VertexInputState::variant_pulled (the layouts item 7 moved) and its codec field, resolve()'s variant argument and the variant arguments of vertex_fetch_projection_for and vertex_input_state. The de-indexed and private list forms and a pipeline made for indirect command buffers keep pulling every attribute (now item 7). Tests: the pulled form of engine_identity_render's from_queries test (now from_queries_pulls_the_de_indexed_form_s_layouts_at_their_pushed_strides, which keeps the de-indexed and private list forms), and the icb_render_stride_template case of the replay refusal test, which existed for the pulled variant (icb_render_replay_template and icb_replay_template stay). Keys and bytes: a render pipeline's PipelineKey hashes the derived Debug of RenderLinkInputs, so every render PipelineKey changes once (the runtime keeps it in memory only: its kernel map keys by queried_render_descriptor_key and its directory by function and content keys). VertexInputState's encoding loses a field: covered by ARTIFACT_FORMAT_VERSION 598 (previous commit). Consumer search: consumer-uses.sh at the consumer's 19b32575f: 0 code hits for pulled_vertex_buffers, variant_pulled, RenderLinkInputs, VertexInputState, VariantKey. In-tree grep after the change: no pulled_vertex_buffers or variant_pulled. Checked by the lane tip's jobs, named in the lane report. --- crates/metal2vulkan/src/cache/codec.rs | 2 +- crates/metal2vulkan/src/cache/mod.rs | 12 +--- crates/metal2vulkan/src/lower/select.rs | 4 +- crates/metal2vulkan/src/pipeline/api_tests.rs | 2 - crates/metal2vulkan/src/pipeline/compile.rs | 6 +- .../src/pipeline/compile/tests.rs | 48 ++++++------- crates/metal2vulkan/src/pipeline/link.rs | 15 ++-- .../metal2vulkan/src/pipeline/link/vertex.rs | 68 ++++++------------- .../metal2vulkan/src/pipeline/lower_inputs.rs | 3 +- crates/metal2vulkan/src/pipeline/vertex.rs | 6 -- .../src/tests/engine_identity_render.rs | 56 ++++++--------- crates/metal2vulkan/tests/api_signatures.tsv | 2 - 12 files changed, 72 insertions(+), 152 deletions(-) diff --git a/crates/metal2vulkan/src/cache/codec.rs b/crates/metal2vulkan/src/cache/codec.rs index 9cab64d0c..10903c5e4 100644 --- a/crates/metal2vulkan/src/cache/codec.rs +++ b/crates/metal2vulkan/src/cache/codec.rs @@ -1342,7 +1342,7 @@ codec_struct! { immutable_samplers, } PushConstantRange { stages, offset, size } - VertexInputState { bindings, attributes, pulled, variant_pulled } + VertexInputState { bindings, attributes, pulled } VertexBinding { binding, buffer_index, input_rate, divisor, stride } VertexAttribute { location, binding, format, offset } PulledAttribute { attribute, buffer_index, format, offset, step_function, step_rate, stride } diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index 9c2bd771d..49492ff9c 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -145,11 +145,6 @@ pub struct VariantKey { #[cfg_attr(feature = "serde", serde(with = "crate::pipeline::serde_pairs"))] pub storage_images: BTreeMap, pub psb_slots: BTreeSet, - /// Metal vertex-buffer indices whose layouts the vertex function fetches in the shader - /// (`VertexFetch::Pulled`) instead of through fixed-function vertex input: the shape binds - /// them at an offset or with a per-bind stride Vulkan's vertex input cannot fetch. - #[cfg_attr(feature = "serde", serde(default))] - pub pulled_vertex_buffers: BTreeSet, /// The kernel's simdgroups run in the emulated tier, which is exact for every threadgroup size: /// a dispatch whose threadgroup has a partial simdgroup asks for it where the kernel's own tier /// runs simdgroups on whole subgroups. @@ -366,7 +361,6 @@ impl VariantKey { pub fn is_empty(&self) -> bool { self.storage_images.is_empty() && self.psb_slots.is_empty() - && self.pulled_vertex_buffers.is_empty() && !self.emulated_simdgroups && self.srgb_textures.is_empty() && self.texel_buffer_parts.is_empty() @@ -405,10 +399,8 @@ impl VariantKey { /// range and whether its draws' tests are read-only, for a tile function the imageblock bytes /// its pass keeps, and for the vertex function the /// dropped `Layer` output and the window depth - /// (a vertex function's projection is - /// derived from the vertex descriptor and - /// [`pulled_vertex_buffers`](VariantKey::pulled_vertex_buffers) when the pipeline compiles, - /// `Device::render_variant_key`). A key carries no stage-input descriptor: a kernel of a + /// (a vertex function's projection is derived from the vertex descriptor when the pipeline + /// compiles, `Device::render_variant_key`). A key carries no stage-input descriptor: a kernel of a /// compute pipeline with one compiles its variant under these inputs with the pipeline's /// `stage_input` added (`LoweringInputs::stage_input`). pub fn lowering_inputs( diff --git a/crates/metal2vulkan/src/lower/select.rs b/crates/metal2vulkan/src/lower/select.rs index 94e24f54f..fe44b2670 100644 --- a/crates/metal2vulkan/src/lower/select.rs +++ b/crates/metal2vulkan/src/lower/select.rs @@ -1863,8 +1863,8 @@ fn identity_unsourced(f: &RuntimeFact) -> bool { /// `PushField::TextureLevelBase`), the compute /// encoder's stage-in region (`PushField::StageInRegion`), the stride of a vertex layout whose /// attributes the function pulls (`PushField::VertexBufferStride`): a post-tessellation function's -/// control points and patches, and a plain vertex function's layouts that a pulled-vertex-buffer -/// variant or the de-indexed and private list forms pull; the render encoder's alpha test +/// control points and patches, and a plain vertex function's layouts that the de-indexed and +/// private list forms and a pipeline made for indirect command buffers pull; the render encoder's alpha test /// reference code a fragment function under the private alpha test compares with /// (`PushField::AlphaTestReference`); the index of the sampled-texture array's element a /// fragment function reads a colour attachment through (`PushField::FetchedColor`, framebuffer diff --git a/crates/metal2vulkan/src/pipeline/api_tests.rs b/crates/metal2vulkan/src/pipeline/api_tests.rs index 7d0918bf6..b9dd917a4 100644 --- a/crates/metal2vulkan/src/pipeline/api_tests.rs +++ b/crates/metal2vulkan/src/pipeline/api_tests.rs @@ -195,7 +195,6 @@ mod serde_round_trips { round_trip(&VariantKey { storage_images, psb_slots: BTreeSet::from([buffer(1)]), - pulled_vertex_buffers: BTreeSet::from([2, 5]), emulated_simdgroups: true, srgb_textures: BTreeSet::from([slot(Stage::Kernel, SlotClass::Texture, 4)]), texel_buffer_parts: BTreeMap::from([(slot(Stage::Kernel, SlotClass::Texture, 11), 2)]), @@ -469,7 +468,6 @@ mod serde_round_trips { step_rate: 2, stride: VertexStride::Static(20), }], - variant_pulled: BTreeSet::from([3]), }); } diff --git a/crates/metal2vulkan/src/pipeline/compile.rs b/crates/metal2vulkan/src/pipeline/compile.rs index 0365f7227..15ecb250d 100644 --- a/crates/metal2vulkan/src/pipeline/compile.rs +++ b/crates/metal2vulkan/src/pipeline/compile.rs @@ -84,9 +84,8 @@ pub enum InputsFrom<'a> { /// The caller's (`Device::compile_function`, validation, tests). Given(&'a LowerInputs), /// The vertex stage of a render pipeline under a variant key: the vertex-fetch projection of - /// this vertex descriptor over the attributes the specialized entry reads with the key's - /// pulled vertex buffers (`link::vertex::vertex_fetch_projection_for`), the key's other - /// vertex-stage inputs (`VariantKey::lowering_inputs`), the pipeline's + /// this vertex descriptor over the attributes the specialized entry reads + /// (`link::vertex::vertex_fetch_projection_for`), the key's vertex-stage inputs (`VariantKey::lowering_inputs`), the pipeline's /// `maxVertexCallStackDepth` (the `u32`), whether the pipeline's fragment function reads /// `[[primitive_id]]` where the device carries it through a varying /// ([`reads_primitive_id_varying`]). A vertex function writes the primitive ID's varying where @@ -2644,7 +2643,6 @@ fn lower_inputs( desc, &attributes, p, - &variant.pulled_vertex_buffers, pull_every, )?; let mut out = variant.lowering_inputs(crate::pipeline::sym::Stage::Vertex); diff --git a/crates/metal2vulkan/src/pipeline/compile/tests.rs b/crates/metal2vulkan/src/pipeline/compile/tests.rs index 0e4e9c549..e08296041 100644 --- a/crates/metal2vulkan/src/pipeline/compile/tests.rs +++ b/crates/metal2vulkan/src/pipeline/compile/tests.rs @@ -3042,9 +3042,7 @@ fn a_fragment_reading_through_a_loaded_pointer_writes_no_memory() { /// every buffer slot's address from its replayed command's root entry at the stage's /// `RootTableAddress`, is refused, typed (`Unsupported{IdentityDomains}` naming the field the /// identity domains do not read), never an internal error: a vertex function's buffer arguments -/// (`icb_render_replay_template`), the attribute of the pulled-vertex-buffer variant -/// (`icb_render_stride_template`, its layout pulled, as a draw replay pulls every layout), and a -/// kernel's buffers (`icb_replay_template`) alike. +/// (`icb_render_replay_template`) and a kernel's buffers (`icb_replay_template`) alike. #[test] fn a_replay_variant_under_the_identity_domains_is_refused_typed() { use crate::cache::VariantKey; @@ -3065,32 +3063,24 @@ fn a_replay_variant_under_the_identity_domains_is_refused_typed() { } other => panic!("{what}: {other}"), }; - for (stem, pulled) in [ - ("icb_render_replay_template", false), - ("icb_render_stride_template", true), - ] { - let Some(bc) = fixture(stem) else { - return; - }; - let vertex = Library::from_air(&bc) - .expect("library") - .function(stem) - .expect("vertex"); - let mut d = - RenderPipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new(vertex))); - d.rasterization_enabled = false; - let mut key = VariantKey::new(); - key.replay_bindings = true; - if pulled { - d.vertex_descriptor = Some(vertex_descriptor(&[(0, metal::VertexFormat::UInt)])); - key.pulled_vertex_buffers.insert(0); - } - let e = dev - .compile_render_variant(&d, &key, &Budget::standard()) - .map(|_| ()) - .expect_err(stem); - refused(stem, e); - } + let stem = "icb_render_replay_template"; + let Some(bc) = fixture(stem) else { + return; + }; + let vertex = Library::from_air(&bc) + .expect("library") + .function(stem) + .expect("vertex"); + let mut d = + RenderPipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new(vertex))); + d.rasterization_enabled = false; + let mut key = VariantKey::new(); + key.replay_bindings = true; + let e = dev + .compile_render_variant(&d, &key, &Budget::standard()) + .map(|_| ()) + .expect_err(stem); + refused(stem, e); let Some(bc) = fixture("icb_replay_template") else { return; }; diff --git a/crates/metal2vulkan/src/pipeline/link.rs b/crates/metal2vulkan/src/pipeline/link.rs index 52e573527..a1df8e270 100644 --- a/crates/metal2vulkan/src/pipeline/link.rs +++ b/crates/metal2vulkan/src/pipeline/link.rs @@ -137,13 +137,11 @@ impl LinkInputs { LinkInputs::Compute } - /// A render pipeline of `desc`'s fixed-function state under `variant`'s pulled vertex - /// buffers. Every attribute is pulled under the de-indexed and private list forms and for a - /// descriptor made for indirect command buffers (`supportIndirectCommandBuffers`), as their - /// vertex stage is compiled. + /// A render pipeline of `desc`'s fixed-function state under `variant`. Every attribute is + /// pulled under the de-indexed and private list forms and for a descriptor made for indirect + /// command buffers (`supportIndirectCommandBuffers`), as their vertex stage is compiled. pub fn render_variant(desc: &RenderPipelineDescriptor, variant: &VariantKey) -> LinkInputs { let mut r = RenderLinkInputs::from(desc); - r.pulled_vertex_buffers = variant.pulled_vertex_buffers.clone(); r.pull_every = variant.primitive_id_indices.is_some() || variant.private_list || desc.support_indirect_command_buffers; @@ -171,9 +169,6 @@ pub struct RenderLinkInputs { pub alpha_to_one: bool, pub rasterization_enabled: bool, pub input_primitive_topology: metal::PrimitiveTopologyClass, - /// The layouts a pulled-vertex-buffer variant pulls (`VariantKey::pulled_vertex_buffers`); - /// empty on the common path. - pub pulled_vertex_buffers: BTreeSet, /// The variant pulls every attribute (`vertex::vertex_fetch_projection_for`'s `pull_every`): /// the de-indexed and private list forms (`VariantKey::primitive_id_indices`, /// `VariantKey::private_list`) and a pipeline made for indirect command buffers @@ -206,7 +201,6 @@ impl RenderLinkInputs { alpha_to_one: false, rasterization_enabled: true, input_primitive_topology: metal::PrimitiveTopologyClass::Unspecified, - pulled_vertex_buffers: BTreeSet::new(), pull_every: false, max_vertex_amplification_count: 1, tessellation: None, @@ -234,7 +228,6 @@ impl From<&RenderPipelineDescriptor> for RenderLinkInputs { alpha_to_one: d.alpha_to_one, rasterization_enabled: d.rasterization_enabled, input_primitive_topology: d.input_primitive_topology, - pulled_vertex_buffers: BTreeSet::new(), pull_every: false, max_vertex_amplification_count: d.max_vertex_amplification_count, tessellation: d.tessellation, @@ -426,7 +419,7 @@ pub fn link( let vi = vertex::vertex_input_state( vs, r.vertex_descriptor.as_ref(), - (&r.pulled_vertex_buffers, r.pull_every), + r.pull_every, &table.locations, p, )?; diff --git a/crates/metal2vulkan/src/pipeline/link/vertex.rs b/crates/metal2vulkan/src/pipeline/link/vertex.rs index a8beddde2..42c361270 100644 --- a/crates/metal2vulkan/src/pipeline/link/vertex.rs +++ b/crates/metal2vulkan/src/pipeline/link/vertex.rs @@ -50,23 +50,17 @@ //! attribute the binding fetches (`VUID-vkCmdBindVertexBuffers2-pStrides-06209`): a //! fixed-function attribute of a static layout that ends past the layout's nonzero stride is //! refused; -//! 7. a **pulled-vertex-buffer variant** (`VariantKey::pulled_vertex_buffers`) pulls every -//! remaining fixed-function attribute of the layouts it names: the binder asks for it when a -//! shape binds such a layout at an offset or with a per-bind stride fixed-function input -//! cannot fetch. It runs after the items above, so the variant's fixed-function bindings are -//! exactly the projection's others, attribute for attribute; -//! 8. the **de-indexed and private list forms** (`VariantKey::primitive_id_indices`, +//! 7. the **de-indexed and private list forms** (`VariantKey::primitive_id_indices`, //! `VariantKey::private_list`) and a pipeline made for indirect command buffers //! (`supportIndirectCommandBuffers`) pull every remaining fixed-function attribute in the //! projection their compile takes, and link resolves their vertex input the same way //! (`RenderLinkInputs::pull_every`): the first two draw without indices, so fixed-function //! input would fetch at the stream position, where the function reads the vertex its index -//! names, and a command binds its vertex buffers by address alone. The layouts they pull are -//! not a pulled-vertex-buffer variant's (`variant_pulled` keeps item 7's). +//! names, and a command binds its vertex buffers by address alone. //! //! Only the identity domains (`Device::from_queries`' profile) fetch in fixed function, and items 2 //! to 6 pull nothing there: item 2's cases are `metal::vertex::attribute_fetch`'s refusals, and -//! items 3 to 6 refuse as `Feature::VertexInputLayout`. What items 7 and 8 pull is read through +//! items 3 to 6 refuse as `Feature::VertexInputLayout`. What item 7 pulls is read through //! the source buffer's device address, as every slot is read there, at the layout's pushed stride //! (`PushField::VertexBufferStride`). //! @@ -184,17 +178,15 @@ struct Resolved<'a> { signed: bool, } -/// Every attribute of `attributes` resolved (items 1-8 of the module docs; item 8 when -/// `pull_every` is set), and the layouts of `variant` that item 7 moved (those that had a -/// fixed-function attribute before it). Any attribute of `desc` whose buffer has no layout, read -/// or not, is `InvalidDescriptor(VertexLayout)` first (`VertexDescriptor::check_layouts`). +/// Every attribute of `attributes` resolved (items 1-7 of the module docs; item 7 when +/// `pull_every` is set). Any attribute of `desc` whose buffer has no layout, read or not, is +/// `InvalidDescriptor(VertexLayout)` first (`VertexDescriptor::check_layouts`). fn resolve<'a>( desc: Option<&'a VertexDescriptor>, attributes: &BTreeMap, p: &DeviceProfile, - variant: &BTreeSet, pull_every: bool, -) -> Result<(BTreeMap>, BTreeSet), Error> { +) -> Result>, Error> { let l = &p.fields().limits; // Only the identity domains fetch in fixed function (item 2), and they pull nothing: what a // fixed-function attribute cannot take is refused (the module docs). @@ -317,24 +309,14 @@ fn resolve<'a>( } } } - // The pulled-vertex-buffer variant (item 7). - let mut moved = BTreeSet::new(); - for r in out.values_mut() { - if matches!(r.fetch, AttributeFetch::FixedFunction { .. }) - && variant.contains(&r.attr.buffer_index) - { - r.fetch = AttributeFetch::Pulled; - moved.insert(r.attr.buffer_index); - } - } // The de-indexed and private list forms and a pipeline made for indirect command buffers - // (item 8). + // (item 7). if pull_every { for r in out.values_mut() { r.fetch = AttributeFetch::Pulled; } } - Ok((out, moved)) + Ok(out) } /// Whether a render pipeline's vertex strides are dynamic state @@ -354,30 +336,26 @@ pub(crate) fn strides_dynamic( /// the module docs). An attribute the descriptor lacks is an invalid descriptor, and so is any /// attribute whose layout it lacks, read or not (Metal stops at an assertion for each); the /// attributes the descriptor has but the function does not read are not projected (they are not -/// key data). [`vertex_fetch_projection_for`] without a variant. +/// key data). [`vertex_fetch_projection_for`] without pulling every attribute. #[cfg(test)] pub fn vertex_fetch_projection( desc: Option<&VertexDescriptor>, attributes: &BTreeMap, p: &DeviceProfile, ) -> Result { - vertex_fetch_projection_for(desc, attributes, p, &BTreeSet::new(), false) + vertex_fetch_projection_for(desc, attributes, p, false) } -/// `vertex_fetch_projection` under a pulled-vertex-buffer variant and a form that pulls every -/// attribute: the attributes of the layouts in `pulled_vertex_buffers` -/// (`VariantKey::pulled_vertex_buffers`) are pulled (item 7), and every attribute when -/// `pull_every` (the de-indexed and private list forms and a pipeline made for indirect command -/// buffers, item 8). +/// `vertex_fetch_projection` under a form that pulls every attribute where `pull_every` (the +/// de-indexed and private list forms and a pipeline made for indirect command buffers, item 7). pub fn vertex_fetch_projection_for( desc: Option<&VertexDescriptor>, attributes: &BTreeMap, p: &DeviceProfile, - pulled_vertex_buffers: &BTreeSet, pull_every: bool, ) -> Result { let mut out = VertexFetchProjection::new(); - for (a, r) in resolve(desc, attributes, p, pulled_vertex_buffers, pull_every)?.0 { + for (a, r) in resolve(desc, attributes, p, pull_every)? { out.attributes.insert(a, fetch_of(&r)); } Ok(out) @@ -440,21 +418,20 @@ pub(crate) fn fixed_function_notes( Ok(notes.into_iter().collect()) } -/// The vertex input state of vertex stage `vs` for descriptor `desc` under the -/// pulled-vertex-buffer variant `pulled_vertex_buffers`, every attribute pulled where `pull_every` -/// (the de-indexed and private list forms; see the module docs), with each fixed-function -/// attribute at the location link assigned its key. Fixed-function bindings are numbered densely -/// in Metal buffer-index order; `variant_pulled` records the layouts the variant moved. +/// The vertex input state of vertex stage `vs` for descriptor `desc`, every attribute pulled where +/// `pull_every` (the de-indexed and private list forms; see the module docs), with each +/// fixed-function attribute at the location link assigned its key. Fixed-function bindings are +/// numbered densely in Metal buffer-index order. pub fn vertex_input_state( vs: &StageInterface, desc: Option<&VertexDescriptor>, - (pulled_vertex_buffers, pull_every): (&BTreeSet, bool), + pull_every: bool, locations: &Locations, p: &DeviceProfile, ) -> Result { let used = vs.io.attributes(); let numeric: BTreeMap = used.iter().map(|(a, (n, _))| (*a, *n)).collect(); - let (resolved, moved) = resolve(desc, &numeric, p, pulled_vertex_buffers, pull_every)?; + let resolved = resolve(desc, &numeric, p, pull_every)?; for (a, (_, fetch)) in &used { // The stage was compiled under another projection (a `Compiled` stage source whose // `LowerInputs` do not fit this descriptor). @@ -481,10 +458,7 @@ pub fn vertex_input_state( })); } } - let mut state = VertexInputState { - variant_pulled: moved, - ..VertexInputState::default() - }; + let mut state = VertexInputState::default(); let mut binding_of: BTreeMap = BTreeMap::new(); for r in resolved.values() { if let AttributeFetch::FixedFunction { diff --git a/crates/metal2vulkan/src/pipeline/lower_inputs.rs b/crates/metal2vulkan/src/pipeline/lower_inputs.rs index 5dee8ff41..31b1af8c0 100644 --- a/crates/metal2vulkan/src/pipeline/lower_inputs.rs +++ b/crates/metal2vulkan/src/pipeline/lower_inputs.rs @@ -97,8 +97,7 @@ pub struct LoweringInputs { /// and a vertex function that fetches an attribute in fixed function are /// `Unsupported{GpuEncodedIndirectCommands, NotImplemented}` under it (a replayed command is a /// compute dispatch with no stage-in region, or a draw whose buffers no fixed-function input - /// reads: a pulled attribute reads its slot table, and the replay pulls every fixed-function - /// binding's layout through the pulled-vertex-buffer variant). + /// reads: a pulled attribute reads its slot table). #[cfg_attr(feature = "serde", serde(default))] pub replay_bindings: bool, /// With `replay_bindings`, the vertex function of a draw replay merged into one draw diff --git a/crates/metal2vulkan/src/pipeline/vertex.rs b/crates/metal2vulkan/src/pipeline/vertex.rs index 6608cdee2..ce2b682a5 100644 --- a/crates/metal2vulkan/src/pipeline/vertex.rs +++ b/crates/metal2vulkan/src/pipeline/vertex.rs @@ -3,8 +3,6 @@ //! Every format substitution is chosen with the shader's real read width in hand, so the consumer //! never guards against `(x, y, z, 1)` versus `(x, y, z, garbage)` reads. -use std::collections::BTreeSet; - use crate::metal; use crate::vk; @@ -19,10 +17,6 @@ pub struct VertexInputState { pub attributes: Vec, /// Attributes fetched in the shader; the plan binds their source buffers. pub pulled: Vec, - /// The Metal vertex-buffer indices whose layouts fixed-function vertex input fetches in the - /// descriptor's own projection but this pipeline pulls, because it was compiled under a - /// `VariantKey` naming them (`pulled_vertex_buffers`). Its plans keep listing them. - pub variant_pulled: BTreeSet, } impl VertexInputState { diff --git a/crates/metal2vulkan/src/tests/engine_identity_render.rs b/crates/metal2vulkan/src/tests/engine_identity_render.rs index e74bad463..6865ee7ad 100644 --- a/crates/metal2vulkan/src/tests/engine_identity_render.rs +++ b/crates/metal2vulkan/src/tests/engine_identity_render.rs @@ -20,9 +20,9 @@ //! instance at rate 2 without the divisor feature is refused as `Unsupported{VertexStepRate}`, //! needing `vertexAttributeInstanceRateDivisor`; with it, the layout is an instance-rate binding //! of divisor 2 whether or not the device reports `supportsNonZeroFirstInstance`, and at a rate -//! past `maxVertexAttribDivisor` it is refused naming the limit. A pulled-vertex-buffer variant -//! of the position's layout pulls it through the slot's pushed address at the layout's pushed -//! stride (`VertexBufferStride`); the de-indexed and private list forms stay refused. +//! past `maxVertexAttribDivisor` it is refused naming the limit. The de-indexed form pulls both +//! layouts through their slots' pushed addresses at the layouts' pushed strides +//! (`VertexBufferStride`); the private list form stays refused. //! //! - On `Device::from_queries`' profile of lavapipe, which enables `shaderOutputLayer`, a vertex //! function that writes `[[render_target_array_index]]` (the owned fixture `engine/rt6_layered`'s @@ -502,52 +502,36 @@ fn from_queries_fetches_a_constant_step_at_vertex_rate_with_stride_zero() { } } -/// Under the identity domains with no buffer robustness, a pulled-vertex-buffer variant of layout 0 -/// pulls `ima_vertex`'s position: the vertex function reads it through the slot's pushed device -/// address at the layout's pushed stride (`PushField::VertexBufferStride(0)`, the descriptor's 8 -/// a static stride), with no bind offset and no descriptor, and fetches its `short` mark in fixed -/// function; both modules L3-valid. The de-indexed form's key, whose fragment function here reads -/// no primitive ID and so whose draw's indices the vertex function does not read, pulls both -/// layouts the same way (every attribute, item 8 of `pipeline::link::vertex`); before the fetch -/// read a source through its own address it was `Unsupported{IdentityDomains}`. The private list -/// form, which reads the draw's raw indices at `PushField::CaptureIndexAddress`, stays +/// Under the identity domains with no buffer robustness, the de-indexed form's key, whose fragment +/// function here reads no primitive ID and so whose draw's indices the vertex function does not +/// read, pulls both of `ima_vertex`'s layouts (every attribute, item 7 of +/// `pipeline::link::vertex`): the vertex function reads each through the slot's pushed device +/// address at the layout's pushed stride (`PushField::VertexBufferStride`, the descriptor's 8 and +/// 4 static strides), with no bind offset and no descriptor; both modules L3-valid. Before the +/// fetch read a source through its own address it was `Unsupported{IdentityDomains}`. The private +/// list form, which reads the draw's raw indices at `PushField::CaptureIndexAddress`, stays /// `Unsupported{IdentityDomains}`. #[test] -fn from_queries_pulls_a_pulled_vertex_buffer_variant_s_layout_at_its_pushed_stride() { +fn from_queries_pulls_the_de_indexed_form_s_layouts_at_their_pushed_strides() { use crate::cache::VariantKey; let Some(library) = ima_library() else { return; }; let d = ima_descriptor(&library); - let mut pulled = VariantKey::new(); - pulled.pulled_vertex_buffers.insert(0); let mut de_indexed = VariantKey::new(); de_indexed.primitive_id_indices = Some(crate::metal::IndexType::UInt16); let mut private_list = VariantKey::new(); private_list.private_list = true; for stem in PROFILES { let device = fixed_function_device(stem); - for (form, v, want_pulled, want_fetched) in [ - ( - "pulled", - &pulled, - &[(0, 0, VertexStride::Static(8))][..], - &[vk::Format::R16_SINT][..], - ), - ( - "de-indexed", - &de_indexed, - &[ - (0, 0, VertexStride::Static(8)), - (1, 1, VertexStride::Static(4)), - ][..], - &[][..], - ), - ] { - let p = (device.compile_render_variant(&d, v, &Budget::standard())) - .unwrap_or_else(|e| panic!("{stem}: the {form} form: {e:?}")); - pulls_at_pushed_strides(stem, form, &device, &p, want_pulled, want_fetched); - } + let form = "de-indexed"; + let p = (device.compile_render_variant(&d, &de_indexed, &Budget::standard())) + .unwrap_or_else(|e| panic!("{stem}: the {form} form: {e:?}")); + let pulled = [ + (0, 0, VertexStride::Static(8)), + (1, 1, VertexStride::Static(4)), + ]; + pulls_at_pushed_strides(stem, form, &device, &p, &pulled, &[]); match device.compile_render_variant(&d, &private_list, &Budget::standard()) { Err(Error::Unsupported(u)) => assert_eq!( (u.feature, u.needs), diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index d7623fbb5..c814af381 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -1933,7 +1933,6 @@ field metal2vulkan::cache::VariantKey.partial_threadgroups pub partial_threadgro field metal2vulkan::cache::VariantKey.primitive_id_indices pub primitive_id_indices: Option field metal2vulkan::cache::VariantKey.private_list pub private_list: bool field metal2vulkan::cache::VariantKey.psb_slots pub psb_slots: BTreeSet -field metal2vulkan::cache::VariantKey.pulled_vertex_buffers pub pulled_vertex_buffers: BTreeSet field metal2vulkan::cache::VariantKey.quad_primitive_ids pub quad_primitive_ids: bool field metal2vulkan::cache::VariantKey.region_viewports pub region_viewports: bool field metal2vulkan::cache::VariantKey.replay_bindings pub replay_bindings: bool @@ -2709,7 +2708,6 @@ field metal2vulkan::pipeline::VertexFetchProjection.attributes pub attributes: B field metal2vulkan::pipeline::VertexInputState.attributes pub attributes: Vec field metal2vulkan::pipeline::VertexInputState.bindings pub bindings: Vec field metal2vulkan::pipeline::VertexInputState.pulled pub pulled: Vec -field metal2vulkan::pipeline::VertexInputState.variant_pulled pub variant_pulled: BTreeSet field metal2vulkan::reflection::DirectArgumentUse.gap pub gap: Option field metal2vulkan::reflection::DirectArgumentUse.stage pub stage: Stage field metal2vulkan::reflection::LinkedUseAnswers.fragment_writes_depth_unattached pub fragment_writes_depth_unattached: Option