diff --git a/crates/metal2vulkan-runtime/src/work_counts.rs b/crates/metal2vulkan-runtime/src/work_counts.rs index 7b765c547..cc4979138 100644 --- a/crates/metal2vulkan-runtime/src/work_counts.rs +++ b/crates/metal2vulkan-runtime/src/work_counts.rs @@ -1325,8 +1325,8 @@ impl Counters { } } - /// A YCbCr texture's conversion, or a render shadow's load, was made to sample its planes' - /// image through the device's own Y′CbCr conversion (`ycbcr_device.rs`). + /// A YCbCr texture was made whose conversion samples its planes' image through the device's + /// own Y′CbCr conversion (`ycbcr_device.rs`). pub(crate) fn ycbcr_device_conversion(&self) { self.ycbcr_device_conversions .fetch_add(1, Ordering::Relaxed); @@ -4643,9 +4643,10 @@ pub struct WorkCounts { pub ycbcr_planes_images_kept_layout: u64, /// Bindings of two-plane YCbCr textures' planes images written into descriptor sets. pub ycbcr_planes_images_bound: u64, - /// Two-plane YCbCr textures' conversions, and render shadows' loads, made to sample the - /// planes' image through the device's own Y′CbCr conversion where it converts their format - /// (`ycbcr_device.rs`), in place of Metal's arithmetic. + /// Two-plane YCbCr textures made whose conversions sample the planes' image through the + /// device's own Y′CbCr conversion where it converts their format (`ycbcr_device.rs`), in + /// place of Metal's arithmetic: counted as each is made, as its conversion is, though the + /// conversion's image, kernel and sets are made at its first conversion. pub ycbcr_device_conversions: u64, /// Samplings of two-plane YCbCr textures' planes' images through the device's own Y′CbCr /// conversion recorded: one per conversion or load of such a texture, run through the diff --git a/crates/metal2vulkan-runtime/src/ycbcr.rs b/crates/metal2vulkan-runtime/src/ycbcr.rs index 904810f6d..82f58d6fa 100644 --- a/crates/metal2vulkan-runtime/src/ycbcr.rs +++ b/crates/metal2vulkan-runtime/src/ycbcr.rs @@ -592,9 +592,9 @@ impl Converts { // multiple of it (`ycbcr_device.rs`). let sampler = YCbCrSampler::of(device, planes, zeros).filter(|_| bytes % 4 == 0); if let Some(sampler) = sampler { + // Counted and announced as the texture was made (`YCbCrConversion::new`). let sampling = YCbCrDeviceSampling::new(device, (planes, sampler), view)?; let groups = sampling.groups(); - announce_device_conversion(device, planes); return Ok((Converts::Device(Box::new(sampling)), groups)); } Converts::ours(device, planes, (raw, bytes, held), shape_at, (view, false)) @@ -766,7 +766,10 @@ impl YCbCrConversion { /// The conversion of `planes`, whose bytes lie in `bytes` of their buffer, at `at` of its /// `VkBuffer`, into `view`, a storage view of the texture's image, on `device`; made at its /// first conversion ([`make`](Self::make)). Where the device converts the planes itself, that - /// is announced here, where the texture is made. + /// is counted (`WorkCounts::ycbcr_device_conversions`) and announced here, where the texture + /// is made: `Converts::new` takes the device's conversion on the same terms, the staging + /// copy's planes lying at `BYTES_AT`, a multiple of 4 bytes, of the staging buffer's own + /// `VkBuffer`. pub(super) fn new( device: &Device, (planes, bytes): (&YCbCrPlanes, Range), @@ -775,7 +778,8 @@ impl YCbCrConversion { ) -> YCbCrConversion { let span = (bytes.end - bytes.start).next_multiple_of(4); let zeros = planes_end(planes).saturating_sub(span).next_multiple_of(4); - if YCbCrSampler::of(device, planes, zeros > 0).is_some() && span % 4 == 0 { + if YCbCrSampler::of(device, planes, zeros > 0).is_some() { + device.shared().counts.ycbcr_device_conversion(); announce_device_conversion(device, planes); } YCbCrConversion { diff --git a/crates/metal2vulkan-runtime/src/ycbcr_device.rs b/crates/metal2vulkan-runtime/src/ycbcr_device.rs index a21af5436..db5c4295c 100644 --- a/crates/metal2vulkan-runtime/src/ycbcr_device.rs +++ b/crates/metal2vulkan-runtime/src/ycbcr_device.rs @@ -773,7 +773,6 @@ impl YCbCrDeviceSampling { [chroma_width, chroma_height], ), ]; - device.shared().counts.ycbcr_device_conversion(); Ok(YCbCrDeviceSampling { device: device.clone(), image,