Translator: delete the orphan items the old-path deletion left (definitions; call sites follow)
This commit is contained in:
1 parent
8998279ad0
commit
f5faf44098
40 files changed
-1754
No files matched your search
@@ -127,12 +127,6 @@ impl CommandWrites {
|
||||
self.operations & bits != 0
|
||||
}
|
||||
|
||||
/// Whether a draw it makes may pass the primitive type of raw value `raw` (`MTLPrimitiveType`;
|
||||
/// a value past Metal's five is never one).
|
||||
pub const fn may_draw_primitive_type(self, raw: u32) -> bool {
|
||||
raw < 5 && self.primitive_types & (1 << raw) != 0
|
||||
}
|
||||
|
||||
/// The writes of one operation `op`, called by `call`.
|
||||
fn of(op: IndirectCommand, call: &Call, parts: &ModuleParts) -> CommandWrites {
|
||||
use IndirectCommand as C;
|
||||
|
||||
@@ -313,63 +313,6 @@ fn type_size_align(ty: DataType) -> Option<(u64, u64, ArgumentType)> {
|
||||
}
|
||||
|
||||
impl ArgumentBufferLayout {
|
||||
/// The layout `newArgumentEncoderWithArguments:` makes of `descriptors` (the module docs).
|
||||
/// Refused as Metal refuses: no descriptors, a data type no argument has, and a constant block
|
||||
/// alignment on a constant that does not start its block.
|
||||
pub fn from_descriptors(
|
||||
descriptors: &[ArgumentDescriptor],
|
||||
) -> Result<ArgumentBufferLayout, ArgumentLayoutError> {
|
||||
if descriptors.is_empty() {
|
||||
return Err(ArgumentLayoutError::NoDescriptors);
|
||||
}
|
||||
let mut cursor = 0u64;
|
||||
let mut alignment = 1u64;
|
||||
let mut in_block = false;
|
||||
let mut members = Vec::with_capacity(descriptors.len());
|
||||
for (position, d) in descriptors.iter().enumerate() {
|
||||
let (size, natural, ty) =
|
||||
type_size_align(d.data_type).ok_or(ArgumentLayoutError::DataType {
|
||||
position,
|
||||
data_type: d.data_type,
|
||||
})?;
|
||||
let mut align = natural;
|
||||
if ty == ArgumentType::Constant {
|
||||
if d.constant_block_alignment != 0 {
|
||||
if in_block {
|
||||
return Err(ArgumentLayoutError::ConstantBlockAlignment { position });
|
||||
}
|
||||
align = align.max(u64::from(d.constant_block_alignment));
|
||||
}
|
||||
in_block = true;
|
||||
} else {
|
||||
in_block = false;
|
||||
}
|
||||
let count = d.array_length.max(1);
|
||||
let offset = metal_align(cursor, align).ok_or(ArgumentLayoutError::TooLarge)?;
|
||||
cursor = size
|
||||
.checked_mul(u64::from(count))
|
||||
.and_then(|bytes| offset.checked_add(bytes))
|
||||
.ok_or(ArgumentLayoutError::TooLarge)?;
|
||||
alignment = alignment.max(natural);
|
||||
members.push(ArgumentMember {
|
||||
id: d.index,
|
||||
count,
|
||||
ids_per_element: 1,
|
||||
offset,
|
||||
stride: size,
|
||||
size,
|
||||
ty,
|
||||
layout: None,
|
||||
});
|
||||
}
|
||||
// Type alignments are powers of two, so this rounds up.
|
||||
let encoded_length = metal_align(cursor, alignment).ok_or(ArgumentLayoutError::TooLarge)?;
|
||||
Ok(ArgumentBufferLayout {
|
||||
encoded_length,
|
||||
alignment,
|
||||
members,
|
||||
})
|
||||
}
|
||||
|
||||
/// Where argument `index` lands: in the last member whose indices hold it, inside a struct
|
||||
/// member's element as that element's layout says. `None` when no member holds it.
|
||||
@@ -417,34 +360,6 @@ impl ArgumentBufferLayout {
|
||||
}
|
||||
|
||||
impl ArgumentBufferLayout {
|
||||
/// The layout `newArgumentEncoderWithBufferBinding:` makes of reflected buffer binding
|
||||
/// `binding` (a library's, [`Function::reflection`](crate::library::Function::reflection), or
|
||||
/// a pipeline's): from its struct type as the reflection states it, by the argument buffer's
|
||||
/// rule or the plain buffer's (the module docs). A binding with no struct type answers
|
||||
/// Metal's encoder of no bytes, alignment 1, with or without API validation. Refused, as
|
||||
/// `Unsupported` ([`Feature::Reflection`]) since Metal's encoder of them is unmeasured: a
|
||||
/// plain buffer's member that is no constant (a pointer, say), a member whose data type no
|
||||
/// argument has, and an argument buffer's struct array whose elements take no ids of their
|
||||
/// own; an array of arrays, as Metal's encoder creation raises.
|
||||
pub fn from_buffer_binding(
|
||||
binding: &BufferBinding,
|
||||
) -> Result<ArgumentBufferLayout, ArgumentLayoutError> {
|
||||
let Some(st) = binding.buffer_struct_type() else {
|
||||
return Ok(ArgumentBufferLayout {
|
||||
encoded_length: 0,
|
||||
alignment: 1,
|
||||
members: Vec::new(),
|
||||
});
|
||||
};
|
||||
if binding
|
||||
.buffer_pointer_type()
|
||||
.is_some_and(PointerType::element_is_argument_buffer)
|
||||
{
|
||||
reflected_layout(st, Some(binding.buffer_alignment()), Rule::ArgumentBuffer)
|
||||
} else {
|
||||
reflected_layout(st, None, Rule::PlainBuffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Which of Metal's two rules lays out a reflected struct (the module docs).
|
||||
|
||||
@@ -220,16 +220,6 @@ impl AstcDecode {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Metal pixel format whose texels the twin's of `texels` are: `RGBA8Unorm`,
|
||||
/// `RGBA16Float` or `RGBA32Float`.
|
||||
pub fn texel_pixel_format(self, texels: AstcTexels) -> PixelFormat {
|
||||
match self.form(texels) {
|
||||
AstcTexels::Unorm8 => PixelFormat::RGBA8Unorm,
|
||||
AstcTexels::Half => PixelFormat::RGBA16Float,
|
||||
AstcTexels::Float => PixelFormat::RGBA32Float,
|
||||
}
|
||||
}
|
||||
|
||||
/// The bytes of a twin's texel of `texels` ([`form`](Self::form)'s): 4, 8 or 16.
|
||||
pub fn texel_bytes(self, texels: AstcTexels) -> u32 {
|
||||
match self.form(texels) {
|
||||
|
||||
@@ -142,11 +142,6 @@ impl ChromaDecode {
|
||||
Format::R8G8B8A8_UNORM
|
||||
}
|
||||
|
||||
/// The Metal format of the twin's texels.
|
||||
pub fn texel_pixel_format(self) -> PixelFormat {
|
||||
PixelFormat::RGBA8Unorm
|
||||
}
|
||||
|
||||
/// Vulkan's format of the pairs, which a sampler Y′CbCr conversion reads (the module docs):
|
||||
/// `G8B8G8R8_422_UNORM` (`G0 B G1 R`) or `B8G8R8G8_422_UNORM` (`B G0 R G1`).
|
||||
pub fn format(self) -> Format {
|
||||
|
||||
@@ -267,11 +267,6 @@ impl ColorResolveFormat {
|
||||
}
|
||||
}
|
||||
|
||||
/// The word whose attachment's samples the format holds ([`word`](Self::word)), if any.
|
||||
pub fn held_word(self) -> Option<WordAttachment> {
|
||||
self.word
|
||||
}
|
||||
|
||||
/// The extended-range form whose raw codes the format holds
|
||||
/// ([`extended_range`](Self::extended_range)), if any.
|
||||
pub fn extended(self) -> Option<ExtendedRange> {
|
||||
@@ -339,21 +334,6 @@ impl ColorResolveFormat {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the sRGB channels take the device's decode and encode
|
||||
/// ([`device_srgb`](Self::device_srgb)).
|
||||
pub fn decodes_on_device(self) -> bool {
|
||||
self.device_srgb
|
||||
}
|
||||
|
||||
/// The format of the view the result is written through: the raw twin's where
|
||||
/// [`written_raw`](Self::written_raw), else the format.
|
||||
pub fn written_format(self) -> Format {
|
||||
match self.written_raw {
|
||||
true => self.raw_format(),
|
||||
false => self.format,
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether a channel is sRGB.
|
||||
fn srgb(self) -> bool {
|
||||
self.channels
|
||||
|
||||
@@ -1069,45 +1069,6 @@ impl BindingPlan {
|
||||
instantiate(t, planned, (state, dispatch), records, commands)
|
||||
}
|
||||
|
||||
/// Whether [`instantiate_dispatch`](Self::instantiate_dispatch)'s commands may read a value the
|
||||
/// state binds at a slot of `class` past the slot's shape. The plan is made for one shape, so
|
||||
/// two states of it that differ only in the values bound at slots of a class this answers
|
||||
/// `false` for give the same commands for a dispatch: a consumer that keeps a dispatch's
|
||||
/// commands keeps them across such a change.
|
||||
///
|
||||
/// - **Buffer slots**: `true`. Their offsets, lengths and addresses place the descriptor
|
||||
/// ranges, the push bytes and the root table.
|
||||
/// - **Texture slots**: `true` where the plan binds a texture buffer's range as a texel-buffer
|
||||
/// view, a push field carries a texture's in-place planes (`PushField::YCbCrInPlace`) or
|
||||
/// rows (`PushField::TexelRows`), or a handle table names the texture bound at a slot by its
|
||||
/// resource ID; `false` otherwise, as
|
||||
/// the commands read a texture slot nowhere else (the consumer binds its view itself).
|
||||
/// - **Sampler slots**: `false`. The commands read no sampler slot.
|
||||
///
|
||||
/// Every other value of the state may be read (its used resources, its argument samplers, its
|
||||
/// stage-in region, ...). `true` for every class of a plan that is not a compute plan.
|
||||
pub fn dispatch_reads(&self, class: SlotClass) -> bool {
|
||||
let Some(t) = &self.compute else {
|
||||
return true;
|
||||
};
|
||||
match class {
|
||||
SlotClass::Buffer => true,
|
||||
SlotClass::Texture => {
|
||||
let resources = &t.resources;
|
||||
!resources.texel_buffers.is_empty()
|
||||
|| (t.fields.iter()).any(|f| {
|
||||
matches!(
|
||||
f.field,
|
||||
PushField::YCbCrInPlace(_) | PushField::TexelRows(_)
|
||||
)
|
||||
})
|
||||
|| (resources.heap_members.iter())
|
||||
.any(|m| matches!(m.source, HeapSource::Bound(_)))
|
||||
}
|
||||
SlotClass::Sampler => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// The commands of one registered variant of a device replay
|
||||
/// ([`replay_preprocess`](crate::bind::replay_preprocess)): one region of `threads_per_group`
|
||||
/// threads per threadgroup whose group count is the replay's arguments
|
||||
|
||||
@@ -209,20 +209,6 @@ impl EtcDecode {
|
||||
}
|
||||
}
|
||||
|
||||
/// The Metal pixel format whose texels a twin's of `texels` are.
|
||||
pub fn texel_pixel_format(self, texels: EtcTexels) -> PixelFormat {
|
||||
use EtcTexels as T;
|
||||
match (self, texels) {
|
||||
(EtcDecode::Rgb8 | EtcDecode::Rgb8A1 | EtcDecode::Rgba8, _) => PixelFormat::RGBA8Unorm,
|
||||
(EtcDecode::R11Unorm, T::Compact) => PixelFormat::R16Unorm,
|
||||
(EtcDecode::R11Snorm, T::Compact) => PixelFormat::R16Snorm,
|
||||
(EtcDecode::Rg11Unorm, T::Compact) => PixelFormat::RG16Unorm,
|
||||
(EtcDecode::Rg11Snorm, T::Compact) => PixelFormat::RG16Snorm,
|
||||
(EtcDecode::R11Unorm | EtcDecode::R11Snorm, T::Float) => PixelFormat::R32Float,
|
||||
(EtcDecode::Rg11Unorm | EtcDecode::Rg11Snorm, T::Float) => PixelFormat::RG32Float,
|
||||
}
|
||||
}
|
||||
|
||||
/// The values of the 16 texels of `block`, row-major (texel `(x, y)` at `4y + x`): the packed
|
||||
/// 8-bit codes, red in the low byte, or an 11-bit format's values (red, then an `RG11`
|
||||
/// format's green; 0 elsewhere).
|
||||
|
||||
@@ -686,9 +686,6 @@ impl MeshDispatch {
|
||||
pub const DISPATCH_OFFSET: u64 = 4 * crate::lower::mesh::work::DISPATCH as u64;
|
||||
/// The byte of the work buffer where the draw's `VkDrawIndirectCommand` lies.
|
||||
pub const DRAW_OFFSET: u64 = 4 * crate::lower::mesh::work::DRAW as u64;
|
||||
/// The byte of the work buffer where the object dispatch's `VkDispatchIndirectCommand` lies,
|
||||
/// which the object arguments pass writes ([`object_arguments`](Self::object_arguments)).
|
||||
pub const OBJECT_DISPATCH_OFFSET: u64 = 4 * crate::lower::mesh::work::OBJECT_DISPATCH as u64;
|
||||
}
|
||||
|
||||
/// Where an emulated mesh draw's mesh threadgroups come from ([`MeshDispatch`]).
|
||||
@@ -2919,24 +2916,6 @@ impl BindingPlan {
|
||||
instantiate(self.drawn(draw)?, state, draw, commands, Heap::Written)
|
||||
}
|
||||
|
||||
/// [`instantiate_draw_into`](Self::instantiate_draw_into)'s commands of `draw` of `state`, but
|
||||
/// for the plan's heap tables, written over `commands`: every field is set as that method sets
|
||||
/// it but `descriptor_bytes`, which holds the stage tables alone, without the heap tables that
|
||||
/// method writes after them ([`heap_tables_into`](Self::heap_tables_into)'s for `state`). So a
|
||||
/// consumer that keeps a state's heap tables binds every later command of a state whose heap
|
||||
/// inputs are the same with them, and works them out once rather than at each command: their
|
||||
/// cost grows with the resources the state makes resident and the textures its slots bind
|
||||
/// that a handle names, a draw's other commands' with what the draw binds. An error is one
|
||||
/// `instantiate_draw_into` answers for `state`, but for those `heap_tables_into` answers.
|
||||
pub fn instantiate_draw_apart_into(
|
||||
&self,
|
||||
state: &BindState,
|
||||
draw: &DrawCall,
|
||||
commands: &mut DrawCommands,
|
||||
) -> Result<(), BindError> {
|
||||
instantiate(self.drawn(draw)?, state, draw, commands, Heap::Apart)
|
||||
}
|
||||
|
||||
/// The render template `draw` instantiates: this plan's, where the draw runs on its variant.
|
||||
fn drawn(&self, draw: &DrawCall) -> Result<&GraphicsTemplate, BindError> {
|
||||
let t = self
|
||||
@@ -2964,34 +2943,6 @@ impl BindingPlan {
|
||||
Ok(t)
|
||||
}
|
||||
|
||||
/// [`instantiate_draw_into`](Self::instantiate_draw_into)'s commands of `state`, written over
|
||||
/// `commands`, which hold that method's commands of the same draw of a state that differed
|
||||
/// from `state` only in what the buffer, texture and sampler slots `slots` bind (a buffer or
|
||||
/// inline bytes at any offset, a texture, a sampler state), the state's shape the same: only
|
||||
/// what those slots decide is written again (the buffers' descriptor ranges, the
|
||||
/// `SlotBindOffset`, `SlotGuestBase` and pulled-stride push fields that read them, and their
|
||||
/// fixed-function vertex buffers' offsets; a texture or sampler slot decides none of the
|
||||
/// commands, its descriptor being the caller's), so the commands are those
|
||||
/// `instantiate_draw_into` writes. `Ok(false)` where the plan or the draw reads one of them
|
||||
/// some other way (a device-address slot, an argument or root table, a fixed-function binding
|
||||
/// of a per-bind stride, a texture buffer's texel range, a YCbCr texture's planes, a mesh,
|
||||
/// patch or de-indexed draw, a uniform view a written slot may alias): `commands` then hold
|
||||
/// no draw's commands, as after an error, and the caller instantiates whole. An error is one
|
||||
/// `instantiate_draw_into` may answer for `state`. It is [`slot_rebinds`](Self::slot_rebinds)
|
||||
/// of `slots` (`Ok(false)` where that answers none), then
|
||||
/// [`rebind_draw_slots_with`](Self::rebind_draw_slots_with) of them.
|
||||
pub fn rebind_draw_slots_into(
|
||||
&self,
|
||||
state: &BindState,
|
||||
slots: &[SlotRef],
|
||||
commands: &mut DrawCommands,
|
||||
) -> Result<bool, BindError> {
|
||||
match self.slot_rebinds(slots) {
|
||||
Some(rebinds) => self.rebind_draw_slots_with(&rebinds, state, commands),
|
||||
None => Ok(false),
|
||||
}
|
||||
}
|
||||
|
||||
/// What [`rebind_draw_slots_into`](Self::rebind_draw_slots_into) of the slots `slots` works
|
||||
/// out of the plan alone, whatever the state and the commands: each changed buffer slot's
|
||||
/// place among the descriptor ranges, the push fields that read the slots and where they lie,
|
||||
@@ -3049,32 +3000,6 @@ impl BindingPlan {
|
||||
}
|
||||
}
|
||||
|
||||
/// [`instantiate_draw_apart_into`](Self::instantiate_draw_apart_into)'s commands of `draw`
|
||||
/// for `state`, written over `commands`, which hold that method's commands of `from` for
|
||||
/// `state`: `from` and `draw` direct draws, each without indices or with indices of any
|
||||
/// index type and index buffer, that differ only in their arguments (whether they read
|
||||
/// indices, their index type and index buffer, vertex or index counts and starts, the index
|
||||
/// offset, instance count, base vertex and base instance). Only what the arguments decide is
|
||||
/// written again: the Vulkan draw, its index overrun, the `BaseVertexInstance` push fields and
|
||||
/// the draw's own uses (its index buffer's), so the commands are those
|
||||
/// `instantiate_draw_apart_into` writes. `Ok(false)` where the plan reads the arguments some
|
||||
/// other way (a stage's argument or root table, a mesh, patch or de-indexed draw, a
|
||||
/// fixed-function vertex buffer whose fetch window the two draws set apart, which the extents
|
||||
/// hold, a vertices-per-primitive push field of a draw with indices and one without) or the
|
||||
/// two are no such pair: `commands` then hold no draw's commands, as after an error, and the
|
||||
/// caller instantiates whole. An error is one `instantiate_draw_apart_into` answers for
|
||||
/// `draw` where it answered none for `from` (its instances past a multiview limit).
|
||||
pub fn redraw_apart_into(
|
||||
&self,
|
||||
state: &BindState,
|
||||
(from, draw): (&DrawCall, &DrawCall),
|
||||
commands: &mut DrawCommands,
|
||||
) -> Result<bool, BindError> {
|
||||
match self.graphics.as_ref() {
|
||||
Some(t) if !t.other_layer_variant => redraw_with(t, state, (from, draw), commands),
|
||||
_ => Ok(false),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The Vulkan draw of a Metal draw, and the base vertex and first instance the
|
||||
|
||||
@@ -2495,41 +2495,6 @@ fn relisted_sampler_tables(
|
||||
}
|
||||
|
||||
impl BindingPlan {
|
||||
/// This plan's heap tables for `state`, written over `tables` (emptied first): the bytes of
|
||||
/// its handle tables, sampler tables and function-table directories, which
|
||||
/// [`instantiate_draw_into`](Self::instantiate_draw_into) writes after a draw's stage tables
|
||||
/// and [`instantiate_draw_apart_into`](Self::instantiate_draw_apart_into) leaves out. They
|
||||
/// are a function of the plan and of the state's heap inputs alone: its used resources (and
|
||||
/// whether it lists them in token order), the textures it binds at the plan's
|
||||
/// [`heap_slots`](Self::heap_slots), its argument samplers, its function tables and its heap
|
||||
/// placement. Their cost grows with the used resources and those slots. A state of another
|
||||
/// shape than the plan's is an internal error, a list past a table's planned entries
|
||||
/// [`BindError::HeapTooLarge`], and a function-table directory the plan cannot represent the
|
||||
/// consumer's [`BindError::Unsupported`] (`DynamicCall`); on an error `tables` holds none.
|
||||
pub fn heap_tables_into(
|
||||
&self,
|
||||
state: &BindState,
|
||||
tables: &mut Vec<crate::bind::instantiate::DescriptorBytes>,
|
||||
) -> Result<(), BindError> {
|
||||
tables.clear();
|
||||
let template = self
|
||||
.resource_template()
|
||||
.ok_or_else(|| internal("a plan without a template"))?;
|
||||
tables.extend(table_bytes(template, state)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The texture slots whose textures this plan's heap tables and heap elements read
|
||||
/// ([`heap_tables_into`](Self::heap_tables_into), [`heap_elements`](Self::heap_elements)):
|
||||
/// those of its heap members a slot binds, beside the used resources. None for a plan whose
|
||||
/// handles name used resources alone, or that reads no handle.
|
||||
pub fn heap_slots(&self) -> impl Iterator<Item = SlotRef> + '_ {
|
||||
let members = self.resource_template().map(|t| &t.heap_members);
|
||||
(members.into_iter().flatten()).filter_map(|m| match m.source {
|
||||
HeapSource::Bound(slot) => Some(slot),
|
||||
HeapSource::Used(_) => None,
|
||||
})
|
||||
}
|
||||
|
||||
/// Where this plan's heap writes go for `state` ([`HeapElements`]), each heap array having
|
||||
/// `capacity` elements (the layout's set-1 count). Under [`HeapPlacement::ResourceId`] a
|
||||
|
||||
@@ -107,8 +107,6 @@ impl IndexBoundsPass {
|
||||
pub const FIRST_DRAW_OFFSET: u64 = 32;
|
||||
/// The second draw's `VkDrawIndexedIndirectCommand` in the bounds words.
|
||||
pub const SECOND_DRAW_OFFSET: u64 = 52;
|
||||
/// The fill's `VkDispatchIndirectCommand` in the bounds words.
|
||||
pub const FILL_DISPATCH_OFFSET: u64 = 72;
|
||||
/// The pool's header: its counter, then reserved bytes; its index bytes follow, where the
|
||||
/// second draw binds the pool as its index buffer.
|
||||
pub const POOL_HEADER_BYTES: u64 = 16;
|
||||
@@ -165,13 +163,6 @@ impl IndexBoundsPass {
|
||||
})
|
||||
}
|
||||
|
||||
/// The parameters as the bytes to upload at the bounds words' start.
|
||||
pub fn parameter_bytes(&self) -> Vec<u8> {
|
||||
self.parameters
|
||||
.iter()
|
||||
.flat_map(|w| w.to_le_bytes())
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// The consumer's parameter words, by index into the bounds words.
|
||||
|
||||
@@ -202,23 +202,6 @@ impl IndexBoundsRun {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The bytes of the words of a run of `draws` draws.
|
||||
pub fn words_bytes(draws: u32) -> u64 {
|
||||
4 * u64::from(Self::HEADER_WORDS) + u64::from(draws) * Self::SLOT_BYTES
|
||||
}
|
||||
|
||||
/// The byte of the words at which slot `slot`'s first draw's `VkDrawIndexedIndirectCommand`
|
||||
/// lies: over the Metal index buffer, where every position lies inside it.
|
||||
pub fn first_draw_offset(slot: u32) -> u64 {
|
||||
Self::slot_offset(slot) + IndexBoundsPass::FIRST_DRAW_OFFSET
|
||||
}
|
||||
|
||||
/// The byte of the words at which slot `slot`'s second draw's `VkDrawIndexedIndirectCommand`
|
||||
/// lies: over the pool, where any position lies past the buffer.
|
||||
pub fn second_draw_offset(slot: u32) -> u64 {
|
||||
Self::slot_offset(slot) + IndexBoundsPass::SECOND_DRAW_OFFSET
|
||||
}
|
||||
|
||||
/// The byte of the words at which slot `slot` starts.
|
||||
fn slot_offset(slot: u32) -> u64 {
|
||||
4 * u64::from(Self::HEADER_WORDS) + u64::from(slot) * Self::SLOT_BYTES
|
||||
|
||||
@@ -620,13 +620,6 @@ impl IndexRewritePass {
|
||||
self
|
||||
}
|
||||
|
||||
/// The parameters as the bytes to upload at the rewrite words' start.
|
||||
pub fn parameter_bytes(&self) -> Vec<u8> {
|
||||
self.parameters
|
||||
.iter()
|
||||
.flat_map(|w| w.to_le_bytes())
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// The consumer's words, by index into the rewrite words.
|
||||
|
||||
@@ -391,48 +391,6 @@ impl IndexGather {
|
||||
Some(first)
|
||||
}
|
||||
|
||||
/// Add an indirect `draw` to the run: its place among the run's draws, whose
|
||||
/// `VkDrawIndexedIndirectCommand` the plan writes at that place's
|
||||
/// [`DRAW_BYTES`](plan::IndexGatherPlanModule::DRAW_BYTES) of its draws' binding. `None`
|
||||
/// where the run cannot take it, and is as before: a direct run, a run of
|
||||
/// [`MAX_DRAWS`](plan::IndexGatherPlanModule::MAX_DRAWS), an arguments offset not a multiple
|
||||
/// of 4 or arguments outside the bound bytes, an index offset not a multiple of the index
|
||||
/// size, or indices read outside the bound bytes.
|
||||
pub fn push_indirect(&mut self, draw: IndirectGatherDraw) -> Option<u32> {
|
||||
let Source::Indirect {
|
||||
arguments,
|
||||
sequential,
|
||||
..
|
||||
} = self.source
|
||||
else {
|
||||
return None;
|
||||
};
|
||||
if self.draws.len() >= plan::IndexGatherPlanModule::MAX_DRAWS as usize
|
||||
|| !draw.arguments_offset.is_multiple_of(4)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
// `MTLDrawPrimitivesIndirectArguments` is four words, the indexed arguments five.
|
||||
let words: u64 = if sequential { 4 } else { 5 };
|
||||
let end = draw.arguments_offset.checked_add(words * 4)?;
|
||||
if draw.arguments_offset < arguments.offset || end > arguments.offset + arguments.range {
|
||||
return None;
|
||||
}
|
||||
let argument_word = u32::try_from((draw.arguments_offset - arguments.offset) / 4).ok()?;
|
||||
let wide = draw.wide && !sequential;
|
||||
let (byte, inside) = match sequential {
|
||||
true => (0, 0),
|
||||
false => {
|
||||
let inside = whole(draw.index_offset, draw.index_end, wide);
|
||||
self.index_words(draw.index_offset, draw.index_end, wide, inside)?
|
||||
}
|
||||
};
|
||||
let place = self.draws.len() as u32;
|
||||
self.draws
|
||||
.push([0, 0, 0, byte, inside, u32::from(wide), 0, argument_word]);
|
||||
Some(place)
|
||||
}
|
||||
|
||||
/// The run's draws.
|
||||
pub fn len(&self) -> usize {
|
||||
self.draws.len()
|
||||
|
||||
@@ -82,8 +82,6 @@ impl IndexGatherPlanModule {
|
||||
pub const LOCAL_SIZE: u32 = 128;
|
||||
/// The most draws of an indirect run.
|
||||
pub const MAX_DRAWS: u32 = 512;
|
||||
/// The bytes of each draw's command in the draws' binding (its stride).
|
||||
pub const DRAW_BYTES: u64 = 20;
|
||||
}
|
||||
|
||||
/// The arguments' binding symbol ([`IndexGatherPlanModule::ARGUMENTS_BINDING`]).
|
||||
|
||||
@@ -226,13 +226,6 @@ impl RootTable {
|
||||
/// Byte offset of the sink entry's `host` field, which the consumer fills.
|
||||
pub const SINK_HOST_OFFSET: u32 = (SINK_ROOT * ENTRY_BYTES + HOST) as u32;
|
||||
|
||||
/// Byte offset of the sink entry's `guest` and `size` fields, `R0` and `N`: the 16 bytes
|
||||
/// [`resident_fields`](Self::resident_fields) gives.
|
||||
pub const RESIDENT_FIELDS_OFFSET: u32 = (SINK_ROOT * ENTRY_BYTES + RESIDENT_FIRST) as u32;
|
||||
|
||||
/// The alignment a table and a [`ResidentSet`] it is pointed at both need: one entry.
|
||||
pub const ENTRY_ALIGNMENT: u64 = ENTRY_BYTES;
|
||||
|
||||
/// The table's resident set, `R0 .. R0 + N` as the binder wrote it, each at its padded size.
|
||||
pub fn resident_ranges(&self) -> Vec<ResidentRange> {
|
||||
let field = |root: u64, field: u64| {
|
||||
@@ -253,26 +246,6 @@ impl RootTable {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The sink entry's `guest` and `size` fields (`R0`, then `N`, little-endian) that point a
|
||||
/// table at `table` at the `count` entries of a [`ResidentSet`] at `set`: `R0` is
|
||||
/// `(set - table) / 32` modulo `2^64`. `None` where `set - table` is not a multiple of 32.
|
||||
pub fn resident_fields(table: u64, set: u64, count: u64) -> Option<[u8; 16]> {
|
||||
let distance = set.abs_diff(table);
|
||||
if !distance.is_multiple_of(ENTRY_BYTES) {
|
||||
return None;
|
||||
}
|
||||
let entries = distance / ENTRY_BYTES;
|
||||
// A set below the table wraps: `first * 32` is `set - table` modulo `2^64` either way.
|
||||
let first = match set >= table {
|
||||
true => entries,
|
||||
false => 0u64.wrapping_sub(entries),
|
||||
};
|
||||
let mut fields = [0u8; 16];
|
||||
fields[..8].copy_from_slice(&first.to_le_bytes());
|
||||
fields[8..].copy_from_slice(&count.to_le_bytes());
|
||||
Some(fields)
|
||||
}
|
||||
|
||||
/// The table with `statics` (entry `2 + n` for each `(n, entry)`, every `n < first - 2`) and
|
||||
/// the resident set `resident` (already coalesced,
|
||||
/// [`resident_set`](crate::bind::resident::resident_set)) from root `first`.
|
||||
@@ -375,19 +348,6 @@ impl ResidentSet {
|
||||
}
|
||||
}
|
||||
|
||||
/// The set of every range of `parts`, in their order: equal to [`ResidentSet::new`] of their
|
||||
/// ranges in that order. Each part's set is joined as it is, coalesced with the parts before
|
||||
/// it only at its head; parts whose ranges interleave by Metal address (one starting below
|
||||
/// another of a part ahead of it) are sorted and coalesced together again.
|
||||
pub fn of_parts<'a>(parts: impl IntoIterator<Item = &'a ResidentPart>) -> ResidentSet {
|
||||
let parts = parts
|
||||
.into_iter()
|
||||
.map(|part| (&part.sorted[..], &part.set[..]));
|
||||
ResidentSet {
|
||||
entries: crate::bind::resident::joined(parts),
|
||||
}
|
||||
}
|
||||
|
||||
/// Its entries' count, `N`.
|
||||
pub fn len(&self) -> u64 {
|
||||
self.entries.len() as u64
|
||||
@@ -422,25 +382,6 @@ impl ResidentSet {
|
||||
end <= u128::from(e.size) && e.host.wrapping_add(into) == range.host
|
||||
}
|
||||
|
||||
/// What a consumer points a replay preprocess's resident root table at
|
||||
/// ([`ReplayPreprocess::resident`](crate::bind::ReplayPreprocess::resident),
|
||||
/// [`DrawReplayPreprocess::resident`](crate::bind::DrawReplayPreprocess::resident)) for its
|
||||
/// commands' addresses to resolve through `ranges` as they lie then (the first submission of
|
||||
/// the command buffer that records it, say): the set of `ranges` ([`ResidentSet::new`]) in its
|
||||
/// entries' layout, then each entry's unpadded extent (a `u64`: how many bytes from its Metal
|
||||
/// address the ranges hold without a gap, at their own lengths), then one zero; and the set's
|
||||
/// count `N`. The consumer uploads the bytes at a 32-byte-aligned device address `set` and
|
||||
/// writes [`RootTable::resident_fields`] of the table, `set` and `N` over the table's own.
|
||||
pub fn replay_bytes(ranges: impl IntoIterator<Item = ResidentRange>) -> (Vec<u8>, u64) {
|
||||
let ranges: Vec<ResidentRange> = ranges.into_iter().collect();
|
||||
let set = ResidentSet::new(ranges.iter().copied());
|
||||
let allocations = ranges.iter().map(|range| (range.guest, range.length));
|
||||
let extents = crate::bind::resident::extents_of(allocations, &set.entries);
|
||||
let mut bytes = set.bytes();
|
||||
bytes.extend(crate::bind::resident::extents_bytes(extents));
|
||||
(bytes, set.len())
|
||||
}
|
||||
|
||||
/// The set of its entries and `ranges`, coalesced.
|
||||
pub fn with(&self, ranges: impl IntoIterator<Item = ResidentRange>) -> ResidentSet {
|
||||
let own = self
|
||||
|
||||
@@ -349,29 +349,6 @@ impl MipmapFilterChain {
|
||||
layout::layout(pixel_format).map(|l| l.bytes)
|
||||
}
|
||||
|
||||
/// The format of the sampled view through which `plan`'s `fetch` reads the first level of an
|
||||
/// image of Vulkan format `image`: the image's own, or the UNORM twin of an 8-bit sRGB format
|
||||
/// (the same bytes, its codes undecoded). `None` where no fetch recovers the texels.
|
||||
pub fn fetch_format(image: Format) -> Option<Format> {
|
||||
let view = match image {
|
||||
Format::R8_SRGB => Format::R8_UNORM,
|
||||
Format::R8G8_SRGB => Format::R8G8_UNORM,
|
||||
Format::R8G8B8A8_SRGB => Format::R8G8B8A8_UNORM,
|
||||
Format::B8G8R8A8_SRGB => Format::B8G8R8A8_UNORM,
|
||||
other => other,
|
||||
};
|
||||
fetch::components(view).map(|_| view)
|
||||
}
|
||||
|
||||
/// Whether a fetch of a sampled view of `format` reads the device's conversion of each texel
|
||||
/// (a normalized or 16-bit float format: `plan`'s `fetch` there needs a device measured to
|
||||
/// return values whose recovery reads every code back) rather than its bits (the
|
||||
/// extended-range formats' integer carriers, read in place on any device). `false` too for a
|
||||
/// format no fetch reads.
|
||||
pub fn fetch_converts(format: Format) -> bool {
|
||||
fetch::components(format).is_some_and(|components| !fetch::integer(&components))
|
||||
}
|
||||
|
||||
/// The levels of this chain on the CPU, from the bytes of the first level (every layer, as
|
||||
/// the scratch buffer holds them), every level in order, the first included: the kernel's
|
||||
/// operations in its order, each `f32` operation rounded once as IEEE does (none
|
||||
|
||||
@@ -298,30 +298,6 @@ pub fn ulong_classes(profile: &DeviceProfile) -> Vec<ImageHandleClass> {
|
||||
}
|
||||
|
||||
impl Device {
|
||||
/// Every neutral resource a plan on this device can ask for, in a fixed order, so the
|
||||
/// consumer can create them up front: zero and sink buffers, both samplers, and the neutral of
|
||||
/// every image class the profile can declare (`neutral::image_classes` and
|
||||
/// `neutral::ulong_classes`).
|
||||
pub fn neutral_kinds(&self) -> Vec<NeutralResource> {
|
||||
let profile = self.profile();
|
||||
let mut kinds = BTreeSet::from([
|
||||
NeutralResource::ZeroBuffer {
|
||||
min_bytes: zero_buffer_bytes(profile),
|
||||
},
|
||||
NeutralResource::Sink {
|
||||
min_bytes: NeutralResource::SINK_BYTES,
|
||||
},
|
||||
NeutralResource::Sampler { compare: false },
|
||||
NeutralResource::Sampler { compare: true },
|
||||
]);
|
||||
kinds.extend(
|
||||
image_classes(profile)
|
||||
.iter()
|
||||
.chain(&ulong_classes(profile))
|
||||
.filter_map(NeutralResource::for_image),
|
||||
);
|
||||
kinds.into_iter().collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// Bytes of the `ZeroBuffer` neutral on `profile`: large enough for any uniform-buffer view
|
||||
|
||||
@@ -120,11 +120,6 @@ impl PvrtcDecode {
|
||||
Format::R8G8B8A8_UNORM
|
||||
}
|
||||
|
||||
/// The Metal pixel format whose texels a twin's are: `RGBA8Unorm`.
|
||||
pub fn texel_pixel_format(self) -> PixelFormat {
|
||||
PixelFormat::RGBA8Unorm
|
||||
}
|
||||
|
||||
/// The `float` Metal reads of channel `ch` (red, green, blue, alpha) of code `c`.
|
||||
pub fn metal_value(self, ch: usize, c: u8) -> f32 {
|
||||
match self.srgb && ch < 3 {
|
||||
|
||||
@@ -497,13 +497,6 @@ pub struct RasterizationRateMap {
|
||||
}
|
||||
|
||||
impl RasterizationRateMap {
|
||||
/// The alignment, in bytes, of the parameter data in its buffer
|
||||
/// (`parameterBufferSizeAndAlign.align`).
|
||||
pub const PARAMETER_DATA_ALIGNMENT: u64 = 4;
|
||||
|
||||
/// The parameter data's size in bytes (`parameterBufferSizeAndAlign.size`): 24,624, Metal's
|
||||
/// for every map ([`Self::parameter_data_size`]).
|
||||
pub const PARAMETER_DATA_SIZE: u64 = format::BYTES as u64;
|
||||
|
||||
/// Compile `desc` (`newRasterizationRateMapWithDescriptor:`) by this module's rule, Apple
|
||||
/// M3's, or refuse it ([`RateMapError::Unpinned`]) outside the bounds the rule is measured in.
|
||||
@@ -592,27 +585,6 @@ impl RasterizationRateMap {
|
||||
))
|
||||
}
|
||||
|
||||
/// [`Self::new`] of `desc`, its tables written over `earlier`, the parameter data's words a
|
||||
/// map held, as Metal's private `resetUsingDescriptor:` writes them: every entry this map's
|
||||
/// tables write ([`Self::words`] holds which: each table's lines, and zero words past them),
|
||||
/// and every other word as `earlier` holds it. So a map reset to fewer layers, or to a smaller
|
||||
/// screen, keeps the entries past its own (measured on an Apple M3 Max under macOS 27.0.1:
|
||||
/// every word of maps of no layers reset from maps of one and two layers and from a taller
|
||||
/// screen). Words past `earlier`'s are zero. Only the parameter data differs from
|
||||
/// [`Self::new`]'s map: the CPU coordinate maps read no entry past a map's own.
|
||||
pub fn new_over(
|
||||
desc: &RateMapDescriptor,
|
||||
earlier: &[u32],
|
||||
) -> Result<RasterizationRateMap, RateMapError> {
|
||||
let mut map = RasterizationRateMap::new(desc)?;
|
||||
let mut words = vec![0u32; format::WORDS as usize];
|
||||
let kept = earlier.len().min(words.len());
|
||||
words[..kept].copy_from_slice(&earlier[..kept]);
|
||||
map.encode_into(&mut words);
|
||||
map.words = words;
|
||||
Ok(map)
|
||||
}
|
||||
|
||||
/// Whether every layer's every tile spans as many screen pixels as physical ones: the map
|
||||
/// is the identity inside the screen.
|
||||
pub fn is_identity(&self) -> bool {
|
||||
|
||||
@@ -284,12 +284,6 @@ impl DrawReplayLayout {
|
||||
self.resident_offset - PARAMS_BYTES
|
||||
}
|
||||
|
||||
/// Where, in the parameters of a replay that reads its range ([`DrawReplay::range_read`]),
|
||||
/// the consumer copies the range's 8 bytes (`location`, then `length`) before the preprocess
|
||||
/// runs, from the scratch's start; the host uploads zero there.
|
||||
pub fn range_offset(&self) -> u64 {
|
||||
self.params_offset() + P_RANGE
|
||||
}
|
||||
}
|
||||
|
||||
/// The preprocess of one draw replay: what the consumer uploads into the scratch (of
|
||||
|
||||
@@ -237,18 +237,6 @@ pub enum PredicationCompare {
|
||||
}
|
||||
|
||||
impl PredicationCompare {
|
||||
/// Metal's `comparison` argument: 0 to 5 as the variants state, and any other value
|
||||
/// (6, 255, `2^32 + 2`, `2^64 - 1`, all measured) [`Equal`](Self::Equal), as Metal compares.
|
||||
pub fn from_metal(comparison: u64) -> PredicationCompare {
|
||||
match comparison {
|
||||
1 => PredicationCompare::NotEqual,
|
||||
2 => PredicationCompare::Greater,
|
||||
3 => PredicationCompare::GreaterEqual,
|
||||
4 => PredicationCompare::Less,
|
||||
5 => PredicationCompare::LessEqual,
|
||||
_ => PredicationCompare::Equal,
|
||||
}
|
||||
}
|
||||
|
||||
fn code(self) -> u32 {
|
||||
match self {
|
||||
@@ -339,12 +327,6 @@ impl PredicationStep {
|
||||
/// The bound form: the record's count of gates (a `u32`), at its own empty table's count.
|
||||
pub const BOUND_COUNT_OFFSET: u64 = PredicationStep::EMPTY_TABLE_OFFSET;
|
||||
|
||||
/// The bound form: the bytes of a record's binding that holds `gates` gates, and one more
|
||||
/// past them, which a pass of the gate loop past the count reads (the module docs).
|
||||
pub const fn bound_bytes(gates: u64) -> u64 {
|
||||
PredicationStep::BOUND_GATES_OFFSET + (gates + 1) * PredicationStep::GATE_BYTES
|
||||
}
|
||||
|
||||
/// The step of `op` on the counter at device address `counter`: for an
|
||||
/// [`If`](PredicationOp::If) use [`PredicationStep::condition`].
|
||||
pub fn new(counter: u64, op: PredicationOp) -> PredicationStep {
|
||||
@@ -392,11 +374,6 @@ impl PredicationStep {
|
||||
}
|
||||
}
|
||||
|
||||
/// This loop step on the loop's flag at device address `flag`, of the loop of id `id`.
|
||||
pub fn in_loop(self, flag: u64, id: u32) -> Self {
|
||||
PredicationStep { flag, id, ..self }
|
||||
}
|
||||
|
||||
/// This [`UnitEnd`](PredicationOp::UnitEnd) step writing its check word (a `u32`) at device
|
||||
/// address `word`. Its flag is the record's own word.
|
||||
pub fn checking(self, word: u64) -> Self {
|
||||
|
||||
@@ -68,8 +68,6 @@ impl RowsCopyModule {
|
||||
pub const LOCAL_SIZE: u32 = 64;
|
||||
/// Bytes of the `COMPUTE` push-constant range at offset 0: the rows' shape.
|
||||
pub const PUSH_BYTES: u32 = 16;
|
||||
/// The largest first word in either binding the shape holds.
|
||||
pub const MOST_FIRST_WORD: u32 = 0xffff;
|
||||
|
||||
/// The push bytes of rows `width` words long, the first row's first word at word
|
||||
/// `first_source` of the source binding and `first_destination` of the destination's (each
|
||||
|
||||
@@ -116,14 +116,6 @@ impl PlanesCopy {
|
||||
.then_some(copy)
|
||||
}
|
||||
|
||||
/// The copy format of the sample planes of a color attachment of `format`: its bits copy
|
||||
/// ([`PlanesCopy::for_format`]), else [`PlanesCopy::Alpha8`] for `A8_UNORM`, whose one 8-bit
|
||||
/// unorm channel its own views' `float`s keep. `None` for another format.
|
||||
pub fn for_planes(format: Format) -> Option<PlanesCopy> {
|
||||
PlanesCopy::for_format(format)
|
||||
.or_else(|| (format == Format::A8_UNORM).then_some(PlanesCopy::Alpha8))
|
||||
}
|
||||
|
||||
/// The Vulkan format of the copy's views: an unsigned-integer one, or `A8_UNORM` for
|
||||
/// [`PlanesCopy::Alpha8`].
|
||||
pub fn format(self) -> Format {
|
||||
|
||||
@@ -560,11 +560,6 @@ impl CompensatedViewport {
|
||||
}
|
||||
}
|
||||
|
||||
/// This compensation, scaling a point's `x` and `y` by `guard`.
|
||||
pub fn with_guard(self, guard: [f32; 2]) -> CompensatedViewport {
|
||||
CompensatedViewport { guard, ..self }
|
||||
}
|
||||
|
||||
/// This compensation, bit `i` of `mirrors` set where viewport `i` is mirrored.
|
||||
pub fn with_mirrors(self, mirrors: u32) -> CompensatedViewport {
|
||||
CompensatedViewport { mirrors, ..self }
|
||||
@@ -626,14 +621,6 @@ impl ArgumentSampler {
|
||||
}
|
||||
}
|
||||
|
||||
/// This state at `element` of the sampler arrays under [`HeapPlacement::ResourceId`].
|
||||
pub fn at_element(self, element: u32) -> ArgumentSampler {
|
||||
ArgumentSampler {
|
||||
element: Some(element),
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
/// The number that places the state under [`HeapPlacement::ResourceId`]: its element, else
|
||||
/// its resource ID.
|
||||
pub(crate) fn placed_at(&self) -> u64 {
|
||||
@@ -734,14 +721,6 @@ impl TessellationFactorBuffer {
|
||||
}
|
||||
|
||||
impl BindState {
|
||||
/// The [`view_base_alignment`](Self::view_base_alignment) of a device of `limits`: the larger
|
||||
/// of its `minUniformBufferOffsetAlignment` and 16, the descriptor base alignment of a Metal
|
||||
/// buffer slot's uniform view; 0 (none told apart) past `u32`.
|
||||
pub fn view_base_alignment_of(limits: &Limits) -> u32 {
|
||||
let alignment =
|
||||
crate::memory::views::base_alignment(limits.min_uniform_buffer_offset_alignment);
|
||||
u32::try_from(alignment).unwrap_or(0)
|
||||
}
|
||||
|
||||
/// The projection of this state that can change a plan: per stage, which slots are bound and
|
||||
/// with what kind of resource, whether a buffer has a device address, its per-bind stride, its
|
||||
@@ -804,20 +783,6 @@ impl BindState {
|
||||
self.is_shape(shape, &mut None)
|
||||
}
|
||||
|
||||
/// The position among `shapes` of the first that is this state's shape (of which
|
||||
/// [`has_shape`](Self::has_shape) answers true), found without making the shape: its used
|
||||
/// resources' shape is made at most once, however many shapes it is compared with, and only
|
||||
/// where it lists any in no token order and a shape's every other field matches.
|
||||
pub fn position_of_shape<'s>(
|
||||
&self,
|
||||
shapes: impl IntoIterator<Item = &'s BindShape>,
|
||||
) -> Option<usize> {
|
||||
let mut used = None;
|
||||
shapes
|
||||
.into_iter()
|
||||
.position(|shape| self.is_shape(shape, &mut used))
|
||||
}
|
||||
|
||||
/// Whether `shape` is this state's shape ([`has_shape`](Self::has_shape)), its used
|
||||
/// resources' compared in place where they are listed in token order, else their shape taken
|
||||
/// from `made`, or made into it where it is needed first.
|
||||
@@ -929,63 +894,6 @@ 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), t.buffer_ranges),
|
||||
)
|
||||
});
|
||||
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> {
|
||||
@@ -2036,106 +1944,7 @@ pub struct BindShape {
|
||||
}
|
||||
|
||||
impl BindShape {
|
||||
/// The shape a plan of a pipeline whose runtime dependencies are `dependencies` is planned
|
||||
/// and keyed by: this shape with each bound texture's level count 1 but at the slots whose
|
||||
/// levels the pipeline reads (`RuntimeFact::StorageTextureLevels` and
|
||||
/// `StorageTextureLevelViews`), and each used texture's 1 (a heap array views level 0 alone).
|
||||
/// The plan reads a texture's level count only at those slots, so it is the same plan, and
|
||||
/// bound textures of other level counts that a function only samples, or writes at level 0,
|
||||
/// share it. Borrowed where nothing changes.
|
||||
pub fn for_plan(&self, dependencies: &[RuntimeDependency]) -> Cow<'_, BindShape> {
|
||||
let reads_levels = |stage: Stage, index: u32| {
|
||||
dependencies.iter().any(|d| match d.fact {
|
||||
RuntimeFact::StorageTextureLevels { slot }
|
||||
| RuntimeFact::StorageTextureLevelViews { slot } => {
|
||||
slot.stage == stage && slot.class == SlotClass::Texture && slot.index == index
|
||||
}
|
||||
_ => false,
|
||||
})
|
||||
};
|
||||
let unread = |stage: Stage, index: u32, shape: &TextureShape| {
|
||||
matches!(shape, TextureShape::Texture { mipmap_level_count, .. } if *mipmap_level_count != 1)
|
||||
&& !reads_levels(stage, index)
|
||||
};
|
||||
let used = |shape: &UsedShape| {
|
||||
matches!(
|
||||
shape.class,
|
||||
UsedClass::Texture(TextureShape::Texture { mipmap_level_count, .. })
|
||||
if mipmap_level_count != 1
|
||||
)
|
||||
};
|
||||
let changes = self.stages.iter().any(|(stage, table)| {
|
||||
table
|
||||
.textures
|
||||
.iter()
|
||||
.any(|(index, shape)| unread(*stage, *index, shape))
|
||||
}) || self.used.values().any(used);
|
||||
if !changes {
|
||||
return Cow::Borrowed(self);
|
||||
}
|
||||
let one_level = |shape: &mut TextureShape| *shape = shape.at_one_level();
|
||||
let mut projected = self.clone();
|
||||
for (stage, table) in &mut projected.stages {
|
||||
for (index, shape) in &mut table.textures {
|
||||
if unread(*stage, *index, shape) {
|
||||
one_level(shape);
|
||||
}
|
||||
}
|
||||
}
|
||||
for shape in projected.used.values_mut() {
|
||||
if let UsedClass::Texture(texture) = &mut shape.class {
|
||||
one_level(texture);
|
||||
}
|
||||
}
|
||||
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
|
||||
|
||||
@@ -132,15 +132,6 @@ impl TiledLevelMove {
|
||||
}
|
||||
}
|
||||
|
||||
/// The level, its elements 32-bit float depths that the move into the image clamps into
|
||||
/// `[0, 1]` ([`clamps_depth`](Self::clamps_depth)).
|
||||
pub const fn clamping_depth(self) -> TiledLevelMove {
|
||||
TiledLevelMove {
|
||||
clamps_depth: true,
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
/// The invocations that move the level: a word of its tight elements each, into the image;
|
||||
/// a word of its tiled regions each, back.
|
||||
pub const fn invocations(&self, into_tight: bool) -> u32 {
|
||||
|
||||
@@ -113,16 +113,6 @@ impl ContinuedResult {
|
||||
}
|
||||
}
|
||||
|
||||
/// The same result, a sum of which is taken into its word's low half alone
|
||||
/// ([`ContinuedResult::low_half`]).
|
||||
#[must_use]
|
||||
pub fn in_low_half(self) -> ContinuedResult {
|
||||
ContinuedResult {
|
||||
low_half: true,
|
||||
..self
|
||||
}
|
||||
}
|
||||
|
||||
/// How the table states its combine: 0 to OR, 1 to sum, 2 to sum into the low half.
|
||||
fn how(&self) -> u32 {
|
||||
match (self.sum, self.low_half) {
|
||||
|
||||
@@ -78,15 +78,10 @@ impl YCbCrRefreshModule {
|
||||
/// The state's word that says a conversion completed from the copy: 0 where none did, which
|
||||
/// takes the conversion's group count whatever the words.
|
||||
pub const COMPLETED: u32 = 3;
|
||||
/// The state's words: the `VkDispatchIndirectCommand`, then
|
||||
/// [`COMPLETED`](Self::COMPLETED).
|
||||
pub const STATE_WORDS: u32 = 4;
|
||||
/// Invocations of one workgroup, along x: one word each.
|
||||
pub const LOCAL_SIZE: u32 = 64;
|
||||
/// Bytes of the `COMPUTE` push-constant range at offset 0: the shape.
|
||||
pub const PUSH_BYTES: u32 = 16;
|
||||
/// The largest first word in either binding the shape holds.
|
||||
pub const MOST_FIRST_WORD: u32 = 0xffff;
|
||||
/// The words one row of workgroups covers: 1024 workgroups across.
|
||||
pub const ROW_WORDS: u32 = Self::LOCAL_SIZE * 1024;
|
||||
|
||||
|
||||
Vendored
-7
@@ -97,13 +97,6 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 556;
|
||||
/// keeps no history.
|
||||
pub const RUNTIME_VERSION: u32 = 2542;
|
||||
|
||||
/// 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
|
||||
/// or reads. A cache of translations across builds keys on it beside [`SEMANTICS_VERSION`] and
|
||||
/// [`ARTIFACT_FORMAT_VERSION`], so a build of other sources never reads another build's output,
|
||||
/// even when no version moved. An edit to a test-only module leaves it unchanged.
|
||||
pub const SOURCE_DIGEST: &str = env!("M2V_SOURCE_DIGEST");
|
||||
|
||||
/// Writes a digest as lowercase hex.
|
||||
pub(crate) fn write_hex(f: &mut fmt::Formatter<'_>, name: &str, hash: &Hash256) -> fmt::Result {
|
||||
f.write_str(name)?;
|
||||
|
||||
@@ -215,23 +215,6 @@ impl DeviceProfile {
|
||||
crate::memory::contain::device_drops_texel_writes(self, texel_buffer)
|
||||
}
|
||||
|
||||
/// Whether this profile runs object and mesh functions as compute work: it does not enable
|
||||
/// `VK_EXT_mesh_shader` and `meshShader`. Then a mesh function writes its primitives as records
|
||||
/// that a synthesized vertex stage draws (`GraphicsState::mesh_records`), each stage's
|
||||
/// threadgroups are held to the compute stage's limits. Elsewhere they are `TaskEXT` and
|
||||
/// `MeshEXT` entries, held to the task and mesh stages' limits, and an object function needs
|
||||
/// `taskShader` too.
|
||||
pub fn emulates_mesh_shading(&self) -> bool {
|
||||
crate::lower::mesh::emulates(self)
|
||||
}
|
||||
|
||||
/// Whether a function reads a two-plane YCbCr texture's planes in place where its slot reads
|
||||
/// the texture only so (`bind::YCbCrInPlace`): on every device. The planes read in place are
|
||||
/// sampled by Vulkan's Y′CbCr model where the sample allows it.
|
||||
pub fn reads_ycbcr_planes_in_place(&self) -> bool {
|
||||
self.fields.ycbcr_in_place
|
||||
}
|
||||
|
||||
/// The driver workarounds the profile takes: the leaf encodings it changes and the refusals of
|
||||
/// what the driver is measured to run wrong.
|
||||
pub fn workarounds(&self) -> &[DriverWorkaround] {
|
||||
|
||||
@@ -151,32 +151,6 @@ impl Error {
|
||||
}
|
||||
}
|
||||
|
||||
/// What this outcome is permanent for. Transient outcomes (those [`Error::retry`] calls
|
||||
/// `Later`) are `Never` and may not enter a memo, artifact cache, or validation observation.
|
||||
pub fn is_permanent_for(&self) -> Permanence {
|
||||
match self {
|
||||
Error::Cancelled | Error::Budget(_) => Permanence::Never,
|
||||
Error::Internal(internal) if internal.kind == InternalKind::AllocationFailed => {
|
||||
Permanence::Never
|
||||
}
|
||||
Error::Unsupported(u) => match u.needs {
|
||||
Needs::AnyOf(_) => Permanence::InputAndDevice,
|
||||
Needs::NotImplemented | Needs::NotRepresentable => Permanence::Input,
|
||||
Needs::DriverDefect(_)
|
||||
| Needs::RuntimeDriverDefect(_)
|
||||
| Needs::StageBound
|
||||
| Needs::DeviceCapability(_)
|
||||
| Needs::MetalGpuFamily(_)
|
||||
| Needs::MetalRefuses(_) => Permanence::InputAndDevice,
|
||||
},
|
||||
Error::NeedsInput(_)
|
||||
| Error::InvalidInput(_)
|
||||
| Error::InvalidDescriptor(_)
|
||||
| Error::LimitExceeded(_) => Permanence::Input,
|
||||
// The emitted module depends on the profile, so an invariant failure is keyed on both.
|
||||
Error::Internal(_) => Permanence::InputAndDevice,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
@@ -479,12 +453,6 @@ impl Unsupported {
|
||||
self
|
||||
}
|
||||
|
||||
/// Name the pixel format a refused texture, view, copy or attachment holds, by its Metal
|
||||
/// enumerator name (`MTLPixelFormatRGB10A8_2P_XR10`), as [`symbol`](Self::symbol)
|
||||
/// (diagnostics only).
|
||||
pub fn naming_format(self, pixel_format: PixelFormat) -> Unsupported {
|
||||
self.naming(DiagName::new(pixel_format.name()))
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Unsupported {
|
||||
|
||||
@@ -911,153 +911,6 @@ pub enum RecordField {
|
||||
}
|
||||
|
||||
impl CommandRecord {
|
||||
/// Write `field` into the record `bytes` hold ([`COMMAND_BYTES`]), as `decode`, setting the
|
||||
/// field and [`encode_into`](Self::encode_into) would, but touching no word the field does
|
||||
/// not take: `bytes` then decode as what `encode_into` writes of the record
|
||||
/// [`decode`](Self::decode) read from them with `field` set, and bytes `encode_into` wrote
|
||||
/// stay what it writes. One setter's write, without decoding and encoding the rest. Refused,
|
||||
/// leaving `bytes` unchanged: what `decode` refuses of `bytes`, what `encode_into` refuses of
|
||||
/// the record with `field` set (an all-ones stride, a stage-in region beside a draw whose
|
||||
/// arguments take its words, the first two threadgroup lengths beside an indexed patch
|
||||
/// draw), and an index past the record's ([`RecordError::Index`]). Answers the bytes it may
|
||||
/// have changed.
|
||||
pub fn write_field(bytes: &mut [u8], field: RecordField) -> Result<Range<usize>, RecordError> {
|
||||
let view = RecordView::new(bytes)?;
|
||||
// The stage-in region and the first two lengths are read only for an action, which checks
|
||||
// them: a setter of another field reads no more of the record than `RecordView::new` does.
|
||||
let action = view.action();
|
||||
let flagged = view.retained_pipeline().is_some() || view.kernel_pipeline();
|
||||
let stage_in = |view: &RecordView<'_>| view.stage_in_region();
|
||||
let lengths = |view: &RecordView<'_>| {
|
||||
[0, 1].map(|index| view.threadgroup_memory_length(index).unwrap_or(0))
|
||||
};
|
||||
let word_bytes = |word: usize, words: usize| word * 4..(word + words) * 4;
|
||||
match field {
|
||||
RecordField::Barrier(barrier) => {
|
||||
put_word(bytes, 1, u32::from(barrier));
|
||||
Ok(word_bytes(1, 1))
|
||||
}
|
||||
RecordField::Pipeline(pipeline) => {
|
||||
put_u64(bytes, 2, pipeline.get());
|
||||
// A pipeline the CPU sets is reported, and not a kernel's.
|
||||
if !flagged {
|
||||
return Ok(word_bytes(2, 2));
|
||||
}
|
||||
let state = layout::STATE as usize;
|
||||
put_word(bytes, state / 4, 0);
|
||||
Ok(8..state + 4)
|
||||
}
|
||||
RecordField::Buffer {
|
||||
stage,
|
||||
slot,
|
||||
binding,
|
||||
} => {
|
||||
if slot >= BINDING_COUNT {
|
||||
return Err(RecordError::Index {
|
||||
index: slot,
|
||||
count: BINDING_COUNT,
|
||||
});
|
||||
}
|
||||
let (address, stride) = match binding {
|
||||
None => (0, 0),
|
||||
Some(binding) if binding.attribute_stride == Some(u64::MAX) => {
|
||||
return Err(RecordError::ReservedStride);
|
||||
}
|
||||
Some(binding) => (
|
||||
binding.address,
|
||||
binding.attribute_stride.unwrap_or(u64::MAX),
|
||||
),
|
||||
};
|
||||
let word = HEADER_WORDS + (stage.index() * BINDING_COUNT + slot) * BUFFER_WORDS;
|
||||
put_u64(bytes, word, address);
|
||||
put_u64(bytes, word + 2, stride);
|
||||
Ok(word_bytes(word, BUFFER_WORDS))
|
||||
}
|
||||
RecordField::ThreadgroupMemoryLength { index, length } => {
|
||||
if index >= THREADGROUP_COUNT {
|
||||
return Err(RecordError::Index {
|
||||
index,
|
||||
count: THREADGROUP_COUNT,
|
||||
});
|
||||
}
|
||||
// An indexed patch draw's control-point index buffer takes the first two
|
||||
// lengths' words: a length of 0 there is the record's already.
|
||||
if matches!(action, Action::DrawIndexedPatches { .. }) && index < 2 {
|
||||
return match length {
|
||||
0 => Ok(0..0),
|
||||
_ => Err(RecordError::ThreadgroupMemoryLength),
|
||||
};
|
||||
}
|
||||
put_word(bytes, THREADGROUP_WORD + index, length);
|
||||
Ok(word_bytes(THREADGROUP_WORD + index, 1))
|
||||
}
|
||||
RecordField::StageInRegion(region) => {
|
||||
// A draw whose arguments take the stage-in region's words has none.
|
||||
if action.takes_stage_in_words() {
|
||||
return match region {
|
||||
[0, 0, 0, 0, 0, 0] => Ok(0..0),
|
||||
_ => Err(RecordError::StageInRegion),
|
||||
};
|
||||
}
|
||||
let first = layout::STAGE_IN as usize / 4;
|
||||
for (index, &value) in region.iter().enumerate() {
|
||||
put_word(bytes, first + index, value);
|
||||
}
|
||||
Ok(word_bytes(first, 6))
|
||||
}
|
||||
RecordField::ImageblockSize(size) => {
|
||||
let at = layout::IMAGEBLOCK as usize;
|
||||
for (index, value) in size.iter().enumerate() {
|
||||
bytes[at + 2 * index..at + 2 * index + 2].copy_from_slice(&value.to_le_bytes());
|
||||
}
|
||||
Ok(at..at + 4)
|
||||
}
|
||||
RecordField::Action(new) => {
|
||||
let (stage_in, lengths) = (stage_in(&view), lengths(&view));
|
||||
let wide = new.takes_stage_in_words();
|
||||
if wide && stage_in != [0; 6] {
|
||||
return Err(RecordError::StageInRegion);
|
||||
}
|
||||
let control_point_indices = match new {
|
||||
Action::DrawIndexedPatches {
|
||||
control_point_index_buffer,
|
||||
..
|
||||
} => Some(control_point_index_buffer),
|
||||
_ => None,
|
||||
};
|
||||
if control_point_indices.is_some() && lengths != [0; 2] {
|
||||
return Err(RecordError::ThreadgroupMemoryLength);
|
||||
}
|
||||
let (tag, arguments) = action_words(&new);
|
||||
put_word(bytes, 0, tag);
|
||||
let first = layout::ARGUMENTS as usize / 4;
|
||||
for (index, value) in arguments.into_iter().enumerate() {
|
||||
put_word(bytes, first + index, value);
|
||||
}
|
||||
// The stage-in region keeps its words beside a dispatch or a draw of primitives;
|
||||
// an indexed or patch draw's arguments took them, and leave it none.
|
||||
if !wide {
|
||||
let stage_in_word = layout::STAGE_IN as usize / 4;
|
||||
for (index, &value) in stage_in.iter().enumerate() {
|
||||
put_word(bytes, stage_in_word + index, value);
|
||||
}
|
||||
}
|
||||
let mut end = (first + layout::DRAW_ARGUMENT_WORDS) * 4;
|
||||
// The first two threadgroup lengths' words: the control-point index buffer of an
|
||||
// indexed patch draw, else the lengths, which one took and leaves 0.
|
||||
let taken = matches!(action, Action::DrawIndexedPatches { .. });
|
||||
if let Some(address) = control_point_indices {
|
||||
put_u64(bytes, layout::CONTROL_POINT_INDICES as usize / 4, address);
|
||||
end = layout::CONTROL_POINT_INDICES as usize + 8;
|
||||
} else if taken {
|
||||
put_word(bytes, THREADGROUP_WORD, lengths[0]);
|
||||
put_word(bytes, THREADGROUP_WORD + 1, lengths[1]);
|
||||
end = layout::THREADGROUP as usize + 8;
|
||||
}
|
||||
Ok(0..end)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn require_length(bytes: &[u8]) -> Result<(), RecordError> {
|
||||
|
||||
@@ -183,56 +183,6 @@ impl CompiledFunction {
|
||||
&self.1
|
||||
}
|
||||
|
||||
/// The digest `derive` gives for `words`, where `words` are the final SPIR-V of this
|
||||
/// function's last relocation -- the very `Arc` a pipeline's stage took from it -- and
|
||||
/// `None` where they are not.
|
||||
///
|
||||
/// A pipeline state that names a stage's module by a digest of its words asks here first: a
|
||||
/// sweep of states over one function pair takes the same words on every creation (the
|
||||
/// relocation slot gives back the same allocation), so without this each creation hashes
|
||||
/// words byte-identical to the previous creation's. Pass the words a stage of the pipeline
|
||||
/// holds and the function that would have hashed them.
|
||||
///
|
||||
/// **A miss costs no `derive` call at all.** `None` is answered from the slot alone: no
|
||||
/// hash is taken, and the caller is free to derive or not. That is what a caller in a hot
|
||||
/// path needs to know, and it is also why the caller's own function stays the only
|
||||
/// derivation of a stage's words that ever runs -- nothing here hashes words any other way,
|
||||
/// so nothing keyed on such a digest can take a different value from this.
|
||||
///
|
||||
/// **The digest a caller gets is always one its own `derive` produced.** The slot keeps the
|
||||
/// function beside the digest and answers only where that function is this call's, so two
|
||||
/// callers that hash differently never read each other's digest: a mismatch derives again
|
||||
/// and replaces what the slot held.
|
||||
///
|
||||
/// **On comparing `fn` pointers**, which is not guaranteed stable: identical-code folding
|
||||
/// may merge two functions into one address, and one `fn` item may have several addresses
|
||||
/// across codegen units. Both directions are harmless here. Two addresses for one function
|
||||
/// make a mismatch, which costs a hash and gives the same digest. The dangerous direction --
|
||||
/// two *different* hash functions reading as one -- cannot occur, because folding merges
|
||||
/// only identical machine code and identical machine code cannot produce different digests.
|
||||
///
|
||||
/// `derive` is the caller's, so it is **never called while the slot is locked**: one that
|
||||
/// reached back into this compiled function would otherwise deadlock. The slot is locked and
|
||||
/// read, released, `derive` is called, and the digest is stored only if the slot still holds
|
||||
/// those words. Two threads deriving at once is benign -- the same words give the same
|
||||
/// digest, and the last store wins.
|
||||
pub fn relocated_words_digest(
|
||||
&self,
|
||||
words: &Arc<[u32]>,
|
||||
derive: fn(&[u32]) -> crate::cache::Hash256,
|
||||
) -> Option<crate::cache::Hash256> {
|
||||
match self.1.digest_of(words, derive) {
|
||||
DigestOf::Kept(digest) => Some(digest),
|
||||
DigestOf::Other => None,
|
||||
// Derived with the slot released: `derive` is the caller's and may reach anywhere.
|
||||
DigestOf::Wanted => {
|
||||
let digest = derive(words);
|
||||
self.1.keep_digest(words, derive, digest);
|
||||
Some(digest)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The key the function was compiled under.
|
||||
pub fn key(&self) -> &FunctionCompileKey {
|
||||
&self.0.key
|
||||
@@ -307,19 +257,6 @@ impl CompiledFunction {
|
||||
!self.0.kernel.partition_oblivious
|
||||
}
|
||||
|
||||
/// Whether the function, a kernel, observes its threadgroup partition through its simdgroups
|
||||
/// alone: its only observations are barriers of simdgroup execution scope, fences and atomics
|
||||
/// of simdgroup scope, simdgroup and quad functions, `is_uniform`, the simdgroup size, and the
|
||||
/// builtins `thread_index_in_simdgroup`, `thread_index_in_quadgroup` and
|
||||
/// `threads_per_simdgroup`. It computes the same in any partition that keeps its threadgroups,
|
||||
/// so a one-row grid in threadgroups of one row may run flat in the call's threadgroups
|
||||
/// (`LoweringInputs`'s `call_threadgroups`). `false` for a kernel that does not observe its
|
||||
/// partition ([`observes_threadgroup_partition`](Self::observes_threadgroup_partition)).
|
||||
/// Decided as that one is.
|
||||
pub fn observes_partition_through_simdgroups_alone(&self) -> bool {
|
||||
self.0.kernel.partition_simdgroups
|
||||
}
|
||||
|
||||
/// Whether the function, a kernel, is image-only: it samples, gathers or reads a texture, and
|
||||
/// loads, stores and updates atomically nothing in device memory, through no load, store,
|
||||
/// atomic or call but a texture or sampler operation on a pointer into the `device` address
|
||||
@@ -331,12 +268,6 @@ impl CompiledFunction {
|
||||
self.0.kernel.image_only
|
||||
}
|
||||
|
||||
/// The function's own `[[max_total_threads_per_threadgroup(n)]]` (`air.max_work_group_size`),
|
||||
/// `None` without one: the most threads Metal compiles a threadgroup of the function for.
|
||||
pub fn max_total_threads_attribute(&self) -> Option<u32> {
|
||||
self.0.kernel.max_total_threads.filter(|&n| n > 0)
|
||||
}
|
||||
|
||||
/// Where a fragment function linked after this vertex function pushes its fields on
|
||||
/// `Device::from_queries`' profile (`LoweringInputs::push_base`): this function's push end, a
|
||||
/// multiple of 4; where it pushes nothing, 24 for a post-tessellation function (past its
|
||||
|
||||
@@ -548,36 +548,6 @@ impl ExtendedRange {
|
||||
}
|
||||
}
|
||||
|
||||
/// The raw texel (the components of [`raw_format`](Self::raw_format)) Metal's `Clear` load
|
||||
/// action stores for the clear color `color` (red, green, blue, alpha; measured on an Apple M3
|
||||
/// Max and an M4): each channel goes through `float` and then `half`,
|
||||
/// each rounded to nearest even, and is stored as a kernel write stores that value; the bits
|
||||
/// Metal does not read are written as a write writes them. That is Metal's route `route` where
|
||||
/// it is [`ClearRoute::ThroughHalf`]; a texel by [`ClearRoute::Straight`] is that route's. A
|
||||
/// bfloat form's code is the one `route` gives. (A color fill, Apple SPI, goes through neither:
|
||||
/// the runtime's `blit_fill`.)
|
||||
pub fn clear_texel(self, color: [f64; 4], route: ClearRoute) -> [u32; 4] {
|
||||
let half =
|
||||
|v: f64| crate::float16::f16_bits_to_f32(crate::float16::f32_to_f16_bits(v as f32));
|
||||
let straight = route == ClearRoute::Straight
|
||||
&& matches!(
|
||||
self,
|
||||
ExtendedRange::Bgr10 { .. } | ExtendedRange::Bgra10 { .. }
|
||||
);
|
||||
let codes = std::array::from_fn(|c| match (self.bfloat(), route) {
|
||||
(true, ClearRoute::ThroughHalf) => bfloat_nearest_even(half(color[c])),
|
||||
(true, ClearRoute::Straight) => bfloat_of_double(color[c]),
|
||||
(false, _) if straight => self.straight_code(color[c] as f32, c == 3),
|
||||
(false, _) => self.code(half(color[c]), c == 3),
|
||||
});
|
||||
let texel = self.texel(codes);
|
||||
match (self, straight) {
|
||||
// Bits 30 and 31 zero.
|
||||
(ExtendedRange::Bgr10 { .. }, true) => [texel[0] & 0x3fff_ffff, 0, 0, 0],
|
||||
_ => texel,
|
||||
}
|
||||
}
|
||||
|
||||
/// The code Metal's straight clear route ([`ClearRoute::Straight`]) stores in a `BGR10_XR`
|
||||
/// or `BGRA10_XR` channel, or its alpha where `alpha`, for the `float` `v` (an Apple M4 under
|
||||
/// macOS 27.0.1: every channel of 2,574 colors of each form; the consumer's M3 Max under 26.7
|
||||
@@ -608,44 +578,6 @@ impl ExtendedRange {
|
||||
(f64::from(x) + 0.5).floor().clamp(0.0, 1023.0) as u32
|
||||
}
|
||||
|
||||
/// Whether a render pass's `Clear` load of the clear color `color` leaves Metal's tile memory
|
||||
/// holding the values the clear's stored codes ([`clear_texel`](Self::clear_texel)) read
|
||||
/// back, rounded to `half`. Metal's tile memory holds each channel of a pass's
|
||||
/// `BGR10_XR`, `BGRA10_XR` or two-plane color, and their `_sRGB` twins, as `half` until the
|
||||
/// pass stores it, and a `Clear` load as the clear color through `float` and then `half`
|
||||
/// (on an Apple M4 and the same probe on an Apple M3 Max): a draw that reads
|
||||
/// or blends into the color then sees those halves, where an image of the codes holds the
|
||||
/// codes nearest them. A padded form's tile holds its channels as `half` too, an unblended
|
||||
/// draw's past `[0, 1]` unclamped (the M3 Max under macOS 27.0.1: a blend over a clear and
|
||||
/// over such a draw, `probes/padded_and_bfloat_blends.m` of the conformance crate); its codes
|
||||
/// read back
|
||||
/// `c / 1023` (`RGB10A2Unorm_sRGB`'s alpha `c / 3`), the color of `R10Unorm_X6_sRGB` and
|
||||
/// `RGB10A2Unorm_sRGB` through the sRGB transfer function. `None` for the bfloat forms,
|
||||
/// whose tile memory is unmeasured.
|
||||
pub fn clear_read_back(self, color: [f64; 4]) -> Option<bool> {
|
||||
if self.bfloat() {
|
||||
return None;
|
||||
}
|
||||
let half = |v: f32| crate::float16::f16_bits_to_f32(crate::float16::f32_to_f16_bits(v));
|
||||
if self.padded() {
|
||||
use crate::metal::ColorWriteMask as M;
|
||||
let held = self.channels();
|
||||
let lanes = [M::RED, M::GREEN, M::BLUE, M::ALPHA];
|
||||
return Some((0..4).filter(|&c| held.contains(lanes[c])).all(|c| {
|
||||
let tile = half(color[c] as f32);
|
||||
tile == half(self.padded_code_value(self.code(tile, c == 3), c == 3))
|
||||
}));
|
||||
}
|
||||
let channels = match self {
|
||||
ExtendedRange::Bgr10 { .. } => 3,
|
||||
_ => 4,
|
||||
};
|
||||
Some((0..channels).all(|c| {
|
||||
let held = half(color[c] as f32);
|
||||
held == half(self.code_value(self.code(held, c == 3), c == 3))
|
||||
}))
|
||||
}
|
||||
|
||||
/// The value a padded form's code `code` of a color channel, or of alpha where `alpha`, reads:
|
||||
/// `code / 1023`, `RGB10A2Unorm_sRGB`'s alpha `code / 3`, the color of `R10Unorm_X6_sRGB` and
|
||||
/// `RGB10A2Unorm_sRGB` through the sRGB transfer function (`RG10Unorm_X12_sRGB` reads its codes
|
||||
@@ -667,23 +599,6 @@ impl ExtendedRange {
|
||||
v as f32
|
||||
}
|
||||
|
||||
/// The `half` values Metal's tile memory holds for a color of this form after a render
|
||||
/// pass's `Clear` load of the clear color `color` (red, green, blue, alpha), as `f32`: each
|
||||
/// channel through `float` and then `half`, each rounded to nearest even, and `BGR10_XR`'s
|
||||
/// alpha 1, as a read of the tile reads it. The runtime clears the attachment's `half` shadow
|
||||
/// to them. `None` for the padded forms, whose `half` shadow the runtime does not hold, and
|
||||
/// the bfloat forms, whose tile memory is unmeasured.
|
||||
pub fn clear_tile_value(self, color: [f64; 4]) -> Option<[f32; 4]> {
|
||||
if self.padded() || self.bfloat() {
|
||||
return None;
|
||||
}
|
||||
let half = |v: f32| crate::float16::f16_bits_to_f32(crate::float16::f32_to_f16_bits(v));
|
||||
Some(std::array::from_fn(|c| match (self, c) {
|
||||
(ExtendedRange::Bgr10 { .. }, 3) => 1.0,
|
||||
_ => half(color[c] as f32),
|
||||
}))
|
||||
}
|
||||
|
||||
/// The `float` value Metal reads from the code `code` (below 1024) of a color channel, or of
|
||||
/// alpha where `alpha`, of a `BGR10_XR`, `BGRA10_XR` or two-plane format or an `_sRGB` twin
|
||||
/// (an Apple M3 Max and an M4): `(code - 384) / 510` correctly rounded, an `_sRGB` color
|
||||
@@ -1271,45 +1186,6 @@ pub fn extended_range_blend(pf: PixelFormat, profile: &DeviceProfile) -> Result<
|
||||
crate::lower::fragment::extended_range_blend(pf, profile)
|
||||
}
|
||||
|
||||
/// Whether `pf` holds each of its 10-bit codes in the top 10 bits of its own little-endian
|
||||
/// 16-bit word, the low 6 unread: the padded formats `R10Unorm_X6` and `RG10Unorm_X12` and their
|
||||
/// `_sRGB` twins. `RGB10A2Unorm_sRGB` packs its codes in one 32-bit word instead, so it is not
|
||||
/// one of these ([`ExtendedRange::padded`] names both sets).
|
||||
///
|
||||
/// Metal makes a texture of such a format wherever it makes one of any format, in memory of its
|
||||
/// own as much as over an IOSurface's plane or a buffer. Measured on an Apple M3 Max under macOS
|
||||
/// 27.0.1 (26A434) for all four, 2D 8x8 unless said: `newTextureWithDescriptor:` answers a
|
||||
/// texture in `Shared`, `Private` and `Memoryless` storage, under `ShaderRead`,
|
||||
/// `ShaderRead | ShaderWrite` and `ShaderRead | RenderTarget` usage, with four levels, as an
|
||||
/// array of three slices, and as a texture buffer of 64 texels; an automatic, a placement and a
|
||||
/// sparse heap each place one, and `heapTextureSizeAndAlignWithDescriptor:` answers the tight
|
||||
/// linear size at an alignment of 128. A shader read answers the code's value and a shader write
|
||||
/// stores the code, a blit from a buffer lands exactly, and a render pass clears and draws into
|
||||
/// one. `newSharedTextureWithDescriptor:` makes one as well, in the `Private` storage that is the
|
||||
/// only storage any shareable texture is made in: all four formats at 2D 8x8, 2D 16x16 and a
|
||||
/// texture buffer of 8 and of 16 texels answered a shareable texture of the format, 8 of 8
|
||||
/// processes each, where `Shared`, `Managed` and `Memoryless` storage answer nil for every format
|
||||
/// alike (`RGBA8Unorm` and `R16Uint` beside these four). Only a multisample descriptor is stopped
|
||||
/// by Metal's validation.
|
||||
///
|
||||
/// Metal's own host copies of such a texture are exact only while it keeps the texture linear —
|
||||
/// `allocatedSize` equal to the tight `width * bytes * height`, which held for every height up
|
||||
/// to 8 at widths to 1024, for heights to 12 at a width of 16, and at any extent whose usage
|
||||
/// includes `ShaderWrite`. Where Metal picks its compressed layout instead (an extra 128 bytes
|
||||
/// or more in `allocatedSize`: 16x16 and 64x64 under `ShaderRead` alone) both host copies are
|
||||
/// silent no-ops: `getBytes:` leaves its destination untouched and `replaceRegion:` leaves the
|
||||
/// texture zero as a shader reads it, while a blit either way still moves the texels. The
|
||||
/// runtime's copies are exact at every extent (docs/API.md, accepted differences).
|
||||
pub fn padded_words(pf: PixelFormat) -> bool {
|
||||
matches!(
|
||||
pf,
|
||||
PixelFormat::R10UnormX6
|
||||
| PixelFormat::RG10UnormX12
|
||||
| PixelFormat::R10UnormX6SRGB
|
||||
| PixelFormat::RG10UnormX12SRGB
|
||||
)
|
||||
}
|
||||
|
||||
/// The texel extent of one block of the compressed format `pf`, `None` for an uncompressed one.
|
||||
///
|
||||
/// Metal states this nowhere: `MTLPixelFormat` has no block-extent getter, and a program that
|
||||
@@ -1893,68 +1769,6 @@ pub fn vk_format(
|
||||
Err(Unsupported::needs_any_of(Feature::Format, alternatives).into())
|
||||
}
|
||||
|
||||
/// The swizzle, over the channels of `own`, through which a texture of `own` reads what a view
|
||||
/// of `pf` made with `swizzle` reads, where `pf` holds its texels in the very bits of `own`'s and
|
||||
/// presents them in other channels: `own` samples as its direct Vulkan format on `profile`, and
|
||||
/// one of `pf`'s candidates is [`FormatEmulation::SwizzledView`] or
|
||||
/// [`FormatEmulation::AlphaInRed`] of that format (`A8Unorm` over `R8Unorm`, read through
|
||||
/// `(Zero, Zero, Zero, Red)`). Exact for sampling and reads as that
|
||||
/// emulation is: the same bits, the same filter, the channels moved by the view's mapping, which
|
||||
/// Vulkan applies to gathered texels and border texels as to any other ("Texel Input Operations":
|
||||
/// replacement, then the component swizzle). `None` elsewhere, for `pf` equal to `own`, where
|
||||
/// `profile` takes no view of the composed mapping
|
||||
/// (`VUID-VkImageViewCreateInfo-imageViewFormatSwizzle-04465`), and where an opaque-black border
|
||||
/// would read otherwise: Vulkan leaves it undefined through a mapping other than the identity
|
||||
/// unless the device swizzles borders (`VK_EXT_border_color_swizzle`), so the swizzle is given only
|
||||
/// where Metal reads the transparent-black texel for opaque black through it
|
||||
/// ([`opaque_black_reads_transparent`](crate::metal::sampler::opaque_black_reads_transparent)),
|
||||
/// whose sampler every device reads exactly; transparent black and opaque white are defined through
|
||||
/// any mapping. A write through it stores as a swizzled texture's storage binding does
|
||||
/// (`LoweringInputs::swizzled_storage`): each of the image's channels from the first lane whose
|
||||
/// source it is, else from the channel's own lane, as Metal stores each of the view's (probe
|
||||
/// `a8write`, an M3 Max under macOS 27.0.1: an `A8Unorm` view of an `R8Unorm` texture stores the
|
||||
/// first lane whose source is alpha, else the alpha lane). So `None` too where a channel of the
|
||||
/// view that holds one of the image's is no lane's source (an `A8Unorm` view of swizzle
|
||||
/// `(Red, Green, Blue, One)`), where the two fallbacks name different lanes.
|
||||
pub fn swizzle_over(
|
||||
pf: PixelFormat,
|
||||
swizzle: TextureSwizzleChannels,
|
||||
own: PixelFormat,
|
||||
profile: &DeviceProfile,
|
||||
) -> Option<TextureSwizzleChannels> {
|
||||
if pf == own {
|
||||
return None;
|
||||
}
|
||||
let sampled = [FormatUsage::SampledImage].into();
|
||||
let image = vk_format(own, &sampled, profile).ok()?;
|
||||
if image.emulation != FormatEmulation::Direct {
|
||||
return None;
|
||||
}
|
||||
let (_, candidates) = candidates(pf).ok()?;
|
||||
let candidate = candidates.iter().find(|c| {
|
||||
matches!(
|
||||
c.emulation,
|
||||
FormatEmulation::SwizzledView | FormatEmulation::AlphaInRed
|
||||
) && c.format == image.format
|
||||
})?;
|
||||
let mapping = swizzle.compose(candidate.components);
|
||||
if view_mapping_gap(mapping, profile).is_some() {
|
||||
return None;
|
||||
}
|
||||
let over = swizzle_of(mapping);
|
||||
// A write stores each of the image's channels from the first lane whose source it is, else
|
||||
// from the channel's own lane: the view's channel holding it must be some lane's source, so
|
||||
// that the image's channel is too and both take the same lane.
|
||||
let held = swizzle_of(candidate.components);
|
||||
let lanes = [over.red, over.green, over.blue, over.alpha];
|
||||
let writes = [held.red, held.green, held.blue, held.alpha]
|
||||
.into_iter()
|
||||
.filter(|c| !matches!(c, TextureSwizzle::Zero | TextureSwizzle::One))
|
||||
.all(|c| lanes.contains(&c));
|
||||
let reads = crate::metal::sampler::opaque_black_reads_transparent(own, over);
|
||||
(reads && writes).then_some(over)
|
||||
}
|
||||
|
||||
/// The swizzle that reads as component mapping `m` (in `TextureSwizzleChannels::compose`'s
|
||||
/// canonical form over a format's own channels): each channel from the one `m` names, from itself
|
||||
/// where `m` names none, or a constant.
|
||||
@@ -2376,25 +2190,6 @@ pub fn color_record(formats: &[Option<PixelFormat>]) -> Option<Vec<Option<(u32,
|
||||
Some(record)
|
||||
}
|
||||
|
||||
/// Metal's `imageblockSampleLength` of a render pipeline whose fragment function declares an
|
||||
/// explicit imageblock of `data_size` bytes (`air.imageblock_data_size`) whose layouts align to
|
||||
/// `alignment`, beside color attachments that pack to `colors` bytes
|
||||
/// ([`imageblock_sample_length`]): the data, then the colors rounded up to 8 bytes and then to
|
||||
/// `alignment`; no colors add nothing. Measured on an M3 Max and an M4 over nine layouts and 23
|
||||
/// sets of color formats: a `char` with `R8Unorm` is 9, a `float4` with `R8Unorm` 32, a
|
||||
/// `packed_float4` with it 24, and a `float4` and a `float` (32 bytes) with
|
||||
/// `R8Unorm` and `RGBA32Float` 64. `None` past `u32`.
|
||||
pub fn explicit_imageblock_sample_length(
|
||||
data_size: u32,
|
||||
alignment: u32,
|
||||
colors: u32,
|
||||
) -> Option<u32> {
|
||||
let colors = colors
|
||||
.checked_next_multiple_of(8)?
|
||||
.checked_next_multiple_of(alignment.max(1))?;
|
||||
data_size.checked_add(colors)
|
||||
}
|
||||
|
||||
/// The aspects of `pf` (`COLOR`, `DEPTH`, `STENCIL`, or `DEPTH | STENCIL`), for formats with a
|
||||
/// Vulkan representation.
|
||||
pub fn aspects(pf: PixelFormat) -> Option<vk::ImageAspectFlags> {
|
||||
|
||||
@@ -248,17 +248,6 @@ impl StageModule {
|
||||
self.spirv.iter().flat_map(|w| w.to_le_bytes()).collect()
|
||||
}
|
||||
|
||||
/// The stage's precision notes where a pipeline creates it under `specialization`: every note
|
||||
/// of [`precision_notes`](Self::precision_notes) that no
|
||||
/// [`specialized_notes`](Self::specialized_notes) entry names, and each specialized note
|
||||
/// one of whose clauses holds under the key's values. A constant the key does not give
|
||||
/// reads its default ([`SpecializationLayout`]), so the empty key gives the notes of the
|
||||
/// default specialization. Sorted, each note once. `precision_notes` itself is the answer
|
||||
/// where no specialization is known.
|
||||
pub fn precision_notes_under(&self, specialization: &SpecializationKey) -> Vec<PrecisionNote> {
|
||||
self.precision_notes_bound(specialization, &|_| None)
|
||||
}
|
||||
|
||||
/// The stage's precision notes where a pipeline creates it under `specialization` and a draw
|
||||
/// or dispatch binds the values `bound` gives: as
|
||||
/// [`precision_notes_under`](Self::precision_notes_under), where a test of a key no pipeline's
|
||||
@@ -285,19 +274,6 @@ impl StageModule {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The clauses of `note`'s [`specialized_notes`](Self::specialized_notes) entry that hold
|
||||
/// where a pipeline creates the stage under `specialization`, as
|
||||
/// [`precision_notes_under`](Self::precision_notes_under) reads them: the bound formats and
|
||||
/// samplers, by slot, that leave the note on an arm that is not Metal's. Empty where no
|
||||
/// entry names `note` or none of its clauses holds.
|
||||
pub fn note_clauses_under(
|
||||
&self,
|
||||
note: PrecisionNote,
|
||||
specialization: &SpecializationKey,
|
||||
) -> Vec<&SpecClause> {
|
||||
self.note_clauses_bound(note, specialization, &|_| None)
|
||||
}
|
||||
|
||||
/// The clauses of `note`'s [`specialized_notes`](Self::specialized_notes) entry that hold
|
||||
/// where a pipeline creates the stage under `specialization` and a draw or dispatch binds
|
||||
/// the values `bound` gives, as [`precision_notes_bound`](Self::precision_notes_bound) reads
|
||||
@@ -316,26 +292,6 @@ impl StageModule {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The clauses of `note`'s [`specialized_notes`](Self::specialized_notes) entry that test
|
||||
/// only the formats bound at texture slots ([`SpecClause::tests_bound_formats`]) and hold
|
||||
/// where `bound` gives the class of the format bound at each slot they name
|
||||
/// (`metal::texel_format::texel_format`), or `None` where it is not known, of which such a
|
||||
/// test holds. A runtime reads them at a draw or dispatch, from the textures it binds: the
|
||||
/// key of its pipeline carries no such class. Empty where no entry names `note` or none of
|
||||
/// those clauses holds.
|
||||
pub fn bound_format_clauses(
|
||||
&self,
|
||||
note: PrecisionNote,
|
||||
bound: &dyn Fn(SlotRef) -> Option<u32>,
|
||||
) -> Vec<&SpecClause> {
|
||||
self.specialized_notes
|
||||
.iter()
|
||||
.filter(|s| s.note == note)
|
||||
.flat_map(|s| &s.when)
|
||||
.filter(|clause| clause.tests_bound_formats() && clause.holds_of_bound(bound))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Whether every test of `clause` holds under `specialization`, a constant the key does not
|
||||
/// give reading its default, and a key no pipeline's key carries (one the stage reads as data,
|
||||
/// a bound sampler's word) reading the value `bound` gives.
|
||||
@@ -474,29 +430,6 @@ impl SpecClause {
|
||||
.all(|t| matches!(t.key, SpecKey::BoundTexelFormat(_)))
|
||||
}
|
||||
|
||||
/// Whether a test reads a value a plan gives (`BindingPlan::specialized_value`) that a
|
||||
/// pipeline's key need not carry: one the function reads as data
|
||||
/// (`SpecKey::read_as_data`), the word of the sampler bound at a slot
|
||||
/// (`SpecKey::BoundSamplerWord`), or what the stage's handles can name
|
||||
/// (`SpecKey::HeapYCbCrTextures`, `SpecKey::HeapRawTextures`, `SpecKey::HeapNanFamilies`,
|
||||
/// `SpecKey::FilteringArgumentSampler`). A runtime reads such
|
||||
/// a clause at each draw or dispatch, from the values its plan gives
|
||||
/// ([`StageModule::note_clauses_bound`]), or the key's where the stage declares the key as a
|
||||
/// constant (`SpecKey::HeapRawTextures` gates the raw arms so).
|
||||
pub fn tests_bound_values(&self) -> bool {
|
||||
self.all.iter().any(|t| {
|
||||
t.key.read_as_data()
|
||||
|| matches!(
|
||||
t.key,
|
||||
SpecKey::BoundSamplerWord(_)
|
||||
| SpecKey::HeapYCbCrTextures(_)
|
||||
| SpecKey::HeapRawTextures(_)
|
||||
| SpecKey::HeapNanFamilies(_)
|
||||
| SpecKey::FilteringArgumentSampler
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// Whether every test of the bound formats holds where `bound` gives the class of the format
|
||||
/// bound at each slot (`None` where it is not known, of which the test holds); a test of any
|
||||
/// other key holds here.
|
||||
|
||||
@@ -349,20 +349,6 @@ impl Device {
|
||||
})
|
||||
}
|
||||
|
||||
/// The key of the tile render pipeline `d` (no decode).
|
||||
pub fn tile_pipeline_key(&self, d: &TileRenderPipelineDescriptor) -> crate::cache::PipelineKey {
|
||||
let stage = match &d.tile {
|
||||
StageSource::Function(f) => self.function_compile_key(f, &tile_inputs(d)),
|
||||
StageSource::Compiled(c) => *c.key(),
|
||||
};
|
||||
pipeline_key(
|
||||
b"tile",
|
||||
&self.profile_fingerprint(),
|
||||
&[stage],
|
||||
&tile_fields(d),
|
||||
)
|
||||
}
|
||||
|
||||
/// Compile the tile render pipeline `d` under budget `b`: its tile function, compiled under the
|
||||
/// descriptor's color attachment formats (`LoweringInputs::tile_attachments`, the color index
|
||||
/// of each attachment whose format is set), as a compute pipeline that runs one threadgroup per
|
||||
|
||||
@@ -92,36 +92,6 @@ impl FunctionDescriptor {
|
||||
self
|
||||
}
|
||||
|
||||
/// This descriptor with a library in `libraries.loaded` for each install name the stage's
|
||||
/// search reaches that it lacks, as Metal loads them at pipeline creation: `load` gives the
|
||||
/// library at an install name, or `None` where none loads. The install names come in the order
|
||||
/// [`DynamicLibraries`] searches them (a loaded library's own after those already reached), and
|
||||
/// loading stops at the first that `load` gives none for: compiling then refuses any import
|
||||
/// that survives specialization (`NeedsInput(DynamicLibrary)`), as Metal fails such a creation
|
||||
/// and makes the others. A library `loaded` already holds is used as it is.
|
||||
pub fn with_loaded_dependencies(
|
||||
mut self,
|
||||
mut load: impl FnMut(&str) -> Option<DynamicLibrary>,
|
||||
) -> FunctionDescriptor {
|
||||
loop {
|
||||
let unloaded = crate::pipeline::compile::dynamic_order(
|
||||
&self.function,
|
||||
&self.linked,
|
||||
&self.libraries,
|
||||
)
|
||||
.unloaded
|
||||
.map(str::to_owned);
|
||||
let Some(name) = unloaded else {
|
||||
return self;
|
||||
};
|
||||
match load(&name) {
|
||||
Some(library) => {
|
||||
self.libraries.loaded.insert(name, library);
|
||||
}
|
||||
None => return self,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The dynamic libraries a pipeline stage links (`MTLDynamicLibrary`): its preloaded libraries, and
|
||||
|
||||
@@ -754,37 +754,7 @@ impl SampledLevels {
|
||||
}
|
||||
|
||||
impl LevelReads {
|
||||
/// The highest level, counted from the view's first, that the slot's reads reach, where
|
||||
/// `sampled` answers for each of its samplers' samples the highest level they reach through
|
||||
/// the sampler the runtime binds ([`SampledLevels::level`]); `None` where a read may reach
|
||||
/// any level ([`LevelReads::any`]) or `sampled` answers `None`. A view of the same first level
|
||||
/// and more levels than this answers every read of the slot as the whole view does: each
|
||||
/// reads the same level and texels (Image Level(s) Selection, at a level of detail that does
|
||||
/// not depend on the level count).
|
||||
pub fn highest_level(&self, sampled: impl Fn(&SampledLevels) -> Option<u32>) -> Option<u32> {
|
||||
if self.any {
|
||||
return None;
|
||||
}
|
||||
let mut highest = self.named.unwrap_or(0);
|
||||
for samples in &self.sampled {
|
||||
highest = highest.max(sampled(samples)?);
|
||||
}
|
||||
Some(highest)
|
||||
}
|
||||
|
||||
/// The lowest level, counted from the view's first, that the slot's reads may reach, where
|
||||
/// `sampled` answers for each of its samplers' samples the lowest level they may reach
|
||||
/// through the sampler the runtime binds ([`SampledLevels::lowest`]): 0 where a read may reach
|
||||
/// any level ([`LevelReads::any`]); `None` where no read reaches a level's texels (a size
|
||||
/// query, a level-count containment's comparison). Over a view of the same first level whose
|
||||
/// last level is lower, a read reaches that last level in its place.
|
||||
pub fn lowest_level(&self, sampled: impl Fn(&SampledLevels) -> u32) -> Option<u32> {
|
||||
if self.any {
|
||||
return Some(0);
|
||||
}
|
||||
let samples = self.sampled.iter().map(sampled);
|
||||
self.lowest_read.into_iter().chain(samples).min()
|
||||
}
|
||||
}
|
||||
|
||||
/// An emulated mesh function's records: what each of its threadgroups writes to the draw's records
|
||||
@@ -943,23 +913,6 @@ pub enum PatchDomain {
|
||||
}
|
||||
|
||||
impl PipelineInterface {
|
||||
/// The buffer slots of `stage` (bit `i` for index `i`, below 64) its function reads through a
|
||||
/// uniform view ([`BufferForm::uniform_view`]): the slots whose bind offset class can tell the
|
||||
/// device's view base alignment apart (`StageTable::at_bind_views`).
|
||||
pub fn uniform_view_buffers(&self, stage: Stage) -> u64 {
|
||||
self.buffers_where(stage, BufferForm::uniform_view)
|
||||
}
|
||||
|
||||
/// The buffer slots of `stage` (bit `i` for index `i`, below 64) its function reads through a
|
||||
/// storage view (`BufferForm::Descriptor(DescriptorView::Storage)`): on a profile that takes
|
||||
/// `DriverWorkaround::PushReadsLengthenThreadPayload`, the slots whose bind offset class can
|
||||
/// tell offset 0 apart (`StageTable::zero_offset_views`), where such a view's
|
||||
/// `SpecKey::RangeAtBindOffset` reads it at its bind offset alone.
|
||||
pub fn storage_view_buffers(&self, stage: Stage) -> u64 {
|
||||
self.buffers_where(stage, |form| {
|
||||
form == BufferForm::Descriptor(DescriptorView::Storage)
|
||||
})
|
||||
}
|
||||
|
||||
/// The buffer slots of `stage` (bit `i` for index `i`, below 64) whose form `takes`.
|
||||
fn buffers_where(&self, stage: Stage, takes: impl Fn(BufferForm) -> bool) -> u64 {
|
||||
|
||||
@@ -407,22 +407,6 @@ impl ComputePipelineDescriptor {
|
||||
Ok(ComputePipelineReflection { bindings })
|
||||
}
|
||||
|
||||
/// Whether the kernel uses a direct texture or sampler argument (`[[texture(n)]]`,
|
||||
/// `[[sampler(n)]]`, a texture array among them) that the pipeline's
|
||||
/// [`reflection`](Self::reflection) lists as used, of the entry its constants specialize where
|
||||
/// they decide one: what `newComputePipelineStateWithDescriptor:` refuses with
|
||||
/// `supportIndirectCommandBuffers`. It decides from the arguments' roles and use alone, so an
|
||||
/// argument whose reflection Metal's answer has not been measured for, which `reflection`
|
||||
/// refuses, decides nothing here. It decodes the kernel's AIR under `budget`; a kernel the
|
||||
/// compile layer already compiled (`StageSource::Compiled`) answers from what its compile kept.
|
||||
///
|
||||
/// Refused: a compiled kernel that kept no reflection (`Unsupported` with
|
||||
/// `Feature::Reflection`), and the decode's and specialization's own errors.
|
||||
pub fn uses_direct_arguments(&self, budget: &crate::Budget) -> Result<bool, Error> {
|
||||
let mut m = Meter::new(budget);
|
||||
stage_direct(&self.kernel, self.max_call_stack_depth, &mut m)
|
||||
}
|
||||
|
||||
/// What the kernel may store through each slot its arguments bind
|
||||
/// ([`writes`](crate::reflection::SlotWrite), whose rules are
|
||||
/// [`reflection`](crate::reflection)'s), of the entry its constants specialize where they
|
||||
|
||||
@@ -231,16 +231,6 @@ impl SlotWrites {
|
||||
&self.fragment
|
||||
}
|
||||
|
||||
/// The tile function's arguments; none for a pipeline without a tile stage.
|
||||
pub fn tile_slots(&self) -> &[SlotWrite] {
|
||||
&self.tile
|
||||
}
|
||||
|
||||
/// The object function's arguments; none for a pipeline without an object stage.
|
||||
pub fn object_slots(&self) -> &[SlotWrite] {
|
||||
&self.object
|
||||
}
|
||||
|
||||
/// The mesh function's arguments; none for a pipeline without a mesh stage.
|
||||
pub fn mesh_slots(&self) -> &[SlotWrite] {
|
||||
&self.mesh
|
||||
|
||||
@@ -114,340 +114,6 @@ impl<'a> ReproBundle<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
/// A bundle of the library input `bytes` a library creation refused, on the device whose
|
||||
/// `device.json` is `device` ([`ReproDevice::to_json`]): its command reads them and compiles
|
||||
/// nothing else.
|
||||
pub fn for_library(device: &[u8], bytes: &'a [u8]) -> ReproBundle<'a> {
|
||||
ReproBundle::new(input_name(bytes), bytes).device(device)
|
||||
}
|
||||
|
||||
/// A bundle of the function `name` of `library`, whose lookup was refused, on the device of
|
||||
/// `device`: its command names the function.
|
||||
pub fn for_function(device: &[u8], library: &'a Library, name: &str) -> ReproBundle<'a> {
|
||||
ReproBundle::of_library(library)
|
||||
.device(device)
|
||||
.options(["--function", name])
|
||||
}
|
||||
|
||||
/// A bundle of the compute pipeline `descriptor` describes, on the device of `device`; `None`
|
||||
/// where its kernel is no function (`StageSource::Compiled`), which the command line cannot
|
||||
/// take.
|
||||
pub fn for_compute(
|
||||
device: &[u8],
|
||||
descriptor: &'a ComputePipelineDescriptor,
|
||||
) -> Option<ReproBundle<'a>> {
|
||||
// Every field, so that a new one fails to compile here until it is replayed or listed.
|
||||
let ComputePipelineDescriptor {
|
||||
kernel,
|
||||
stage_input,
|
||||
max_total_threads_per_threadgroup,
|
||||
threadgroup_size_is_multiple_of_execution_width,
|
||||
support_indirect_command_buffers,
|
||||
max_call_stack_depth,
|
||||
required_threads_per_threadgroup,
|
||||
support_adding_binary_functions,
|
||||
buffers,
|
||||
needs_custom_border_color_samplers,
|
||||
open_cl_mode_enabled,
|
||||
} = descriptor;
|
||||
let StageSource::Function(function) = kernel else {
|
||||
return None;
|
||||
};
|
||||
let defaults = ComputePipelineDescriptor::new(kernel.clone());
|
||||
let mut bundle = ReproBundle::of_function(device, function);
|
||||
if let Some(stage_input) = stage_input {
|
||||
bundle = bundle.json("--stage-input", "stage-input.json", stage_input);
|
||||
}
|
||||
let mut unreplayed = Unreplayed::default();
|
||||
unreplayed.field(
|
||||
"max_total_threads_per_threadgroup",
|
||||
max_total_threads_per_threadgroup,
|
||||
&defaults.max_total_threads_per_threadgroup,
|
||||
);
|
||||
unreplayed.field(
|
||||
"threadgroup_size_is_multiple_of_execution_width",
|
||||
threadgroup_size_is_multiple_of_execution_width,
|
||||
&defaults.threadgroup_size_is_multiple_of_execution_width,
|
||||
);
|
||||
unreplayed.field(
|
||||
"support_indirect_command_buffers",
|
||||
support_indirect_command_buffers,
|
||||
&defaults.support_indirect_command_buffers,
|
||||
);
|
||||
unreplayed.field(
|
||||
"max_call_stack_depth",
|
||||
max_call_stack_depth,
|
||||
&defaults.max_call_stack_depth,
|
||||
);
|
||||
unreplayed.field(
|
||||
"required_threads_per_threadgroup",
|
||||
required_threads_per_threadgroup,
|
||||
&defaults.required_threads_per_threadgroup,
|
||||
);
|
||||
unreplayed.field(
|
||||
"support_adding_binary_functions",
|
||||
support_adding_binary_functions,
|
||||
&defaults.support_adding_binary_functions,
|
||||
);
|
||||
unreplayed.field("buffers", buffers, &defaults.buffers);
|
||||
unreplayed.field(
|
||||
"needs_custom_border_color_samplers",
|
||||
needs_custom_border_color_samplers,
|
||||
&defaults.needs_custom_border_color_samplers,
|
||||
);
|
||||
unreplayed.field(
|
||||
"open_cl_mode_enabled",
|
||||
open_cl_mode_enabled,
|
||||
&defaults.open_cl_mode_enabled,
|
||||
);
|
||||
bundle.unreplayed.extend(unreplayed.0);
|
||||
Some(bundle)
|
||||
}
|
||||
|
||||
/// A bundle of the tile pipeline `descriptor` describes, on the device of `device`: the
|
||||
/// command line compiles a kernel with `--color-format` as a tile pipeline. `None` where its
|
||||
/// tile function is no function.
|
||||
pub fn for_tile(
|
||||
device: &[u8],
|
||||
descriptor: &'a TileRenderPipelineDescriptor,
|
||||
) -> Option<ReproBundle<'a>> {
|
||||
let TileRenderPipelineDescriptor {
|
||||
tile,
|
||||
color_attachment_formats,
|
||||
raster_sample_count,
|
||||
threadgroup_size_matches_tile_size,
|
||||
max_total_threads_per_threadgroup,
|
||||
max_call_stack_depth,
|
||||
required_threads_per_threadgroup,
|
||||
support_adding_binary_functions,
|
||||
buffers,
|
||||
} = descriptor;
|
||||
let StageSource::Function(function) = tile else {
|
||||
return None;
|
||||
};
|
||||
let defaults = TileRenderPipelineDescriptor::new(tile.clone());
|
||||
let mut bundle = ReproBundle::of_function(device, function);
|
||||
let mut unreplayed = Unreplayed::default();
|
||||
let mut formats = 0;
|
||||
for (index, format) in color_attachment_formats.iter().enumerate() {
|
||||
if let Some(format) = format {
|
||||
bundle =
|
||||
bundle.options(["--color-format".to_owned(), color_format(index, *format)]);
|
||||
formats += 1;
|
||||
}
|
||||
}
|
||||
if formats == 0 {
|
||||
unreplayed.note(
|
||||
"color_attachment_formats: none (the command line compiles a kernel without \
|
||||
--color-format as a compute pipeline)",
|
||||
);
|
||||
}
|
||||
unreplayed.field(
|
||||
"raster_sample_count",
|
||||
raster_sample_count,
|
||||
&defaults.raster_sample_count,
|
||||
);
|
||||
unreplayed.field(
|
||||
"threadgroup_size_matches_tile_size",
|
||||
threadgroup_size_matches_tile_size,
|
||||
&defaults.threadgroup_size_matches_tile_size,
|
||||
);
|
||||
unreplayed.field(
|
||||
"max_total_threads_per_threadgroup",
|
||||
max_total_threads_per_threadgroup,
|
||||
&defaults.max_total_threads_per_threadgroup,
|
||||
);
|
||||
unreplayed.field(
|
||||
"max_call_stack_depth",
|
||||
max_call_stack_depth,
|
||||
&defaults.max_call_stack_depth,
|
||||
);
|
||||
unreplayed.field(
|
||||
"required_threads_per_threadgroup",
|
||||
required_threads_per_threadgroup,
|
||||
&defaults.required_threads_per_threadgroup,
|
||||
);
|
||||
unreplayed.field(
|
||||
"support_adding_binary_functions",
|
||||
support_adding_binary_functions,
|
||||
&defaults.support_adding_binary_functions,
|
||||
);
|
||||
unreplayed.field("buffers", buffers, &defaults.buffers);
|
||||
bundle.unreplayed.extend(unreplayed.0);
|
||||
Some(bundle)
|
||||
}
|
||||
|
||||
/// A bundle of the render pipeline `descriptor` describes, on the device of `device`; `None`
|
||||
/// where its vertex function is no function.
|
||||
pub fn for_render(
|
||||
device: &[u8],
|
||||
descriptor: &'a RenderPipelineDescriptor,
|
||||
) -> Option<ReproBundle<'a>> {
|
||||
// Every field, so that a new one fails to compile here until it is replayed or listed.
|
||||
let RenderPipelineDescriptor {
|
||||
vertex,
|
||||
fragment,
|
||||
vertex_descriptor,
|
||||
color_attachments,
|
||||
depth_format,
|
||||
stencil_format,
|
||||
raster_sample_count,
|
||||
alpha_to_coverage,
|
||||
alpha_to_one,
|
||||
rasterization_enabled,
|
||||
input_primitive_topology,
|
||||
max_vertex_amplification_count,
|
||||
tessellation,
|
||||
support_indirect_command_buffers,
|
||||
max_vertex_call_stack_depth,
|
||||
max_fragment_call_stack_depth,
|
||||
support_adding_vertex_binary_functions,
|
||||
support_adding_fragment_binary_functions,
|
||||
vertex_buffers,
|
||||
fragment_buffers,
|
||||
texture_write_rounding_mode,
|
||||
private,
|
||||
} = descriptor;
|
||||
let StageSource::Function(vertex_function) = vertex else {
|
||||
return None;
|
||||
};
|
||||
let defaults = RenderPipelineDescriptor::new(vertex.clone());
|
||||
let mut bundle = ReproBundle::of_function(device, vertex_function);
|
||||
let mut unreplayed = Unreplayed::default();
|
||||
match fragment {
|
||||
None => unreplayed.note(format!(
|
||||
"rasterization_enabled: {rasterization_enabled} (without a fragment function the \
|
||||
command line sets it from whether the vertex function returns a value)"
|
||||
)),
|
||||
Some(StageSource::Compiled(_)) => {
|
||||
unreplayed.note("fragment: a compiled function");
|
||||
}
|
||||
Some(StageSource::Function(fragment)) => {
|
||||
let FunctionDescriptor {
|
||||
function,
|
||||
constants,
|
||||
specialized: _,
|
||||
linked,
|
||||
libraries,
|
||||
} = fragment;
|
||||
if function.library().content_hash()
|
||||
!= vertex_function.function.library().content_hash()
|
||||
{
|
||||
unreplayed.note(format!(
|
||||
"fragment: `{}` of another library than the vertex function's",
|
||||
function.info().name
|
||||
));
|
||||
} else {
|
||||
bundle = bundle.options(["--fragment", function.info().name]);
|
||||
}
|
||||
if *constants != vertex_function.constants {
|
||||
unreplayed.note(format!(
|
||||
"the fragment function's constant values (the command line gives both \
|
||||
stages the vertex function's): {constants:?}"
|
||||
));
|
||||
}
|
||||
unreplayed.links(
|
||||
function.info().name,
|
||||
linked.is_empty(),
|
||||
libraries.is_empty(),
|
||||
);
|
||||
unreplayed.field(
|
||||
"rasterization_enabled",
|
||||
rasterization_enabled,
|
||||
&defaults.rasterization_enabled,
|
||||
);
|
||||
}
|
||||
}
|
||||
if let Some(vertex_descriptor) = vertex_descriptor {
|
||||
bundle = bundle.json(
|
||||
"--vertex-descriptor",
|
||||
"vertex-descriptor.json",
|
||||
vertex_descriptor,
|
||||
);
|
||||
}
|
||||
for (index, attachment) in color_attachments.iter().enumerate() {
|
||||
let Some(attachment) = attachment else {
|
||||
continue;
|
||||
};
|
||||
bundle = bundle.options([
|
||||
"--color-format".to_owned(),
|
||||
color_format(index, attachment.pixel_format),
|
||||
]);
|
||||
if *attachment != ColorAttachmentDescriptor::new(attachment.pixel_format) {
|
||||
unreplayed.note(format!("color_attachments[{index}]: {attachment:?}"));
|
||||
}
|
||||
}
|
||||
if let Some(format) = depth_format {
|
||||
bundle = bundle.options(["--depth-format", format_name(*format)]);
|
||||
}
|
||||
if let Some(format) = stencil_format {
|
||||
bundle = bundle.options(["--stencil-format", format_name(*format)]);
|
||||
}
|
||||
if *raster_sample_count != defaults.raster_sample_count {
|
||||
bundle = bundle.options([
|
||||
"--raster-samples".to_owned(),
|
||||
raster_sample_count.to_string(),
|
||||
]);
|
||||
}
|
||||
if *max_vertex_amplification_count != defaults.max_vertex_amplification_count {
|
||||
bundle = bundle.options([
|
||||
"--vertex-amplification-count".to_owned(),
|
||||
max_vertex_amplification_count.to_string(),
|
||||
]);
|
||||
}
|
||||
unreplayed.field(
|
||||
"alpha_to_coverage",
|
||||
alpha_to_coverage,
|
||||
&defaults.alpha_to_coverage,
|
||||
);
|
||||
unreplayed.field("alpha_to_one", alpha_to_one, &defaults.alpha_to_one);
|
||||
unreplayed.field(
|
||||
"input_primitive_topology",
|
||||
input_primitive_topology,
|
||||
&defaults.input_primitive_topology,
|
||||
);
|
||||
unreplayed.field("tessellation", tessellation, &defaults.tessellation);
|
||||
unreplayed.field(
|
||||
"support_indirect_command_buffers",
|
||||
support_indirect_command_buffers,
|
||||
&defaults.support_indirect_command_buffers,
|
||||
);
|
||||
unreplayed.field(
|
||||
"max_vertex_call_stack_depth",
|
||||
max_vertex_call_stack_depth,
|
||||
&defaults.max_vertex_call_stack_depth,
|
||||
);
|
||||
unreplayed.field(
|
||||
"max_fragment_call_stack_depth",
|
||||
max_fragment_call_stack_depth,
|
||||
&defaults.max_fragment_call_stack_depth,
|
||||
);
|
||||
unreplayed.field(
|
||||
"support_adding_vertex_binary_functions",
|
||||
support_adding_vertex_binary_functions,
|
||||
&defaults.support_adding_vertex_binary_functions,
|
||||
);
|
||||
unreplayed.field(
|
||||
"support_adding_fragment_binary_functions",
|
||||
support_adding_fragment_binary_functions,
|
||||
&defaults.support_adding_fragment_binary_functions,
|
||||
);
|
||||
unreplayed.field("vertex_buffers", vertex_buffers, &defaults.vertex_buffers);
|
||||
unreplayed.field(
|
||||
"fragment_buffers",
|
||||
fragment_buffers,
|
||||
&defaults.fragment_buffers,
|
||||
);
|
||||
unreplayed.field(
|
||||
"texture_write_rounding_mode",
|
||||
texture_write_rounding_mode,
|
||||
&defaults.texture_write_rounding_mode,
|
||||
);
|
||||
unreplayed.field("private", private, &PrivateRenderState::new());
|
||||
bundle.unreplayed.extend(unreplayed.0);
|
||||
Some(bundle)
|
||||
}
|
||||
|
||||
/// The bundle of `library`'s bytes, which its content hash names.
|
||||
fn of_library(library: &'a Library) -> ReproBundle<'a> {
|
||||
let bytes = library.bytes();
|
||||
|
||||
Reference in new issue
Block a user