rt: the render encoder's use_resource, and a draw after a declared write of a texture with no storage element is Gap::StorageElement
What: RenderCommandEncoder::use_resource is useResource:usage:stages:, its plural and their
deprecated forms without stages. The command buffer keeps the buffer or the texture until it
retires and nothing is recorded: every resource is resident to every function, and the pass's
barriers already order its draws. A usage that writes a texture (or a view of one) made for
shader writes with no storage element marks the encoder, and every later draw whose vertex or
fragment function may reach a texture through its storage image beyond its slots
(PipelineInterface::unbound_storage_textures: an argument buffer's write or read_write texture, a
resource ID) is Gap::StorageElement with no slot, as the compute encoder's dispatch already is.
Before this, such a draw ran and Vulkan dropped the writes Metal makes. The declaration
invalidates the encoder's held draw facts, so a draw of an unchanged state and bindings after it
is checked again.
Also: the three redundant explicit links in new_render_pipeline_state's docs (private rustdoc
-D warnings, from 3653240b57) are plain intra-doc links; Refusal::OtherDevice's doc names the
render encoder's calls; the README's storage-element known gap no longer waits for the render
encoder's useResource:, and the render encoder's section describes use_resource; coverage.tsv
marks the four MTLRenderCommandEncoder useResource rows implemented; REFUSALS.md,
METAL-COVERAGE.md, CONFORMANCE-COVERAGE.md and api_signatures.tsv regenerated.
Test: every_device_refuses_a_draw_after_a_declared_write_of_a_texture_with_no_storage_element
(storage_element.rs, device cfgs): an owned fragment function writes an argument buffer's
texture2d<float, write>; for RGBA8Unorm, RGBA8Unorm_sRGB, BGRA8Unorm_sRGB, A8Unorm and an sRGB
view of an RGBA8Unorm texture, a draw before the declaration draws, the same draw after
use_resource(WRITE) is Gap::StorageElement { slot: None, pixel_format } exactly where the texture
has no storage element, and a colored_fragment draw after the declaration draws; the fragment
function's write through its resource ID lands (1, 0, 1, 1). Without the Facts::find check the
refused cases draw and the test panics.
This commit is contained in:
1 parent
bc69c32292
commit
62b3e5a250
12 files changed
+347
-69
No files matched your search
@@ -1404,11 +1404,11 @@ made, with no lock, and never rewritten for layouts.
|
||||
device lacks their storage), or holds through a view of another (an `A8Unorm` held in red, the
|
||||
extended-range formats), has no storage element. A draw or dispatch whose function writes such
|
||||
a texture bound to a slot, or reads it there through its storage image (`access::read_write`),
|
||||
is `Gap::StorageElement`. So is, with no slot, a dispatch whose kernel may reach a texture
|
||||
through its storage image beyond its slots (an argument buffer's `access::write` or
|
||||
`access::read_write` texture, a resource ID) after `use_resource` declared a write of such a
|
||||
texture in its encoder. A draw's twin waits for the render encoder's `useResource:`, which is
|
||||
not built. A write through a resource ID with no such declaration is outside documented Metal
|
||||
is `Gap::StorageElement`. So is, with no slot, a dispatch whose kernel, or a draw whose vertex
|
||||
or fragment function, may reach a texture through its storage image beyond its slots (an
|
||||
argument buffer's `access::write` or `access::read_write` texture, a resource ID) after the
|
||||
compute or render encoder's `use_resource` declared a write of such a texture in its encoder.
|
||||
A write through a resource ID with no such declaration is outside documented Metal
|
||||
(`useHeap:` declares its heap's resources read only) and is dropped, and a storage read there
|
||||
answers zeros.
|
||||
- A texture whose storage element the device cannot read without a format (its format lacks
|
||||
@@ -3255,13 +3255,19 @@ or does not check is rebuilt from the generations' names, with young counted ful
|
||||
conformance cases `visibility-disabled-reset` and `visibility-disabled-accumulate`), so the
|
||||
result type is not a field. The replay streams that set a visibility result buffer enable no
|
||||
mode.
|
||||
- Not built, and so not methods: indirect draws (of patches too), `useResource:`, `useHeap:stages:`, the store action options setters, tile functions,
|
||||
`setVertexBuffer:offset:attributeStride:atIndex:`, `setTessellationFactorScale:` (read only by a
|
||||
state that enables the scale, which is refused) and `drawIndexedPatches:` (whose control-point
|
||||
index buffer only a state of a control-point index type reads, which is refused). Where a replay stream calls
|
||||
`useHeap:stages:` (`command-replay shapes` counts a stream's calls of each selector), it is
|
||||
built in the compute encoder's form, `use_heap`: the command buffer keeps the block and declares
|
||||
no access.
|
||||
- `use_resource` is `useResource:usage:stages:`, its plural and their deprecated forms without
|
||||
stages: the command buffer keeps the buffer or the texture until it retires, and nothing is
|
||||
recorded. The stages are not read: every resource is resident to every function, and the pass's
|
||||
barriers order its draws after every earlier command and before every later one. A declared
|
||||
write of a texture with no storage element refuses the encoder's later draws that may reach one
|
||||
beyond their slots (the known gaps of textures).
|
||||
- Not built, and so not methods: indirect draws (of patches too), `useHeap:stages:`, the store
|
||||
action options setters, tile functions, `setVertexBuffer:offset:attributeStride:atIndex:`,
|
||||
`setTessellationFactorScale:` (read only by a state that enables the scale, which is refused) and
|
||||
`drawIndexedPatches:` (whose control-point index buffer only a state of a control-point index type
|
||||
reads, which is refused). Where a replay stream calls `useHeap:stages:` (`command-replay shapes`
|
||||
counts a stream's calls of each selector), it is built in the compute encoder's form, `use_heap`:
|
||||
the command buffer keeps the block and declares no access.
|
||||
- Refused by `Gap::RenderPass`, naming its `RenderPassKind`: a depth and a stencil attachment
|
||||
that are not one texture's same level and slice (`DepthStencilViews`: Vulkan's rendering takes
|
||||
one view for both), a `Clear` load of a depth attachment whose clear depth is outside `[0, 1]`
|
||||
|
||||
@@ -60,7 +60,7 @@ impl ResourceUsage {
|
||||
pub const SAMPLE: ResourceUsage = ResourceUsage(4);
|
||||
|
||||
/// The access the usage declares, or None for no usage.
|
||||
fn access(self) -> Option<Access> {
|
||||
pub(crate) fn access(self) -> Option<Access> {
|
||||
let reads = self.0 & (Self::READ.0 | Self::SAMPLE.0) != 0;
|
||||
let writes = self.0 & Self::WRITE.0 != 0;
|
||||
match (reads, writes) {
|
||||
|
||||
@@ -255,7 +255,8 @@ pub enum Refusal {
|
||||
/// An event, a buffer, a texture or a pipeline state of another device in an encode call
|
||||
/// ([`CommandBuffer::encode_wait_for_event`](crate::CommandBuffer::encode_wait_for_event),
|
||||
/// [`CommandBuffer::encode_signal_event`](crate::CommandBuffer::encode_signal_event), or a
|
||||
/// [`ComputeCommandEncoder`](crate::ComputeCommandEncoder) or
|
||||
/// [`ComputeCommandEncoder`](crate::ComputeCommandEncoder),
|
||||
/// [`RenderCommandEncoder`](crate::RenderCommandEncoder) or
|
||||
/// [`BlitCommandEncoder`](crate::BlitCommandEncoder) call), or a block of another device
|
||||
/// given to [`Device::release_block`](crate::Device::release_block).
|
||||
///
|
||||
@@ -1195,13 +1196,14 @@ pub enum Gap {
|
||||
/// `RG11B10Float` among others on ANV before Gfx12.5): such a read is outside Vulkan's valid
|
||||
/// usage (`VUID-vkCmdDispatch-OpTypeImage-07028`), and those formats are outside Metal's
|
||||
/// read-write tiers, whose reads Metal's documentation defines. With no slot: a dispatch whose
|
||||
/// kernel may reach a texture through its storage image beyond its slots (an argument
|
||||
/// buffer's `access::write` or `access::read_write` texture, a resource ID), in an encoder
|
||||
/// where `use_resource` declared a write of a texture with no storage element. A texture
|
||||
/// reached by its resource ID with no such declaration is not found: Metal documents no write
|
||||
/// to it (`useHeap:` declares its heap's resources read only), and its writes are dropped. A
|
||||
/// read there of a storage element the device cannot read without a format is not found
|
||||
/// either (the crate's README, known gaps).
|
||||
/// kernel, or a draw whose vertex or fragment function, may reach a texture through its
|
||||
/// storage image beyond its slots (an argument buffer's `access::write` or
|
||||
/// `access::read_write` texture, a resource ID), in an encoder where `use_resource` declared a
|
||||
/// write of a texture with no storage element. A texture reached by its resource ID with no
|
||||
/// such declaration is not found: Metal documents no write to it (`useHeap:` declares its
|
||||
/// heap's resources read only), and its writes are dropped. A read there of a storage element
|
||||
/// the device cannot read without a format is not found either (the crate's README, known
|
||||
/// gaps).
|
||||
///
|
||||
/// Basis: ours (the storage element through a view of the nearest format whose storage Vulkan
|
||||
/// requires of every device, with the translator's conversion, is the form to build).
|
||||
@@ -2325,9 +2327,9 @@ impl fmt::Display for Gap {
|
||||
pixel_format,
|
||||
} => write!(
|
||||
f,
|
||||
"a kernel that may write or read as storage a texture beyond its slots, where \
|
||||
useResource declared a write of a {pixel_format:?} texture with no storage \
|
||||
element on this device, is not built"
|
||||
"a kernel or a draw's function that may write or read as storage a texture \
|
||||
beyond its slots, where useResource declared a write of a {pixel_format:?} \
|
||||
texture with no storage element on this device, is not built"
|
||||
),
|
||||
Gap::BicubicTexels { slot, pixel_format } => write!(
|
||||
f,
|
||||
|
||||
@@ -150,6 +150,10 @@ pub(crate) struct Draws {
|
||||
pub(crate) reads_unbound: bool,
|
||||
/// Whether a function writes through an address that is not one of its slots.
|
||||
pub(crate) writes_unbound: bool,
|
||||
/// Whether a function may reach a texture through its storage image through something other
|
||||
/// than its slots (`PipelineInterface::unbound_storage_textures`): an argument buffer's
|
||||
/// `access::write` or `access::read_write` texture, a resource ID.
|
||||
pub(crate) unbound_storage: bool,
|
||||
/// Whether a function writes memory (`PipelineInterface::writes_memory`).
|
||||
pub(crate) writes_memory: bool,
|
||||
/// The bytes of the push range the functions read, from 0.
|
||||
@@ -360,10 +364,9 @@ impl crate::Device {
|
||||
///
|
||||
/// Err: [`Error::Translation`], the translator's typed refusal or a descriptor Metal refuses;
|
||||
/// [`Gap::IndirectCommandBuffers`]; [`Gap::RenderPipeline`] for what the runtime does not
|
||||
/// build, naming it; [`Refusal::PointSizeTopology`](crate::Refusal::PointSizeTopology) for a
|
||||
/// vertex function that writes `[[point_size]]` under the line or the triangle class;
|
||||
/// [`Refusal::SamplerIds`](crate::Refusal::SamplerIds) where `sampler_ids` answers another
|
||||
/// count; [`Refusal::IndicesNotGranted`](crate::Refusal::IndicesNotGranted) for a constexpr
|
||||
/// build, naming it; [`Refusal::PointSizeTopology`] for a vertex function that writes
|
||||
/// `[[point_size]]` under the line or the triangle class; [`Refusal::SamplerIds`] where
|
||||
/// `sampler_ids` answers another count; [`Refusal::IndicesNotGranted`] for a constexpr
|
||||
/// sampler's index; [`Limit::DeviceSamplers`](crate::Limit::DeviceSamplers); [`Error::Vulkan`].
|
||||
pub fn new_render_pipeline_state(
|
||||
&self,
|
||||
@@ -693,6 +696,7 @@ fn draws(
|
||||
bindings,
|
||||
reads_unbound: translated.reads_unbound_resources,
|
||||
writes_unbound: translated.writes_unbound_resources,
|
||||
unbound_storage: translated.unbound_storage_textures,
|
||||
writes_memory: translated.writes_memory,
|
||||
push_len,
|
||||
fields,
|
||||
|
||||
@@ -78,7 +78,9 @@ use crate::command::{Building, CommandBuffer};
|
||||
use crate::counters::Metric;
|
||||
use crate::depth_stencil::{DepthStencilState, Face, Tests};
|
||||
use crate::device::Core;
|
||||
use crate::encoder::{check_alignment, BUFFER_SLOTS, SAMPLER_SLOTS, TEXTURE_SLOTS};
|
||||
use crate::encoder::{
|
||||
check_alignment, Resource, ResourceUsage, BUFFER_SLOTS, SAMPLER_SLOTS, TEXTURE_SLOTS,
|
||||
};
|
||||
use crate::error::{DrawKind, Error, Gap, Limit, Refusal, RenderPassKind};
|
||||
use crate::fence::Fence;
|
||||
use crate::hazard::Access;
|
||||
@@ -99,7 +101,7 @@ use metal2vulkan::bind::alpha_test_code;
|
||||
use metal2vulkan::metal::format::{integer_channels_word, BICUBIC_TEXELS_UNBOUND};
|
||||
use metal2vulkan::metal::state::{input_assembly, DepthStencilDescriptor};
|
||||
use metal2vulkan::metal::{
|
||||
CullMode, DepthClipMode, IndexType, PrimitiveType, TriangleFillMode, Winding,
|
||||
CullMode, DepthClipMode, IndexType, PixelFormat, PrimitiveType, TriangleFillMode, Winding,
|
||||
};
|
||||
use metal2vulkan::pipeline::PrecisionNote;
|
||||
use std::sync::Arc;
|
||||
@@ -253,12 +255,19 @@ struct Facts {
|
||||
|
||||
impl Facts {
|
||||
/// The facts of a draw of `draws` with `tables` bound in `pass`, but the alignments, which the
|
||||
/// draw checks after its attachment reads.
|
||||
/// draw checks after its attachment reads. `declared` is the pixel format of a texture with
|
||||
/// no storage element that `use_resource` declared written.
|
||||
///
|
||||
/// Err: [`Refusal::VertexBufferOffset`]; [`Refusal::NoBufferAtIndex`] for a vertex buffer the
|
||||
/// vertex descriptor reads that is not bound; [`Gap::SwizzledReadWrite`];
|
||||
/// [`Gap::BicubicTexels`]; [`Gap::StorageElement`].
|
||||
fn find(&mut self, draws: &Draws, tables: &[Tables; 2], pass: &Pass) -> Result<(), Error> {
|
||||
fn find(
|
||||
&mut self,
|
||||
draws: &Draws,
|
||||
tables: &[Tables; 2],
|
||||
pass: &Pass,
|
||||
declared: Option<PixelFormat>,
|
||||
) -> Result<(), Error> {
|
||||
self.vertex.clear();
|
||||
for &(binding, index) in &draws.bindings {
|
||||
let (buffer, offset) = match tables[VERTEX].buffers.get(index as usize) {
|
||||
@@ -313,6 +322,14 @@ impl Facts {
|
||||
}));
|
||||
}
|
||||
}
|
||||
// A texture declared written with no storage element, which a function may reach through
|
||||
// its storage image beyond its slots.
|
||||
if let (true, Some(pixel_format)) = (draws.unbound_storage, declared) {
|
||||
return Err(Error::Unsupported(Gap::StorageElement {
|
||||
slot: None,
|
||||
pixel_format,
|
||||
}));
|
||||
}
|
||||
self.attachments = !draws.fetched.is_empty()
|
||||
|| (draws.textures.iter()).any(|&(table, slot, _)| {
|
||||
tables[table].texture(slot).is_some_and(|texture| {
|
||||
@@ -569,6 +586,9 @@ pub struct RenderCommandEncoder {
|
||||
shadow_slots: Vec<(usize, u32)>,
|
||||
/// What a draw of the pipeline state reaches of the bound resources.
|
||||
facts: Facts,
|
||||
/// The pixel format of the first texture a `use_resource` declaration writes that has no
|
||||
/// storage element ([`TextureObject::unstored`]).
|
||||
declared_unstored_write: Option<PixelFormat>,
|
||||
/// The push bytes of the last draw.
|
||||
push: Vec<u8>,
|
||||
/// The parameter blocks of the last draw's functions, where their fields spill.
|
||||
@@ -644,6 +664,7 @@ impl CommandBuffer {
|
||||
shadowed: Vec::new(),
|
||||
shadow_slots: Vec::new(),
|
||||
facts: Facts::default(),
|
||||
declared_unstored_write: None,
|
||||
push: Vec::new(),
|
||||
blocks: [Vec::new(), Vec::new()],
|
||||
push_filled: false,
|
||||
@@ -1563,6 +1584,51 @@ impl RenderCommandEncoder {
|
||||
})
|
||||
}
|
||||
|
||||
/// `useResource:usage:stages:` (`useResources:count:usage:stages:` is a loop of it, as are the
|
||||
/// deprecated forms without stages): the command buffer keeps the buffer or the texture until
|
||||
/// it retires. It records nothing, and the stages are not read: every resource is resident to
|
||||
/// every function, and the pass's barriers order its draws after every earlier command and
|
||||
/// before every later one.
|
||||
///
|
||||
/// A usage that writes a texture, or a view of one, made for shader writes with no storage
|
||||
/// element (not a multisampled one, which Metal's shaders only read) makes every later draw of
|
||||
/// the encoder whose vertex or fragment function may reach a texture through its storage image
|
||||
/// beyond its bound slots (an argument buffer's `access::write` or `access::read_write`
|
||||
/// texture, a resource ID) [`Gap::StorageElement`], with no slot: Metal writes such a texture
|
||||
/// there, and the runtime would drop the writes. A draw whose functions have no such access
|
||||
/// draws.
|
||||
///
|
||||
/// Err: [`Refusal::OtherDevice`] for another device's resource.
|
||||
pub fn use_resource(
|
||||
&mut self,
|
||||
resource: Resource<'_>,
|
||||
usage: ResourceUsage,
|
||||
) -> Result<(), Error> {
|
||||
let building = self.building();
|
||||
let unstored = match resource {
|
||||
Resource::Buffer(buffer) => {
|
||||
if !buffer.is_of(building.device.core()) {
|
||||
return Err(Error::Refused(Refusal::OtherDevice));
|
||||
}
|
||||
building.keep(buffer);
|
||||
None
|
||||
}
|
||||
Resource::Texture(texture) => {
|
||||
if !texture.is_of(building.device.core()) {
|
||||
return Err(Error::Refused(Refusal::OtherDevice));
|
||||
}
|
||||
building.keep_texture(texture);
|
||||
texture.unstored()
|
||||
}
|
||||
};
|
||||
let writes = usage.access().is_some_and(|access| access.writes());
|
||||
if writes && unstored.is_some() && self.declared_unstored_write.is_none() {
|
||||
self.declared_unstored_write = unstored;
|
||||
self.changed();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// `updateFence:afterStages:`: encoders that wait on `fence` after this one, of any queue,
|
||||
/// see what this encoder and the ones before it wrote. It records nothing ([`Fence`]): the
|
||||
/// pass's second barrier, recorded or owed, already reaches every command submitted after it.
|
||||
@@ -1807,7 +1873,8 @@ impl RenderCommandEncoder {
|
||||
}
|
||||
};
|
||||
if !self.facts.held {
|
||||
self.facts.find(draws, &self.tables, &self.pass)?;
|
||||
let declared = self.declared_unstored_write;
|
||||
self.facts.find(draws, &self.tables, &self.pass, declared)?;
|
||||
}
|
||||
// Metal orders a colour attachment's read (`[[color(n)]]`) after every earlier fragment of
|
||||
// the pass, with no barrier from the program: after a draw of the pass, a draw that reads
|
||||
|
||||
@@ -20,17 +20,29 @@
|
||||
//! same encoder runs either way;
|
||||
//! - the same texture placed in a heap and reached after `use_heap` alone is not refused.
|
||||
//!
|
||||
//! `llvm-as` assembles the kernels; without it the tests skip visibly.
|
||||
//! And the same textures reached by a draw, through `colored_vertex` and an owned fragment function
|
||||
//! that writes an argument buffer's `texture2d<float, write>`, on every device: after the render
|
||||
//! encoder's `use_resource` with a write usage, the encoder's next draw is `Gap::StorageElement`
|
||||
//! with no slot and the texture's format exactly where the texture has no storage element, though
|
||||
//! the same draw before the declaration drew; a draw of `colored_fragment`, which reaches no
|
||||
//! texture beyond its slots, draws after it.
|
||||
//!
|
||||
//! `llvm-as` assembles the functions; without it the tests skip visibly.
|
||||
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod on_device {
|
||||
use crate::tests::command::on_device::{each_device, finished, Arena};
|
||||
use crate::tests::draw::on_device::{
|
||||
descriptor as render_descriptor, examples, pass, run, state as render_state, target,
|
||||
vertices, Buffers,
|
||||
};
|
||||
use crate::texture::TextureObject;
|
||||
use crate::{
|
||||
Buffer, ComputeCommandEncoder, ComputePipelineDescriptor, ComputePipelineState, Device,
|
||||
DispatchType, Error, FunctionDescriptor, Gap, HeapRange, IndexClass, Library, MemoryClass,
|
||||
PixelFormat, Resource, ResourceUsage, StageSource, StorageMode, Texture, TextureDescriptor,
|
||||
TextureType, TextureUsage,
|
||||
Buffer, ColorAttachmentDescriptor, ComputeCommandEncoder, ComputePipelineDescriptor,
|
||||
ComputePipelineState, Device, DispatchType, Error, FunctionDescriptor, Gap, HeapRange,
|
||||
IndexClass, Library, MemoryClass, PixelFormat, PrimitiveType, Region, RenderCommandEncoder,
|
||||
RenderPipelineDescriptor, Resource, ResourceUsage, StageSource, StorageMode, Texture,
|
||||
TextureDescriptor, TextureType, TextureUsage,
|
||||
};
|
||||
use ash::vk;
|
||||
use metal2vulkan_devtools::{engine_dir, llvm_assemble, llvm_assemble_text, AssembleError};
|
||||
@@ -333,4 +345,190 @@ declare { <4 x float>, i8 } @air.read_texture_2d.v4f32(ptr addrspace(1), ptr add
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/// A fragment function over the argument buffer at fragment buffer 0, whose one member is a
|
||||
/// texture's 8-byte resource ID: it writes `(1, 0, 1, 1)` to texel `(0, 0)` of the member's
|
||||
/// `texture2d<float, write>` and returns opaque green.
|
||||
const ARGUMENT_FRAGMENT: &str = r#"target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024-n8:16:32"
|
||||
target triple = "air64_v28-apple-macosx26.0.0"
|
||||
|
||||
%struct.T = type { ptr addrspace(1) }
|
||||
%struct.R = type { %struct.T }
|
||||
|
||||
define <4 x float> @argument_write_fragment(ptr addrspace(2) %r) {
|
||||
entry:
|
||||
%pt = getelementptr inbounds %struct.R, ptr addrspace(2) %r, i64 0, i32 0, i32 0
|
||||
%t = load ptr addrspace(1), ptr addrspace(2) %pt, align 8
|
||||
tail call void @air.write_texture_2d.v4f32(ptr addrspace(1) %t, <2 x i32> zeroinitializer, <4 x float> <float 1.0, float 0.0, float 1.0, float 1.0>, i32 0, i32 2)
|
||||
ret <4 x float> <float 0.0, float 1.0, float 0.0, float 1.0>
|
||||
}
|
||||
|
||||
declare void @air.write_texture_2d.v4f32(ptr addrspace(1), <2 x i32>, <4 x float>, i32, i32)
|
||||
|
||||
!air.fragment = !{!0}
|
||||
!air.version = !{!7}
|
||||
!air.language_version = !{!8}
|
||||
!0 = !{ptr @argument_write_fragment, !1, !3}
|
||||
!1 = !{!2}
|
||||
!2 = !{!"air.render_target", i32 0, i32 0, !"air.arg_type_name", !"float4", !"air.arg_name", !"color"}
|
||||
!3 = !{!4}
|
||||
!4 = !{i32 0, !"air.indirect_buffer", !"air.buffer_size", i32 8, !"air.location_index", i32 0, i32 1, !"air.read", !"air.address_space", i32 2, !"air.struct_type_info", !5, !"air.arg_type_size", i32 8, !"air.arg_type_align_size", i32 8, !"air.arg_type_name", !"W", !"air.arg_name", !"r"}
|
||||
!5 = !{i32 0, i32 8, i32 0, !"texture2d<float, write>", !"t", !"air.indirect_argument", !6}
|
||||
!6 = !{i32 0, !"air.texture", !"air.location_index", i32 0, i32 1, !"air.write", !"air.arg_type_name", !"texture2d<float, write>", !"air.arg_name", !"t"}
|
||||
!7 = !{i32 2, i32 8, i32 0}
|
||||
!8 = !{!"Metal", i32 4, i32 0, i32 0}
|
||||
"#;
|
||||
|
||||
/// One render pass into `color` that `encode` fills, committed and finished: what `encode`
|
||||
/// answered.
|
||||
fn rendered(
|
||||
name: &str,
|
||||
device: &Device,
|
||||
color: &Texture,
|
||||
encode: impl FnOnce(&mut RenderCommandEncoder) -> Result<(), Error>,
|
||||
) -> Result<(), Error> {
|
||||
let queue = device.new_command_queue(1).expect("a queue");
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut encoder = (command_buffer.render_command_encoder(&pass(color, None)))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let answered = encode(&mut encoder);
|
||||
encoder.end_encoding();
|
||||
run(name, &command_buffer);
|
||||
answered
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_device_refuses_a_draw_after_a_declared_write_of_a_texture_with_no_storage_element() {
|
||||
let Some(examples) = examples() else {
|
||||
return;
|
||||
};
|
||||
let library = match llvm_assemble_text(ARGUMENT_FRAGMENT) {
|
||||
Ok(bitcode) => Library::from_air(&bitcode).expect("the library"),
|
||||
Err(AssembleError::Missing(why)) => {
|
||||
eprintln!("SKIPPED: {why}");
|
||||
return;
|
||||
}
|
||||
Err(error) => panic!("the argument fragment: {error:?}"),
|
||||
};
|
||||
let mut writing = RenderPipelineDescriptor::new(StageSource::Function(
|
||||
FunctionDescriptor::new(examples.function("colored_vertex").expect("the function")),
|
||||
));
|
||||
writing.fragment = Some(StageSource::Function(FunctionDescriptor::new(
|
||||
(library.function("argument_write_fragment")).expect("the function"),
|
||||
)));
|
||||
writing.color_attachments[0] =
|
||||
Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm));
|
||||
let plain = render_descriptor(&examples, "colored_fragment", PixelFormat::RGBA8Unorm);
|
||||
each_device("declared storage elements in draws", |name, _, device| {
|
||||
let writing = render_state(name, &device, &writing);
|
||||
let plain = render_state(name, &device, &plain);
|
||||
let grant = (device.grant_indices(IndexClass::Texture, 1, 16))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let descriptor = |pixel_format, storage_mode| {
|
||||
let mut d = TextureDescriptor::new(TextureType::Type2D, pixel_format, 2, 2);
|
||||
d.usage = TextureUsage::SHADER_READ | TextureUsage::SHADER_WRITE;
|
||||
d.storage_mode = storage_mode;
|
||||
d
|
||||
};
|
||||
let mut index = 1..17;
|
||||
let mut next = || index.next().expect("an index of the grant");
|
||||
let mut cases = Vec::new();
|
||||
for format in [
|
||||
PixelFormat::RGBA8Unorm,
|
||||
PixelFormat::RGBA8UnormSRGB,
|
||||
PixelFormat::BGRA8UnormSRGB,
|
||||
PixelFormat::A8Unorm,
|
||||
] {
|
||||
let d = descriptor(format, StorageMode::Private);
|
||||
let texture = (device.new_texture(&d, Some(next())))
|
||||
.unwrap_or_else(|error| panic!("{name}: {format:?}: {error}"));
|
||||
cases.push((format!("{format:?}"), texture));
|
||||
}
|
||||
let parent = descriptor(PixelFormat::RGBA8Unorm, StorageMode::Private);
|
||||
let parent = (device.new_texture(&parent, Some(next())))
|
||||
.unwrap_or_else(|error| panic!("{name}: RGBA8Unorm: {error}"));
|
||||
let view = (parent.new_texture_view(
|
||||
PixelFormat::RGBA8UnormSRGB,
|
||||
TextureType::Type2D,
|
||||
0..1,
|
||||
0..1,
|
||||
Some(next()),
|
||||
))
|
||||
.unwrap_or_else(|error| panic!("{name}: the sRGB view: {error}"));
|
||||
cases.push((
|
||||
"an RGBA8UnormSRGB view of an RGBA8Unorm texture".into(),
|
||||
view,
|
||||
));
|
||||
// The texture every draw's fragment function writes, through the argument buffer.
|
||||
let written = descriptor(PixelFormat::RGBA8Unorm, StorageMode::Shared);
|
||||
let written = (device.new_texture(&written, Some(next())))
|
||||
.unwrap_or_else(|error| panic!("{name}: the written texture: {error}"));
|
||||
let mut buffers = Buffers::new(&device);
|
||||
let (positions, colors) = vertices(&device, &mut buffers);
|
||||
let argument = buffers.of(&device, &[0; 8]);
|
||||
place_id(&argument, &written);
|
||||
let color = target(
|
||||
&device,
|
||||
PixelFormat::RGBA8Unorm,
|
||||
TextureUsage::RENDER_TARGET,
|
||||
);
|
||||
let mut refused = Vec::new();
|
||||
for (case, texture) in &cases {
|
||||
let unstored = texture.unstored();
|
||||
let answered = rendered(name, &device, &color, |encoder| {
|
||||
encoder.use_resource(Resource::Texture(&written), ResourceUsage::WRITE)?;
|
||||
encoder.set_vertex_buffer(Some(&positions), 0, 0)?;
|
||||
encoder.set_vertex_buffer(Some(&colors), 0, 1)?;
|
||||
encoder.set_fragment_buffer(Some(&argument), 0, 0)?;
|
||||
encoder.set_render_pipeline_state(&writing)?;
|
||||
(encoder.draw_primitives(PrimitiveType::Triangle, 3, 3, 1, 0)).unwrap_or_else(
|
||||
|error| panic!("{name}: {case}: the draw before the declaration: {error}"),
|
||||
);
|
||||
encoder.use_resource(Resource::Texture(texture), ResourceUsage::WRITE)?;
|
||||
encoder.draw_primitives(PrimitiveType::Triangle, 3, 3, 1, 0)
|
||||
});
|
||||
match (unstored, answered) {
|
||||
(None, Ok(())) => {}
|
||||
(
|
||||
Some(format),
|
||||
Err(Error::Unsupported(Gap::StorageElement {
|
||||
slot: None,
|
||||
pixel_format,
|
||||
})),
|
||||
) if pixel_format == format => refused.push(case.clone()),
|
||||
(unstored, other) => {
|
||||
panic!("{name}: {case}, with no storage element {unstored:?}: {other:?}")
|
||||
}
|
||||
}
|
||||
(rendered(name, &device, &color, |encoder| {
|
||||
encoder.use_resource(Resource::Texture(texture), ResourceUsage::WRITE)?;
|
||||
encoder.set_vertex_buffer(Some(&positions), 0, 0)?;
|
||||
encoder.set_vertex_buffer(Some(&colors), 0, 1)?;
|
||||
encoder.set_render_pipeline_state(&plain)?;
|
||||
encoder.draw_primitives(PrimitiveType::Triangle, 3, 3, 1, 0)
|
||||
}))
|
||||
.unwrap_or_else(|error| {
|
||||
panic!("{name}: {case}: a draw of no such access: {error}")
|
||||
});
|
||||
}
|
||||
let mut texel = [0; 4];
|
||||
let region = Region {
|
||||
origin: [0; 3],
|
||||
size: [1, 1, 1],
|
||||
};
|
||||
(written.get_bytes(&mut texel, 4, 4, region, 0, 0))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
assert_eq!(
|
||||
texel,
|
||||
[255, 0, 255, 255],
|
||||
"{name}: the fragment function's write"
|
||||
);
|
||||
drop((cases, parent, written));
|
||||
(device.release_indices(grant)).unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
println!(
|
||||
"{name}: a draw after a declared write refused for {refused:?}; every other case \
|
||||
and every draw of no such access drew"
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -6689,6 +6689,7 @@ method metal2vulkan-runtime::RenderCommandEncoder::set_viewport pub fn set_viewp
|
||||
method metal2vulkan-runtime::RenderCommandEncoder::set_viewports pub fn set_viewports(&mut self, viewports: &[Viewport]) -> Result<(), Error>
|
||||
method metal2vulkan-runtime::RenderCommandEncoder::set_visibility_result_mode pub fn set_visibility_result_mode(&mut self, mode: VisibilityResultMode, offset: u64) -> Result<(), Error>
|
||||
method metal2vulkan-runtime::RenderCommandEncoder::update_fence pub fn update_fence(&mut self, fence: &Fence) -> Result<(), Error>
|
||||
method metal2vulkan-runtime::RenderCommandEncoder::use_resource pub fn use_resource(&mut self, resource: Resource<'_>, usage: ResourceUsage) -> Result<(), Error>
|
||||
method metal2vulkan-runtime::RenderCommandEncoder::wait_for_fence pub fn wait_for_fence(&mut self, fence: &Fence) -> Result<(), Error>
|
||||
method metal2vulkan-runtime::RenderPassDescriptor::precision_note pub fn precision_note(&self) -> Option<PrecisionNote>
|
||||
method metal2vulkan-runtime::RenderPipelineDescriptor::fragment_writes_depth_unattached pub fn fragment_writes_depth_unattached(&self, budget: &crate::Budget, entries: &StageEntries) -> Result<bool, Error>
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -30,13 +30,13 @@ Its limits, measured rather than asserted:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| implemented Metal items | 593 |
|
||||
| implemented Metal items | 597 |
|
||||
| of those, unreachable: `objc2-metal` binds no name for them | 1 |
|
||||
| so reachable by some case | 592 |
|
||||
| of the reachable, exercised by the suite's Metal leg | 519 |
|
||||
| so reachable by some case | 596 |
|
||||
| of the reachable, exercised by the suite's Metal leg | 523 |
|
||||
| of the reachable, not exercised | 73 |
|
||||
| share of the reachable exercised | 88% |
|
||||
| of those exercised, no case reaching it loosens anything | 302 |
|
||||
| of those exercised, no case reaching it loosens anything | 306 |
|
||||
| of those exercised, a case reaching it loosens some site | 217 |
|
||||
| case modules | 179 |
|
||||
| committed recordings | 1319 |
|
||||
@@ -363,7 +363,7 @@ Every container with an implemented item, by how much of it the suite reaches. *
|
||||
|---|---|---|---|---|---|
|
||||
| `MTLArgument` | 17 | 0 | 0 | 17 | |
|
||||
| `MTLRasterizationRateLayerDescriptor` | 9 | 0 | 2 | 7 | `rate_map_degenerate_forms`, `rate_map_sweeps`, `rate_maps` |
|
||||
| `MTLRenderCommandEncoder` | 51 | 0 | 46 | 5 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… |
|
||||
| `MTLRenderCommandEncoder` | 55 | 0 | 50 | 5 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… |
|
||||
| the header's free functions | 4 | 0 | 0 | 4 | |
|
||||
| `MTLFunctionConstantValues` | 5 | 0 | 2 | 3 | `function_constants_half3`, `function_facts`, `library_facts` |
|
||||
| `MTLLibrary` | 10 | 0 | 7 | 3 | `alpha_coverage_pairs`, `argument_encoder_crossings`, `argument_encoders`, `astc_textures`… |
|
||||
@@ -450,7 +450,7 @@ A container is one Objective-C type; the SDK header it sits in is the family of
|
||||
| `MTLArgument.h` | 77 | 59 | 18 |
|
||||
| `MTLRasterizationRate.h` | 25 | 12 | 13 |
|
||||
| `MTLLibrary.h` | 40 | 35 | 5 |
|
||||
| `MTLRenderCommandEncoder.h` | 51 | 46 | 5 |
|
||||
| `MTLRenderCommandEncoder.h` | 55 | 50 | 5 |
|
||||
| `MTLRenderPipeline.h` | 102 | 97 | 5 |
|
||||
| `MTLDevice.h` | 33 | 29 | 4 |
|
||||
| `MTLFunctionConstantValues.h` | 5 | 2 | 3 |
|
||||
@@ -599,8 +599,8 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
|
||||
| `heap_metal_sizes` | 7 | 7 | 1 tolerance(s): `AcceptedDifference` | 14 |
|
||||
| `host_detach` | 1 | 1 | every field | 18 |
|
||||
| `host_page_writes` | 4 | 4 | every field | 124 |
|
||||
| `indirect_command_depth` | 6 | 6 | every field | 148 |
|
||||
| `indirect_commands` | 9 | 9 | every field | 150 |
|
||||
| `indirect_command_depth` | 6 | 6 | every field | 149 |
|
||||
| `indirect_commands` | 9 | 9 | every field | 151 |
|
||||
| `indirect_private_types` | 1 | 0 | every field | 0 |
|
||||
| `int_attributes` | 1 | 1 | every field | 103 |
|
||||
| `layered_targets` | 5 | 5 | every field | 132 |
|
||||
@@ -608,7 +608,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
|
||||
| `library_facts` | 9 | 9 | every field | 38 |
|
||||
| `math_routines` | 2 | 2 | every field | 25 |
|
||||
| `mesh_barriers` | 2 | 2 | every field | 50 |
|
||||
| `mesh_commands` | 2 | 2 | every field | 47 |
|
||||
| `mesh_commands` | 2 | 2 | every field | 48 |
|
||||
| `mesh_draws` | 6 | 6 | every field | 46 |
|
||||
| `mesh_partial_barriers` | 4 | 4 | every field | 45 |
|
||||
| `mesh_pipeline_descriptors` | 3 | 3 | every field | 47 |
|
||||
@@ -644,7 +644,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
|
||||
| `render_depth_stencil_state` | 3 | 3 | every field | 136 |
|
||||
| `render_draw_forms` | 4 | 4 | every field | 121 |
|
||||
| `render_pass_descriptors` | 12 | 12 | every field | 30 |
|
||||
| `render_residency` | 2 | 2 | every field | 122 |
|
||||
| `render_residency` | 2 | 2 | every field | 126 |
|
||||
| `render_state` | 3 | 3 | every field | 156 |
|
||||
| `resolve_then_load` | 1 | 1 | every field | 124 |
|
||||
| `resource_facts` | 4 | 4 | every field | 23 |
|
||||
@@ -1285,6 +1285,10 @@ One row per implemented item of the SDK, in the coverage map's order. *exercised
|
||||
| `waitForFence:beforeStages:` | no | — | — |
|
||||
| `setTessellationFactorBuffer:offset:instanceStride:` | yes | `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps` | 14 |
|
||||
| `drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:` | yes | `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps` | 14 |
|
||||
| `useResource:usage:` | yes | `render_residency` | 2 |
|
||||
| `useResources:count:usage:` | yes | `render_residency` | 2 |
|
||||
| `useResource:usage:stages:` | yes | `indirect_command_depth`, `indirect_commands`, `mesh_commands`, `render_residency` | 19 |
|
||||
| `useResources:count:usage:stages:` | yes | `render_residency` | 2 |
|
||||
| `memoryBarrierWithScope:afterStages:beforeStages:` | yes | `mesh_barriers`, `pass_start_reads`, `render_residency` | 18 |
|
||||
| `memoryBarrierWithResources:count:afterStages:beforeStages:` | yes | `mesh_barriers`, `render_residency` | 4 |
|
||||
|
||||
@@ -1912,10 +1916,6 @@ An item the suite's Metal leg calls whose coverage-map status is not implemented
|
||||
| `MTLRenderCommandEncoder` `useHeap:stages:` | missing | as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` | `render_residency` |
|
||||
| `MTLRenderCommandEncoder` `useHeaps:count:` | missing | as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` | `render_residency` |
|
||||
| `MTLRenderCommandEncoder` `useHeaps:count:stages:` | missing | as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` | `render_residency` |
|
||||
| `MTLRenderCommandEncoder` `useResource:usage:` | missing | as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` | `render_residency` |
|
||||
| `MTLRenderCommandEncoder` `useResource:usage:stages:` | missing | as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` | `indirect_command_depth`, `indirect_commands`, `mesh_commands`, `render_residency` |
|
||||
| `MTLRenderCommandEncoder` `useResources:count:usage:` | missing | as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` | `render_residency` |
|
||||
| `MTLRenderCommandEncoder` `useResources:count:usage:stages:` | missing | as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` | `render_residency` |
|
||||
| `MTLRenderPassAttachmentDescriptor` `depthPlane` | missing | a 3D texture's depth plane as an attachment; such an attachment is refused (`RenderPassKind::TextureType`) | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `visibility`, `wide_int_attributes`, `wide_points` |
|
||||
| `MTLRenderPassAttachmentDescriptor` `storeActionOptions` | missing | store action options, whose one option needs more than one sample | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `visibility`, `wide_int_attributes`, `wide_points` |
|
||||
| `MTLRenderPassDescriptor` `defaultRasterSampleCount` | missing | a pass with no attachment, which is refused (`RenderPassKind::NoAttachment`) | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `visibility`, `wide_int_attributes`, `wide_points` |
|
||||
|
||||
@@ -10,12 +10,12 @@ Every public item of the macOS 27.2 SDK (Xcode 27.2, 27B52)'s Metal headers, by
|
||||
|
||||
| Status | Items | Of which deprecated |
|
||||
|---|---|---|
|
||||
| implemented | 594 | 25 |
|
||||
| missing | 1117 | 38 |
|
||||
| implemented | 598 | 27 |
|
||||
| missing | 1113 | 36 |
|
||||
| out of scope | 424 | 5 |
|
||||
| all | 2135 | 68 |
|
||||
|
||||
Implemented by the runtime: 238; by the translator's values: 356. Missing by size: S 191, M 208, L 342, XL 376.
|
||||
Implemented by the runtime: 242; by the translator's values: 356. Missing by size: S 187, M 208, L 342, XL 376.
|
||||
|
||||
## Missing, in build order
|
||||
|
||||
@@ -33,7 +33,7 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app
|
||||
| a buffer made with bytes | S | 1 | `MTLDevice.newBufferWithBytes:length:options:` |
|
||||
| pipeline creation forms (from a function, with a completion handler) | S | 6 | `MTLDevice.newRenderPipelineStateWithDescriptor:options:completionHandler:`, `MTLDevice.newComputePipelineStateWithFunction:error:`, `MTLDevice.newComputePipelineStateWithFunction:options:reflection:error:`, ... |
|
||||
| render pass descriptor fields | S/M/L | 9 | `MTLRenderPassAttachmentDescriptor.depthPlane`, `MTLRenderPassAttachmentDescriptor.storeActionOptions`, `MTLRenderPassDescriptor.imageblockSampleLength`, ... |
|
||||
| encoder calls (stride setters, indirect draws, store action options, a render encoder's resource and heap uses) | S/M/L | 36 | `MTLBlitCommandEncoder.synchronizeTexture:slice:level:`, `MTLBlitCommandEncoder.copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount:`, `MTLBlitCommandEncoder.copyFromTexture:toTexture:`, ... |
|
||||
| encoder calls (stride setters, indirect draws, store action options, a render encoder's heap uses) | S/M/L | 32 | `MTLBlitCommandEncoder.synchronizeTexture:slice:level:`, `MTLBlitCommandEncoder.copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount:`, `MTLBlitCommandEncoder.copyFromTexture:toTexture:`, ... |
|
||||
| `textureBarrier` and queue-stage barriers | S/M | 2 | `MTLCommandEncoder.barrierAfterQueueStages:beforeStages:`, `MTLRenderCommandEncoder.textureBarrier` |
|
||||
| a pipeline state's reflection after creation | S | 2 | `MTLComputePipelineState.reflection`, `MTLRenderPipelineState.reflection` |
|
||||
| function handles by name, and a handle's type and ID | S | 4 | `MTLComputePipelineState.functionHandleWithName:`, `MTLFunctionHandle.functionType`, `MTLFunctionHandle.gpuResourceID`, ... |
|
||||
@@ -2122,10 +2122,10 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app
|
||||
| `MTLRenderCommandEncoder.setTileAccelerationStructure:atBufferIndex:` | method | out of scope | ray tracing |
|
||||
| `MTLRenderCommandEncoder.dispatchThreadsPerTile:` | method | missing | L: tile render pipelines; metal2vulkan-runtime makes none |
|
||||
| `MTLRenderCommandEncoder.setThreadgroupMemoryLength:offset:atIndex:` | method | missing | M: a render pass's threadgroup memory, which tile functions use |
|
||||
| `MTLRenderCommandEncoder.useResource:usage:` (deprecated) | method | missing | S: as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` |
|
||||
| `MTLRenderCommandEncoder.useResources:count:usage:` (deprecated) | method | missing | S: as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` |
|
||||
| `MTLRenderCommandEncoder.useResource:usage:stages:` | method | missing | S: as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` |
|
||||
| `MTLRenderCommandEncoder.useResources:count:usage:stages:` | method | missing | S: as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` |
|
||||
| `MTLRenderCommandEncoder.useResource:usage:` (deprecated) | method | implemented | `RenderCommandEncoder::use_resource` (runtime): without stages, which are not read |
|
||||
| `MTLRenderCommandEncoder.useResources:count:usage:` (deprecated) | method | implemented | `RenderCommandEncoder::use_resource` (runtime): a loop of it |
|
||||
| `MTLRenderCommandEncoder.useResource:usage:stages:` | method | implemented | `RenderCommandEncoder::use_resource` (runtime): the stages are not read |
|
||||
| `MTLRenderCommandEncoder.useResources:count:usage:stages:` | method | implemented | `RenderCommandEncoder::use_resource` (runtime): a loop of it; the stages are not read |
|
||||
| `MTLRenderCommandEncoder.useHeap:` (deprecated) | method | missing | S: as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` |
|
||||
| `MTLRenderCommandEncoder.useHeaps:count:` (deprecated) | method | missing | S: as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` |
|
||||
| `MTLRenderCommandEncoder.useHeap:stages:` | method | missing | S: as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` |
|
||||
|
||||
+4
-4
@@ -272,7 +272,7 @@ Columns:
|
||||
| `Committed` | A call on a command buffer already committed | every device (a public call's own check of its arguments) | `metal-documented`: Metal's validation asserts "commit an already committed command buffer", "Completed handler provided after commit call" and "Scheduled handler provided after commit call" | 1: `crates/metal2vulkan-runtime/src/command.rs (open)` | `-` |
|
||||
| `InScheduledHandler` | A call a scheduled handler may not make (`CommandBuffer::add_scheduled_handler`) | every device (a public call's own check of its arguments) | `ours`: the consumer's scheduled handlers run on the submit thread, and the one consumer's make none of these calls; a guest's scheduled handler runs in the guest | 1: `crates/metal2vulkan-runtime/src/command.rs (not_in_scheduled_handler)` | `-` |
|
||||
| `WaitOnOwnThread` | A wait, in a handler or a listener, for what the runtime thread that runs it would have to do first, so it would never end | every device (a public call's own check of its arguments) | `ours`: no wait of the runtime's hangs by construction | 4: `crates/metal2vulkan-runtime/src/command.rs (wait_until_completed)`, `crates/metal2vulkan-runtime/src/command.rs (wait_until_scheduled)` (+2) | `-` |
|
||||
| `OtherDevice` | An event, a buffer, a texture or a pipeline state of another device in an encode call (`CommandBuffer::encode_wait_for_event`,... | every device (a public call's own check of its arguments) | `ours`: an event's semaphore, a buffer's block, a texture's image, a pipeline and a block belong to the `VkDevice` that made them | 30: `crates/metal2vulkan-runtime/src/blit.rs (buffer_copy)`, `crates/metal2vulkan-runtime/src/blit.rs (copy_from_buffer_to_buffer)` (+26) | `-` |
|
||||
| `OtherDevice` | An event, a buffer, a texture or a pipeline state of another device in an encode call (`CommandBuffer::encode_wait_for_event`,... | every device (a public call's own check of its arguments) | `ours`: an event's semaphore, a buffer's block, a texture's image, a pipeline and a block belong to the `VkDevice` that made them | 32: `crates/metal2vulkan-runtime/src/blit.rs (buffer_copy)`, `crates/metal2vulkan-runtime/src/blit.rs (copy_from_buffer_to_buffer)` (+27) | `-` |
|
||||
| `NoCommandBuffers` | A queue that may hold no command buffer (`Device::new_command_queue` with a count of 0) | every device (a public call's own check of its arguments) | `ours`: its first `commandBuffer` call would wait forever | 1: `crates/metal2vulkan-runtime/src/queue.rs (new_command_queue)` | `-` |
|
||||
| `EncoderOpen` | A second encoder, an encode call, or a commit or enqueue, while an encoder of the command buffer is open | every device (a public call's own check of its arguments) | `metal-documented`: a command buffer has one active encoder at a time, ended by `endEncoding` before another is made or the command buffer is committed | 1: `crates/metal2vulkan-runtime/src/command.rs (open)` | `-` |
|
||||
| `NoPipeline` | A dispatch or a draw with no pipeline state set | every device (a public call's own check of its arguments) | `metal-documented`: a compute dispatch needs a compute pipeline state set first, and a draw a render pipeline state | 3: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` (+1) | `-` |
|
||||
@@ -383,7 +383,7 @@ Columns:
|
||||
| `FillAlignment` | `BlitCommandEncoder::fill_buffer` of a range that does not start and end on whole 4-byte words of the bytes shaders reach, which Metal fills byte... | every device (a public call's own check of its arguments) | `ours`: `vkCmdFillBuffer` writes whole words; a byte fill is built when a replay stream makes one | 1: `crates/metal2vulkan-runtime/src/blit.rs (fill_range)` | `-` |
|
||||
| `RenderPipeline` | A render pipeline state of something the runtime does not build yet | every device (a public call's own check of its arguments) | `ours`: the replay streams' render pipelines draw into colour, depth and stencil attachments of one sample, with no tessellation and no framebuffer fetch; each other kind is built when a replay stream makes one | 5: `crates/metal2vulkan-runtime/src/render.rs (draw_input)`, `crates/metal2vulkan-runtime/src/render.rs (of, 3 sites)` (+1) | `-` |
|
||||
| `SwizzledReadWrite` | A draw or dispatch whose function declares `access::read_write` at texture slot `slot` and reads it, where the texture bound there has a swizzle... | every device (a public call's own check of its arguments) | `ours`: built when a replay stream counts one | 2: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (find)` | `-` |
|
||||
| `StorageElement` | A draw or dispatch whose function writes a texture slot, or reads one through its storage image (`access::read_write`), bound to a texture made... | every device (a public call's own check of its arguments) | `ours`: the storage element through a view of the nearest format whose storage Vulkan requires of every device, with the translator's conversion, is the form to build | 3: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch, 2 sites)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (find)` | `-` |
|
||||
| `StorageElement` | A draw or dispatch whose function writes a texture slot, or reads one through its storage image (`access::read_write`), bound to a texture made... | every device (a public call's own check of its arguments) | `ours`: the storage element through a view of the nearest format whose storage Vulkan requires of every device, with the translator's conversion, is the form to build | 4: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch, 2 sites)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (find, 2 sites)` | `-` |
|
||||
| `BicubicTexels` | A dispatch or a draw whose function samples texture slot `slot` through a constexpr sampler with Metal's bicubic filter (`filter::bicubic`), where... | every device (a public call's own check of its arguments) | `ours`: each refused format's treatment is built when a guest binds one | 2: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (find)` | `-` |
|
||||
| `TextureView` | `Texture::new_texture_view` of a kind Metal makes and the runtime does not build | every device (a public call's own check of its arguments) | `ours`: the replay streams' views that compute binds are same-format views of every slice, 2D views of one slice of a 2D array, and level subranges, swizzled or not; each other kind is built when a replay stream binds one | 1: `crates/metal2vulkan-runtime/src/texture.rs (view)` | `-` |
|
||||
| `RenderPass` | A render pass of something the runtime does not build yet (`CommandBuffer::render_command_encoder`) | every device (a public call's own check of its arguments) | `ours`: the replay streams' passes render into one to two color attachments and a stencil or a depth attachment, each a level of a 2D texture of one sample, with no resolve and a clear depth of 1, none naming two textures for its depth and stencil; each other kind is built when a replay stream makes one; `DepthStencilViews` and `ClearDepth` are what Vulkan's rendering under the floor takes no form of | 6: `crates/metal2vulkan-runtime/src/pass.rs (check)`, `crates/metal2vulkan-runtime/src/pass.rs (ops)` (+4) | `-` |
|
||||
@@ -567,7 +567,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `rt:Refusal::Committed`: `crates/metal2vulkan-runtime/src/command.rs (open)`
|
||||
- `rt:Refusal::InScheduledHandler`: `crates/metal2vulkan-runtime/src/command.rs (not_in_scheduled_handler)`
|
||||
- `rt:Refusal::WaitOnOwnThread`: `crates/metal2vulkan-runtime/src/command.rs (wait_until_completed)`; `crates/metal2vulkan-runtime/src/command.rs (wait_until_scheduled)`; `crates/metal2vulkan-runtime/src/event.rs (wait_until_signaled_value)`; `crates/metal2vulkan-runtime/src/queue.rs (command_buffer)`
|
||||
- `rt:Refusal::OtherDevice`: `crates/metal2vulkan-runtime/src/blit.rs (buffer_copy)`; `crates/metal2vulkan-runtime/src/blit.rs (copy_from_buffer_to_buffer)`; `crates/metal2vulkan-runtime/src/blit.rs (copy_from_texture)`; `crates/metal2vulkan-runtime/src/blit.rs (fill_buffer)`; `crates/metal2vulkan-runtime/src/blit.rs (generate_mipmaps)`; `crates/metal2vulkan-runtime/src/blit.rs (release_surface_to_external)`; `crates/metal2vulkan-runtime/src/blit.rs (release_to_external)`; `crates/metal2vulkan-runtime/src/blit.rs (synchronize_resource)`; `crates/metal2vulkan-runtime/src/command.rs (check)`; `crates/metal2vulkan-runtime/src/command.rs (present_drawable)`; `crates/metal2vulkan-runtime/src/device.rs (release_block)`; `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`; `crates/metal2vulkan-runtime/src/encoder.rs (set_buffer)`; `crates/metal2vulkan-runtime/src/encoder.rs (set_compute_pipeline_state)`; `crates/metal2vulkan-runtime/src/encoder.rs (set_sampler_state)`; `crates/metal2vulkan-runtime/src/encoder.rs (set_texture)`; `crates/metal2vulkan-runtime/src/encoder.rs (use_resource, 2 sites)`; `crates/metal2vulkan-runtime/src/fence.rs (check)`; `crates/metal2vulkan-runtime/src/pass.rs (check, 2 sites)`; `crates/metal2vulkan-runtime/src/pass.rs (resolve)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_buffer)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_depth_stencil_state)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_render_pipeline_state)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_sampler_state)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_tessellation_factor_buffer)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_texture)`; `crates/metal2vulkan-runtime/src/texture.rs (new_managed_texture)`
|
||||
- `rt:Refusal::OtherDevice`: `crates/metal2vulkan-runtime/src/blit.rs (buffer_copy)`; `crates/metal2vulkan-runtime/src/blit.rs (copy_from_buffer_to_buffer)`; `crates/metal2vulkan-runtime/src/blit.rs (copy_from_texture)`; `crates/metal2vulkan-runtime/src/blit.rs (fill_buffer)`; `crates/metal2vulkan-runtime/src/blit.rs (generate_mipmaps)`; `crates/metal2vulkan-runtime/src/blit.rs (release_surface_to_external)`; `crates/metal2vulkan-runtime/src/blit.rs (release_to_external)`; `crates/metal2vulkan-runtime/src/blit.rs (synchronize_resource)`; `crates/metal2vulkan-runtime/src/command.rs (check)`; `crates/metal2vulkan-runtime/src/command.rs (present_drawable)`; `crates/metal2vulkan-runtime/src/device.rs (release_block)`; `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`; `crates/metal2vulkan-runtime/src/encoder.rs (set_buffer)`; `crates/metal2vulkan-runtime/src/encoder.rs (set_compute_pipeline_state)`; `crates/metal2vulkan-runtime/src/encoder.rs (set_sampler_state)`; `crates/metal2vulkan-runtime/src/encoder.rs (set_texture)`; `crates/metal2vulkan-runtime/src/encoder.rs (use_resource, 2 sites)`; `crates/metal2vulkan-runtime/src/fence.rs (check)`; `crates/metal2vulkan-runtime/src/pass.rs (check, 2 sites)`; `crates/metal2vulkan-runtime/src/pass.rs (resolve)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_buffer)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_depth_stencil_state)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_render_pipeline_state)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_sampler_state)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_tessellation_factor_buffer)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_texture)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (use_resource, 2 sites)`; `crates/metal2vulkan-runtime/src/texture.rs (new_managed_texture)`
|
||||
- `rt:Refusal::NoCommandBuffers`: `crates/metal2vulkan-runtime/src/queue.rs (new_command_queue)`
|
||||
- `rt:Refusal::EncoderOpen`: `crates/metal2vulkan-runtime/src/command.rs (open)`
|
||||
- `rt:Refusal::NoPipeline`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw_reaches)`
|
||||
@@ -668,7 +668,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `rt:Gap::FillAlignment`: `crates/metal2vulkan-runtime/src/blit.rs (fill_range)`
|
||||
- `rt:Gap::RenderPipeline`: `crates/metal2vulkan-runtime/src/render.rs (draw_input)`; `crates/metal2vulkan-runtime/src/render.rs (of, 3 sites)`; `crates/metal2vulkan-runtime/src/render.rs (refuse)`
|
||||
- `rt:Gap::SwizzledReadWrite`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (find)`
|
||||
- `rt:Gap::StorageElement`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch, 2 sites)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (find)`
|
||||
- `rt:Gap::StorageElement`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch, 2 sites)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (find, 2 sites)`
|
||||
- `rt:Gap::BicubicTexels`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (find)`
|
||||
- `rt:Gap::TextureView`: `crates/metal2vulkan-runtime/src/texture.rs (view)`
|
||||
- `rt:Gap::RenderPass`: `crates/metal2vulkan-runtime/src/pass.rs (check)`; `crates/metal2vulkan-runtime/src/pass.rs (ops)`; `crates/metal2vulkan-runtime/src/pass.rs (resolve)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (later_store)`; `crates/metal2vulkan-runtime/src/texture.rs (attachment_view)`; `crates/metal2vulkan-runtime/src/texture.rs (resolve_attachment)`
|
||||
|
||||
@@ -88,7 +88,7 @@ GROUP_NAMES = {
|
||||
"buffers": "a buffer made with bytes",
|
||||
"pipelines": "pipeline creation forms (from a function, with a completion handler)",
|
||||
"render-pass": "render pass descriptor fields",
|
||||
"encoder-calls": "encoder calls (stride setters, indirect draws, store action options, a render encoder's resource and heap uses)",
|
||||
"encoder-calls": "encoder calls (stride setters, indirect draws, store action options, a render encoder's heap uses)",
|
||||
"sharing": "texture and event handles shared across processes",
|
||||
"library-objects": "a function's options (`MTLFunctionOptions`)",
|
||||
"argument-encoders": "argument encoders",
|
||||
|
||||
@@ -1666,10 +1666,10 @@ MTLRenderCommandEncoder.h MTLRenderCommandEncoder method setTileIntersectionFunc
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method setTileAccelerationStructure:atBufferIndex: O ray tracing
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method dispatchThreadsPerTile: M tile render pipelines; metal2vulkan-runtime makes none L tile
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method setThreadgroupMemoryLength:offset:atIndex: M a render pass's threadgroup memory, which tile functions use M encoder-calls
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method useResource:usage: yes M as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` S encoder-calls
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method useResources:count:usage: yes M as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` S encoder-calls
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method useResource:usage:stages: M as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` S encoder-calls
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method useResources:count:usage:stages: M as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` S encoder-calls
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method useResource:usage: yes I runtime RenderCommandEncoder::use_resource without stages, which are not read
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method useResources:count:usage: yes I runtime RenderCommandEncoder::use_resource a loop of it
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method useResource:usage:stages: I runtime RenderCommandEncoder::use_resource the stages are not read
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method useResources:count:usage:stages: I runtime RenderCommandEncoder::use_resource a loop of it; the stages are not read
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method useHeap: yes M as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` S encoder-calls
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method useHeaps:count: yes M as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` S encoder-calls
|
||||
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method useHeap:stages: M as the compute encoder's `ComputeCommandEncoder::use_resource` and `use_heap` S encoder-calls
|
||||
|
||||
|
Reference in new issue
Block a user