diff --git a/crates/metal2vulkan-runtime/src/device/holds.rs b/crates/metal2vulkan-runtime/src/device/holds.rs index 5ad7d4804..218cc5feb 100644 --- a/crates/metal2vulkan-runtime/src/device/holds.rs +++ b/crates/metal2vulkan-runtime/src/device/holds.rs @@ -56,8 +56,15 @@ pub(crate) enum Holder { /// The pool's making of a render execution's draw replay kernels ahead /// (`Device::begin_draw_replay_kernels`), between its kernels. DrawReplayKernels, + /// The pool's making of the rate-map routes' kernel ahead + /// (`Device::begin_route_counts_kernel`), before it. + RouteCountsKernel, } +/// The holders: one test hold each ([`Holds::held`]). +#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] +const HOLDERS: usize = Holder::RouteCountsKernel as usize + 1; + /// A device's registry of its handles and the runtime's own holds (the module docs). #[derive(Default)] pub(crate) struct Holds { @@ -76,7 +83,7 @@ pub(crate) struct Holds { /// The crate's device tests' holds of each holder between its steps /// (`tests/teardown_threads.rs`). #[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))] - held: [crate::freed_memory::held::Held; 3], + held: [crate::freed_memory::held::Held; HOLDERS], } /// The registry's count of the holders' handles, and its stop. diff --git a/crates/metal2vulkan-runtime/src/device/mod.rs b/crates/metal2vulkan-runtime/src/device/mod.rs index c14449b13..5402c95d2 100644 --- a/crates/metal2vulkan-runtime/src/device/mod.rs +++ b/crates/metal2vulkan-runtime/src/device/mod.rs @@ -541,6 +541,9 @@ pub(super) struct DeviceShared { /// The crate-owned compute kernels the runtime dispatches for itself, made on first use /// (`owned_kernel.rs`). pub(super) owned_kernels: Mutex, + /// A pass's first draw the GPU routes began the routes' kernel on the device's pool + /// (`Device::begin_route_counts_kernel`): no later draw begins it again. + pub(super) route_counts_begun: AtomicBool, /// The two-plane YCbCr formats the device converts itself (`ycbcr_device.rs`). pub(super) ycbcr_formats: crate::ycbcr_device::YCbCrFormats, /// The spare scratch block of `generate_mipmaps`' filter chains (`mipmap_scratch.rs`). @@ -3220,6 +3223,7 @@ impl Device { gpu_work: AtomicU64::new(0), dynamic_multi_variable: OnceLock::new(), owned_kernels: Mutex::new(OwnedKernels::default()), + route_counts_begun: AtomicBool::new(false), ycbcr_formats, mipmap_scratch: Mutex::default(), planes: Mutex::new(PlanesObjects::default()), diff --git a/crates/metal2vulkan-runtime/src/owned_kernel.rs b/crates/metal2vulkan-runtime/src/owned_kernel.rs index 9af43e6ff..f830474a4 100644 --- a/crates/metal2vulkan-runtime/src/owned_kernel.rs +++ b/crates/metal2vulkan-runtime/src/owned_kernel.rs @@ -52,6 +52,7 @@ use metal2vulkan::bind::{ use metal2vulkan::device::VkFeature; use metal2vulkan::metal::format::ExtendedRange; use std::collections::HashMap; +use std::sync::atomic::Ordering; use std::sync::{Mutex, OnceLock}; /// A crate-owned module the runtime dispatches. @@ -999,6 +1000,45 @@ impl Device { })); } + /// Begin making the rate-map routes' kernel (`bind::fan_out::route_counts_module`) on the + /// device's pool, once per device, at a pass's first draw the GPU routes + /// (`render/gpu_routes.rs`): the encoder that routes it takes the kernel only made + /// ([`route_counts_kernel`](Self::route_counts_kernel)), so neither the making nor a wait for + /// its turn lies on the encoding thread. A pass without a fanning draw begins none. + pub(crate) fn begin_route_counts_kernel(&self) { + if self + .shared() + .route_counts_begun + .swap(true, Ordering::Relaxed) + { + return; + } + let weak = self.downgrade(); + let _ = self.shared().pipeline_pool.run(Box::new(move || { + // A holder's handle for the making alone. + let Some(device) = weak.hold() else { + return; + }; + if !device.holds_go_on(Holder::RouteCountsKernel) { + return; + } + // Refused again, and announced, where an encoder asks for it. + let _ = device.owned_kernel(OwnedModule::RouteCounts); + })); + } + + /// The rate-map routes' kernel where it is made, without waiting: `None` while it is not, or + /// while another kernel's making holds the kernels' lock + /// ([`begin_route_counts_kernel`](Self::begin_route_counts_kernel)). + pub(crate) fn route_counts_kernel(&self) -> Option { + let mut kernels = match self.shared().owned_kernels.try_lock() { + Ok(kernels) => kernels, + Err(std::sync::TryLockError::Poisoned(poisoned)) => poisoned.into_inner(), + Err(std::sync::TryLockError::WouldBlock) => return None, + }; + kernels.get(OwnedModule::RouteCounts) + } + /// The kernel of `which`, made on first use. pub(super) fn owned_kernel(&self, which: OwnedModule) -> Result { // A making's turn before the lock (`budget::helper_turn`): none where it is made. diff --git a/crates/metal2vulkan-runtime/src/rate_mapped_pass.rs b/crates/metal2vulkan-runtime/src/rate_mapped_pass.rs index 1848e6fa3..db49fcaf9 100644 --- a/crates/metal2vulkan-runtime/src/rate_mapped_pass.rs +++ b/crates/metal2vulkan-runtime/src/rate_mapped_pass.rs @@ -302,9 +302,11 @@ //! (`WorkCounts::rate_map_gpu_routed_draws`, of them `rate_map_gpu_fanned_draws` and //! `rate_map_gpu_copied_draws`). The two routes are the pair above, so the draw meets an //! `Equal` test whichever the GPU picked (`tests::rate_mapped_depth_equal`, a flagged draw -//! between two halves of a ground plane). A draw whose fan-out variant or probe is not yet made begins its -//! making on the device's pool and is drawn through its region-copy variant alone, and so is -//! every encoder draw on a device without `drawIndirectCount` or `multiDrawIndirect`. +//! between two halves of a ground plane). A draw whose fan-out variant or probe is not yet made +//! begins its making on the device's pool and is drawn through its region-copy variant alone. +//! So is each routed draw of an instance whose encoder ends before the kernel is made, which +//! the device's first routed draw begins on the pool, and every encoder draw on a device +//! without `drawIndirectCount` or `multiDrawIndirect`. //! - **What the plan refuses** is `NotImplemented(RuntimeGap::RateMapRegions)`, naming the //! compile layer's reason ([`RegionRefusal`]): a viewport of no extent or a flipped one, a //! scissor as above, a plan past its bound or past the device's viewport limits, a pipeline whose diff --git a/crates/metal2vulkan-runtime/src/render.rs b/crates/metal2vulkan-runtime/src/render.rs index 8fb3070d5..4d71b7ec5 100644 --- a/crates/metal2vulkan-runtime/src/render.rs +++ b/crates/metal2vulkan-runtime/src/render.rs @@ -6259,8 +6259,12 @@ impl RenderLowering { )), None => None, }); - later_probes.push(match instance.routes.probes.take() { - Some(probes) => { + // Only where the routes' kernel is made: else the instance runs no steps, and its + // routed draws each draw their region-copy route (`render/gpu_routes.rs`). + let probes = (instance.routes.probes.take()) + .and_then(|probes| Some((probes, device.route_counts_kernel()?))); + later_probes.push(match probes { + Some((probes, kernel)) => { let between = Position { first: false, last: false, @@ -6268,7 +6272,7 @@ impl RenderLowering { let none = Feedback::NONE; let pass = render_target::final_pass(&device, own, shape, between, none, rests)?; - Some(gpu_routes::ProbeSteps::plan(&device, probes, pass)?) + Some(gpu_routes::ProbeSteps::plan(&device, probes, kernel, pass)?) } None => None, }); @@ -8698,11 +8702,10 @@ impl RenderLowering { // A route that could not record leaves the draw to its region-copy route. recorded &= drawn.is_ok() && self.gpu_recorded; } - let probes = self.current.routes.probes.as_ref(); + let probes = self.current.routes.probes.as_mut(); if let (true, Some(slot), Some(probes)) = (recorded, slot, probes) { if probes.holds(slot) { probes.mark(slot); - (self.core.device().shared().counts).rate_map_gpu_routed_draw(); } } Ok(()) @@ -8760,6 +8763,8 @@ impl RenderLowering { let compatible = Arc::clone(&self.current.compatible); let draws = self.core.command_buffer().begin_draws(&compatible).ok()?; self.current.routes.probes = Some(gpu_routes::Probes::new(draws)); + // The routes' kernel, made ahead on the device's pool (`gpu_routes.rs`). + device.begin_route_counts_kernel(); } let mut state = self.core.command_buffer().state(); let probes = self.current.routes.probes.as_mut()?; diff --git a/crates/metal2vulkan-runtime/src/render/gpu_routes.rs b/crates/metal2vulkan-runtime/src/render/gpu_routes.rs index d8d2e5a44..39645a493 100644 --- a/crates/metal2vulkan-runtime/src/render/gpu_routes.rs +++ b/crates/metal2vulkan-runtime/src/render/gpu_routes.rs @@ -27,10 +27,16 @@ //! the kernel runs over each chunk of the probes' words, and a barrier takes its writes to the //! instance's indirect reads, to everything after, and to the host. So the probe reads what the //! draw reads: no draw of the instance before it wrote memory. +//! - **The kernel, made ahead.** A pass's first routed draw begins the kernel on the device's +//! pool (`Device::begin_route_counts_kernel`), once per device; the encoder takes it as it +//! ends only where it is made (`Device::route_counts_kernel`), so neither its making nor a wait +//! for its turn lies on the encoding thread. An instance whose kernel is not made by then runs +//! no steps: its draws' counts keep what the CPU wrote, so each draws its region-copy route, as +//! a draw whose other routes did not record does. //! - **Counted** (`WorkCounts::rate_map_gpu_routed_draws`, `rate_map_gpu_fanned_draws`, -//! `rate_map_gpu_copied_draws`): each routed draw as its mark is written, and as the command -//! buffer completes, the routed draws the kernel decided to fan out and those it decided to -//! draw by region copies, read from their marks and counts ([`RouteCounts`]). +//! `rate_map_gpu_copied_draws`): an instance's marked draws as its steps are planned, and as +//! the command buffer completes, the routed draws the kernel decided to fan out and those it +//! decided to draw by region copies, read from their marks and counts ([`RouteCounts`]). //! //! Every route the GPU picks between is the pair a host step's routes mix in one pass //! (`bind::fan_out`, **One route per pass**): a draw that tests `Equal` the depth another stored @@ -41,7 +47,7 @@ use super::bound::Bound; use crate::device::functions::Vk; use crate::error::Error; use crate::exit_guard; -use crate::owned_kernel::{OwnedBinds, OwnedKernel, OwnedModule, OwnedSet}; +use crate::owned_kernel::{OwnedBinds, OwnedKernel, OwnedSet}; use crate::recorder::CountDraws; use crate::render_target::RenderPassObject; use crate::tracker::Barrier; @@ -73,6 +79,8 @@ pub(super) struct Probes { pub(super) draws: vk::CommandBuffer, pub(super) bound: Bound, chunks: Vec, + /// The draws marked routed ([`mark`](Self::mark)). + marked: u64, } /// One chunk of an instance's probes' words: [`CHUNK_DRAWS`] draws' probe words, zero, and their @@ -223,6 +231,7 @@ impl Probes { draws, bound: Bound::default(), chunks: Vec::new(), + marked: 0, } } @@ -289,10 +298,11 @@ impl Probes { /// Mark `slot`'s draw routed: its probe and both its routes recorded, the kernel decides its /// counts. - pub(super) fn mark(&self, slot: RouteSlot) { + pub(super) fn mark(&mut self, slot: RouteSlot) { if let Some(chunk) = self.chunks.get(slot.chunk).filter(|_| self.holds(slot)) { let at = 4 * u64::from(slot.index * ROUTE_WORDS); chunk.routes.write_at(at, &ROUTE_ROUTED.to_le_bytes()); + self.marked += 1; } } } @@ -311,13 +321,14 @@ pub(super) struct ProbeSteps { } impl ProbeSteps { - /// The steps of `probes`, their secondary ended, run in `pass` on `device`. + /// The steps of `probes`, their secondary ended, run in `pass` on `device` by `kernel`, the + /// routes' kernel made ahead (the module docs); their marked draws counted routed. pub(super) fn plan( device: &Device, probes: Probes, + kernel: OwnedKernel, pass: RenderPassObject, ) -> Result { - let kernel = device.owned_kernel(OwnedModule::RouteCounts)?; let sets: Vec = (probes.chunks.iter()) .map(|chunk| OwnedSet { images: Vec::new(), @@ -334,6 +345,7 @@ impl ProbeSteps { .collect(); let binds = OwnedBinds::new(device, &kernel, &sets)?; let chunks = probes.chunks.iter().map(|chunk| chunk.used).collect(); + (device.shared().counts).rate_map_gpu_routed_draws(probes.marked); let counts = RouteCounts { device: device.clone(), routes: (probes.chunks.into_iter()) diff --git a/crates/metal2vulkan-runtime/src/tests/mod.rs b/crates/metal2vulkan-runtime/src/tests/mod.rs index d42ce9f46..ed1ee88e3 100644 --- a/crates/metal2vulkan-runtime/src/tests/mod.rs +++ b/crates/metal2vulkan-runtime/src/tests/mod.rs @@ -631,6 +631,8 @@ mod rate_mapped_pieces; #[cfg(any(m2v_gpu, m2v_cpu_icd))] mod rate_mapped_region_boxes; #[cfg(any(m2v_gpu, m2v_cpu_icd))] +mod rate_mapped_route_kernel; +#[cfg(any(m2v_gpu, m2v_cpu_icd))] mod read_through_constant; #[cfg(any(m2v_gpu, m2v_cpu_icd))] mod read_twin_device; diff --git a/crates/metal2vulkan-runtime/src/tests/rate_mapped_route_kernel.rs b/crates/metal2vulkan-runtime/src/tests/rate_mapped_route_kernel.rs new file mode 100644 index 000000000..91f1720cd --- /dev/null +++ b/crates/metal2vulkan-runtime/src/tests/rate_mapped_route_kernel.rs @@ -0,0 +1,239 @@ +//! The routes' kernel of a rate-mapped pass's draws the GPU routes, made ahead on the device's +//! pool (`render/gpu_routes.rs`, **The kernel, made ahead**): an instance whose encoder ends +//! before it is made makes none itself and runs no steps, and each of its routed draws draws its +//! region-copy route; once it is made, the same draws are fanned out, over the same pixels. +//! +//! A device test: compiled only under the validation crate's GPU safety cfgs (`m2v_gpu`, +//! `m2v_cpu_icd`), on the kind of device the cfg selects. The functions are `tob_triangle` and +//! `tob_solid` of the owned fixture `validation/fixtures/public/engine/tob_renders.ll`. + +use super::blit_holds::{options, Scratch, WAIT}; +use super::encoder_holds::library; +use crate::pipeline::pool::held; +use crate::{ + Buffer, ClearColor, CommandBufferStatus, CommandQueue, Device, LoadAction, PipelineOptions, + RasterizationRateMap, Region, RenderPassDescriptor, RenderPipelineState, ResourceOptions, + StoreAction, Texture, TextureDescriptor, WorkCounts, +}; +use metal2vulkan::bind::{RateMapDescriptor, RateMapLayerDescriptor}; +use metal2vulkan::device::VkFeature; +use metal2vulkan::metal::{IndexType, PixelFormat, PrimitiveType, TextureUsage}; +use metal2vulkan::pipeline::{ColorAttachmentDescriptor, RenderPipelineDescriptor, StageSource}; +use std::time::{Duration, Instant}; + +/// The draws of a frame past the first: small triangles over a grid of this many a side. +const SIDE: u32 = 4; + +struct Lane { + device: Device, + queue: CommandQueue, + pipeline: RenderPipelineState, + positions: Buffer, + indices: Buffer, + color: Buffer, + map: RasterizationRateMap, + target: Texture, +} + +impl Lane { + fn new(device: Device) -> Lane { + let renders = library(&device, "engine/tob_renders.ll"); + let function = |name| { + StageSource::Function( + renders + .new_function_with_name(name) + .unwrap() + .function_descriptor(), + ) + }; + let mut descriptor = RenderPipelineDescriptor::new(function("tob_triangle")); + descriptor.fragment = Some(function("tob_solid")); + descriptor.color_attachments[0] = + Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm)); + let pipeline = device + .new_render_pipeline_state(&descriptor, &PipelineOptions::default()) + .unwrap(); + // Each triangle a twentieth of the view wide: it touches few regions, so the probe + // flags none. + let positions: Vec = (0..SIDE * SIDE) + .flat_map(|k| { + let at = |i: u32| -0.8 + 1.6 * i as f32 / SIDE as f32; + let (x, y) = (at(k % SIDE), at(k / SIDE)); + [[x, y], [x + 0.1, y], [x, y + 0.1]] + }) + .flatten() + .flat_map(f32::to_le_bytes) + .collect(); + let indices: Vec = (0..3 * SIDE * SIDE).flat_map(u32::to_le_bytes).collect(); + let color: Vec = [1.0f32, 0.0, 0.0, 1.0] + .into_iter() + .flat_map(f32::to_le_bytes) + .collect(); + let buffer = |bytes: &[u8]| { + (device.new_buffer_with_bytes(bytes, ResourceOptions::shared())).unwrap() + }; + let quality = [0.3f32, 0.6, 1.0, 0.6, 0.3]; + let mut map = RateMapDescriptor::new([512, 512]); + map.layers = vec![RateMapLayerDescriptor::new( + quality.to_vec(), + quality.to_vec(), + )]; + let map = device.new_rasterization_rate_map(&map).unwrap(); + let size = map.physical_size_for_layer(0); + let mut target = + TextureDescriptor::texture_2d(PixelFormat::RGBA8Unorm, size.width, size.height, false); + target.usage = TextureUsage::RENDER_TARGET; + target.resource_options = ResourceOptions::shared(); + Lane { + queue: device.new_command_queue().unwrap(), + pipeline, + positions: buffer(&positions), + indices: buffer(&indices), + color: buffer(&color), + target: device.new_texture(&target).unwrap(), + map, + device, + } + } + + /// A frame of the first `draws` triangles, a draw each: the target's red pixels, and the + /// device's counts before and after. + fn frame(&self, draws: u32) -> (usize, WorkCounts, WorkCounts) { + let before = self.device.work_counts(); + let command_buffer = self.queue.command_buffer().unwrap(); + let mut pass = RenderPassDescriptor::new(); + let color = &mut pass.color_attachments[0]; + color.texture = Some(self.target.clone()); + color.load_action = LoadAction::Clear; + color.clear_color = ClearColor::new(0.0, 0.0, 0.0, 1.0); + color.store_action = StoreAction::Store; + pass.rasterization_rate_map = Some(self.map.clone()); + let mut encoder = command_buffer.render_command_encoder(&pass).unwrap(); + encoder.set_render_pipeline_state(&self.pipeline).unwrap(); + encoder + .set_vertex_buffer(Some(&self.positions), 0, 0) + .unwrap(); + encoder + .set_fragment_buffer(Some(&self.color), 0, 0) + .unwrap(); + for k in 0..u64::from(draws) { + encoder + .draw_indexed_primitives( + PrimitiveType::Triangle, + 3, + IndexType::UInt32, + &self.indices, + k * 12, + 1, + 0, + 0, + ) + .unwrap(); + } + encoder.end_encoding().unwrap(); + command_buffer.commit().unwrap(); + command_buffer.wait_until_completed_for(WAIT).unwrap(); + assert_eq!(command_buffer.status(), CommandBufferStatus::Completed); + drop(command_buffer); + let after = self.device.work_counts(); + let (width, height) = (self.target.width(), self.target.height()); + let mut bytes = vec![0u8; (width * height * 4) as usize]; + (self.target) + .get_bytes( + &mut bytes, + width * 4, + 0, + Region::new_2d(0, 0, width, height), + 0, + 0, + ) + .unwrap(); + let red = bytes.chunks(4).filter(|t| t[..3] == [255, 0, 0]).count(); + (red, before, after) + } +} + +/// Whether `device` routes a fanning pass's draws on the GPU (`render/gpu_routes.rs`). +fn routes_on_gpu(device: &Device) -> bool { + let profile = device.compile_device().profile(); + let features = &profile.enabled().features; + [ + VkFeature::GeometryShader, + VkFeature::ShaderClipDistance, + VkFeature::VertexPipelineStoresAndAtomics, + VkFeature::ShaderOutputViewportIndex, + VkFeature::ShaderDrawParameters, + VkFeature::DrawIndirectCount, + VkFeature::MultiDrawIndirect, + ] + .iter() + .all(|feature| features.contains(feature)) +} + +/// Wait until `done` holds, for ten seconds at most. +fn until(what: &str, done: impl Fn() -> bool) { + let start = Instant::now(); + while !done() { + assert!(start.elapsed() < Duration::from_secs(10), "{what}"); + std::thread::sleep(Duration::from_millis(5)); + } +} + +/// The routes' counts between two counts: routed, fanned out, through the region-copy variant. +fn routes(before: &WorkCounts, after: &WorkCounts) -> [u64; 3] { + [ + after.rate_map_gpu_routed_draws - before.rate_map_gpu_routed_draws, + after.rate_map_gpu_fanned_draws - before.rate_map_gpu_fanned_draws, + after.rate_map_gpu_copied_draws - before.rate_map_gpu_copied_draws, + ] +} + +/// The first frame draws once, its region-copy variant being made, so it begins the fan-out's +/// variants and no routes' kernel; with the pool held, the next frame's routed draws begin the +/// kernel, which is not made as their encoder ends: the encoder makes none, and the draws are +/// drawn by their region-copy route; with the pool let go and the kernel made, the same draws +/// are fanned out, over the same pixels. +#[test] +fn an_instance_ending_before_its_routes_kernel_is_made_draws_the_region_copy_route() { + let scratch = Scratch::new("rate-mapped-route-kernel"); + let lane = Lane::new(Device::system_default_with(&options(&scratch.0)).unwrap()); + if !routes_on_gpu(&lane.device) { + eprintln!("RATE-MAP-ROUTE-KERNEL: the device routes no draw on the GPU"); + return; + } + let draws = SIDE * SIDE; + let (red, ..) = lane.frame(1); + assert!(red > 0, "the first frame drew nothing"); + assert!( + lane.device.route_counts_kernel().is_none(), + "the first frame's draw, its region-copy variant being made, began the routes' kernel" + ); + let pool = &lane.device.shared().pipeline_pool; + until("the fan-out's variants still being made", || { + pool.busy() == 0 + }); + let hold = held::hold(); + let (held_red, before, after) = lane.frame(draws); + let made = after.owned_kernels_made - before.owned_kernels_made; + let held_routes = routes(&before, &after); + let copies = after.rate_map_region_copy_draws - before.rate_map_region_copy_draws; + drop(hold); + until("the routes' kernel never made", || { + lane.device.route_counts_kernel().is_some() + }); + let (made_red, before, after) = lane.frame(draws); + let made_routes = routes(&before, &after); + eprintln!( + "RATE-MAP-ROUTE-KERNEL: held, {held_red} red, {made} kernels made, routed, fanned, \ + copied {held_routes:?}, {copies} region-copy draws; made, {made_red} red, {made_routes:?}" + ); + assert_eq!(made, 0, "the encoder made the routes' kernel itself"); + assert_eq!(held_routes, [0, 0, 0], "draws routed without the kernel"); + assert_eq!(u64::from(draws), copies, "the draws' region-copy route"); + assert_eq!( + made_routes, + [u64::from(draws), u64::from(draws), 0], + "the draws fanned out once the kernel is made" + ); + assert_eq!(held_red, made_red, "the routes' pixels"); +} diff --git a/crates/metal2vulkan-runtime/src/work_counts.rs b/crates/metal2vulkan-runtime/src/work_counts.rs index c7bac5dfe..707c66f7a 100644 --- a/crates/metal2vulkan-runtime/src/work_counts.rs +++ b/crates/metal2vulkan-runtime/src/work_counts.rs @@ -3449,10 +3449,10 @@ impl Counters { (self.rate_map_boxed_draws).fetch_add(1, Ordering::Relaxed); } - /// A draw of the encoder's own recorded its probe and both its routes, whose counts the GPU - /// decides (`render/gpu_routes.rs`). - pub(crate) fn rate_map_gpu_routed_draw(&self) { - (self.rate_map_gpu_routed_draws).fetch_add(1, Ordering::Relaxed); + /// `draws` of the encoder's own recorded their probes and both their routes, in an instance + /// whose steps run the routes' kernel, which decides their counts (`render/gpu_routes.rs`). + pub(crate) fn rate_map_gpu_routed_draws(&self, draws: u64) { + (self.rate_map_gpu_routed_draws).fetch_add(draws, Ordering::Relaxed); } /// The routed draws of an instance whose command buffer completed: `fanned` the GPU decided to @@ -8557,7 +8557,8 @@ pub struct WorkCounts { pub rate_map_boxed_draws: u64, /// The encoder's own draws of a fanning pass that recorded their probe and both their routes, /// the fan-out variant's and the region-copy variant's, whose counts the GPU decides from the - /// probe (`render/gpu_routes.rs`): among + /// probe, counted as the encoder ends where their instance's steps run the routes' kernel + /// (`render/gpu_routes.rs`): among /// [`rate_map_region_copy_draws`](Self::rate_map_region_copy_draws). pub rate_map_gpu_routed_draws: u64, /// Those the GPU fanned out, its probe flagging none of their triangles, read as their command diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index a11d742b2..2cfa305bd 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -94,7 +94,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 523; /// changes no behaviour, and then updates that hash alone with the commit saying why, or changes /// behaviour and also bumps this version. The commit that bumps it says what changed; this comment /// keeps no history. -pub const RUNTIME_VERSION: u32 = 2390; +pub const RUNTIME_VERSION: u32 = 2391; /// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex, /// of the manifest, the build script, and exactly the files the crate roots' module tree compiles