rt: delete Device::release_indices, Grants::release and Refusal::IndicesInUse
A grant now lasts as long as the device. The consumer never returns one:
its code, read at its tree on the 8a36a49453 pin, has zero calls of
release_indices and no IndicesInUse (it calls grant_indices in four
files). Only the runtime's own tests called it.
Product: Grants::release, Device::release_indices with its doc, the
IndicesInUse variant and its Display arm go; Bits::put and Grants::set
lose the clearing arm only release used. 40 code lines and 19 comment
lines fewer. IndexGrant::indices stays (grant uses it). Grants are
dropped with the device.
Docs: the README's index section, Device::grant_indices, new_texture,
IndicesNotGranted, Gauges::releases_waiting and the pool's release
comments no longer name the call; they say a grant lasts as long as the
device and point at Gauges::descriptor_slots where a vacate shows.
api_signatures.tsv re-blessed (two records out) and docs/REFUSALS.md
regenerated (77 runtime refusals). The api_surface table pins only the
translator's names and does not change.
Tests: 36 tests called release_indices only as cleanup; those calls go
and their grant bindings take a leading underscore. The two Grants unit
tests in tests/arrays.rs drop their release cases. The four that read IndicesInUse read instead:
- an_index_has_one_owner_the_object_placed_there_last: the owners map
(owns goes false after the owner's vacate);
- every_device_round_trips_texture_bytes and
every_device_shares_sampler_states_device_samplers:
Gauges::descriptor_slots, counted while the objects live and back to
its count before the placements once they are gone;
- every_device_holds_a_release_until_the_work_committed_before_it_retires:
releases_waiting nonzero and descriptor_slots 1 under the work, then
descriptor_slots 0 once releases_waiting reads 0 (the block-maker
thread vacates the index before that gauge falls).
Checked before the commit: signatures.py --check and
refusal_surface.py --check pass. The compile gate (fmt check; clippy
plain, --cfg m2v_gpu and --cfg m2v_cpu_icd; workspace Rustdoc, all with
-D warnings) and the runtime's tests on lavapipe run on this commit.
This commit is contained in:
1 parent
c44e588007
commit
f61383d22b
22 files changed
+109
-314
No files matched your search
@@ -1118,9 +1118,8 @@ made, with no lock, and never rewritten for layouts.
|
||||
(`IndexClass::range`): textures of every usage take 1 to 65,535, one index valid in both
|
||||
texture arrays, so a texture of any usage can be made at any index of a texture grant; samplers
|
||||
take 1 to 3,999. Index 0 is nil and never granted. A range that is empty or leaves its class's is
|
||||
`Limit::IndexRange`, and one holding an index granted already `Refusal::IndicesGranted`.
|
||||
`Device::release_indices` returns a grant; one not granted is `Refusal::IndicesNotGranted`, and
|
||||
one where an object still holds an index `Refusal::IndicesInUse`.
|
||||
`Limit::IndexRange`, and one holding an index granted already `Refusal::IndicesGranted`. A
|
||||
grant lasts as long as the device.
|
||||
- An index has one owner: the object placed there last, in each class. Making an object at an
|
||||
index another object holds, a live one or one the program released that a command buffer not
|
||||
yet retired still holds, takes the index at once, as Metal's later texture at a resource ID
|
||||
@@ -1149,7 +1148,7 @@ made, with no lock, and never rewritten for layouts.
|
||||
committed before that has retired and the block-maker thread has vacated it, on its first pass
|
||||
after the completion thread's round that retired them, behind the frees ahead of it there
|
||||
(`Gauges::releases_waiting` reads 0 only after that). Its elements read their default again
|
||||
from then, and `Device::release_indices` may return its grant.
|
||||
from then, and `Gauges::descriptor_slots` no longer counts it.
|
||||
|
||||
## Textures
|
||||
|
||||
|
||||
@@ -151,12 +151,8 @@ impl Bits {
|
||||
self.0[(index / 64) as usize] & (1 << (index % 64)) != 0
|
||||
}
|
||||
|
||||
fn put(&mut self, index: u32, on: bool) {
|
||||
let word = &mut self.0[(index / 64) as usize];
|
||||
match on {
|
||||
true => *word |= 1 << (index % 64),
|
||||
false => *word &= !(1 << (index % 64)),
|
||||
}
|
||||
fn put(&mut self, index: u32) {
|
||||
self.0[(index / 64) as usize] |= 1 << (index % 64);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,8 +191,8 @@ impl Grants {
|
||||
self.granted[class.slot()].get(index)
|
||||
}
|
||||
|
||||
fn set(&mut self, class: IndexClass, index: u32, on: bool) {
|
||||
self.granted[class.slot()].put(index, on);
|
||||
fn set(&mut self, class: IndexClass, index: u32) {
|
||||
self.granted[class.slot()].put(index);
|
||||
}
|
||||
|
||||
/// Places an object at `index` of `class`, where it is granted: the object owns the index
|
||||
@@ -255,38 +251,10 @@ impl Grants {
|
||||
return Err(Error::Refused(Refusal::IndicesGranted { class, index }));
|
||||
}
|
||||
for index in grant.indices() {
|
||||
self.set(class, index, true);
|
||||
self.set(class, index);
|
||||
}
|
||||
Ok(grant)
|
||||
}
|
||||
|
||||
/// Returns `grant`, where every index of it is granted and no object holds one.
|
||||
pub(crate) fn release(&mut self, grant: IndexGrant) -> Result<(), Error> {
|
||||
let IndexGrant { class, .. } = grant;
|
||||
let range = class.range();
|
||||
let inside = grant.first >= range.start
|
||||
&& grant
|
||||
.first
|
||||
.checked_add(grant.count)
|
||||
.is_some_and(|end| end <= range.end);
|
||||
let missing = match inside {
|
||||
true => grant.indices().find(|&index| !self.bit(class, index)),
|
||||
false => Some(grant.first),
|
||||
};
|
||||
if let Some(index) = missing {
|
||||
return Err(Error::Refused(Refusal::IndicesNotGranted { class, index }));
|
||||
}
|
||||
let held = (self.owners[class.slot()].keys().copied())
|
||||
.filter(|index| grant.indices().contains(index))
|
||||
.min();
|
||||
if let Some(index) = held {
|
||||
return Err(Error::Refused(Refusal::IndicesInUse { class, index }));
|
||||
}
|
||||
for index in grant.indices() {
|
||||
self.set(class, index, false);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Set 1, its layouts, its default samplers, and the grants of its indices.
|
||||
@@ -980,8 +948,8 @@ fn write(
|
||||
impl Device {
|
||||
/// No Metal counterpart: grants the consumer `first..first + count` of `class`, the range it
|
||||
/// names, so the resource IDs it chooses from it reproduce in replay. A texture or a sampler
|
||||
/// state is made at an index of a live grant of its class, and so is each constexpr sampler a
|
||||
/// pipeline state numbers.
|
||||
/// state is made at an index of a grant of its class, and so is each constexpr sampler a
|
||||
/// pipeline state numbers. A grant lasts as long as the device.
|
||||
///
|
||||
/// Err: [`Limit::IndexRange`] where the range is empty or leaves the class's
|
||||
/// ([`IndexClass::range`]); [`Refusal::IndicesGranted`] where one of its indices is granted
|
||||
@@ -994,16 +962,4 @@ impl Device {
|
||||
) -> Result<IndexGrant, Error> {
|
||||
lock(&self.core().arrays.grants).grant(class, first, count)
|
||||
}
|
||||
|
||||
/// No Metal counterpart: returns a grant [`Device::grant_indices`] made, so its indices may be
|
||||
/// granted again.
|
||||
///
|
||||
/// Err: [`Refusal::IndicesNotGranted`] where one of its indices is not granted;
|
||||
/// [`Refusal::IndicesInUse`] where a texture or a sampler state lives at one, until its last
|
||||
/// handle is gone and, where work was in flight then, the block-maker thread has vacated the
|
||||
/// index: on its first pass after the completion thread's round that retired the command
|
||||
/// buffers committed before the release, behind the frees ahead of it there.
|
||||
pub fn release_indices(&self, grant: IndexGrant) -> Result<(), Error> {
|
||||
lock(&self.core().arrays.grants).release(grant)
|
||||
}
|
||||
}
|
||||
@@ -2788,8 +2788,9 @@ pub struct Gauges {
|
||||
/// indices and device samplers that wait for the command buffers committed before them to
|
||||
/// retire, which may reach them through set 1 with no handle of them; none where nothing was
|
||||
/// in flight at the release. One stops counting once that work has retired and the
|
||||
/// block-maker thread has taken it: an index vacated, so its grant may be returned, an object
|
||||
/// handed to the reaper thread, which frees it next.
|
||||
/// block-maker thread has taken it: an index vacated, so
|
||||
/// [`descriptor_slots`](Self::descriptor_slots) no longer counts it, an object handed to the
|
||||
/// reaper thread, which frees it next.
|
||||
pub releases_waiting: u64,
|
||||
/// Indirect command buffers alive, each with its records' block
|
||||
/// ([`Device::new_indirect_command_buffer`](crate::Device::new_indirect_command_buffer)).
|
||||
|
||||
@@ -426,31 +426,17 @@ pub enum Refusal {
|
||||
/// The first index of the range that is granted already.
|
||||
index: u32,
|
||||
},
|
||||
/// A texture, a sampler state or a pipeline state's constexpr sampler at an index no live
|
||||
/// grant of its class holds ([`Device::new_texture`](crate::Device::new_texture),
|
||||
/// A texture, a sampler state or a pipeline state's constexpr sampler at an index no grant
|
||||
/// of its class holds ([`Device::new_texture`](crate::Device::new_texture),
|
||||
/// [`Device::new_sampler_state`](crate::Device::new_sampler_state),
|
||||
/// [`Device::new_compute_pipeline_state`](crate::Device::new_compute_pipeline_state)), or a
|
||||
/// release of an index that is not granted
|
||||
/// ([`Device::release_indices`](crate::Device::release_indices)). Metal has no counterpart.
|
||||
/// [`Device::new_compute_pipeline_state`](crate::Device::new_compute_pipeline_state)). Metal
|
||||
/// has no counterpart.
|
||||
///
|
||||
/// Basis: ours (an object takes an index the consumer was granted, and a grant is returned
|
||||
/// once).
|
||||
/// Basis: ours (an object takes an index the consumer was granted).
|
||||
IndicesNotGranted {
|
||||
/// The class of the index.
|
||||
class: IndexClass,
|
||||
/// The first index of the range that is not granted.
|
||||
index: u32,
|
||||
},
|
||||
/// A release of a grant while a texture, a sampler state or a constexpr sampler holds one of
|
||||
/// its indices ([`Device::release_indices`](crate::Device::release_indices)), a released one
|
||||
/// until the command buffers committed before its release retired and the runtime vacated
|
||||
/// the index. Metal has no counterpart.
|
||||
///
|
||||
/// Basis: ours (an object's index stays granted while the object holds it).
|
||||
IndicesInUse {
|
||||
/// The class of the index.
|
||||
class: IndexClass,
|
||||
/// The first index of the grant where an object lives.
|
||||
/// The index that is not granted.
|
||||
index: u32,
|
||||
},
|
||||
/// A texture shaders reach made without an index, or one they do not reach made with one
|
||||
@@ -2138,9 +2124,6 @@ impl fmt::Display for Refusal {
|
||||
Refusal::IndicesNotGranted { class, index } => {
|
||||
write!(f, "{class:?} index {index} is not granted")
|
||||
}
|
||||
Refusal::IndicesInUse { class, index } => {
|
||||
write!(f, "an object lives at {class:?} index {index} of the grant")
|
||||
}
|
||||
Refusal::TextureIndex { index: Some(index) } => write!(
|
||||
f,
|
||||
"a texture no shader reaches takes no index, and {index} was given"
|
||||
|
||||
@@ -899,8 +899,7 @@ impl Pool {
|
||||
/// sampler), which work committed before now may reach with no handle of it, through set 1:
|
||||
/// it goes once that work retired ([`Wait`]): an index on the block-maker thread, an object
|
||||
/// on the reaper thread. Where none is in flight, it goes at once, an index on this thread,
|
||||
/// so its grant may be returned at once
|
||||
/// ([`Device::release_indices`](crate::Device::release_indices)). Releases keep their order.
|
||||
/// so it is vacated before the program's release returns. Releases keep their order.
|
||||
pub(crate) fn release(&self, core: &Core, object: Free) {
|
||||
let wait = self.noted();
|
||||
let now = matches!(wait, Wait::Progress(0));
|
||||
@@ -1613,7 +1612,7 @@ pub(crate) fn run(core: Arc<Core>) {
|
||||
(state, object) = ripe(&core, state, |state| &mut state.held, &mut held);
|
||||
if let Some(object) = object {
|
||||
drop(state);
|
||||
// An index goes here, before the gauge falls, so its grant may be returned once
|
||||
// An index goes here, before the gauge falls, so every released index is vacated once
|
||||
// nothing waits; an object goes to the reaper.
|
||||
match object {
|
||||
Free::TextureIndex(..) | Free::SamplerIndex(..) => {
|
||||
|
||||
@@ -154,7 +154,7 @@ mod on_device {
|
||||
return;
|
||||
};
|
||||
each_device("argument_sampling", |name, _, device| {
|
||||
let grants = [
|
||||
let _grants = [
|
||||
(IndexClass::Texture, 1),
|
||||
(IndexClass::Sampler, SLOT_SAMPLER),
|
||||
]
|
||||
@@ -217,9 +217,6 @@ mod on_device {
|
||||
);
|
||||
}
|
||||
drop((command_buffer, queue, state, sampler, h, f));
|
||||
for grant in grants {
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
println!(
|
||||
"{name}: an argument buffer's textures sampled through slot and constexpr samplers"
|
||||
);
|
||||
@@ -437,7 +434,7 @@ mod on_device {
|
||||
return;
|
||||
};
|
||||
each_device("argument_sampling", |name, _, device| {
|
||||
let grants = [(IndexClass::Texture, 1, 1), (IndexClass::Sampler, 1, 4)].map(
|
||||
let _grants = [(IndexClass::Texture, 1, 1), (IndexClass::Sampler, 1, 4)].map(
|
||||
|(class, first, count)| {
|
||||
(device.grant_indices(class, first, count))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"))
|
||||
@@ -503,9 +500,6 @@ mod on_device {
|
||||
);
|
||||
}
|
||||
drop((command_buffer, queue, state, t));
|
||||
for grant in grants {
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
println!(
|
||||
"{name}: an argument buffer's texture sampled through a table of constexpr samplers"
|
||||
);
|
||||
@@ -527,7 +521,7 @@ mod on_device {
|
||||
return;
|
||||
};
|
||||
each_device("argument_sampling", |name, _, device| {
|
||||
let grants = [
|
||||
let _grants = [
|
||||
(IndexClass::Texture, 1),
|
||||
(IndexClass::Sampler, SLOT_SAMPLER),
|
||||
]
|
||||
@@ -606,9 +600,6 @@ mod on_device {
|
||||
"{name}: through a resource ID whose index is past the sampler arrays"
|
||||
);
|
||||
drop((command_buffer, queue, state, sampler, t));
|
||||
for grant in grants {
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
println!(
|
||||
"{name}: an argument buffer's texture sampled through the argument buffer's sampler"
|
||||
);
|
||||
@@ -687,7 +678,7 @@ mod on_device {
|
||||
let uv = normalized_grid(WIDTH, HEIGHT);
|
||||
let count = uv.len();
|
||||
each_device("argument_sampling", |name, _, device| {
|
||||
let grants = [
|
||||
let _grants = [
|
||||
(IndexClass::Texture, 1, 1),
|
||||
(IndexClass::Sampler, SLOT_SAMPLER, 4),
|
||||
]
|
||||
@@ -838,9 +829,6 @@ mod on_device {
|
||||
samplers,
|
||||
t,
|
||||
));
|
||||
for grant in grants {
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
println!(
|
||||
"{name}: one texture sampled alike through an argument buffer's sampler and a \
|
||||
slot's, under {} address modes at {count} coordinates",
|
||||
|
||||
@@ -172,7 +172,7 @@ mod on_device {
|
||||
"{name}"
|
||||
);
|
||||
let state = state(name, &device, &library, "a8r_held");
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 2))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 2))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let rw = texture(name, &device, 2, 1, &TEXELS);
|
||||
let w = texture(name, &device, 2, 2, &[[0.0; 4]; 4]);
|
||||
@@ -223,7 +223,6 @@ mod on_device {
|
||||
"{name}: the write member"
|
||||
);
|
||||
drop((rw, w, command_buffer));
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!("{name}: an argument buffer's read_write and write textures read and wrote");
|
||||
});
|
||||
}
|
||||
@@ -238,7 +237,7 @@ mod on_device {
|
||||
each_device("argument_tier_gpu_written", |name, _, device| {
|
||||
let copy = state(name, &device, &library, "ab_copy");
|
||||
let read = state(name, &device, &library, "ab_read");
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 1))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 1))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let texture = texture(name, &device, 1, 1, &TEXELS[..1]);
|
||||
let mut shared = Shared::new(&device);
|
||||
@@ -267,7 +266,6 @@ mod on_device {
|
||||
assert_eq!(command_buffer.error(), None, "{name}");
|
||||
assert_eq!(float4s(&out, 1), [TEXELS[0]], "{name}");
|
||||
drop((texture, command_buffer));
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!("{name}: a texture read through an argument buffer a kernel wrote");
|
||||
});
|
||||
}
|
||||
@@ -281,7 +279,7 @@ mod on_device {
|
||||
};
|
||||
each_device("argument_tier_private", |name, _, device| {
|
||||
let read = state(name, &device, &library, "ab_read");
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 1))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 1))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let texture = texture(name, &device, 1, 1, &TEXELS[1..2]);
|
||||
let mut shared = Shared::new(&device);
|
||||
@@ -317,7 +315,6 @@ mod on_device {
|
||||
assert_eq!(command_buffer.error(), None, "{name}");
|
||||
assert_eq!(float4s(&out, 1), [TEXELS[1]], "{name}");
|
||||
drop((texture, held, command_buffer));
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!("{name}: a texture read through a Private argument buffer");
|
||||
});
|
||||
}
|
||||
@@ -332,7 +329,7 @@ mod on_device {
|
||||
};
|
||||
each_device("argument_tier_indexed", |name, _, device| {
|
||||
let read = state(name, &device, &library, "ab_indexed");
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 4))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 4))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let textures: Vec<Texture> = (TEXELS.iter().zip(1..))
|
||||
.map(|(texel, index)| texture(name, &device, 1, index, std::slice::from_ref(texel)))
|
||||
@@ -365,7 +362,6 @@ mod on_device {
|
||||
assert_eq!(command_buffer.error(), None, "{name}");
|
||||
assert_eq!(float4s(&out, 4), TEXELS, "{name}");
|
||||
drop((textures, command_buffer));
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!("{name}: the textures argument buffers a pointer member reaches hold, read");
|
||||
});
|
||||
}
|
||||
@@ -542,19 +538,19 @@ mod on_device {
|
||||
/// A release under work committed before it waits for that work (`crate::memory::Wait`): a
|
||||
/// command buffer that waits on an event, committed before the last handles of a 17 MiB
|
||||
/// Shared block (an allocation of its own) and of a texture at an index drop, holds both.
|
||||
/// Nothing reads either. Past twice the idle age the allocation is not freed, the index is in
|
||||
/// use and `releases_waiting` counts what waits; once the event is set and the command buffer
|
||||
/// retires, the allocation is freed, nothing waits and the grant may be returned. The reaper
|
||||
/// thread is held from before the releases until then, so the grant's return waits on the
|
||||
/// block-maker thread alone, as `releases_waiting` falls only after it vacated the index.
|
||||
/// Nothing reads either. Past twice the idle age the allocation is not freed, the
|
||||
/// descriptor-slot gauge counts the index and `releases_waiting` counts what waits; once the
|
||||
/// event is set and the command buffer retires, the allocation is freed, nothing waits and
|
||||
/// the gauge no longer counts the index. The reaper thread is held from before the releases
|
||||
/// until then, so the index's vacating waits on the block-maker thread alone, as
|
||||
/// `releases_waiting` falls only after it vacated the index.
|
||||
#[test]
|
||||
fn every_device_holds_a_release_until_the_work_committed_before_it_retires() {
|
||||
use crate::tests::command::on_device::{shared_event, within};
|
||||
use crate::{Error, Refusal};
|
||||
const LEN: u64 = 17 << 20;
|
||||
each_device("argument_tier_held_release", |name, _, device| {
|
||||
let counters = device.counters();
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 1))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 1))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let mut d = TextureDescriptor::new(TextureType::Type2D, PixelFormat::RGBA8Unorm, 2, 2);
|
||||
d.usage = TextureUsage::SHADER_READ;
|
||||
@@ -578,27 +574,25 @@ mod on_device {
|
||||
std::thread::sleep(std::time::Duration::from_nanos(
|
||||
2 * crate::memory::IDLE_AGE_NANOS,
|
||||
));
|
||||
let (held, waiting) = (
|
||||
let (held, waiting, slots) = (
|
||||
counters.metrics().allocations_freed,
|
||||
counters.gauges().releases_waiting,
|
||||
counters.gauges().descriptor_slots,
|
||||
);
|
||||
let in_use = device.release_indices(grant);
|
||||
event.set_signaled_value(1);
|
||||
finished(name, &command_buffer);
|
||||
assert_eq!(held, freed, "{name}: an allocation freed under the work");
|
||||
assert!(waiting >= 1, "{name}: {waiting} releases waiting");
|
||||
assert!(
|
||||
matches!(
|
||||
in_use,
|
||||
Err(Error::Refused(Refusal::IndicesInUse { index: 1, .. }))
|
||||
),
|
||||
"{name}: the index under the work: {in_use:?}"
|
||||
);
|
||||
assert_eq!(slots, 1, "{name}: the index under the work");
|
||||
within("the releases once the work retired", || {
|
||||
counters.metrics().allocations_freed > freed
|
||||
&& counters.gauges().releases_waiting == 0
|
||||
});
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
assert_eq!(
|
||||
counters.gauges().descriptor_slots,
|
||||
0,
|
||||
"{name}: the index once nothing waits"
|
||||
);
|
||||
drop(resume);
|
||||
println!("{name}: {waiting} releases held under the work, then gone");
|
||||
});
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
//! - A grant takes a range inside its class's (textures 1 to 65,535, samplers 1 to 3,999); index
|
||||
//! 0, an empty range and one past the class's are
|
||||
//! `Limit::IndexRange`. An index granted already is `Refusal::IndicesGranted`, of any range that
|
||||
//! holds it; a release of an index not granted is `Refusal::IndicesNotGranted`. A released range
|
||||
//! is granted again.
|
||||
//! holds it.
|
||||
//! - Under a device cfg, on every device of the cfg's kind, the device writes every element of
|
||||
//! set 1 its default at creation, and holds two `VkSampler`s for it; grants work through the
|
||||
//! device; `Device::new`, and making and destroying a second set 1, are timed and reported,
|
||||
@@ -52,7 +51,6 @@ fn a_grant_takes_a_range_inside_its_class() {
|
||||
(whole.class, whole.first, whole.count),
|
||||
(class, first, end - first)
|
||||
);
|
||||
grants.release(whole).expect("the release");
|
||||
for (first, count) in [(0, 1), (first - 1, 2), (end - 1, 2), (end, 1), (first, 0)] {
|
||||
assert_eq!(
|
||||
limit(grants.grant(class, first, count)),
|
||||
@@ -75,12 +73,12 @@ fn a_grant_takes_a_range_inside_its_class() {
|
||||
}
|
||||
}
|
||||
|
||||
/// An index has one grant at a time; a released range is granted again; the classes are apart.
|
||||
/// An index has one grant; the classes are apart.
|
||||
#[test]
|
||||
fn an_index_has_one_grant_at_a_time() {
|
||||
let mut grants = Grants::new();
|
||||
let class = IndexClass::Sampler;
|
||||
let held = grants.grant(class, 10, 5).expect("the grant");
|
||||
grants.grant(class, 10, 5).expect("the grant");
|
||||
for (first, count, index) in [(10, 5, 10), (14, 3, 14), (8, 3, 10)] {
|
||||
assert_eq!(
|
||||
refusal(grants.grant(class, first, count)),
|
||||
@@ -92,21 +90,7 @@ fn an_index_has_one_grant_at_a_time() {
|
||||
grants
|
||||
.grant(IndexClass::Texture, 10, 5)
|
||||
.expect("another class's grant");
|
||||
let next = grants.grant(class, 15, 1).expect("the next index");
|
||||
grants.release(held).expect("the release");
|
||||
assert_eq!(
|
||||
refusal(grants.release(held)),
|
||||
Refusal::IndicesNotGranted { class, index: 10 }
|
||||
);
|
||||
// A range partly granted is not released.
|
||||
let mut partly = next;
|
||||
partly.first = 14;
|
||||
partly.count = 2;
|
||||
assert_eq!(
|
||||
refusal(grants.release(partly)),
|
||||
Refusal::IndicesNotGranted { class, index: 14 }
|
||||
);
|
||||
grants.grant(class, 10, 5).expect("the range again");
|
||||
grants.grant(class, 15, 1).expect("the next index");
|
||||
}
|
||||
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
@@ -129,7 +113,7 @@ mod on_device {
|
||||
/// One object `make` makes at every index of `indices` of `class`, through one grant of
|
||||
/// them, then [`AGAIN`] of them each dropped and made again at the index it left, as a
|
||||
/// consumer reuses an index: the descriptor-slot gauge counts them on top of what it counted
|
||||
/// before while they live, and is back to that once they are gone and the grant is released.
|
||||
/// before while they live, and is back to that once they are gone.
|
||||
fn fill_past_capacity<T>(
|
||||
name: &str,
|
||||
device: &Device,
|
||||
@@ -139,7 +123,7 @@ mod on_device {
|
||||
let counters = device.counters();
|
||||
let before = counters.gauges().descriptor_slots;
|
||||
let Range { start, end } = indices;
|
||||
let grant = (device.grant_indices(class, start, end - start))
|
||||
let _grant = (device.grant_indices(class, start, end - start))
|
||||
.unwrap_or_else(|error| panic!("{name}: {class:?}: {error}"));
|
||||
let mut live: Vec<Option<T>> = (start..end).map(|index| Some(make(index))).collect();
|
||||
let full = before + u64::from(end - start);
|
||||
@@ -163,7 +147,6 @@ mod on_device {
|
||||
before,
|
||||
"{name}: {class:?}"
|
||||
);
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
|
||||
/// Set 1's arrays filled past their capacity: 3,999 sampler states and 128 more, through one
|
||||
@@ -193,7 +176,7 @@ mod on_device {
|
||||
d.usage = TextureUsage::SHADER_READ | TextureUsage::SHADER_WRITE;
|
||||
d.storage_mode = StorageMode::Private;
|
||||
let Range { start, end } = IndexClass::Texture.range();
|
||||
let first = (device.grant_indices(IndexClass::Texture, start, 1))
|
||||
let _first = (device.grant_indices(IndexClass::Texture, start, 1))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let texture = (device.new_texture(&d, Some(start)))
|
||||
.unwrap_or_else(|error| panic!("{name}: texture {start}: {error}"));
|
||||
@@ -203,7 +186,6 @@ mod on_device {
|
||||
.unwrap_or_else(|error| panic!("{name}: view {index}: {error}"))
|
||||
});
|
||||
drop(texture);
|
||||
(device.release_indices(first)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
drop(device);
|
||||
let gauges = counters.gauges();
|
||||
assert_eq!(
|
||||
@@ -259,7 +241,7 @@ mod on_device {
|
||||
println!("M2V-MATRIX device_new/{name} {micros} us");
|
||||
let counters = device.counters();
|
||||
assert_eq!(counters.gauges().device_samplers, 2, "{name}");
|
||||
let grant = device
|
||||
let _grant = device
|
||||
.grant_indices(IndexClass::Texture, 4096, 64)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
assert_eq!(
|
||||
@@ -270,7 +252,6 @@ mod on_device {
|
||||
},
|
||||
"{name}"
|
||||
);
|
||||
device.release_indices(grant).expect("the release");
|
||||
let core = device.core();
|
||||
let start = Instant::now();
|
||||
// SAFETY: the device is live and made at the floor.
|
||||
|
||||
@@ -109,9 +109,9 @@ mod on_device {
|
||||
return;
|
||||
};
|
||||
each_device("border_swizzle", |name, _, device| {
|
||||
let textures = (device.grant_indices(IndexClass::Texture, 1, 2))
|
||||
let _textures = (device.grant_indices(IndexClass::Texture, 1, 2))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let samplers = (device.grant_indices(IndexClass::Sampler, 1, 8))
|
||||
let _samplers = (device.grant_indices(IndexClass::Sampler, 1, 8))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
|
||||
// The note, decided by the descriptor on every device.
|
||||
@@ -275,9 +275,6 @@ mod on_device {
|
||||
texture,
|
||||
sampler,
|
||||
));
|
||||
for grant in [textures, samplers] {
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -308,7 +308,7 @@ mod on_device {
|
||||
#[test]
|
||||
fn every_device_copies_a_textures_rows_out_at_their_stride() {
|
||||
each_device("copy_out_rows", |name, _, device| {
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 256)).expect("indices");
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 256)).expect("indices");
|
||||
let (mut index, mut class) = (0, 0);
|
||||
let before = SPLIT.load(Ordering::SeqCst);
|
||||
for format in [
|
||||
@@ -339,7 +339,6 @@ mod on_device {
|
||||
class > 0 && split >= u64::from(class),
|
||||
"{name}: the class's copies split"
|
||||
);
|
||||
(device.release_indices(grant)).expect("a release");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -176,9 +176,9 @@ declare {{ <4 x float>, i8 }} @air.sample_texture_2d.v4f32(ptr addrspace(1), ptr
|
||||
return;
|
||||
};
|
||||
each_device("filter nest", |name, _, device| {
|
||||
let textures = (device.grant_indices(IndexClass::Texture, 1, 2))
|
||||
let _textures = (device.grant_indices(IndexClass::Texture, 1, 2))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let samplers = (device.grant_indices(IndexClass::Sampler, CONSTEXPR, 1))
|
||||
let _samplers = (device.grant_indices(IndexClass::Sampler, CONSTEXPR, 1))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let unrolled = sums(name, &device, &decided, 1);
|
||||
let switched = sums(name, &device, &loaded, 2);
|
||||
@@ -199,8 +199,6 @@ declare {{ <4 x float>, i8 }} @air.sample_texture_2d.v4f32(ptr addrspace(1), ptr
|
||||
"{name}: thread {tid}: {got} against {want}"
|
||||
);
|
||||
}
|
||||
(device.release_indices(textures)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
(device.release_indices(samplers)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!("filter nest: {name}: the unrolled and switched forms write the same 64 sums");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ mod on_device {
|
||||
Ok(vec![0])
|
||||
}))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 3))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 3))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
// Level 0's texel (x, y) is (10 + 40x, 20 + 40y, 30, 200), level 1's (5 + 50x,
|
||||
// 7 + 50y, 99, 150); the red texture's 64 + x + 4y.
|
||||
@@ -176,7 +176,6 @@ mod on_device {
|
||||
);
|
||||
}
|
||||
drop((two_levels, one_level, red, command_buffer));
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!("image reads out of range: {name}: the 11 reads answer Metal's texels");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ mod on_device {
|
||||
let base = counters.gauges().blocks;
|
||||
let made = counters.metrics().blocks_made;
|
||||
let most = 2 * MemoryClass::Private.block_len() / MIB;
|
||||
let grant = device
|
||||
let _grant = device
|
||||
.grant_indices(IndexClass::Texture, 4096, most as u32)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let d = TextureDescriptor::new(TextureType::Type2D, PixelFormat::RGBA8Unorm, 512, 512);
|
||||
@@ -190,9 +190,6 @@ mod on_device {
|
||||
"{name}: after the rounds"
|
||||
);
|
||||
|
||||
device
|
||||
.release_indices(grant)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
drop(device);
|
||||
wait_until("the teardown", || counters.gauges() == Gauges::default());
|
||||
println!(
|
||||
@@ -250,7 +247,7 @@ mod on_device {
|
||||
.unwrap_or_else(|error| panic!("{name}: a release: {error}"));
|
||||
}
|
||||
}
|
||||
let grant = device
|
||||
let _grant = device
|
||||
.grant_indices(IndexClass::Texture, 4096, 1)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let d =
|
||||
@@ -264,9 +261,6 @@ mod on_device {
|
||||
);
|
||||
drop(texture);
|
||||
wait_until("the texture freed", || counters.gauges().textures == 0);
|
||||
device
|
||||
.release_indices(grant)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,7 +336,7 @@ mod on_device {
|
||||
);
|
||||
|
||||
// A small texture alone in its texture block, then a sixteenth of the block beside it.
|
||||
let grant = device
|
||||
let _grant = device
|
||||
.grant_indices(IndexClass::Texture, 4096, 2)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let tiny = TextureDescriptor::new(TextureType::Type2D, PixelFormat::RGBA8Unorm, 32, 32);
|
||||
@@ -406,9 +400,6 @@ mod on_device {
|
||||
[1, 0],
|
||||
"{name}: the kept texture block alone holds its unit"
|
||||
);
|
||||
device
|
||||
.release_indices(grant)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
drop(device);
|
||||
wait_until("the teardown", || counters.gauges() == Gauges::default());
|
||||
}
|
||||
@@ -430,7 +421,7 @@ mod on_device {
|
||||
let core = device.core();
|
||||
let counters = device.counters();
|
||||
core.pool.await_internals();
|
||||
let grant = device
|
||||
let _grant = device
|
||||
.grant_indices(IndexClass::Texture, 4096, 2)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
// A texture longer than a block whose block, of its length rounded up to the pool's
|
||||
@@ -516,9 +507,6 @@ mod on_device {
|
||||
wait_until("the small texture freed", || {
|
||||
counters.gauges().textures == 0
|
||||
});
|
||||
device
|
||||
.release_indices(grant)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
drop(device);
|
||||
wait_until("the teardown", || counters.gauges() == Gauges::default());
|
||||
}
|
||||
@@ -542,7 +530,7 @@ mod on_device {
|
||||
let core = device.core();
|
||||
let counters = device.counters();
|
||||
core.pool.await_internals();
|
||||
let grant = device
|
||||
let _grant = device
|
||||
.grant_indices(IndexClass::Texture, 4096, count)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let mut state = 0x2545_F491_4F6C_DD1D_u64;
|
||||
@@ -620,9 +608,6 @@ mod on_device {
|
||||
(0, [0; 4], [unit, 0, 0, 0]),
|
||||
"{name}: nothing placed"
|
||||
);
|
||||
device
|
||||
.release_indices(grant)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
drop(device);
|
||||
wait_until("the teardown", || counters.gauges() == Gauges::default());
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ declare void @air.write_texture_2d.s.v4i32(ptr addrspace(1), <2 x i32>, <4 x i32
|
||||
};
|
||||
let kernels =
|
||||
["rw_tier_f", "rw_tier_u", "rw_tier_s"].map(|entry| (entry, states(entry)));
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, FORMATS.len() as u32))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, FORMATS.len() as u32))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let queue = device.new_command_queue(1).expect("a queue");
|
||||
let mut arena = Arena::new(&device);
|
||||
@@ -392,7 +392,6 @@ declare void @air.write_texture_2d.s.v4i32(ptr addrspace(1), <2 x i32>, <4 x i32
|
||||
}
|
||||
drop((texture, command_buffer));
|
||||
}
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!(
|
||||
"read_write_tier: {name}: the 18 formats read and write, {without_format} \
|
||||
declared without a format, {declared} with it"
|
||||
@@ -426,7 +425,7 @@ declare void @air.write_texture_2d.s.v4i32(ptr addrspace(1), <2 x i32>, <4 x i32
|
||||
let state = (device
|
||||
.new_compute_pipeline_state(&descriptor, |samplers| Ok(vec![0; samplers.len()])))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, BEYOND.len() as u32))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, BEYOND.len() as u32))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let queue = device.new_command_queue(1).expect("a queue");
|
||||
let mut arena = Arena::new(&device);
|
||||
@@ -472,7 +471,6 @@ declare void @air.write_texture_2d.s.v4i32(ptr addrspace(1), <2 x i32>, <4 x i32
|
||||
}
|
||||
drop((texture, command_buffer));
|
||||
}
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!("read_write_beyond: {name}: read {read:?}; refused {refused:?}");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
//! its plain and integer-texture uses, and an equal state, or one differing only in a border
|
||||
//! colour no address mode reads, shares it; a linear state with a compare function takes three;
|
||||
//! an anisotropic state is made. A cubic filter is `Gap::CubicSampler`. A state made at an index
|
||||
//! another holds takes it, and the earlier state's going leaves it; the grant waits for the
|
||||
//! index's owner, and the index is free once that state is gone. The device's samplers come
|
||||
//! back to zero with the device. A state's constexpr samplers numbered up to one the
|
||||
//! translator refuses give back what the earlier ones took. A state binds with LOD clamps that
|
||||
//! read as its own on the compute encoder and the render encoder's vertex and fragment
|
||||
//! functions, and clamps that read otherwise are `Gap::LodClamps`.
|
||||
//! another holds takes it, and the earlier state's going leaves it; the descriptor-slot gauge
|
||||
//! counts the index until its owner is gone. The device's samplers come back to zero with the
|
||||
//! device. A state's constexpr samplers numbered up to one the translator refuses give back
|
||||
//! what the earlier ones took. A state binds with LOD clamps that read as its own on the
|
||||
//! compute encoder and the render encoder's vertex and fragment functions, and clamps that
|
||||
//! read otherwise are `Gap::LodClamps`.
|
||||
|
||||
use crate::error::{Error, Limit};
|
||||
use crate::sampler::SamplerTable;
|
||||
@@ -50,21 +50,11 @@ mod on_device {
|
||||
use crate::tests::devices_of_the_cfgs_kind;
|
||||
use crate::{
|
||||
CompareFunction, Device, DeviceOptions, DispatchType, Error, Gap, IndexClass,
|
||||
KernelInputKind, PixelFormat, Refusal, RenderPassDescriptor, SamplerBorderColor,
|
||||
SamplerDescriptor, SamplerMinMagFilter, SamplerState, TextureDescriptor, TextureType,
|
||||
TextureUsage,
|
||||
KernelInputKind, PixelFormat, RenderPassDescriptor, SamplerBorderColor, SamplerDescriptor,
|
||||
SamplerMinMagFilter, SamplerState, TextureDescriptor, TextureType, TextureUsage,
|
||||
};
|
||||
use metal2vulkan::metal::sampler::SamplerWord;
|
||||
|
||||
/// The refusal of `result`.
|
||||
fn refused(result: Result<impl Sized, Error>) -> Refusal {
|
||||
match result {
|
||||
Err(Error::Refused(refusal)) => refusal,
|
||||
Err(other) => panic!("not a refusal: {other}"),
|
||||
Ok(_) => panic!("not a refusal: it was made"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_device_shares_sampler_states_device_samplers() {
|
||||
let instance = crate::tests::validation::instance(&[]);
|
||||
@@ -77,7 +67,7 @@ mod on_device {
|
||||
let device = Device::new(&physical, DeviceOptions::default())
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let counters = device.counters();
|
||||
let grant = device
|
||||
let _grant = device
|
||||
.grant_indices(IndexClass::Sampler, 1, 16)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let state = |descriptor: &SamplerDescriptor, index| -> SamplerState {
|
||||
@@ -123,14 +113,6 @@ mod on_device {
|
||||
);
|
||||
// A state at the index `a` holds takes it; `a`'s going leaves it.
|
||||
let later = state(&nearest, 1);
|
||||
assert_eq!(
|
||||
refused(device.release_indices(grant)),
|
||||
Refusal::IndicesInUse {
|
||||
class: IndexClass::Sampler,
|
||||
index: 1
|
||||
},
|
||||
"{name}"
|
||||
);
|
||||
assert_eq!(counters.gauges().samplers, 6, "{name}");
|
||||
assert_eq!(counters.gauges().descriptor_slots, 5, "{name}");
|
||||
drop(a);
|
||||
@@ -140,9 +122,6 @@ mod on_device {
|
||||
state(&linear, 1);
|
||||
drop((b, c, d, e));
|
||||
assert_eq!(counters.gauges().descriptor_slots, 0, "{name}");
|
||||
device
|
||||
.release_indices(grant)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
drop(device);
|
||||
let gauges = counters.gauges();
|
||||
assert_eq!(
|
||||
@@ -240,7 +219,7 @@ mod on_device {
|
||||
let device = Device::new(&physical, DeviceOptions::default())
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let counters = device.counters();
|
||||
let grant = device
|
||||
let _grant = device
|
||||
.grant_indices(IndexClass::Sampler, 1, 2)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let before = counters.gauges();
|
||||
@@ -273,9 +252,6 @@ mod on_device {
|
||||
crate::tests::command::on_device::within("the reaper frees the device sampler", || {
|
||||
counters.gauges().device_samplers == before.device_samplers
|
||||
});
|
||||
device
|
||||
.release_indices(grant)
|
||||
.unwrap_or_else(|error| panic!("{name}: index 1 is free: {error}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@ mod on_device {
|
||||
};
|
||||
each_device("sampling_runtime_and_constexpr", |name, _, device| {
|
||||
let counters = device.counters();
|
||||
let grants = [
|
||||
let _grants = [
|
||||
(IndexClass::Texture, 4096),
|
||||
(IndexClass::Texture, 1),
|
||||
(IndexClass::Sampler, 1),
|
||||
@@ -413,11 +413,6 @@ mod on_device {
|
||||
drop((command_buffer, queue, down, up));
|
||||
assert_eq!(counters.gauges().descriptor_slots, slots, "{name}");
|
||||
drop((sampler, source, middle, output));
|
||||
for grant in grants {
|
||||
device
|
||||
.release_indices(grant)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -432,7 +427,7 @@ mod on_device {
|
||||
};
|
||||
each_device("sampling_any_usage_at_any_index", |name, _, device| {
|
||||
let range = IndexClass::Texture.range();
|
||||
let grants = [
|
||||
let _grants = [
|
||||
(IndexClass::Texture, range.start, range.end - range.start),
|
||||
(IndexClass::Sampler, 1, 1),
|
||||
]
|
||||
@@ -459,9 +454,6 @@ mod on_device {
|
||||
let (got, want) = (texels(&written, SIDE / 2), means());
|
||||
assert!(near(&got, &want), "{name}: {got:?} {want:?}");
|
||||
drop((queue, down, sampler, source, written));
|
||||
for grant in grants {
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -483,7 +475,7 @@ mod on_device {
|
||||
};
|
||||
each_device("sampling_through_views", |name, _, device| {
|
||||
let counters = device.counters();
|
||||
let grants = [
|
||||
let _grants = [
|
||||
(IndexClass::Texture, 4096, 4),
|
||||
(IndexClass::Texture, 1, 4),
|
||||
(IndexClass::Sampler, 1, 1),
|
||||
@@ -565,9 +557,6 @@ mod on_device {
|
||||
}
|
||||
drop((queue, down, sampler, first, twin, of_twin));
|
||||
drop((written, written_twin, source, target));
|
||||
for grant in grants {
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -587,7 +576,7 @@ mod on_device {
|
||||
each_device("sampling_index_placed_last", |name, _, device| {
|
||||
let counters = device.counters();
|
||||
let range = IndexClass::Texture.range();
|
||||
let grants = [
|
||||
let _grants = [
|
||||
(IndexClass::Texture, range.start, range.end - range.start),
|
||||
(IndexClass::Sampler, 1, 1),
|
||||
]
|
||||
@@ -662,9 +651,6 @@ mod on_device {
|
||||
drop(d);
|
||||
assert_eq!(counters.gauges().descriptor_slots, slots + 3, "{name}");
|
||||
drop((queue, down, sampler, source, target));
|
||||
for grant in grants {
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -681,7 +667,7 @@ mod on_device {
|
||||
};
|
||||
each_device("sampling_constexpr_index_placed_last", |name, _, device| {
|
||||
let counters = device.counters();
|
||||
let grants = [IndexClass::Texture, IndexClass::Sampler].map(|class| {
|
||||
let _grants = [IndexClass::Texture, IndexClass::Sampler].map(|class| {
|
||||
(device.grant_indices(class, 1, 4))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"))
|
||||
});
|
||||
@@ -737,9 +723,6 @@ mod on_device {
|
||||
drop((up, again));
|
||||
assert_eq!(counters.gauges().descriptor_slots, slots, "{name}");
|
||||
drop((queue, down, sampler, source, middle, output));
|
||||
for grant in grants {
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -760,7 +743,7 @@ mod on_device {
|
||||
};
|
||||
each_device("sampling_released_index_next", |name, _, device| {
|
||||
let counters = device.counters();
|
||||
let grants =
|
||||
let _grants =
|
||||
[(IndexClass::Texture, 8), (IndexClass::Sampler, 1)].map(|(class, count)| {
|
||||
(device.grant_indices(class, 1, count))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"))
|
||||
@@ -826,9 +809,6 @@ mod on_device {
|
||||
drop((b, sb));
|
||||
assert_eq!(counters.gauges().descriptor_slots, slots - 2, "{name}");
|
||||
drop((pending, queue, other, down, first, second));
|
||||
for grant in grants {
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -846,7 +826,7 @@ mod on_device {
|
||||
};
|
||||
each_device("sampling_equal_sampler_held", |name, _, device| {
|
||||
let counters = device.counters();
|
||||
let grants =
|
||||
let _grants =
|
||||
[(IndexClass::Texture, 8), (IndexClass::Sampler, 1)].map(|(class, count)| {
|
||||
(device.grant_indices(class, 1, count))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"))
|
||||
@@ -900,9 +880,6 @@ mod on_device {
|
||||
"{name}: another descriptor at the index writes its elements"
|
||||
);
|
||||
drop((sb, other, held, queue, down, a, target));
|
||||
for grant in grants {
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -914,7 +891,7 @@ mod on_device {
|
||||
return;
|
||||
};
|
||||
each_device("sampling_constexpr_refused", |name, _, device| {
|
||||
let grant = device
|
||||
let _grant = device
|
||||
.grant_indices(IndexClass::Sampler, 1, 4)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let cap = lock(&device.core().samplers).set_cap(|held| held);
|
||||
@@ -943,9 +920,6 @@ mod on_device {
|
||||
)
|
||||
.unwrap_or_else(|error| panic!("{name}: sample_up: {error}"));
|
||||
drop(up);
|
||||
device
|
||||
.release_indices(grant)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ pub(crate) mod on_device {
|
||||
vk::FormatFeatureFlags2::STORAGE_IMAGE
|
||||
| vk::FormatFeatureFlags2::STORAGE_WRITE_WITHOUT_FORMAT,
|
||||
);
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 1))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 1))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let mut d =
|
||||
TextureDescriptor::new(TextureType::Type2D, PixelFormat::RGBA8UnormSRGB, 2, 2);
|
||||
@@ -140,7 +140,6 @@ pub(crate) mod on_device {
|
||||
let read = state(&device, &library, "rrp_sw_read_f");
|
||||
(dispatch(&device, &read, &texture, &out)).unwrap_or_else(|e| panic!("{name}: {e}"));
|
||||
drop(texture);
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!("{name}: the device stores 8-bit sRGB {stores}; stored slots answered so");
|
||||
});
|
||||
}
|
||||
@@ -238,7 +237,7 @@ declare { <4 x float>, i8 } @air.read_texture_2d.v4f32(ptr addrspace(1), ptr add
|
||||
Err(error) => panic!("the argument kernels: {error:?}"),
|
||||
};
|
||||
each_device("declared storage elements", |name, _, device| {
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 16))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 16))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let write = state(&device, &library, "argument_write");
|
||||
let read = state(&device, &library, "argument_read");
|
||||
@@ -338,7 +337,6 @@ declare { <4 x float>, i8 } @air.read_texture_2d.v4f32(ptr addrspace(1), ptr add
|
||||
}
|
||||
drop((cases, parent));
|
||||
(device.release_block(block)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!(
|
||||
"{name}: a declared write refused for {refused:?}; every other case and every \
|
||||
used heap dispatched"
|
||||
@@ -422,7 +420,7 @@ declare void @air.write_texture_2d.v4f32(ptr addrspace(1), <2 x i32>, <4 x float
|
||||
each_device("declared storage elements in draws", |name, _, device| {
|
||||
let writing = render_state(name, &device, &writing);
|
||||
let plain = render_state(name, &device, &plain);
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 16))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 16))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let descriptor = |pixel_format, storage_mode| {
|
||||
let mut d = TextureDescriptor::new(TextureType::Type2D, pixel_format, 2, 2);
|
||||
@@ -524,7 +522,6 @@ declare void @air.write_texture_2d.v4f32(ptr addrspace(1), <2 x i32>, <4 x float
|
||||
"{name}: the fragment function's write"
|
||||
);
|
||||
drop((cases, parent, written));
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!(
|
||||
"{name}: a draw after a declared write refused for {refused:?}; every other case \
|
||||
and every draw of no such access drew"
|
||||
|
||||
@@ -90,7 +90,7 @@ mod on_device {
|
||||
return;
|
||||
};
|
||||
each_device("swizzled kernels", |name, _, device| {
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 2))
|
||||
let _grant = (device.grant_indices(IndexClass::Texture, 1, 2))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let mut d = TextureDescriptor::new(TextureType::Type2D, PixelFormat::RGBA8Unorm, 2, 2);
|
||||
d.usage = TextureUsage::SHADER_READ | TextureUsage::SHADER_WRITE;
|
||||
@@ -172,7 +172,6 @@ mod on_device {
|
||||
"{name}: a write through the view stores the value unswizzled"
|
||||
);
|
||||
drop((view, texture));
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!("{name}: a swizzled view read through, written past, read_write refused");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
//! the type does not take, and levels past the full chain (one for 1D and multisample types).
|
||||
//! - An index has one owner, the object placed there last, in each class: a placement where
|
||||
//! another object holds the index displaces it, and only the owner's vacating frees the index;
|
||||
//! placing at one not granted is `Refusal::IndicesNotGranted`, and a grant is not released while
|
||||
//! an object holds one of its indices (`Refusal::IndicesInUse`); vacated, it is placed at and
|
||||
//! released again.
|
||||
//! placing at one not granted is `Refusal::IndicesNotGranted`; the owner owns the index until
|
||||
//! it vacates it, and vacated, it is placed at again.
|
||||
//! - A view's components are Metal's swizzle over the format's own mapping: zero and one stay,
|
||||
//! and a channel source reads through the format's mapping. A view's swizzle combines with its
|
||||
//! parent's as Metal's does: each channel it names is the parent's as the parent's swizzle
|
||||
@@ -23,9 +22,10 @@
|
||||
//! padding, a 3D region two images deep, a slice of an array, a cube's face, a depth texture,
|
||||
//! and a block-compressed texture where the device makes one; padding in the caller's bytes is
|
||||
//! left alone. A Private texture's bytes are refused. A texture's ID is its index and its
|
||||
//! format's word. An index is taken while its texture lives and free once it is gone, and its
|
||||
//! grant is released only then. The gauges of textures, descriptor slots and blocks come back to
|
||||
//! zero with the device, and the copies are counted in `bytes_copied`.
|
||||
//! format's word. An index is taken while its texture lives and free once it is gone: the
|
||||
//! descriptor-slot gauge counts it while it lives and is back to its count before the
|
||||
//! placements once the textures are gone. The gauges of textures, descriptor slots and blocks
|
||||
//! come back to zero with the device, and the copies are counted in `bytes_copied`.
|
||||
//! - Under a device cfg, `replace_region` reads its bytes in place through `HostBytes::from_raw`,
|
||||
//! from memory no slice covers, and copies the region's bytes once: `bytes_copied` grows by the
|
||||
//! region's rows alone, not the padding between them, and the texture reads them back.
|
||||
@@ -195,7 +195,7 @@ fn each_shape_metal_stops_is_refused() {
|
||||
fn an_index_has_one_owner_the_object_placed_there_last() {
|
||||
for (class, first) in [(IndexClass::Texture, 4096), (IndexClass::Sampler, 1)] {
|
||||
let mut grants = Grants::new();
|
||||
let grant = grants.grant(class, first, 4).expect("the grant");
|
||||
grants.grant(class, first, 4).expect("the grant");
|
||||
let at = first + 1;
|
||||
let place = |grants: &mut Grants| grants.place(class, at).expect("a placement");
|
||||
let earlier = place(&mut grants);
|
||||
@@ -211,16 +211,12 @@ fn an_index_has_one_owner_the_object_placed_there_last() {
|
||||
grants.place(class, first + 4),
|
||||
Err(Error::Refused(Refusal::IndicesNotGranted { index, .. })) if index == first + 4
|
||||
));
|
||||
assert_eq!(
|
||||
refused(grants.release(grant)),
|
||||
Refusal::IndicesInUse { class, index: at }
|
||||
);
|
||||
// The owner's vacating frees the index.
|
||||
assert!(grants.vacate(class, at, later.owner), "{class:?}");
|
||||
assert!(!grants.owns(class, at, later.owner), "{class:?}");
|
||||
let again = place(&mut grants);
|
||||
assert!(!again.displaced, "{class:?}");
|
||||
assert!(grants.vacate(class, at, again.owner), "{class:?}");
|
||||
assert!(grants.release(grant).is_ok(), "{class:?}");
|
||||
}
|
||||
// The classes are apart: a texture grant grants no sampler index.
|
||||
let mut grants = Grants::new();
|
||||
@@ -411,10 +407,10 @@ mod on_device {
|
||||
let device = Device::new(&physical, DeviceOptions::default())
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let counters = device.counters();
|
||||
let sampled = device
|
||||
let _sampled = device
|
||||
.grant_indices(IndexClass::Texture, 4096, 16)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let storage = device
|
||||
let _storage = device
|
||||
.grant_indices(IndexClass::Texture, 1, 16)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let make = |d: &TextureDescriptor, index| {
|
||||
@@ -573,20 +569,12 @@ mod on_device {
|
||||
"{name}"
|
||||
);
|
||||
|
||||
// An index holds its texture until it is gone, and its grant waits for it.
|
||||
// An index holds its texture until it is gone.
|
||||
assert_eq!(
|
||||
refused(device.new_texture(&d, None)),
|
||||
Refusal::TextureIndex { index: None },
|
||||
"{name}"
|
||||
);
|
||||
assert_eq!(
|
||||
refused(device.release_indices(sampled)),
|
||||
Refusal::IndicesInUse {
|
||||
class: IndexClass::Texture,
|
||||
index: 4096
|
||||
},
|
||||
"{name}"
|
||||
);
|
||||
// Seven live at their indices; a dropped texture's image may wait for its upload.
|
||||
let gauges = counters.gauges();
|
||||
assert_eq!(gauges.descriptor_slots, 7, "{name}");
|
||||
@@ -594,12 +582,6 @@ mod on_device {
|
||||
drop(private);
|
||||
make(&d, Some(4102));
|
||||
drop((rgba, half, volume, array, cube, depth));
|
||||
device
|
||||
.release_indices(sampled)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
device
|
||||
.release_indices(storage)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
assert_eq!(counters.gauges().descriptor_slots, 0, "{name}");
|
||||
assert!(counters.metrics().bytes_copied > 0, "{name}");
|
||||
drop(device);
|
||||
@@ -695,7 +677,7 @@ mod on_device {
|
||||
let device = Device::new(&physical, DeviceOptions::default())
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let counters = device.counters();
|
||||
let grant = device
|
||||
let _grant = device
|
||||
.grant_indices(IndexClass::Texture, 4096, 2)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
// Format, type, extent, levels, slices, an element's bytes and the texels across it.
|
||||
@@ -936,9 +918,6 @@ mod on_device {
|
||||
});
|
||||
}
|
||||
}
|
||||
device
|
||||
.release_indices(grant)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!(
|
||||
"texture zeros: {name}: {cleared} new textures read zero where another was written"
|
||||
);
|
||||
@@ -966,7 +945,7 @@ mod on_device {
|
||||
let device = Device::new(&physical, DeviceOptions::default())
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let counters = device.counters();
|
||||
let grant = device
|
||||
let _grant = device
|
||||
.grant_indices(IndexClass::Texture, 4096, 2)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let d = descriptor(
|
||||
@@ -1070,9 +1049,6 @@ mod on_device {
|
||||
"{name}: {barriers} barriers, the moves home and the zeroing's among them"
|
||||
);
|
||||
drop((buffer, block, new, queue));
|
||||
device
|
||||
.release_indices(grant)
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!(
|
||||
"texture zeros: {name}: one upload cleared 2 new textures and counted 1 zeroing \
|
||||
barrier of its {barriers}"
|
||||
|
||||
@@ -927,11 +927,11 @@ impl Device {
|
||||
/// duty, as it is Metal's; nothing checks it). A released one it may: its index, elements,
|
||||
/// views and image go once every command buffer committed before the release retired
|
||||
/// ([`Gauges::releases_waiting`](crate::Gauges::releases_waiting)), the index then on the
|
||||
/// block-maker thread's next pass ([`Device::release_indices`]), so that work reads it as
|
||||
/// it was. Metal leaves that read undefined: a program that released textures a frame in
|
||||
/// flight still sampled finished every run with no command buffer error on two Macs, with the
|
||||
/// answer it gave with the textures held on a Radeon Pro 5300M, and one a few channel levels
|
||||
/// off it, differing from run to run, on an Apple M3 Max. The runtime gives the first answer.
|
||||
/// block-maker thread's next pass, so that work reads it as it was. Metal leaves that read
|
||||
/// undefined: a program that released textures a frame in flight still sampled finished every
|
||||
/// run with no command buffer error on two Macs, with the answer it gave with the textures
|
||||
/// held on a Radeon Pro 5300M, and one a few channel levels off it, differing from run to run,
|
||||
/// on an Apple M3 Max. The runtime gives the first answer.
|
||||
///
|
||||
/// A swizzle composes with the view's own component mapping. Shader-write usage writes the
|
||||
/// storage element where the device stores the format through a storage image without a
|
||||
|
||||
@@ -6638,7 +6638,6 @@ method metal2vulkan-runtime::Device::quiesce pub fn quiesce(&self, timeout: Dura
|
||||
method metal2vulkan-runtime::Device::raw pub fn raw(&self) -> RawDevice<'_>
|
||||
method metal2vulkan-runtime::Device::read_write_texture_support pub fn read_write_texture_support(&self) -> ReadWriteTextureTier
|
||||
method metal2vulkan-runtime::Device::release_block pub fn release_block(&self, block: Block) -> Result<(), Error>
|
||||
method metal2vulkan-runtime::Device::release_indices pub fn release_indices(&self, grant: IndexGrant) -> Result<(), Error>
|
||||
method metal2vulkan-runtime::Device::report_loss pub fn report_loss(&self, loss: DeviceLoss)
|
||||
method metal2vulkan-runtime::Device::supports_texture_sample_count pub fn supports_texture_sample_count(&self, count: u32) -> bool
|
||||
method metal2vulkan-runtime::Device::take_block pub fn take_block(&self, class: MemoryClass, len: u64) -> Result<Block, Error>
|
||||
@@ -9482,7 +9481,6 @@ variant metal2vulkan-runtime::Refusal::HeapTexturePlace HeapTexturePlace { offse
|
||||
variant metal2vulkan-runtime::Refusal::InScheduledHandler InScheduledHandler
|
||||
variant metal2vulkan-runtime::Refusal::IndexBufferOffset IndexBufferOffset { offset: u64, length: u64 }
|
||||
variant metal2vulkan-runtime::Refusal::IndicesGranted IndicesGranted { class: IndexClass, index: u32 }
|
||||
variant metal2vulkan-runtime::Refusal::IndicesInUse IndicesInUse { class: IndexClass, index: u32 }
|
||||
variant metal2vulkan-runtime::Refusal::IndicesNotGranted IndicesNotGranted { class: IndexClass, index: u32 }
|
||||
variant metal2vulkan-runtime::Refusal::IndirectOffset IndirectOffset { offset: u64, length: u64 }
|
||||
variant metal2vulkan-runtime::Refusal::ManagedBlockPrivate ManagedBlockPrivate { block: BlockId }
|
||||
|
||||
|
Can't render this file because it is too large.
|
+4
-6
@@ -32,7 +32,7 @@ Columns:
|
||||
| Rate maps the compile layer does not compile | 5 | 5 | 0 | 0 | 4 | 1 | 0 |
|
||||
| The translation deadline | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
|
||||
| Devices below the runtime's floor | 8 | 8 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 78 | 78 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 77 | 77 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 17 | 17 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Gap` | 30 | 30 | 0 | 0 | 0 | 0 | 0 |
|
||||
|
||||
@@ -46,7 +46,7 @@ Columns:
|
||||
| Rate maps the compile layer does not compile | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
|
||||
| The translation deadline | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
|
||||
| Devices below the runtime's floor | 0 | 0 | 0 | 8 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 22 | 21 | 0 | 0 | 35 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 22 | 21 | 0 | 0 | 34 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 0 | 0 | 0 | 13 | 4 | 0 | 0 | 0 |
|
||||
| The runtime's `Gap` | 0 | 0 | 0 | 2 | 28 | 0 | 0 | 0 |
|
||||
|
||||
@@ -289,8 +289,7 @@ Columns:
|
||||
| `IndirectOffset` | An indirect dispatch's or draw's argument offset that is not a multiple of 4, or that leaves fewer than the arguments' bytes in the buffer | every device (a public call's own check of its arguments) | `ours`: `vkCmdDispatchIndirect`, `vkCmdDrawIndirect` and `vkCmdDrawIndexedIndirect` read their 32-bit words at a 4-byte aligned offset inside the buffer | 2: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (indirect)` | `-` |
|
||||
| `BufferOffsetAlignment` | A dispatch whose kernel, or a draw whose vertex or fragment function, reaches a buffer bound where its address, the buffer's `gpuAddress` plus the... | every device (a public call's own check of its arguments) | `metal-documented`: Metal's API validation refuses the bind offset: "must be a multiple of 4 but was set to 2" for a `uint *` argument bound at offset 2, an Apple M3 Max, macOS 27.0.1, `probes/vector_access_placement.m` in the conformance crate | 1: `crates/metal2vulkan-runtime/src/encoder.rs (check_alignment)` | `-` |
|
||||
| `IndicesGranted` | A grant of an index already granted (`Device::grant_indices`) | every device (a public call's own check of its arguments) | `ours`: each index has one grant, so each resource ID names one object | 1: `crates/metal2vulkan-runtime/src/arrays.rs (grant)` | `-` |
|
||||
| `IndicesNotGranted` | A texture, a sampler state or a pipeline state's constexpr sampler at an index no live grant of its class holds (`Device::new_texture`,... | every device (a public call's own check of its arguments) | `ours`: an object takes an index the consumer was granted, and a grant is returned once | 2: `crates/metal2vulkan-runtime/src/arrays.rs (place)`, `crates/metal2vulkan-runtime/src/arrays.rs (release)` | `-` |
|
||||
| `IndicesInUse` | A release of a grant while a texture, a sampler state or a constexpr sampler holds one of its indices (`Device::release_indices`), a released one... | every device (a public call's own check of its arguments) | `ours`: an object's index stays granted while the object holds it | 1: `crates/metal2vulkan-runtime/src/arrays.rs (release)` | `-` |
|
||||
| `IndicesNotGranted` | A texture, a sampler state or a pipeline state's constexpr sampler at an index no grant of its class holds (`Device::new_texture`,... | every device (a public call's own check of its arguments) | `ours`: an object takes an index the consumer was granted | 1: `crates/metal2vulkan-runtime/src/arrays.rs (place)` | `-` |
|
||||
| `TextureIndex` | A texture shaders reach made without an index, or one they do not reach made with one (`Device::new_texture`) | every device (a public call's own check of its arguments) | `ours`: an index is an element of set 1's texture arrays, which only shaders read | 4: `crates/metal2vulkan-runtime/src/texture.rs (new_drawable_texture)`, `crates/metal2vulkan-runtime/src/texture.rs (surface_texture)` (+2) | `-` |
|
||||
| `TextureZeroExtent` | A texture with a width, height or depth of 0 | every device (a public call's own check of its arguments) | `metal-measured`: an Apple M3 Max, macOS 27.0.1: plain Metal asserts "MTLTextureDescriptor has width of zero", and the same for a height of zero | 1: `crates/metal2vulkan-runtime/src/texture.rs (shape)` | `-` |
|
||||
| `TextureExtentForType` | A texture with a height other than 1 of a 1D type, or a depth other than 1 of a type that is not 3D | every device (a public call's own check of its arguments) | `metal-measured`: an Apple M3 Max, macOS 27.0.1: plain Metal asserts "the texture type MTLTextureType1D requires that height is 1", and the same for a 2D texture of depth 2 | 1: `crates/metal2vulkan-runtime/src/texture.rs (shape)` | `-` |
|
||||
@@ -586,8 +585,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `rt:Refusal::IndirectOffset`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (indirect)`
|
||||
- `rt:Refusal::BufferOffsetAlignment`: `crates/metal2vulkan-runtime/src/encoder.rs (check_alignment)`
|
||||
- `rt:Refusal::IndicesGranted`: `crates/metal2vulkan-runtime/src/arrays.rs (grant)`
|
||||
- `rt:Refusal::IndicesNotGranted`: `crates/metal2vulkan-runtime/src/arrays.rs (place)`; `crates/metal2vulkan-runtime/src/arrays.rs (release)`
|
||||
- `rt:Refusal::IndicesInUse`: `crates/metal2vulkan-runtime/src/arrays.rs (release)`
|
||||
- `rt:Refusal::IndicesNotGranted`: `crates/metal2vulkan-runtime/src/arrays.rs (place)`
|
||||
- `rt:Refusal::TextureIndex`: `crates/metal2vulkan-runtime/src/texture.rs (new_drawable_texture)`; `crates/metal2vulkan-runtime/src/texture.rs (surface_texture)`; `crates/metal2vulkan-runtime/src/texture.rs (texture)`; `crates/metal2vulkan-runtime/src/texture.rs (view)`
|
||||
- `rt:Refusal::TextureZeroExtent`: `crates/metal2vulkan-runtime/src/texture.rs (shape)`
|
||||
- `rt:Refusal::TextureExtentForType`: `crates/metal2vulkan-runtime/src/texture.rs (shape)`
|
||||
|
||||
Reference in new issue
Block a user