diff --git a/crates/metal2vulkan-conformance/src/cost.rs b/crates/metal2vulkan-conformance/src/cost.rs index fa70d3b4c..29b437ea9 100644 --- a/crates/metal2vulkan-conformance/src/cost.rs +++ b/crates/metal2vulkan-conformance/src/cost.rs @@ -2652,13 +2652,13 @@ mod the_creation_prediction { /// multisampled blend into an extended-range color: a creation predicts those /// (`PassShape::keyed`, the point guard, the shadows), and their draws take its pipeline. /// - /// **Two of the draws class's 31 are an open bug, not coverage.** - /// `render-then-sample-magnified-nearest` and `-linear` each make one pipeline no draw takes, - /// 3 made and 2 taken: a state whose fragment function converts a texture's texels to `half` - /// makes its predicted key's general form at its creation and hands the predicted key itself - /// to the pool, and their draws take the predicted key, so the general form is made for - /// nothing. Not making the general form where the prediction is plain is the fix, and lowers - /// this class's ceiling by 2. + /// **Two of the draws class's 31 are the recordings', no longer the runtime's.** + /// `render-then-sample-magnified-nearest` and `-linear` each record 3 made and 2 taken: a state + /// whose fragment function converts a texture's texels to `half` made its predicted key's + /// general form at its creation, the class routine's arm, beside the predicted key its draws + /// take. A general form keeps the predicted plain arm (`render/residual.rs`), so such a + /// creation makes the one pipeline its draws take: the rows' next measurement reads 2 and 2, + /// and lowers this class's ceiling by 2. /// /// # Why the total cannot hold this /// diff --git a/crates/metal2vulkan-runtime/src/pipeline/predicted.rs b/crates/metal2vulkan-runtime/src/pipeline/predicted.rs index 336f4d987..f73589edc 100644 --- a/crates/metal2vulkan-runtime/src/pipeline/predicted.rs +++ b/crates/metal2vulkan-runtime/src/pipeline/predicted.rs @@ -16,13 +16,14 @@ //! unbound one is. A draw that leaves those slots unbound takes this key itself; the draws that //! bind them do so at offsets the creation cannot know, and the residual form reads the same //! bytes at every one: a draw whose own key is not made takes it at once while its own is made. -//! On a device that reads every view at its residual (MoltenVK) it is their own key. The key -//! made is the general form of that (`render/residual.rs`): each texture slot's -//! `SpecKey::PlainHalfTexels` at 0 too, the class routine that converts every bound class, and -//! its `SpecKey::UnmeasuredTexels` at 0, so a draw of any texture takes it at once while its own -//! key is made; the key with those slots' `PlainHalfTexels` at 1, as unbound ones take, which a -//! draw binding a plain, measured class takes, is handed to the pool right after, at the rank -//! nothing waits for, and nothing waits for it. +//! On a device that reads every view at its residual (MoltenVK) it is their own key. +//! The key made is the general form of that (`render/residual.rs`), each texture slot's +//! `SpecKey::UnmeasuredTexels` at 0 too, as an unbound slot's is, so a draw binding a class +//! whose `half` conversion is not measured takes it at once while its own key is made; its +//! `SpecKey::PlainHalfTexels` at 1, as an unbound slot's is, the plain arm every draw of a plain +//! class takes. Where the key differs from its general form (a uniform-view slot at its bind +//! offset, on a device that reads views there), the key itself is handed to the pool right +//! after, at the rank nothing waits for, and nothing waits for it. //! - **The tests**: for a fragment function that stores a color through the interlocked storage //! form before its depth and stencil tests (`RuntimeFact::TestedStorageWrites`) in a pipeline //! with a depth or stencil attachment, tests that drop fragments but write neither attachment and @@ -77,9 +78,9 @@ //! separate depth and stencil formats, a fragment function that writes depth) makes nothing here. //! The key is the draw's own key type: a draw that takes the same key takes the pipeline made, and //! so does a draw whose key differs only in constants the general form sets (a uniform-view slot -//! read at the bind offset alone, a texture slot's plain `half` arm or its unmeasured class), until -//! its own key's pipeline, made on the pool meanwhile, is made (`render/residual.rs`); any other -//! draw makes its own, as before. Nothing an answer depends on changes, only when the +//! read at the bind offset alone, a texture slot's unmeasured class), until its own key's +//! pipeline, made on the pool meanwhile, is made (`render/residual.rs`); any other draw makes its +//! own, as before. Nothing an answer depends on changes, only when the //! driver is called. A failed making is not kept and refuses nothing: the draw that needs the key //! meets it as before. //! @@ -128,10 +129,10 @@ use std::sync::Arc; impl GraphicsState { /// Make the `VkPipeline` of the key the state's first draw is predicted to take (the module - /// docs), now, in its general form, which a draw of every binding can take - /// (`render/residual.rs`); where the key differs from that form, hand the key itself to the - /// device's pool right after, at the rank nothing waits for, for the draws that bind what the - /// prediction names. A key whose pass is refused is left to its draw. + /// docs), now, in its general form, which a draw whose key differs only in that form's + /// constants can take (`render/residual.rs`); where the key differs from that form, hand the + /// key itself to the device's pool right after, at the rank nothing waits for, for the draws + /// that bind what the prediction names. A key whose pass is refused is left to its draw. pub(crate) fn make_at_creation(&self) { let Some((variant, key)) = self.predicted() else { return; diff --git a/crates/metal2vulkan-runtime/src/pipeline/render/residual.rs b/crates/metal2vulkan-runtime/src/pipeline/render/residual.rs index c93b70657..0d501f476 100644 --- a/crates/metal2vulkan-runtime/src/pipeline/render/residual.rs +++ b/crates/metal2vulkan-runtime/src/pipeline/render/residual.rs @@ -1,9 +1,8 @@ //! A draw's key's general form: a draw whose own `VkPipeline` is not made draws at once with its //! general form's where that one is made, and its own is made on the device's pool meanwhile, //! nothing waiting for it. The general form is the key with each constant that has an arm valid -//! for every binding at that arm ([`general_form`]); its first such constant was the uniform -//! views' (the residual form, below), and the texel routes' are the others (the end of these -//! docs). +//! for every binding at that arm, at that arm ([`general_form`]): the uniform views' (the residual +//! form, below) and the unmeasured texel class's (the end of these docs). //! //! A buffer slot a function reads through a uniform view declares the boolean specialization //! `SpecKey::RangeAtBindOffset`. A draw's plan sets it to 1 where the slot's descriptor range starts @@ -56,40 +55,39 @@ //! Such a making may outlast its draw's command buffer, which does not wait for it //! (`WorkCounts::pipeline_pool_busy` says when the pool holds none). //! -//! **The texel routes' general arms.** On a device that samples through Metal's own texture unit -//! (MoltenVK), a texture slot a function converts to `half` declares two booleans more, each with -//! an arm that serves every bound format exactly: +//! **The texel routes.** On a device that samples through Metal's own texture unit (MoltenVK), a +//! texture slot a function converts to `half` declares two booleans more: //! -//! - `SpecKey::PlainHalfTexels` at 0 converts each texel by the class routine, the bound class -//! read from push data, which for a plain class (`TexelFormat::plain_on_metal_sampler`: every -//! class but a YCbCr field on the grid `8192`) rounds the `float` texel to nearest even as the -//! plain arm (1) does; the plain arm lets Metal's compiler fold the conversion into the image -//! instruction (`lower::texture::half`). A slot bound to nothing, or to a plain class, takes 1, -//! and a draw binding a YCbCr field on the grid `8192` takes 0. //! - `SpecKey::UnmeasuredTexels` names the bound class to the slot's precision note alone: no //! instruction reads it, so both values run alike, and 0 is its general arm. A slot bound to //! nothing takes 0, and a draw binding a class whose `half` conversion is not measured //! (`TexelFormat::unmeasured_on_metal_sampler`: BC4 to BC7 and the linear ASTC formats among -//! them) 1. +//! them) 1. A state's creation predicts no texture bound, so such a draw keys apart from the +//! predicted key, and its general form is the predicted key itself: the draw takes the pipeline +//! the creation made at once while its own is made. +//! - `SpecKey::PlainHalfTexels` keeps the value the draw's own binding gives it, and is no +//! constant of the general form. At 0 each texel converts by the class routine, the bound class +//! read from push data, which serves every class; at 1 by the plain arm, which lets Metal's +//! compiler fold the conversion into the image instruction (`lower::texture::half`) and serves +//! every plain class (`TexelFormat::plain_on_metal_sampler`: every class but a YCbCr field on +//! the grid `8192`), rounding the `float` texel to nearest even as the routine does for those. +//! A slot bound to nothing, or to a plain class, takes 1, and a draw binding a YCbCr field on +//! the grid `8192` takes 0. A creation predicts the plain arm, which every draw of a plain class +//! takes, and makes that one pipeline: were 0 the general form, it would make a pipeline of the +//! routine's arm too, which a draw of a plain class takes only while its own is still made. A +//! draw binding a YCbCr field on the grid `8192` makes its own key, as a draw of any key its +//! creation did not predict; on a device whose memory is the host's such a slot reads its planes +//! in place, in a variant of its own (`VariantKey::ycbcr_in_place`), which no creation predicts +//! either. //! -//! A state's creation predicts no texture bound, so a draw of the predicted variant binding a -//! class of either kind keys apart from the predicted key: with that key alone made, such a draw -//! would make a pipeline of its own at the draw, a compile its command buffer waits for (and past -//! its bound drops the draw, `PipelineWaitPolicy::Bounded`). So a state's creation makes its -//! predicted key's general form, which every draw of that variant can take, and hands its -//! predicted key itself, where it differs (its texture slots' `PlainHalfTexels` at 1, as unbound -//! slots take), to the pool right after, at the rank nothing waits for: a draw binding a plain, -//! measured class takes it once made, and every other draw of the variant takes the general form -//! at once while its own is made (`predicted.rs`). The cost: such a creation makes two pipelines, -//! the second on the pool, nothing waiting for it; and GPU time, until a draw's own key lands, of -//! the class routine at each `half` conversion of an image instruction's texel in place of the -//! device's own conversion. +//! A draw that takes its key's general form runs the instructions its own key runs but for the +//! residual's reads in place of the bind offset's: an unmeasured class's draw runs its own key's. //! //! Constants with no arm that serves every binding stay as before, each value a pipeline of its -//! own: `SpecKey::SamplerState` (each sampler word a sampling emulation of its own), -//! `SpecKey::NearestPixelSampler` (a nearest pixel sampler's sample at its texel's centre, which -//! the other arm's quotient does not read exactly) and `SpecKey::BicubicTexels` (how Metal's bicubic -//! filter treats each format's texels). +//! own: `SpecKey::PlainHalfTexels` (above), `SpecKey::SamplerState` (each sampler word a sampling +//! emulation of its own), `SpecKey::NearestPixelSampler` (a nearest pixel sampler's sample at its +//! texel's centre, which the other arm's quotient does not read exactly) and +//! `SpecKey::BicubicTexels` (how Metal's bicubic filter treats each format's texels). //! //! [`general_form`]: RenderVariant::general_form //! [`residual_form`]: RenderVariant::residual_form @@ -126,9 +124,8 @@ impl RenderVariant { } /// `specialization` with each of the variant's constants that has an arm serving every binding - /// at that arm, its general form (the module docs): `SpecKey::RangeAtBindOffset`, - /// `SpecKey::PlainHalfTexels` and `SpecKey::UnmeasuredTexels` at 0; `None` where every one of - /// them is there already. + /// at that arm, its general form (the module docs): `SpecKey::RangeAtBindOffset` and + /// `SpecKey::UnmeasuredTexels` at 0; `None` where every one of them is there already. pub(crate) fn general_form( &self, specialization: &SpecializationKey, @@ -213,10 +210,10 @@ pub(crate) fn residual_form<'a>( /// `specialization` with each constant of `constants` (a pipeline's stages', each its ID and its /// meaning) that has an arm serving every binding at that arm (the module docs): -/// `SpecKey::RangeAtBindOffset` (the residual form's), `SpecKey::PlainHalfTexels` and -/// `SpecKey::UnmeasuredTexels`, each at 0; `None` where every one of them is 0 there already. A -/// constant `specialization` gives no entry takes the module's default: 0 for the first and last, -/// and a plan gives every `PlainHalfTexels` its value. +/// `SpecKey::RangeAtBindOffset` (the residual form's) and `SpecKey::UnmeasuredTexels`, each at 0; +/// `None` where every one of them is 0 there already. A constant `specialization` gives no entry +/// takes the module's default, 0. `SpecKey::PlainHalfTexels` keeps its value: its plain arm +/// serves only the plain classes. pub(crate) fn general_form( constants: impl Iterator + Clone, specialization: &SpecializationKey, @@ -226,9 +223,7 @@ pub(crate) fn general_form( at == id && matches!( key, - SpecKey::RangeAtBindOffset(_) - | SpecKey::PlainHalfTexels(_) - | SpecKey::UnmeasuredTexels(_) + SpecKey::RangeAtBindOffset(_) | SpecKey::UnmeasuredTexels(_) ) }) }; diff --git a/crates/metal2vulkan-runtime/src/tests/general_form.rs b/crates/metal2vulkan-runtime/src/tests/general_form.rs index 4daa3c725..3803c436d 100644 --- a/crates/metal2vulkan-runtime/src/tests/general_form.rs +++ b/crates/metal2vulkan-runtime/src/tests/general_form.rs @@ -1,5 +1,6 @@ //! A key's general form (`pipeline/render/residual.rs`): each constant with an arm that serves -//! every binding at that arm, the others as the key has them. +//! every binding at that arm, the others as the key has them. A texture slot's plain `half` arm +//! keeps its value: it serves the plain classes alone, and a creation predicts it. use crate::pipeline::general_form; use metal2vulkan::cache::SpecializationKey; @@ -52,20 +53,25 @@ fn key(values: [u32; 5]) -> SpecializationKey { #[test] fn the_general_form_zeroes_the_constants_whose_zero_serves_every_binding() { let general = general_form(constants().into_iter(), &key([1, 1, 1, 5, 3])); - // The sampler's word and the bicubic class keep their values: no arm of theirs serves every - // binding. - assert_eq!(general, Some(key([0, 0, 0, 5, 3]))); - // A plain-class or unbound texture's key and a measured class's alike. - let general = general_form(constants().into_iter(), &key([0, 1, 0, 5, 3])); + // The plain arm, the sampler's word and the bicubic class keep their values: no arm of theirs + // serves every binding the key's does not. + assert_eq!(general, Some(key([0, 1, 0, 5, 3]))); + // An unmeasured plain class's key: its general form is the key of an unbound or measured + // plain class, the one a creation predicts. + let general = general_form(constants().into_iter(), &key([0, 1, 1, 5, 3])); + assert_eq!(general, Some(key([0, 1, 0, 5, 3]))); + // A class the plain arm does not serve keeps the routine's arm. + let general = general_form(constants().into_iter(), &key([1, 0, 1, 5, 3])); assert_eq!(general, Some(key([0, 0, 0, 5, 3]))); } #[test] fn a_key_in_its_general_form_has_none_of_its_own() { - assert_eq!( - general_form(constants().into_iter(), &key([0, 0, 0, 5, 3])), - None - ); + // An unbound or measured plain class's key, which a creation predicts, and one of the + // routine's arm. + for values in [[0, 1, 0, 5, 3], [0, 0, 0, 5, 3]] { + assert_eq!(general_form(constants().into_iter(), &key(values)), None); + } // A constant the key's stages do not declare is not the general form's to set. assert_eq!( general_form(std::iter::empty(), &key([1, 1, 1, 5, 3])), diff --git a/crates/metal2vulkan-runtime/src/work_counts.rs b/crates/metal2vulkan-runtime/src/work_counts.rs index fd1751eca..b4d031d69 100644 --- a/crates/metal2vulkan-runtime/src/work_counts.rs +++ b/crates/metal2vulkan-runtime/src/work_counts.rs @@ -4697,8 +4697,8 @@ pub struct WorkCounts { /// Draws and dispatches whose key's `VkPipeline` was not made, which were recorded at once /// with the made one of its general form, each of the key's uniform-view slots read at its /// residual (which reads the same bytes at every bind offset) and, for a draw on a device that - /// samples through Metal's own texture unit, each texture slot converted to `half` by its - /// class's routine (exact for every class): none waited for its key's making. + /// samples through Metal's own texture unit, each texture slot's unmeasured `half` class + /// unnamed (which no instruction reads): none waited for its key's making. pub residual_form_draws: u64, /// Of the makings draws and dispatches began, those whose command took its key's general /// form meanwhile: makings on the device's pool that nothing waits for. diff --git a/crates/metal2vulkan-validation/src/runtime_lane.rs b/crates/metal2vulkan-validation/src/runtime_lane.rs index 064168ea3..78f25bd31 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane.rs @@ -57,8 +57,9 @@ const WAIT: Duration = Duration::from_secs(60); /// `device`'s work counts once its pipeline pool holds no piece (`WorkCounts::pipeline_pool_busy`), /// waiting at most [`WAIT`]: a draw that took its key's general form does not wait for its own -/// key's making, which may outlast the draw's command buffer, and a state's creation hands its -/// predicted key's making to the pool after its general form's, not waiting for it. +/// key's making, which may outlast the draw's command buffer, and under +/// `PipelineWaitPolicy::Bounded` a state's creation hands its predicted key's making to the pool +/// and returns. #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] fn pipelines_settled(device: &Device) -> metal2vulkan_runtime::WorkCounts { let until = std::time::Instant::now() + WAIT; diff --git a/crates/metal2vulkan-validation/src/runtime_lane/made_at_creation.rs b/crates/metal2vulkan-validation/src/runtime_lane/made_at_creation.rs index ee73b8e7c..0d0ff3b57 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/made_at_creation.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/made_at_creation.rs @@ -305,10 +305,10 @@ fn a_state_s_first_draw_takes_the_pipeline_made_at_its_creation() { /// pipeline's key carries). Each draw binds an `RGBA16Float` texture, which takes the pipeline /// made at creation (`a_draw_binding_a_texture_takes_the_pipeline_made_at_creation`); every kind /// the first draw announces is one the stage specializes ([`specialized_kinds`]), or, on a device -/// without unified memory, `SharedInSystemMemory` for the draw's `Shared` buffer. On a device that -/// samples through Metal's own texture unit the creation makes the predicted key's general form, -/// and hands the predicted key itself to the pool right after (`pipeline/render/residual.rs`): -/// both counted once the pool settles, and neither announcing anything before a draw. +/// without unified memory, `SharedInSystemMemory` for the draw's `Shared` buffer. The creation +/// makes that one pipeline on every device, counted once the pool settles: where the device +/// samples through Metal's own texture unit too, the predicted key's plain `half` arm is no +/// constant of its general form (`pipeline/render/residual.rs`). #[test] fn a_pipeline_made_at_creation_announces_at_its_first_draw() { let cache = ScratchCache::new().unwrap(); @@ -326,12 +326,10 @@ fn a_pipeline_made_at_creation_announces_at_its_first_draw() { let before = device.work_counts(); let state = state(&device, "sampled_fragment"); pipelines_settled(&device); - let metal = metal_sampler(&device); assert_eq!( made_since(&device, &before), - (1 + u64::from(metal), 0), - "the predicted key's pipeline, made at creation, and its general form where the \ - device samples through Metal's texture unit ({metal})" + (1, 0), + "the predicted key's pipeline, made at creation, alone" ); let at_creation = counts(&messages.take_notices()); let created = device.work_counts(); @@ -382,22 +380,20 @@ fn a_pipeline_made_at_creation_announces_at_its_first_draw() { /// draw binds. A draw of `sampled_fragment` binding nothing takes the pipeline made at creation, /// and so do draws binding an `RGBA8Unorm` or an `RGBA16Float` texture, each sampling its texels: /// the class of the format the slot binds reaches the function as a push field, not as the -/// pipeline's specialization. On a device that samples through Metal's own texture unit the -/// creation makes the predicted key's general form too (`pipeline/render/residual.rs`), and the -/// predicted key, made on the pool right after, is the one these draws take once the pool settles: -/// each class is plain and measured, as the unbound slot the prediction binds. +/// pipeline's specialization. On a device that samples through Metal's own texture unit too, the +/// creation makes the predicted key alone, its texture slot's plain `half` arm +/// (`pipeline/render/residual.rs`), which these draws take: each class is plain and measured, as +/// the unbound slot the prediction binds. No draw takes a general form. #[test] fn a_draw_binding_a_texture_takes_the_pipeline_made_at_creation() { on_device_with(at_plan, |device, _| { - let metal = metal_sampler(device); let before = device.work_counts(); let state = state(device, "sampled_fragment"); pipelines_settled(device); assert_eq!( made_since(device, &before), - (1 + u64::from(metal), 0), - "made at creation, with the general form where the device samples through Metal's \ - texture unit ({metal})" + (1, 0), + "made at creation, the predicted key alone" ); let created = device.work_counts(); draw(device, &state, PrimitiveType::Triangle); @@ -460,9 +456,10 @@ fn bc4_filled(device: &Device, side: u64, block: [u8; 8]) -> Texture { /// draws at once with the pipeline its state's creation made. On a device that samples through /// Metal's own texture unit the class keys apart from the prediction (`SpecKey::UnmeasuredTexels` /// 1, where the unbound slot the prediction binds has 0), so the draw takes its key's general form, -/// the one the creation made (`pipeline/render/residual.rs`), and hands its own key's making to -/// the pool, which nothing waits for; once made, a second draw takes it. Elsewhere the class is a -/// push field alone, and both draws take the predicted key. Each draws the blocks' red, 1. +/// which is the predicted key the creation made (`pipeline/render/residual.rs`), and hands its own +/// key's making to the pool, which nothing waits for; once made, a second draw takes it. Elsewhere +/// the class is a push field alone, and both draws take the predicted key. Each draws the blocks' +/// red, 1. #[test] fn a_draw_of_an_unmeasured_class_takes_the_general_form_its_creation_made() { on_device_with(at_plan, |device, _| { @@ -472,9 +469,8 @@ fn a_draw_of_an_unmeasured_class_takes_the_general_form_its_creation_made() { let created = pipelines_settled(device); assert_eq!( made_since(device, &before), - (1 + u64::from(metal), 0), - "made at creation, with the general form where the device samples through Metal's \ - texture unit ({metal})" + (1, 0), + "made at creation, the predicted key alone" ); // Both endpoints 255, every index 0: red 1, and Metal's green 0, blue 0 and alpha 1. let red = bc4_filled(device, SIDE, [0xff, 0xff, 0, 0, 0, 0, 0, 0]); @@ -492,9 +488,9 @@ fn a_draw_of_an_unmeasured_class_takes_the_general_form_its_creation_made() { drawn.creation_pipelines_drawn - created.creation_pipelines_drawn, ), (metal_count, metal_count, 1), - "the draw took the general form, made at creation, and began its own key's making \ - where the device samples through Metal's texture unit ({metal}); elsewhere the \ - predicted key" + "the draw took its general form, the predicted key made at creation, and began its \ + own key's making where the device samples through Metal's texture unit ({metal}); \ + elsewhere the predicted key" ); assert_eq!( made_since(device, &created), diff --git a/crates/metal2vulkan-validation/src/runtime_lane/pipeline_creation.rs b/crates/metal2vulkan-validation/src/runtime_lane/pipeline_creation.rs index 039c87745..273741983 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/pipeline_creation.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/pipeline_creation.rs @@ -861,8 +861,8 @@ fn quadrants( /// pipelines made already: one state drawn binding each of four formats into a quadrant each, then /// as a line, under a `Counting` visibility query. The format draws take the `VkPipeline` the /// state's creation made, on every device: each format's class reaches the function as a push -/// field, and none keys apart (where the device samples through Metal's own texture unit, the -/// creation's predicted key, or its general form while the pool still makes the predicted key, +/// field, and none keys apart (where the device samples through Metal's own texture unit, each is +/// a plain class whose `half` conversion is measured, which takes the creation's predicted key, /// `pipeline/render/residual.rs`). The line, whose key no creation predicts, hands its making to the /// pool; none is made at a draw; the command buffer completes, and a command buffer committed /// after it on its queue completes after it. The same draws again, diff --git a/crates/metal2vulkan-validation/src/runtime_lane/ycbcr_textures.rs b/crates/metal2vulkan-validation/src/runtime_lane/ycbcr_textures.rs index 1bf2a21ab..024fa410b 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/ycbcr_textures.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/ycbcr_textures.rs @@ -1780,9 +1780,8 @@ fn a_ycbcr_slot_takes_the_devices_filter_in_the_pipeline_its_creation_made() { .unwrap(); for fragment in ["between_runtime_float", "between_runtime_half"] { let pipeline = between_state(device, &library, fragment); - // Where the device samples through Metal's texture unit, the `half` function's - // creation hands its predicted key's making to the pool after its general form's - // (`pipeline/render/residual.rs`): settled first, so the count below is the draw's. + // The creation hands its predicted key's making to the pool + // (`PipelineWaitPolicy::Bounded`): settled first, so the count below is the draw's. super::pipelines_settled(device); let plain = drawn_with(device, &pipeline, (&twin, Some(&linear)), |_, _| {}); let before = device.work_counts().variant_pipelines_made; diff --git a/docs/API.md b/docs/API.md index fbe9e9bb0..e972564d5 100644 --- a/docs/API.md +++ b/docs/API.md @@ -4310,29 +4310,28 @@ each item named states the rule in full. form the pipeline takes, and the residual is 0 wherever the range starts at the bind offset. A slot bound to nothing is read at its residual too (0), so a draw that leaves such slots unbound takes the creation's pipeline itself. On MoltenVK a texture slot a function converts to `half` - converts its texels by the class routine (`PlainHalfTexels` 0, the bound class read from push - data), which rounds a plain class's `float` texel to nearest even as the plain arm does (the arm - Metal's compiler can fold into the image instruction, which a slot bound to nothing or to a plain - class takes: every class but a YCbCr field on the grid 8192), and its `UnmeasuredTexels`, which - no instruction reads, is at 0 (a class whose `half` conversion is not measured, BC4 to BC7 and - the linear ASTC formats among them, takes 1). Where the predicted key is not its own general form - (a slot of the plain arm), the creation hands it to the pool right after, behind the makings - something waits for, and a draw binding a plain, measured class takes it once made. A draw whose - own pipeline (which reads such a buffer slot at the bind offset alone, converts by the plain arm, - or names an unmeasured class) is not made, and whose key's general form's is, draws with that one - at once; its own is made on the pool behind the makings something waits for, and later draws - take it. So a draw binding a texture of an unmeasured class waits for no compile of its own. - Only GPU time moves for the draws before it lands (`WorkCounts::residual_form_draws`, - `residual_form_makings`): on ANV the residual form's reads are loads where the other form's are - pushed constants; on MoltenVK the class routine converts each `half` read in place of the image - instruction's own conversion. The creation of a state - whose predicted key is not its general form makes two pipelines, the second on the pool, nothing - waiting for it. On MoltenVK every key reads its buffer slots at their residual (the two forms - measured alike there), so a draw's bind offsets choose no pipeline there. A constant with no arm - that serves every binding stays a pipeline per value, made at the first draw of it: a sampler's - state (`SamplerState`, each sampler word a sampling emulation of its own), whether a pixel - sampler is a nearest one (`NearestPixelSampler`, whose sample reads its texel's centre) and how - the bicubic filter treats the bound format's texels (`BicubicTexels`). + has its `UnmeasuredTexels`, which no instruction reads, at 0 (a class whose `half` conversion is + not measured, BC4 to BC7 and the linear ASTC formats among them, takes 1), and its + `PlainHalfTexels` at 1, as a slot bound to nothing takes: the plain arm, which Metal's compiler + can fold into the image instruction and which every plain class takes (every class but a YCbCr + field on the grid 8192, which takes the class routine, `PlainHalfTexels` 0, and makes its own + pipeline at its draw, as any key the creation did not predict). Where the predicted key is not + its own general form (a buffer slot read at the bind offset, on a device that reads views + there), the creation hands it to the pool right after, behind the makings something waits for. + A draw whose own pipeline (which reads such a buffer slot at the bind offset alone, or names an + unmeasured class) is not made, and whose key's general form's is, draws with that one at once; + its own is made on the pool behind the makings something waits for, and later draws take it. + So a draw binding a texture of an unmeasured class waits for no compile of its own, and runs + the instructions its own key runs. Only GPU time moves for the draws before their own lands + (`WorkCounts::residual_form_draws`, `residual_form_makings`): on ANV the residual form's reads + are loads where the other form's are pushed constants. On MoltenVK every key reads its buffer + slots at their residual (the two forms measured alike there), so a draw's bind offsets choose no + pipeline there, and a creation makes one pipeline. A constant with no arm that serves every + binding stays a pipeline per value, made at the first draw of it: the `half` conversion's arm + (`PlainHalfTexels`, above), a sampler's state (`SamplerState`, each sampler word a sampling + emulation of its own), whether a pixel sampler is a nearest one (`NearestPixelSampler`, whose + sample reads its texel's centre) and how the bicubic filter treats the bound format's texels + (`BicubicTexels`). - **A dispatch's `VkPipeline` is made while the dispatch goes on**, the same way: one pipeline per threadgroup size and edge region, made on the pool. A compute state whose descriptor states `requiredThreadsPerThreadgroup` -- the threadgroup every dispatch of the state must have -- makes