RUNTIME 2226: a draw compares whole only the kept bind shapes of its key

Each kept bind shape now stores a 64-bit key of every field except its used resources
(BindShape::key_beside_used). A draw computes its own key once, in place, without making the
shape (BindState::shape_key_beside_used). The recent-shape lookup (RecentShapes, 5 shapes) and
the settled-shape lookup (GraphicsState::kept_shape, 4) compare whole only the shapes whose key
matches. A state's key equals the key of every shape it has, so a shape with another key cannot
be its shape; one with the same key is still compared whole, so the answer is exact. The
argument samplers' shapes enter the key as an OR of their hashes, so a shape's set and a state's
list (which may repeat a sampler) key alike.

Why: on the XTX Launchpad walk, draw_resident holds 44-48% of our CPU per frame with no single
dominant callee; the shape lookups were about 7.5% of it (profile bound). Expected cut about
0.25-0.35 ms a frame after paying for the key. Not measured at the frame level yet.

New public surface: WorkCounts::draw_shape_compares, BindState::shape_key_beside_used,
BindShape::key_beside_used (api_signatures.tsv in the commit).

Verified (imgleak, msi job 25756, off aea1543936): clippy -D warnings all features on metal2vulkan
and metal2vulkan-runtime clean; translator bind and API tests 482 passed; runtime unit suite 1525
passed, including the new recent_shape_keys tests (every fixture state's key matches its shapes
and other shapes key apart; with 5 recent shapes each is found with one whole compare, before
5 - at). Conformance cost recordings carry the new count: re-blessed on development if needed.

RUNTIME_VERSION 2225 -> 2226.
This commit is contained in:
Anees Iqbal committed 2026-11-13 09:17:12 -08:00
1 parent 4f0e02ac6b
commit 54752dd4f7
11 files changed
+322 -32

No files matched your search

+38 -18
View File
@@ -33,7 +33,10 @@
//! without listing the resources made resident. Else, and at an encoder's first draw, it is
//! one the drawing state settled lately where the state has it (`BindState::position_of_shape`,
//! compared in place: `GraphicsState::kept_shape`), so a pass that draws as the one before it
//! makes none; else it is made again, whole.
//! makes none; else it is made again, whole. Both keep each shape with its key beside its used
//! resources (`BindShape::key_beside_used`), and the state's key is worked out once, in place
//! (`BindState::shape_key_beside_used`): only a shape of the state's key is compared whole
//! (counted: `WorkCounts::draw_shape_compares`), as a shape of another key is not the state's.
//! - **One per pipeline state lately drawn.** Beside the state its last draw brought in place, the
//! encoder sets aside the states of up to [`SET_ASIDE`] pipeline states it drew before that one
//! ([`LiveBind::select`]), each under the pipeline state whose draw left it, and a draw starts
@@ -313,9 +316,10 @@ pub(super) struct LiveBind {
/// resources it lists now, so the used resources' shape of each is the state's, and a state has
/// one of them as its shape where the rest of it matches (`BindState::has_shape_beside_used`).
/// Forgotten where the state lists other used resources (`RenderCommandEncoder::
/// refresh_bind_state`).
/// refresh_bind_state`). Each is kept with its key beside its used resources
/// (`BindShape::key_beside_used`).
#[derive(Default)]
pub(super) struct RecentShapes(Vec<Arc<BindShape>>);
pub(super) struct RecentShapes(Vec<(u64, Arc<BindShape>)>);
impl RecentShapes {
/// The used resources the state lists changed: none of the shapes may be its shape.
@@ -323,22 +327,33 @@ impl RecentShapes {
self.0.clear();
}
/// The one of them that is `state`'s shape, where one is.
fn find(&self, state: &BindState) -> Option<Arc<BindShape>> {
let mut latest_first = self.0.iter().rev();
/// The one of them that is `state`'s shape, where one is: of those of `key`, the state's key
/// beside its used resources (`BindState::shape_key_beside_used`), the only ones compared
/// whole, each counted in `compared`.
pub(super) fn find(
&self,
state: &BindState,
key: u64,
compared: &mut u64,
) -> Option<Arc<BindShape>> {
let mut latest_first = self.0.iter().rev().filter(|(kept, _)| *kept == key);
latest_first
.find(|shape| state.has_shape_beside_used(shape))
.cloned()
.find(|(_, shape)| {
*compared += 1;
state.has_shape_beside_used(shape)
})
.map(|(_, shape)| Arc::clone(shape))
}
/// Keep `shape`, the state's now, in place of the one kept longest where they are full.
fn keep(&mut self, shape: &Arc<BindShape>) {
if let Some(at) = self.0.iter().position(|kept| Arc::ptr_eq(kept, shape)) {
/// Keep `shape`, the state's now, of key `key` (its `BindShape::key_beside_used`), in place
/// of the one kept longest where they are full.
pub(super) fn keep(&mut self, key: u64, shape: &Arc<BindShape>) {
if let Some(at) = (self.0.iter()).position(|(_, kept)| Arc::ptr_eq(kept, shape)) {
self.0.remove(at);
} else if self.0.len() == RECENT_SHAPES {
self.0.remove(0);
}
self.0.push(Arc::clone(shape));
self.0.push((key, Arc::clone(shape)));
}
}
@@ -761,12 +776,13 @@ impl LiveBind {
}
/// The state's shape: the kept one, else the one of those it took lately that is its shape
/// ([`RecentShapes`]), else the one `found` finds of the state, else made again (counted in
/// `counts`, found or made).
/// ([`RecentShapes`]), else the one `found` finds of the state and its key beside its used
/// resources, else made again (counted in `counts`, found or made, and each whole comparison
/// of the recent shapes').
pub(super) fn shape(
&mut self,
counts: Counting<'_>,
found: impl FnOnce(&BindState) -> Option<Arc<BindShape>>,
found: impl FnOnce(&BindState, u64) -> Option<Arc<BindShape>>,
) -> Arc<BindShape> {
if let Some(shape) = &self.shape {
debug_assert!(
@@ -775,7 +791,11 @@ impl LiveBind {
);
return Arc::clone(shape);
}
if let Some(shape) = self.recent.find(&self.state) {
let key = self.state.shape_key_beside_used();
let mut compared = 0;
let recent = self.recent.find(&self.state, key, &mut compared);
counts.draw_shapes_compared(compared);
if let Some(shape) = recent {
debug_assert!(
*shape == self.state.shape(),
"a recent bind shape that is not its state's"
@@ -783,7 +803,7 @@ impl LiveBind {
self.shape = Some(Arc::clone(&shape));
return shape;
}
let shape = match found(&self.state) {
let shape = match found(&self.state, key) {
Some(shape) => {
debug_assert!(
*shape == self.state.shape(),
@@ -797,7 +817,7 @@ impl LiveBind {
Arc::new(self.state.shape())
}
};
self.recent.keep(&shape);
self.recent.keep(key, &shape);
self.shape = Some(Arc::clone(&shape));
shape
}
@@ -69,6 +69,7 @@ use crate::resource_ids::{
use crate::shader_cache::VariantStages;
use crate::unique_identifier::UniqueIdentifier;
use crate::values::Size;
use crate::work_counts::Counting;
use crate::Device;
use metal2vulkan::bind::{BindShape, BindState, BindingPlan, FragmentTests};
use metal2vulkan::cache::{Hash256, PipelineKey, SpecializationKey, VariantKey};
@@ -329,8 +330,9 @@ pub(crate) struct Program {
/// Its part of the pipeline creation log, while the log is on (`creation_log.rs`).
log: Option<StateLog>,
/// What its last [`SETTLED`] settles of other shapes settled, in which buffer forms, the
/// latest used first (`GraphicsState::settle_shape`).
settled: Mutex<VecDeque<(BufferForms, Settled)>>,
/// latest used first, each with its shape's key beside its used resources
/// (`BindShape::key_beside_used`; `GraphicsState::settle_shape`).
settled: Mutex<VecDeque<(BufferForms, u64, Settled)>>,
/// Whether it made a visible function table (`GraphicsState::function_tables`): set once,
/// at the first, never cleared.
made_tables: AtomicBool,
@@ -2542,11 +2544,25 @@ impl GraphicsState {
/// ([`settle_shape`](Self::settle_shape)), compared with the state in place
/// (`BindState::position_of_shape`, which makes the shape of the resources it lists at most
/// once for all of them): what a draw of `state` settles where it has one, and finds there,
/// without its shape made (`live_bind.rs`).
pub(crate) fn kept_shape(&self, state: &BindState) -> Option<Arc<BindShape>> {
/// without its shape made (`live_bind.rs`). Only those of `key`, the state's key beside its
/// used resources (`BindState::shape_key_beside_used`), are compared, each counted in
/// `counts`: a shape of another key is not the state's.
pub(crate) fn kept_shape(
&self,
state: &BindState,
key: u64,
counts: Counting<'_>,
) -> Option<Arc<BindShape>> {
let settled = lock(&self.0.settled);
let at = state.position_of_shape(settled.iter().map(|(_, last)| &*last.shape))?;
Some(Arc::clone(&settled[at].1.shape))
let of_key = || {
(settled.iter())
.filter(|(_, kept, _)| *kept == key)
.map(|(_, _, last)| &last.shape)
};
let at = state.position_of_shape(of_key().map(|shape| &**shape));
let compared = at.map_or_else(|| of_key().count(), |at| at + 1);
counts.draw_shapes_compared(compared as u64);
of_key().nth(at?).cloned()
}
/// What a draw of bind shape `shape` runs on in `forms` ([`settle`](Self::settle)'s answer),
@@ -2567,9 +2583,9 @@ impl GraphicsState {
// The very shape first, as a draw's encoder keeps the one it found here; else an
// equal one, compared whole.
let found = (kept.iter())
.position(|(kept, last)| *kept == forms && Arc::ptr_eq(&last.shape, shape))
.position(|(kept, _, last)| *kept == forms && Arc::ptr_eq(&last.shape, shape))
.or_else(|| {
(kept.iter()).position(|(kept, last)| *kept == forms && last.shape == *shape)
(kept.iter()).position(|(kept, _, last)| *kept == forms && last.shape == *shape)
});
if let Some(mut entry) = found.and_then(|at| kept.remove(at)) {
// An equal shape holds the draw's own from now on, which its encoder keeps and
@@ -2577,8 +2593,8 @@ impl GraphicsState {
// pipeline state's draws made, which an encoder took with its bind state
// (`SpareLiveBinds`), would otherwise find this settle again by value at every
// draw, and no draw of its encoder rebound.
entry.1.shape = Arc::clone(shape);
let last = entry.1.clone();
entry.2.shape = Arc::clone(shape);
let last = entry.2.clone();
kept.push_front(entry);
return Ok(last);
}
@@ -2591,11 +2607,12 @@ impl GraphicsState {
facts: Arc::new(PlanFacts::of(&plan)),
plan,
};
let key = shape.key_beside_used();
let mut kept = lock(&self.0.settled);
if kept.len() == SETTLED {
kept.pop_back();
}
kept.push_front((forms, settled.clone()));
kept.push_front((forms, key, settled.clone()));
Ok(settled)
}
+2 -1
View File
@@ -12035,7 +12035,8 @@ impl RenderLowering {
reshape.field(&mut state.render_area, render_area);
reshape.field(&mut state.tile_threadgroup, tile_threadgroup);
live.reshaped(reshape);
let shape = live.shape(self.core.counts(), |state| pipeline.kept_shape(state));
let counts = self.core.counts();
let shape = live.shape(counts, |state, key| pipeline.kept_shape(state, key, counts));
// As the state's last recorded draw settled, where it settled the same
// (`live_bind.rs`): no lock of the pipeline state's; else through what the pipeline
// state settled lately (`GraphicsState::settle_shape`).
@@ -766,7 +766,7 @@ impl RenderLowering {
// step finds and settles it (`RenderLowering::settle_draw`); the draw goes on where that
// settles to the kept draw's variant and plan, which are all a rebind works out of.
if reshaped {
let shape = live.shape(counts, |state| pipeline.kept_shape(state));
let shape = live.shape(counts, |state, key| pipeline.kept_shape(state, key, counts));
let settled = pipeline.settle_shape(&shape, self.forms);
let same =
settled.is_ok_and(|settled| live.settle_again(pipeline, self.forms, settled));
@@ -547,6 +547,7 @@ mod rebind_behind_a_wait;
mod rebind_descriptor_slip;
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
mod rebind_making_wait;
mod recent_shape_keys;
#[cfg(all(m2v_gpu, target_os = "linux"))]
mod reclaim_submit_bench;
mod record_pass_formats;
@@ -0,0 +1,45 @@
//! A draw whose bind shape may have changed compares whole only the shapes its state took lately
//! of its key beside its used resources (`live_bind::RecentShapes`,
//! `BindState::shape_key_beside_used`): it finds the shape a whole comparison of each, the latest
//! first, finds, comparing one where that compared one per shape kept since.
use std::sync::Arc;
use metal2vulkan::bind::BindState;
use crate::live_bind::RecentShapes;
/// States of five shapes, apart in a field the shape reads alone (the render area).
fn states() -> Vec<BindState> {
(1..=5)
.map(|side| {
let mut state = BindState::default();
state.render_area = [side, side];
state
})
.collect()
}
#[test]
fn a_recent_shape_is_found_comparing_only_those_of_its_key() {
let states = states();
let mut recent = RecentShapes::default();
for state in &states {
let shape = Arc::new(state.shape());
recent.keep(shape.key_beside_used(), &shape);
}
for (at, state) in states.iter().enumerate() {
let mut compared = 0;
let found = recent.find(state, state.shape_key_beside_used(), &mut compared);
assert_eq!(found.as_deref(), Some(&state.shape()), "state {at}");
// A whole comparison of each, the latest first, compared one per shape kept after it too.
let before = states.len() - at;
assert_eq!(compared, 1, "state {at}: compared whole (before: {before})");
}
let mut other = BindState::default();
other.render_area = [9, 9];
let mut compared = 0;
let found = recent.find(&other, other.shape_key_beside_used(), &mut compared);
assert!(found.is_none(), "a state of another shape found one");
assert_eq!(compared, 0, "a state of another shape compared whole");
}
@@ -751,6 +751,7 @@ struct CommandCounters {
draw_shapes_carried: AtomicU64,
draw_shapes_made: AtomicU64,
draw_shapes_found: AtomicU64,
draw_shape_compares: AtomicU64,
dispatch_shapes_made: AtomicU64,
dispatch_shapes_found: AtomicU64,
dispatch_used_resources_listed: AtomicU64,
@@ -1178,6 +1179,14 @@ impl Counting<'_> {
self.0.add(|counts| &counts.draw_shapes_found, 1);
}
/// A draw looking for the bind shape of its bind state compared `compared` kept shapes with
/// it whole, those of its key (`LiveBind::shape`, `GraphicsState::kept_shape`).
pub(crate) fn draw_shapes_compared(&self, compared: u64) {
if compared > 0 {
self.0.add(|counts| &counts.draw_shape_compares, compared);
}
}
/// A compute dispatch made the bind shape of its encoder's kept bind state
/// (`LiveDispatch::shape`).
pub(crate) fn dispatch_shape_made(&self) {
@@ -7453,6 +7462,11 @@ pub struct WorkCounts {
/// other bind state's shape is its encoder's last draw's (values no shape reads, such as the
/// depth/stencil state, the stencil references or the blend color, may differ).
pub draw_shapes_found: u64,
/// Kept bind shapes draws compared whole with their bind states, looking for theirs among
/// those their encoders took lately and those their drawing states settled lately: only
/// those of a draw's key beside its used resources (`BindState::shape_key_beside_used`), and
/// none for a draw whose shape is its encoder's last draw's.
pub draw_shape_compares: u64,
/// Bind shapes compute encoders' dispatches made of their encoder's kept bind state
/// (`compute/live.rs`): none for a dispatch that took what its encoder's last dispatch settled
/// (`dispatches_settled_as_before`), nor for one whose bound slots keep their shapes and whose
@@ -10434,6 +10448,7 @@ impl Device {
.load(Ordering::Relaxed),
draw_shapes_made: commands(|counts| &counts.draw_shapes_made),
draw_shapes_found: commands(|counts| &counts.draw_shapes_found),
draw_shape_compares: commands(|counts| &counts.draw_shape_compares),
dispatch_shapes_made: commands(|counts| &counts.dispatch_shapes_made),
dispatch_shapes_found: commands(|counts| &counts.dispatch_shapes_found),
dispatch_used_resources_listed: commands(|counts| {
+164
View File
@@ -7,6 +7,7 @@
use std::borrow::Cow;
use std::collections::{BTreeMap, BTreeSet};
use std::hash::{Hash, Hasher};
use crate::bind::ResidentRange;
use crate::device::profile::Limits;
@@ -15,6 +16,7 @@ use crate::pipeline::artifact::RuntimeDependency;
use crate::pipeline::facts::RuntimeFact;
use crate::pipeline::lower_inputs::ViewportCompensation;
use crate::pipeline::sym::{SlotClass, Stage};
use crate::spirv::ir::intern::FxHasher;
/// Everything bound for one draw or dispatch.
#[non_exhaustive]
@@ -906,6 +908,59 @@ impl BindState {
&& self.region_fan_out.map(|(mode, _)| mode) == *region_fan_out
}
/// The key of this state's shape beside its used resources, worked out in place, making no
/// shape: [`BindShape::key_beside_used`]'s answer for every shape of which
/// [`has_shape_beside_used`](Self::has_shape_beside_used) answers true. A consumer that keeps
/// shapes with their keys compares whole only those whose key is the state's: a shape of
/// another key is not its shape. A hash of every field the comparison reads: two shapes of
/// one key may still differ, and it is fixed within a build alone.
pub fn shape_key_beside_used(&self) -> u64 {
let mut key = FxHasher::default();
let alignment = self.view_base_alignment;
for (stage, t) in self.stages.iter().filter(|(_, t)| !t.has_empty_shape()) {
let buffers =
(t.buffers.iter()).map(|(i, b)| (*i, b.shape(t.class_alignment(*i, alignment))));
let textures = t.textures.iter().map(|(i, x)| (*i, x.shape()));
let samplers = t.samplers.iter().map(|(i, s)| (*i, s.shape()));
key_stage(&mut key, *stage, (buffers, textures, samplers));
t.threadgroup_lengths.hash(&mut key);
}
KeyRest {
vertex_amplification: &self.vertex_amplification,
imageblock_size: self.imageblock_size,
render_target_array_length: self.render_target_array_length,
tessellation_factor_buffer: self.tessellation_factors.buffer.is_some(),
render_area: self.render_area,
argument_samplers: (
capacity_class(self.argument_samplers.len()),
(self.argument_samplers.iter())
.fold(0, |all, s| all | sampler_key(&s.desc.shape())),
),
function_tables: FunctionTablesShape::of(&self.function_tables),
tile_threadgroup: &self.tile_threadgroup,
viewport_compensation: self.viewport_compensation.map(|c| c.compensation),
zeroed_colors: &self.zeroed_colors,
dropped_colors: &self.dropped_colors,
kept_imageblock_bytes: self.kept_imageblock_bytes,
depth_clamp_range: self.depth_clamp_range.is_some(),
rotated_weights: self.rotated_weights,
mesh_last_first: self.mesh_last_first,
line_band: self.line_band.map(|(primitive, _)| primitive),
interlocked_colors: &self.interlocked_colors,
fragment_tests: self.fragment_tests,
extended_shadows: &self.extended_shadows,
snapshot_textures: &self.snapshot_textures,
primitive_id_indices: self.primitive_id_indices,
quad_primitive_ids: self.quad_primitive_ids,
private_list: self.private_list,
far_vertex_buffers: &self.far_vertex_buffers,
region_viewports: self.region_viewports,
region_fan_out: self.region_fan_out.map(|(mode, _)| mode),
}
.hash(&mut key);
key.finish()
}
/// `used_resources` by token ([`BindShape::used`]): one token names one resource, and listing
/// it twice unions its usage and stages.
fn used_shape(&self) -> BTreeMap<u32, UsedShape> {
@@ -1878,6 +1933,115 @@ impl BindShape {
}
Cow::Owned(projected)
}
/// Its key beside its used resources ([`BindState::shape_key_beside_used`], which answers
/// it for a state of which [`BindState::has_shape_beside_used`] answers true): a hash of
/// every field but `used`. Shapes equal but for `used` have one key.
pub fn key_beside_used(&self) -> u64 {
let mut key = FxHasher::default();
for (stage, s) in &self.stages {
let buffers = s.buffers.iter().map(|(i, b)| (*i, *b));
let textures = s.textures.iter().map(|(i, t)| (*i, *t));
let samplers = s.samplers.iter().map(|(i, x)| (*i, *x));
key_stage(&mut key, *stage, (buffers, textures, samplers));
s.threadgroup_lengths.hash(&mut key);
}
KeyRest {
vertex_amplification: &self.vertex_amplification,
imageblock_size: self.imageblock_size,
render_target_array_length: self.render_target_array_length,
tessellation_factor_buffer: self.tessellation_factor_buffer,
render_area: self.render_area,
argument_samplers: (
self.argument_samplers.class,
(self.argument_samplers.shapes.iter()).fold(0, |all, s| all | sampler_key(s)),
),
function_tables: self.function_tables,
tile_threadgroup: &self.tile_threadgroup,
viewport_compensation: self.viewport_compensation,
zeroed_colors: &self.zeroed_colors,
dropped_colors: &self.dropped_colors,
kept_imageblock_bytes: self.kept_imageblock_bytes,
depth_clamp_range: self.depth_clamp_range,
rotated_weights: self.rotated_weights,
mesh_last_first: self.mesh_last_first,
line_band: self.line_band,
interlocked_colors: &self.interlocked_colors,
fragment_tests: self.fragment_tests,
extended_shadows: &self.extended_shadows,
snapshot_textures: &self.snapshot_textures,
primitive_id_indices: self.primitive_id_indices,
quad_primitive_ids: self.quad_primitive_ids,
private_list: self.private_list,
far_vertex_buffers: &self.far_vertex_buffers,
region_viewports: self.region_viewports,
region_fan_out: self.region_fan_out,
}
.hash(&mut key);
key.finish()
}
}
/// One stage's slots into a shape key ([`BindShape::key_beside_used`]): the stage, then each
/// class's count and its slots' shapes in index order, as a state's table and a shape's give them.
fn key_stage(
key: &mut FxHasher,
stage: Stage,
(buffers, textures, samplers): (
impl ExactSizeIterator<Item = (u32, BufferShape)>,
impl ExactSizeIterator<Item = (u32, TextureShape)>,
impl ExactSizeIterator<Item = (u32, BoundSamplerShape)>,
),
) {
stage.hash(key);
key.write_usize(buffers.len());
buffers.for_each(|slot| slot.hash(key));
key.write_usize(textures.len());
textures.for_each(|slot| slot.hash(key));
key.write_usize(samplers.len());
samplers.for_each(|slot| slot.hash(key));
}
/// An argument sampler shape's part of a shape key: the samplers' parts are or-ed, so the
/// shape's set of them and a state's list, which may repeat one, have one key
/// ([`BindShape::key_beside_used`]).
fn sampler_key(shape: &SamplerShape) -> u64 {
let mut key = FxHasher::default();
shape.hash(&mut key);
key.finish()
}
/// The fields of a shape beside its stages that its key holds, of the types the shape holds them
/// in (the argument samplers as their class and their shapes' or-ed parts), so a state's key and
/// a shape's hash them alike ([`BindShape::key_beside_used`]).
#[derive(Hash)]
struct KeyRest<'a> {
vertex_amplification: &'a VertexAmplification,
imageblock_size: ImageblockSize,
render_target_array_length: u32,
tessellation_factor_buffer: bool,
render_area: [u32; 2],
argument_samplers: (u8, u64),
function_tables: FunctionTablesShape,
tile_threadgroup: &'a TileThreadgroupMemory,
viewport_compensation: Option<ViewportCompensation>,
zeroed_colors: &'a BTreeMap<u32, metal::PixelFormat>,
dropped_colors: &'a BTreeSet<u32>,
kept_imageblock_bytes: Option<u32>,
depth_clamp_range: bool,
rotated_weights: bool,
mesh_last_first: bool,
line_band: Option<crate::pipeline::BandPrimitive>,
interlocked_colors: &'a BTreeSet<u32>,
fragment_tests: FragmentTests,
extended_shadows: &'a BTreeSet<u32>,
snapshot_textures: &'a BTreeSet<u32>,
primitive_id_indices: Option<metal::IndexType>,
quad_primitive_ids: bool,
private_list: bool,
far_vertex_buffers: &'a BTreeSet<u32>,
region_viewports: bool,
region_fan_out: Option<crate::pipeline::RegionFanOut>,
}
/// The projection of `BindState::argument_samplers` that can change a plan: the capacity class of
+1 -1
View File
@@ -94,7 +94,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 517;
/// 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 = 2225;
pub const RUNTIME_VERSION: u32 = 2226;
/// 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
@@ -280,6 +280,30 @@ fn a_state_has_exactly_the_shape_it_makes() {
assert_eq!(same, 9 * 8 + 2, "pairs of one shape");
}
/// A state's shape key is its shape's, and the key of every shape it has beside its used
/// resources: a consumer that compares whole only the shapes of its key finds every one it would
/// find comparing all. The fixture's states of other shapes beside their used resources have other
/// keys too, so the key spares their comparisons.
#[test]
fn a_state_s_shape_key_is_the_key_of_every_shape_it_has() {
let states = states();
let shapes: Vec<_> = states.iter().map(BindState::shape).collect();
let mut apart = 0;
for (at, state) in states.iter().enumerate() {
let key = state.shape_key_beside_used();
assert_eq!(key, shapes[at].key_beside_used(), "state {at}: {state:?}");
for (of, shape) in shapes.iter().enumerate() {
if state.has_shape_beside_used(shape) {
assert_eq!(key, shape.key_beside_used(), "state {at}, shape {of}");
} else {
assert_ne!(key, shape.key_beside_used(), "state {at}, shape {of}");
apart += 1;
}
}
}
assert!(apart > 0, "no state of another shape in the fixture");
}
/// A buffer's bind offset cycling through the multiples of 16 up to 256 at a view base alignment
/// of 64 keeps one shape where its slot tells no alignment past 4 apart (vertex data, or a view
/// a runtime left out), and takes two where the slot tells it apart (a uniform view: 64 divides
@@ -2820,6 +2820,7 @@ field metal2vulkan-runtime::WorkCounts.dma_buf_sparse_buffers pub dma_buf_sparse
field metal2vulkan-runtime::WorkCounts.dma_buf_textures_in_place pub dma_buf_textures_in_place: u64
field metal2vulkan-runtime::WorkCounts.draw_heap_parts_made pub draw_heap_parts_made: u64
field metal2vulkan-runtime::WorkCounts.draw_resident_textures_looked_at pub draw_resident_textures_looked_at: u64
field metal2vulkan-runtime::WorkCounts.draw_shape_compares pub draw_shape_compares: u64
field metal2vulkan-runtime::WorkCounts.draw_shapes_carried pub draw_shapes_carried: u64
field metal2vulkan-runtime::WorkCounts.draw_shapes_found pub draw_shapes_found: u64
field metal2vulkan-runtime::WorkCounts.draw_shapes_made pub draw_shapes_made: u64
@@ -9152,10 +9153,12 @@ method metal2vulkan::bind::AstcDecode::texel_bytes pub fn texel_bytes(self, texe
method metal2vulkan::bind::AstcDecode::texel_format pub fn texel_format(self, texels: AstcTexels) -> Format
method metal2vulkan::bind::AstcDecode::texel_pixel_format pub fn texel_pixel_format(self, texels: AstcTexels) -> PixelFormat
method metal2vulkan::bind::BindShape::for_plan pub fn for_plan(&self, dependencies: &[RuntimeDependency]) -> Cow<'_, BindShape>
method metal2vulkan::bind::BindShape::key_beside_used pub fn key_beside_used(&self) -> u64
method metal2vulkan::bind::BindState::has_shape pub fn has_shape(&self, shape: &BindShape) -> bool
method metal2vulkan::bind::BindState::has_shape_beside_used pub fn has_shape_beside_used(&self, shape: &BindShape) -> bool
method metal2vulkan::bind::BindState::position_of_shape pub fn position_of_shape<'s>(&self, shapes: impl IntoIterator<Item = &'s BindShape>) -> Option<usize>
method metal2vulkan::bind::BindState::shape pub fn shape(&self) -> BindShape
method metal2vulkan::bind::BindState::shape_key_beside_used pub fn shape_key_beside_used(&self) -> u64
method metal2vulkan::bind::BindState::view_base_alignment_of pub fn view_base_alignment_of(limits: &Limits) -> u32
method metal2vulkan::bind::BindingPlan::content_digest pub fn content_digest(&self) -> Result<crate::cache::Hash256, String>
method metal2vulkan::bind::BindingPlan::dispatch_variant pub fn dispatch_variant(&self, dispatch: &Dispatch) -> Result<VariantKey, BindError>
Can't render this file because it is too large.