YCbCr conversion: count and announce the device's conversion once, as the texture is made
The lazy conversion (a9d9712869) announced the device's conversion as the texture was made and again where its first conversion made the device's sampling, and counted it only there. On the Radeon 780M (um870 job m3-max-8351) tests::ycbcr_device saw the notice twice (2 against 1), and the ycbcr_textures lane, which reads a texture made while ycbcr_device_conversions grows as the device's, held the device's texels of a kept image to Metal's grid (688.5 off the grid). Both now happen once, in YCbCrConversion::new, where the texture is made, as before the conversion was made lazily: Converts::new takes the device's conversion on the same terms (the staging copy's planes at BYTES_AT, a multiple of 4, of the staging buffer's own VkBuffer) and neither counts nor announces, nor does YCbCrDeviceSampling::new. The WorkCounts docs say the count is taken as the texture is made. Verified: cargo fmt; the 780M run follows. (cherry picked from commit 9bd9b9077b25718979af0486c45c2ad7bb4a7b95)
This commit is contained in:
1 parent
26db05e481
commit
be9e3547b2
3 files changed
+13
-9
No files matched your search
@@ -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
|
||||
|
||||
@@ -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<u64>),
|
||||
@@ -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 {
|
||||
|
||||
@@ -773,7 +773,6 @@ impl YCbCrDeviceSampling {
|
||||
[chroma_width, chroma_height],
|
||||
),
|
||||
];
|
||||
device.shared().counts.ycbcr_device_conversion();
|
||||
Ok(YCbCrDeviceSampling {
|
||||
device: device.clone(),
|
||||
image,
|
||||
|
||||
Reference in new issue
Block a user