rt: indirect draws, of primitives, indexed primitives and patches

The render encoder builds Metal's three indirect draws:
`drawPrimitives:indirectBuffer:indirectBufferOffset:` (`draw_primitives_indirect`),
`drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:`
(`draw_indexed_primitives_indirect`) and
`drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:`
(`draw_patches_indirect`). Each is one `vkCmdDrawIndirect` or `vkCmdDrawIndexedIndirect` on the
buffer at its offset: Metal's argument structs lie as Vulkan's commands do, so the GPU reads
them as they are and nothing is copied. Before, the encoder had no such methods and the README
listed indirect draws as not built.

drawPatches indirect is built: rt's patch draw is vkCmdDraw(patch_count, instances, patch_start,
base), each patch one vertex of the state's patch list, so Metal's patch count is the indirect
command's vertex count unchanged. A patch index buffer stays `DrawKind::PatchIndexBuffer`, as
the direct draw's.

The arguments' buffer counts among the draw's reads as an index buffer does (draw_reaches,
Managed copies), and the command buffer keeps it until it retires. The pass's first barrier
(Reach::Commands, which has INDIRECT_COMMAND_READ) and the encoder's memory barrier make earlier
writes visible to the read. An offset not a multiple of 4 or without the arguments' 16 bytes (20
indexed) is Refusal::IndirectOffset; arguments at a block byte not a multiple of 4 are
Refusal::ArgumentPlace; an indexed draw's index offset must be a multiple of the index size and
inside the buffer. A device that takes firstInstance 0 alone under a divided step rate refuses
an indirect draw through such a state (DividedBaseInstance), since the GPU reads the base
instance.

Floor: drawIndirectFirstInstance joins REQUIRED (Vulkan 1.4 requires it), so Metal's base
instance is the device's own. The translator is not told. The venue dumps report it true on
every venue: m3-max-48727, 48728, 48729, 48730, 48731, 48736, 48737 and 61508. tests/floor.rs,
the README floor table, regen_device_profiles.py's RUNTIME_FLOOR and profiles/runtime-floor.json
add it. The translator's tests that read runtime-floor only see indirect_needs_arguments become
false more often, which none asserts the other way.

Known gap (README): an indexed indirect draw's index count is the GPU's, so a count past the
index buffer is not refused as a direct one is. Without robustBufferAccess2, which the floor does
not require, a count past the block's VkBuffer is outside valid usage
(VUID-vkCmdDrawIndexedIndirect-robustBufferAccess2-08798).

The encoder's doc no longer lists `useResource:` as not built (it is, since 62b3e5a250).

Docs: README, REFUSALS.md and METAL-COVERAGE.md (the three selectors now implemented), the
api_signatures table (three methods).

Tests: draw.rs's every_device_draws_from_indirect_arguments_a_blit_wrote: arguments written by a
blit earlier in the command buffer, at offset 16, draw the constant-step triangle as the direct
draw does (vertex 1, instances 1 and 2 at base instance 1), indexed through [7, 0, 1, 2] from
index 1 at base vertex 1 too; arguments of no instances draw nothing. patch.rs's
every_device_draws_patches_from_indirect_arguments: two patches from arguments 4 bytes in draw
as the direct patch test's, and a patch index buffer is PatchIndexBuffer.
This commit is contained in:
Anees Iqbal committed 2026-11-21 00:02:34 -08:00
1 parent 4cf936ed4d
commit aed460e0da
13 files changed
+447 -98

No files matched your search

+46 -19
View File
@@ -3128,6 +3128,26 @@ or does not check is rebuilt from the generations' names, with young counted ful
`Refusal::NoTessellationFactorBuffer`; factors at an odd byte
`Refusal::TessellationFactorOffset` (an offset 2 past a multiple of 4, which Metal's validation
refuses, is read at that byte, as plain Metal reads it).
- `draw_primitives_indirect` is `drawPrimitives:indirectBuffer:indirectBufferOffset:`,
`draw_indexed_primitives_indirect` is
`drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:`
and `draw_patches_indirect` is
`drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:`: one
`vkCmdDrawIndirect`, or `vkCmdDrawIndexedIndirect` for the indexed draw, on the buffer at its
offset, which the GPU reads as Vulkan's own command, as Metal's
`MTLDrawPrimitivesIndirectArguments`, `MTLDrawIndexedPrimitivesIndirectArguments` and
`MTLDrawPatchIndirectArguments` lie as `VkDrawIndirectCommand` and `VkDrawIndexedIndirectCommand`
do. A patch draw's patch count is the draw's vertex count unchanged, each patch one vertex as a
direct patch draw's. The base instance is the device's own under the floor's
`drawIndirectFirstInstance`. The arguments' buffer counts among the draw's reads as an index
buffer does, and the command buffer keeps it until it retires; the pass's first barrier, and the
encoder's memory barrier after a draw that wrote, make earlier writes visible to the GPU's read.
The runtime never reads the arguments, so a count of 0 is recorded and draws nothing. An offset
that is not a multiple of 4 or leaves fewer than the arguments' 16 bytes in the buffer (20 for an
indexed draw) is `Refusal::IndirectOffset`, as Metal's validation stops it; arguments at a byte of
the block's allocation that is not a multiple of 4 are `Refusal::ArgumentPlace`; an indexed draw's
index offset that is not a multiple of the index size or is at or past the buffer's end is
`Refusal::IndexBufferOffset`.
- A viewport is Vulkan's with its height negated (from `y + height`): framebuffer rows, the
fragment position and derivatives follow Metal's clip space, whose y points up, and Metal's
front-facing winding is Vulkan's front face of the same name. A viewport of no width or height,
@@ -3209,6 +3229,12 @@ or does not check is rebuilt from the generations' names, with young counted ful
### Known gaps of render encoders
- An indexed indirect draw's index count is the GPU's to read, so a count that runs past the index
buffer is not refused, as a direct draw's is (`Refusal::IndexBufferOffset`, which Metal's
validation stops). The index buffer is bound from the indices to the end of the block's
`VkBuffer`, so such a draw reads the block's later bytes as indices, and a count past the block's
end is outside Vulkan's valid usage without `robustBufferAccess2`, which the floor does not
require (`VUID-vkCmdDrawIndexedIndirect-robustBufferAccess2-08798`).
- Refused by `Gap::Draw`, naming its `DrawKind`: a triangle fill mode but `Fill`
(`FillMode`, `set_triangle_fill_mode`), the depth clip mode `Clamp` (`DepthClamp`,
`set_depth_clip_mode`), a count of viewports or scissor rectangles other than 1 (`Viewports`,
@@ -3230,18 +3256,18 @@ or does not check is rebuilt from the generations' names, with young counted ful
`supportsNonZeroFirstInstance` (lavapipe and the UHD 630 among the lab's), a draw at a base
instance other than 0 through a state that steps a layout per instance at a rate above 1
(`DividedBaseInstance`: Vulkan's divisor takes `firstInstance` 0 alone there,
VUID-vkCmdDraw-pNext-09461); the same draw from base instance 0 runs. An indirect draw, whose
base instance the CPU does not see, is not built. A patch draw through a patch index buffer is
`PatchIndexBuffer`: the control stage takes each patch's index from its position, and no replay
stream's patch draw names one. Every attachment the replay streams read through a texture is
a colour render target of `Private` storage, read from the fragment function; and
their stepped draws (a WebGL stream's, at rates 2 and 3) are all at base instance 0.
A draw that reads its own target over a buffer in place, a linear image on the buffer's memory
that never leaves the general layout, is refused on every device (`AttachmentRead`): no play
of the replay streams met it. The forms ruled for it, should a stream meet it, are the read
through the image's shadow, the counted copy a device without the feedback loop takes, first,
and then, where the device has the feedback loop, unified image layouts and a `LINEAR` image
with the feedback usage, the loop on the attachment in the general layout.
VUID-vkCmdDraw-pNext-09461); the same draw from base instance 0 runs. An indirect draw through
such a state, whose base instance the GPU reads, is refused alike. A patch draw through a patch
index buffer is `PatchIndexBuffer`: the control stage takes each patch's index from its position,
and no replay stream's patch draw names one. Every attachment the replay streams read through a
texture is a colour render target of `Private` storage, read from the fragment function; and their
stepped draws (a WebGL stream's, at rates 2 and 3) are all at base instance 0. A draw that reads
its own target over a buffer in place, a linear image on the buffer's memory that never leaves the
general layout, is refused on every device (`AttachmentRead`): no play of the replay streams met
it. The forms ruled for it, should a stream meet it, are the read through the image's shadow, the
counted copy a device without the feedback loop takes, first, and then, where the device has the
feedback loop, unified image layouts and a `LINEAR` image with the feedback usage, the loop on the
attachment in the general layout.
- A fetch (`[[color(n)]]`) orders the fragments of earlier draws before it, not the fragments of its
own draw that cover the same pixel, which Metal orders in primitive order: a fragment may read the
texel from before an earlier fragment of its draw wrote it
@@ -3295,13 +3321,13 @@ or does not check is rebuilt from the generations' names, with young counted ful
a declared write of a Shared buffer, or of a texture over one, reaches the host once the command
buffer completes. 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.
- Not built, and so not methods: `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]`
@@ -3596,6 +3622,7 @@ Presenting runs on the runtime's own device; nothing is exported or imported.
| `bresenhamLines` | `VkPhysicalDeviceLineRasterizationFeaturesEXT` | a line drawn by Metal's rule, the pixels whose diamond it exits (`VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT`), where Vulkan's default rule is the device's own: the rectangle of the line's width on a device whose `strictLines` is set (lavapipe, NVIDIA's driver); Vulkan 1.4 requires it |
| `fullDrawIndexUint32` | `VkPhysicalDeviceFeatures` | an indexed draw's 32-bit indices past `2^24 - 1`; Vulkan 1.4 and Roadmap 2022 require it |
| `depthBiasClamp` | `VkPhysicalDeviceFeatures` | a depth bias's clamp (`set_depth_bias`), the device's own; Vulkan 1.4 and Roadmap 2022 require it |
| `drawIndirectFirstInstance` | `VkPhysicalDeviceFeatures` | an indirect draw's base instance, which the GPU reads from Metal's arguments; Vulkan 1.4 requires it |
| `shaderClipDistance` | `VkPhysicalDeviceFeatures` | a vertex or post-tessellation vertex function's `[[clip_distance]]` |
| `tessellationShader` | `VkPhysicalDeviceFeatures` | a post-tessellation vertex function's patches, drawn through the device's tessellator |
| `shaderTessellationAndGeometryPointSize` | `VkPhysicalDeviceFeatures` | a post-tessellation vertex function's `[[point_size]]`; without it the device draws every such point at size 1 |
+7 -5
View File
@@ -374,11 +374,12 @@ pub enum Refusal {
/// The state's `maxTotalThreadsPerThreadgroup`.
max: u32,
},
/// An indirect dispatch's argument offset that is not a multiple of 4, or that leaves fewer
/// than 12 bytes (three 32-bit counts) in the buffer.
/// An indirect dispatch's or draw's argument offset that is not a multiple of 4, or that leaves
/// fewer than the arguments' bytes in the buffer: 12 for a dispatch (three 32-bit counts), 20
/// for an indexed draw, 16 for another draw.
///
/// Basis: ours (`vkCmdDispatchIndirect` reads three 32-bit counts at a 4-byte aligned offset
/// inside the buffer).
/// Basis: ours (`vkCmdDispatchIndirect`, `vkCmdDrawIndirect` and `vkCmdDrawIndexedIndirect`
/// read their 32-bit words at a 4-byte aligned offset inside the buffer).
IndirectOffset {
/// The offset asked for.
offset: u64,
@@ -1498,7 +1499,8 @@ pub enum DrawKind {
/// per instance at a rate above 1, on a device that does not report
/// `supportsNonZeroFirstInstance`: Vulkan's divisor takes `firstInstance` 0 alone there
/// (VUID-vkCmdDraw-pNext-09461). Metal counts the step from any base instance. The same
/// draw from base instance 0 runs.
/// draw from base instance 0 runs; an indirect draw through such a state, whose base instance
/// the GPU reads, is refused alike.
DividedBaseInstance,
/// A draw of patches through a patch index buffer (`drawPatches:`'s `patchIndexBuffer`), which
/// no replay stream's patch draws name: the control stage takes each patch's index from its
+4
View File
@@ -439,6 +439,10 @@ pub(crate) const REQUIRED: &[Feature] = &[
// A depth bias's clamp (`setDepthBias:slopeScale:clamp:`), the device's own, set as dynamic
// state. Vulkan 1.4 and Roadmap 2022 require it of every device.
feature!(core.depth_bias_clamp),
// An indirect draw's base instance, which the GPU reads from Metal's arguments as Vulkan's
// `firstInstance`; without it Vulkan takes 0 alone there. Vulkan 1.4 requires it of every
// device.
feature!(core.draw_indirect_first_instance),
// A vertex or post-tessellation vertex function's `[[clip_distance]]`, the device's own
// clipping. Every floor driver reports it.
feature!(core.shader_clip_distance => ShaderClipDistance),
+215 -45
View File
@@ -501,6 +501,25 @@ enum Call<'a> {
},
/// A draw of patches: each patch one vertex of a patch list, at its position.
Patches { patch_start: u32, patch_count: u32 },
/// A draw whose counts and starts the GPU reads from `arguments` at `offset`, each Metal's
/// layout Vulkan's indirect command's too: `MTLDrawIndexedPrimitivesIndirectArguments` where it
/// has `indices`, `MTLDrawPatchIndirectArguments` where `patches` (each patch one vertex, as a
/// direct patch draw's), else `MTLDrawPrimitivesIndirectArguments`.
Indirect {
arguments: &'a Buffer,
offset: u64,
indices: Option<IndexBuffer<'a>>,
patches: bool,
},
}
/// The bytes of a draw's indirect arguments: `VkDrawIndexedIndirectCommand`'s 20 for an indexed
/// draw, `VkDrawIndirectCommand`'s 16 for another.
fn indirect_bytes(indexed: bool) -> u64 {
match indexed {
true => 20,
false => 16,
}
}
/// A render encoder's `use_resource` declarations.
@@ -533,16 +552,16 @@ struct Declarations {
/// winding, a depth-stencil state's depth and stencil tests, the depth bias without a clamp, the
/// stencil references, the blend color, the line width (lines drawn at 1 alone: a draw of lines
/// at another width is [`DrawKind::LineWidth`]), the store actions an encoder sets for an
/// attachment whose pass left them unknown, memory barriers, fences, direct draws of points, lines
/// and triangles, indexed or not, direct draws of patches with a tessellation factor buffer, and the `Disabled`
/// visibility result mode (`Boolean` and `Counting` are [`DrawKind::VisibilityResults`]). Not
/// built, and so not methods: indirect draws, several viewports or scissor rectangles, the
/// triangle fill mode, the depth clip mode, `useResource:`, the store action options
/// setters, tile functions, the `setVertexBuffer:offset:attributeStride:atIndex:` family,
/// attachment whose pass left them unknown, memory barriers, fences, draws of points, lines and
/// triangles, indexed or not, draws of patches with a tessellation factor buffer, each direct or
/// indirect, and the `Disabled` visibility result mode (`Boolean` and `Counting` are
/// [`DrawKind::VisibilityResults`]). Not built, and so not methods: several viewports or scissor
/// rectangles, the triangle fill mode, the depth clip mode, the store action options setters,
/// tile functions, the `setVertexBuffer:offset:attributeStride:atIndex:` family,
/// `setTessellationFactorScale:` (read by a pipeline that enables the scale, which is refused),
/// and indexed patch draws (`drawIndexedPatches:`, read by a pipeline of a control-point index
/// type, which is refused). A draw of what the runtime does not
/// build is [`Gap::Draw`], naming its [`DrawKind`].
/// type, which is refused). A draw of what the runtime does not build is [`Gap::Draw`], naming
/// its [`DrawKind`].
///
/// Owned: one thread encodes at a time. Dropping it ends it, as
/// [`end_encoding`](Self::end_encoding) does.
@@ -1737,12 +1756,31 @@ impl RenderCommandEncoder {
vertex_start,
vertex_count,
};
self.draw(
primitives(primitive_type),
call,
instance_count,
base_instance,
)
let instances = Some([instance_count, base_instance]);
self.draw(primitives(primitive_type), call, instances)
}
/// `drawPrimitives:indirectBuffer:indirectBufferOffset:`: one `vkCmdDrawIndirect` on the
/// buffer at `indirect_buffer_offset`, whose `MTLDrawPrimitivesIndirectArguments` (vertex
/// count, instance count, vertex start, base instance) the GPU reads as Vulkan's own
/// command. The buffer counts as a read, and the command buffer keeps it until it retires. The
/// runtime never reads the counts: a draw of no vertices or no instances is recorded and draws
/// nothing.
///
/// Err: as [`draw_primitives`](Self::draw_primitives); [`Refusal::OtherDevice`] for another
/// device's buffer; [`Refusal::IndirectOffset`] for an offset not a multiple of 4 or without
/// 16 bytes after it in the buffer; [`Refusal::ArgumentPlace`] for arguments at a byte of the
/// buffer's block's allocation that is not a multiple of 4; [`Gap::Draw`] of
/// [`DrawKind::DividedBaseInstance`] for a state whose base instance the device takes as 0
/// alone.
pub fn draw_primitives_indirect(
&mut self,
primitive_type: PrimitiveType,
indirect_buffer: &Buffer,
indirect_buffer_offset: u64,
) -> Result<(), Error> {
let call = self.indirect(indirect_buffer, indirect_buffer_offset, None, false)?;
self.draw(primitives(primitive_type), call, None)
}
/// `drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:`
@@ -1769,12 +1807,37 @@ impl RenderCommandEncoder {
indices,
base_vertex,
};
self.draw(
primitives(primitive_type),
call,
instance_count,
base_instance,
)
let instances = Some([instance_count, base_instance]);
self.draw(primitives(primitive_type), call, instances)
}
/// `drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:`,
/// its index buffer arguments in `indices`: one `vkCmdDrawIndexedIndirect` on the buffer at
/// `indirect_buffer_offset`, whose `MTLDrawIndexedPrimitivesIndirectArguments` (index count,
/// instance count, index start, base vertex, base instance) the GPU reads as Vulkan's own
/// command. Both buffers count as reads, and the command buffer keeps them until it retires.
/// A strip restarts at the all-ones index, as Metal's. The runtime never reads the counts: an
/// index count past the buffer's end reads what Vulkan's index fetch reads there.
///
/// Err: as [`draw_primitives_indirect`](Self::draw_primitives_indirect), 20 bytes the
/// arguments; [`Refusal::OtherDevice`] for another device's index buffer;
/// [`Refusal::IndexBufferOffset`] for an offset not a multiple of the index size or at or
/// past the buffer's end; [`Refusal::ArgumentPlace`] for indices at a byte of the buffer's block's
/// allocation that is not a multiple of the index size.
pub fn draw_indexed_primitives_indirect(
&mut self,
primitive_type: PrimitiveType,
indices: IndexBuffer<'_>,
indirect_buffer: &Buffer,
indirect_buffer_offset: u64,
) -> Result<(), Error> {
let call = self.indirect(
indirect_buffer,
indirect_buffer_offset,
Some(indices),
false,
)?;
self.draw(primitives(primitive_type), call, None)
}
/// `setTessellationFactorBuffer:offset:instanceStride:`. `None` unbinds it. A draw of
@@ -1851,16 +1914,76 @@ impl RenderCommandEncoder {
patch_count,
};
let patches = (vk::PrimitiveTopology::PATCH_LIST, false);
self.draw(patches, call, instance_count, base_instance)
self.draw(patches, call, Some([instance_count, base_instance]))
}
/// A draw of `call` at `topology`, with primitive restart or not.
/// `drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:`,
/// with a pipeline state whose vertex function is post-tessellation: one `vkCmdDrawIndirect`
/// on the buffer at `indirect_buffer_offset`, whose `MTLDrawPatchIndirectArguments` (patch
/// count, instance count, patch start, base instance) the GPU reads as Vulkan's own command,
/// each patch one vertex of the state's patch list as in
/// [`draw_patches`](Self::draw_patches), so Metal's patch count is the draw's vertex count
/// unchanged. The buffer counts as a read, and the command buffer keeps it until it retires.
///
/// Err: as [`draw_patches`](Self::draw_patches) and
/// [`draw_primitives_indirect`](Self::draw_primitives_indirect).
pub fn draw_patches_indirect(
&mut self,
number_of_patch_control_points: u32,
patch_index_buffer: Option<(&Buffer, u64)>,
indirect_buffer: &Buffer,
indirect_buffer_offset: u64,
) -> Result<(), Error> {
let _ = number_of_patch_control_points;
if patch_index_buffer.is_some() {
return Err(Error::Unsupported(Gap::Draw {
kind: DrawKind::PatchIndexBuffer,
}));
}
let call = self.indirect(indirect_buffer, indirect_buffer_offset, None, true)?;
let patches = (vk::PrimitiveTopology::PATCH_LIST, false);
self.draw(patches, call, None)
}
/// An indirect draw's call: its arguments `offset` into `arguments`, checked as
/// [`draw_primitives_indirect`](Self::draw_primitives_indirect) says.
fn indirect<'a>(
&self,
arguments: &'a Buffer,
offset: u64,
indices: Option<IndexBuffer<'a>>,
patches: bool,
) -> Result<Call<'a>, Error> {
if !arguments.is_of(&self.core) {
return Err(Error::Refused(Refusal::OtherDevice));
}
let bytes = indirect_bytes(indices.is_some());
let length = arguments.length();
if offset % 4 != 0 || offset.checked_add(bytes).is_none_or(|end| end > length) {
return Err(Error::Refused(Refusal::IndirectOffset { offset, length }));
}
let place = arguments.device_range().1 + offset;
if !place.is_multiple_of(4) {
return Err(Error::Refused(Refusal::ArgumentPlace {
place,
alignment: 4,
}));
}
Ok(Call::Indirect {
arguments,
offset,
indices,
patches,
})
}
/// A draw of `call` at `topology`, with primitive restart or not, of `instances` (the count
/// and the base instance) where the call is direct.
fn draw(
&mut self,
(topology, restart): (vk::PrimitiveTopology, bool),
call: Call<'_>,
instance_count: u32,
base_instance: u32,
instances: Option<[u32; 2]>,
) -> Result<(), Error> {
let Some(state) = &self.pipeline else {
return Err(Error::Refused(Refusal::NoPipeline));
@@ -1869,7 +1992,11 @@ impl RenderCommandEncoder {
let draws = &compiled.draws;
let gap = |kind| Err(Error::Unsupported(Gap::Draw { kind }));
let patches = draws.patches;
if patches != matches!(call, Call::Patches { .. }) {
let patch_call = matches!(
call,
Call::Patches { .. } | Call::Indirect { patches: true, .. }
);
if patches != patch_call {
return Err(Error::Refused(Refusal::PatchDraw));
}
if patches && self.factors.is_none() {
@@ -1881,19 +2008,28 @@ impl RenderCommandEncoder {
if self.tests.stencil && self.pass.stencil.is_none() {
return Err(Error::Refused(Refusal::StencilAttachment));
}
// The index buffer: its `VkBuffer`, the offset there, and the index type.
let index = match call {
// The index buffer: its `VkBuffer`, the offset there, and the index type. An indirect
// draw's count is the GPU's, so its indices are checked to start inside the buffer: one
// index there.
let indexed = match call {
Call::Direct { .. } | Call::Patches { .. } => None,
Call::Indexed {
index_count,
indices:
IndexBuffer {
buffer,
offset,
index_type,
},
indices,
..
} => {
} => Some((indices, index_count)),
Call::Indirect { indices, .. } => indices.map(|indices| (indices, 1)),
};
let index = match indexed {
None => None,
Some((
IndexBuffer {
buffer,
offset,
index_type,
},
index_count,
)) => {
if !buffer.is_of(&self.core) {
return Err(Error::Refused(Refusal::OtherDevice));
}
@@ -1967,14 +2103,17 @@ impl RenderCommandEncoder {
self.facts.held = true;
}
let count = match call {
Call::Direct { vertex_count, .. } => vertex_count,
Call::Indexed { index_count, .. } => index_count,
Call::Patches { patch_count, .. } => patch_count,
Call::Direct { vertex_count, .. } => Some(vertex_count),
Call::Indexed { index_count, .. } => Some(index_count),
Call::Patches { patch_count, .. } => Some(patch_count),
Call::Indirect { .. } => None,
};
if count == 0 || instance_count == 0 {
let [instance_count, base_instance] = instances.unwrap_or([1, 0]);
if count == Some(0) || instance_count == 0 {
return Ok(());
}
if draws.first_instance_zero && base_instance != 0 {
// An indirect draw's base instance is the GPU's to read.
if draws.first_instance_zero && (instances.is_none() || base_instance != 0) {
return gap(DrawKind::DividedBaseInstance);
}
let lines = matches!(
@@ -1997,7 +2136,12 @@ impl RenderCommandEncoder {
// reached through an address outside its resources, or buffers read while such a texture
// the segment used has its image ahead of its buffer.
let index_buffer = index.map(|(buffer, ..)| buffer);
// A patch draw's factor buffer is its read as an index buffer is an indexed draw's.
// An indirect draw's arguments, and a patch draw's factor buffer, are its reads as an
// index buffer is an indexed draw's.
let arguments = match call {
Call::Indirect { arguments, .. } => Some(arguments),
_ => None,
};
let factors = (self.factors.as_ref()).filter(|_| patches);
let overs = building.copies_over()
&& (draws.reads_unbound
@@ -2008,10 +2152,11 @@ impl RenderCommandEncoder {
let each = reads.is_some()
|| self.facts.managed
|| index_buffer.is_some_and(|buffer| buffer.managed_overs().is_some())
|| arguments.is_some_and(|buffer| buffer.managed_overs().is_some())
|| factors.is_some_and(|(buffer, _)| buffer.managed_overs().is_some())
|| overs;
match each {
true => self.draw_reaches(reads, index_buffer, overs)?,
true => self.draw_reaches(reads, [index_buffer, arguments], overs)?,
false => {
if !self.shadow_slots.is_empty() {
self.shadow_slots.clear();
@@ -2026,6 +2171,9 @@ impl RenderCommandEncoder {
if self.facts.host {
building.wrote_host();
}
if let Some(arguments) = arguments {
building.keep(arguments);
}
self.wrote |= writes_memory;
(self.drew, self.pass_drew) = (true, true);
let (bind, first) = building.bind_graphics(pipeline);
@@ -2142,6 +2290,28 @@ impl RenderCommandEncoder {
patch_start,
base_instance,
),
(
Call::Indirect {
arguments, offset, ..
},
index,
) => {
let (reached, at) = arguments.device_range();
let stride = indirect_bytes(index.is_some()) as u32;
match index {
Some((_, buffer, index_offset, ty)) => {
device.cmd_bind_index_buffer(command, buffer, index_offset, ty);
device.cmd_draw_indexed_indirect(
command,
reached,
at + offset,
1,
stride,
);
}
None => device.cmd_draw_indirect(command, reached, at + offset, 1, stride),
}
}
(Call::Indexed { .. }, None) => {}
}
}
@@ -2298,12 +2468,12 @@ impl RenderCommandEncoder {
/// hold copied; then the copies it needs first, its textures over a buffer in an image of
/// their own (`crate::over`), where `overs`, and the textures over a Managed buffer's device
/// copy it reaches (`crate::over::ManagedOvers`), each recorded between the rendering's end
/// and its new beginning. `index` is its index buffer; a patch draw reads the tessellation
/// factor buffer as such.
/// and its new beginning. `index` is its index buffer and its indirect arguments' buffer; a
/// patch draw reads the tessellation factor buffer as such.
fn draw_reaches(
&mut self,
reads: Option<AttachmentReads>,
index: Option<&Buffer>,
index: [Option<&Buffer>; 2],
overs: bool,
) -> Result<(), Error> {
let reads_attachment = match reads {
@@ -2346,7 +2516,7 @@ impl RenderCommandEncoder {
.expect("an encoder holds its command buffer's recording until it ends");
let vertex_reads = (draws.bindings.iter())
.filter_map(|&(_, index)| tables[VERTEX].buffer(index))
.chain(index.map(BufferObject::object))
.chain(index.into_iter().flatten().map(BufferObject::object))
.chain(factors);
let copies = match overs {
false => over::Copies::default(),
+90 -7
View File
@@ -2176,13 +2176,27 @@ define internal void @_GLOBAL__sub_I_() section "air.static_init" {
d
}
/// Two instances of `state`'s triangle ([`marked`]), drawn from vertex 1 at `base_instance`
/// over the marks `0xA0` to `0xA3`: each texel's four words, or the draw's error.
/// How [`two_instances`] draws its instances. An indirect draw's arguments are copied into
/// place, 16 bytes into their buffer, by a blit earlier in its command buffer.
#[derive(Clone, Copy, PartialEq, Eq)]
enum Drawn {
/// `draw_primitives` of two instances.
Direct,
/// `draw_primitives_indirect`, of `count` instances.
Indirect { count: u32 },
/// `draw_indexed_primitives_indirect` of two instances: index 1 on of 16-bit indices
/// `[7, 0, 1, 2]`, at base vertex 1.
IndexedIndirect,
}
/// Instances of `state`'s triangle ([`marked`]), drawn from vertex 1 at `base_instance` over
/// the marks `0xA0` to `0xA3`, as `drawn` says: each texel's four words, or the draw's error.
fn two_instances(
name: &str,
device: &Device,
state: &RenderPipelineState,
base_instance: u32,
drawn: Drawn,
) -> Result<Vec<[u32; 4]>, Error> {
// `ima_vertex` maps pixel positions to clip space by the frame's width and height and
// moves instance `iid` down `iid` rows of the frame's row stride, 4. Vertices 1 to 3 are a
@@ -2211,14 +2225,44 @@ define internal void @_GLOBAL__sub_I_() section "air.static_init" {
let color = target(device, PixelFormat::RGBA32Uint, TextureUsage::RENDER_TARGET);
let queue = device.new_command_queue(4).expect("a queue");
let command_buffer = queue.command_buffer().expect("a command buffer");
let draw = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}"));
// The indirect arguments: Metal's words, written by the host into one buffer and copied
// by the GPU into another, which the draw reads.
let words: Vec<u32> = match drawn {
Drawn::Direct => Vec::new(),
Drawn::Indirect { count } => vec![3, count, 1, base_instance],
Drawn::IndexedIndirect => vec![3, 2, 1, 1, base_instance],
};
let bytes: Vec<u8> = words.iter().flat_map(|w| w.to_le_bytes()).collect();
let indices = buffers.of(device, &[7u16, 0, 1, 2].map(u16::to_le_bytes).concat());
let arguments = buffers.of(device, &[0xee; 40]);
if !bytes.is_empty() {
let source = buffers.of(device, &bytes);
let mut blit = (command_buffer.blit_command_encoder())
.unwrap_or_else(|error| panic!("{name}: {error}"));
let size = bytes.len() as u64;
draw(blit.copy_from_buffer_to_buffer(&source, 0, &arguments, 16, size));
blit.end_encoding();
}
let mut encoder = (command_buffer.render_command_encoder(&pass(&color, None)))
.unwrap_or_else(|error| panic!("{name}: {error}"));
let draw = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}"));
draw(encoder.set_render_pipeline_state(state));
draw(encoder.set_vertex_buffer(Some(&xy), 0, 0));
draw(encoder.set_vertex_buffer(Some(&mark), 0, 1));
draw(encoder.set_vertex_bytes(&frame, 2));
let drawn = encoder.draw_primitives(PrimitiveType::Triangle, 1, 3, 2, base_instance);
let triangle = PrimitiveType::Triangle;
let drawn = match drawn {
Drawn::Direct => encoder.draw_primitives(triangle, 1, 3, 2, base_instance),
Drawn::Indirect { .. } => encoder.draw_primitives_indirect(triangle, &arguments, 16),
Drawn::IndexedIndirect => {
let indices = IndexBuffer {
buffer: &indices,
offset: 0,
index_type: IndexType::UInt16,
};
encoder.draw_indexed_primitives_indirect(triangle, indices, &arguments, 16)
}
};
encoder.end_encoding();
run(name, &command_buffer);
drawn?;
@@ -2254,7 +2298,7 @@ define internal void @_GLOBAL__sub_I_() section "air.static_init" {
let d = marked(&library, VertexStepFunction::Constant, 0);
each_device("draw_constant_step", |name, _, device| {
let state = state(name, &device, &d);
let texels = two_instances(name, &device, &state, 1)
let texels = two_instances(name, &device, &state, 1, Drawn::Direct)
.unwrap_or_else(|error| panic!("{name}: {error}"));
for (at, words) in texels.iter().enumerate() {
assert_eq!(
@@ -2267,6 +2311,45 @@ define internal void @_GLOBAL__sub_I_() section "air.static_init" {
});
}
/// An indirect draw reads Metal's arguments from its buffer as Vulkan's own command, after a
/// blit earlier in the command buffer wrote them: the constant-step triangle of
/// [`every_device_fetches_a_constant_step_attribute_for_every_vertex_and_instance`], drawn
/// from `MTLDrawPrimitivesIndirectArguments` of vertex start 1, two instances and base
/// instance 1, and from `MTLDrawIndexedPrimitivesIndirectArguments` of three indices from
/// index 1 (`[0, 1, 2]`), base vertex 1, two instances and base instance 1, fills every texel
/// as the direct draw does: the vertex ID 1, and the instance 1 in the upper half and 2 in
/// the lower, the base instance the device's own (`drawIndirectFirstInstance`). Arguments of
/// no instances draw nothing, every texel the clear.
#[test]
fn every_device_draws_from_indirect_arguments_a_blit_wrote() {
let Some(library) = library(&engine_dir().join("icb_merged_attributes.ll")) else {
return;
};
let d = marked(&library, VertexStepFunction::Constant, 0);
each_device("draw_indirect", |name, _, device| {
let state = state(name, &device, &d);
for drawn in [Drawn::Indirect { count: 2 }, Drawn::IndexedIndirect] {
let texels = two_instances(name, &device, &state, 1, drawn)
.unwrap_or_else(|error| panic!("{name}: {error}"));
for (at, words) in texels.iter().enumerate() {
let want = [0xA0, 1, upper_or_lower(at), 1];
let indexed = drawn == Drawn::IndexedIndirect;
assert_eq!(*words, want, "{name}: indexed {indexed}, texel {at}");
}
}
let none = two_instances(name, &device, &state, 1, Drawn::Indirect { count: 0 })
.unwrap_or_else(|error| panic!("{name}: {error}"));
assert!(
none.iter().all(|words| *words == [0, 0, 0, 1]),
"{name}: no instances"
);
println!(
"{name}: indirect and indexed indirect draws of instances 1 and 2 as the direct \
draw's; no instances drew nothing"
);
});
}
/// Metal's per-instance step at rate 2 fetches one element for every two instances, counted
/// from the draw's base instance (the conformance case `vertex-step-rate-instances`): a
/// binding's divisor where the device has the step rates (Floor, Step rates).
@@ -2306,12 +2389,12 @@ define internal void @_GLOBAL__sub_I_() section "air.static_init" {
Err(other) => panic!("{name}: {other}"),
};
assert!(divides, "{name}: a step rate of 2 made a state");
let from_zero = two_instances(name, &device, &state, 0)
let from_zero = two_instances(name, &device, &state, 0, Drawn::Direct)
.unwrap_or_else(|error| panic!("{name}: from base instance 0: {error}"));
for (at, words) in from_zero.iter().enumerate() {
assert_eq!(*words, [0xA0, 1, 1, 1], "{name}: from 0: texel {at}");
}
match two_instances(name, &device, &state, 1) {
match two_instances(name, &device, &state, 1, Drawn::Direct) {
Ok(texels) => {
assert!(nonzero, "{name}: a base instance of 1 drew");
for (at, words) in texels.iter().enumerate() {
@@ -64,6 +64,7 @@ fn at_the_floor() -> Queried {
features.core.logic_op = vk::TRUE;
features.core.full_draw_index_uint32 = vk::TRUE;
features.core.depth_bias_clamp = vk::TRUE;
features.core.draw_indirect_first_instance = vk::TRUE;
features.core.shader_clip_distance = vk::TRUE;
features.core.shader_tessellation_and_geometry_point_size = vk::TRUE;
features.core.large_points = vk::TRUE;
@@ -370,7 +371,7 @@ fn each_missing_feature_is_named() {
const CORE: &str = "VkPhysicalDeviceFeatures";
const ROBUSTNESS2: &str = "VkPhysicalDeviceRobustness2FeaturesEXT";
type Clear = fn(&mut Features);
let cases: [(Clear, Missing); 54] = [
let cases: [(Clear, Missing); 55] = [
(
|f| f.vulkan12.buffer_device_address = vk::FALSE,
feature(V12, "bufferDeviceAddress"),
@@ -570,6 +571,10 @@ fn each_missing_feature_is_named() {
|f| f.core.depth_bias_clamp = vk::FALSE,
feature(CORE, "depthBiasClamp"),
),
(
|f| f.core.draw_indirect_first_instance = vk::FALSE,
feature(CORE, "drawIndirectFirstInstance"),
),
(
|f| f.core.shader_clip_distance = vk::FALSE,
feature(CORE, "shaderClipDistance"),
@@ -452,6 +452,60 @@ BUFFER_META"#;
});
}
/// `drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:`
/// reads `MTLDrawPatchIndirectArguments` (two patches from patch 0, one instance, base
/// instance 0), 4 bytes into its buffer, as `vkCmdDrawIndirect`'s command, the patch count
/// the draw's vertex count: the patches draw as
/// [`every_device_draws_patches_from_their_factors`]'s. Through a patch index buffer the draw
/// is `DrawKind::PatchIndexBuffer`, as a direct one's.
#[test]
fn every_device_draws_patches_from_indirect_arguments() {
let Some(libraries) = libraries() else {
return;
};
let d = patches(&libraries);
each_device("draw_patches_indirect", |name, _, device| {
let state = state(name, &device, &d);
let mut buffers = Buffers::new(&device);
let (points, tints, factors) = patch_buffers(&device, &mut buffers);
let words: Vec<u8> = [0xeeee_eeee_u32, 2, 1, 0, 0]
.iter()
.flat_map(|w| w.to_le_bytes())
.collect();
let arguments = buffers.of(&device, &words);
let color = target(
&device,
PixelFormat::RGBA8Unorm,
TextureUsage::RENDER_TARGET,
);
let queue = device.new_command_queue(4).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 draw = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}"));
draw(encoder.set_render_pipeline_state(&state));
draw(encoder.set_vertex_buffer(Some(&points), 0, 0));
draw(encoder.set_vertex_buffer(Some(&tints), 0, 1));
draw(encoder.set_tessellation_factor_buffer(Some(&factors), 8, 0));
let indexed = encoder.draw_patches_indirect(3, Some((&factors, 0)), &arguments, 4);
assert!(
matches!(
indexed,
Err(Error::Unsupported(Gap::Draw {
kind: DrawKind::PatchIndexBuffer,
}))
),
"{name}: a patch index buffer: {indexed:?}"
);
draw(encoder.draw_patches_indirect(3, None, &arguments, 4));
encoder.end_encoding();
run(name, &command_buffer);
let want = texels(|_, y| if y < 4 { GREEN } else { BLACK });
assert_eq!(read(&color, 4), want, "{name}: the texels");
println!("{name}: two patches drawn from indirect arguments, the second culled");
});
}
/// A post-tessellation function whose fields pass its push window ([`wide_vertex`]) spills
/// the rest into its parameter block, which each draw writes into the ring and the function
/// reads: the pipeline's control stage, whose fields the translator states as a second
@@ -1140,6 +1140,7 @@
"logicOp": true,
"fullDrawIndexUint32": true,
"depthBiasClamp": true,
"drawIndirectFirstInstance": true,
"shaderClipDistance": true,
"tessellationShader": true,
"shaderTessellationAndGeometryPointSize": true,
@@ -6657,8 +6657,11 @@ method metal2vulkan-runtime::PixelFormatInfo::describes_a_format pub fn describe
method metal2vulkan-runtime::PrecisionNote::of_float_operator pub fn of_float_operator(op: AirBin, width: FloatWidth, fmf: FastMath, p: &DeviceProfile) -> Option<BTreeSet<PrecisionNote>>
method metal2vulkan-runtime::PrecisionNote::of_math_call pub fn of_math_call(call: Math, fmf: FastMath, p: &DeviceProfile) -> Option<BTreeSet<PrecisionNote>>
method metal2vulkan-runtime::RenderCommandEncoder::draw_indexed_primitives pub fn draw_indexed_primitives(&mut self, primitive_type: PrimitiveType, index_count: u32, indices: IndexBuffer<'_>, instance_count: u32, base_vertex: i32, base_instance: u32) -> Result<(), Error>
method metal2vulkan-runtime::RenderCommandEncoder::draw_indexed_primitives_indirect pub fn draw_indexed_primitives_indirect(&mut self, primitive_type: PrimitiveType, indices: IndexBuffer<'_>, indirect_buffer: &Buffer, indirect_buffer_offset: u64) -> Result<(), Error>
method metal2vulkan-runtime::RenderCommandEncoder::draw_patches pub fn draw_patches(&mut self, number_of_patch_control_points: u32, patch_start: u32, patch_count: u32, patch_index_buffer: Option<(&Buffer, u64)>, instance_count: u32, base_instance: u32) -> Result<(), Error>
method metal2vulkan-runtime::RenderCommandEncoder::draw_patches_indirect pub fn draw_patches_indirect(&mut self, number_of_patch_control_points: u32, patch_index_buffer: Option<(&Buffer, u64)>, indirect_buffer: &Buffer, indirect_buffer_offset: u64) -> Result<(), Error>
method metal2vulkan-runtime::RenderCommandEncoder::draw_primitives pub fn draw_primitives(&mut self, primitive_type: PrimitiveType, vertex_start: u32, vertex_count: u32, instance_count: u32, base_instance: u32) -> Result<(), Error>
method metal2vulkan-runtime::RenderCommandEncoder::draw_primitives_indirect pub fn draw_primitives_indirect(&mut self, primitive_type: PrimitiveType, indirect_buffer: &Buffer, indirect_buffer_offset: u64) -> Result<(), Error>
method metal2vulkan-runtime::RenderCommandEncoder::end_encoding pub fn end_encoding(mut self)
method metal2vulkan-runtime::RenderCommandEncoder::memory_barrier pub fn memory_barrier(&mut self) -> Result<(), Error>
method metal2vulkan-runtime::RenderCommandEncoder::set_alpha_test_reference_value pub fn set_alpha_test_reference_value(&mut self, value: f32)
Can't render this file because it is too large.
+7 -7
View File
@@ -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 | 598 | 27 |
| missing | 1113 | 36 |
| implemented | 601 | 27 |
| missing | 1110 | 36 |
| out of scope | 424 | 5 |
| all | 2135 | 68 |
Implemented by the runtime: 242; by the translator's values: 356. Missing by size: S 187, M 208, L 342, XL 376.
Implemented by the runtime: 245; by the translator's values: 356. Missing by size: S 187, M 205, 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 heap uses) | S/M/L | 32 | `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 | 29 | `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`, ... |
@@ -2092,15 +2092,15 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app
| `MTLRenderCommandEncoder.drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:` | method | implemented | `RenderCommandEncoder::draw_indexed_primitives` (runtime) |
| `MTLRenderCommandEncoder.drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance:` | method | implemented | `RenderCommandEncoder::draw_primitives` (runtime) |
| `MTLRenderCommandEncoder.drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:` | method | implemented | `RenderCommandEncoder::draw_indexed_primitives` (runtime) |
| `MTLRenderCommandEncoder.drawPrimitives:indirectBuffer:indirectBufferOffset:` | method | missing | M: indirect draws |
| `MTLRenderCommandEncoder.drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:` | method | missing | M: indirect draws |
| `MTLRenderCommandEncoder.drawPrimitives:indirectBuffer:indirectBufferOffset:` | method | implemented | `RenderCommandEncoder::draw_primitives_indirect` (runtime) |
| `MTLRenderCommandEncoder.drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:` | method | implemented | `RenderCommandEncoder::draw_indexed_primitives_indirect` (runtime) |
| `MTLRenderCommandEncoder.textureBarrier` (deprecated) | method | missing | S: deprecated; Metal states it as `memoryBarrierWithScope:` of textures from fragment to fragment, which the runtime has |
| `MTLRenderCommandEncoder.updateFence:afterStages:` | method | implemented | `RenderCommandEncoder::update_fence` (runtime) |
| `MTLRenderCommandEncoder.waitForFence:beforeStages:` | method | implemented | `RenderCommandEncoder::wait_for_fence` (runtime) |
| `MTLRenderCommandEncoder.setTessellationFactorBuffer:offset:instanceStride:` | method | implemented | `RenderCommandEncoder::set_tessellation_factor_buffer` (runtime) |
| `MTLRenderCommandEncoder.setTessellationFactorScale:` | method | missing | S: a tessellation factor scale; a state that enables one is refused (`RenderPipelineKind::Tessellation`) |
| `MTLRenderCommandEncoder.drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:` | method | implemented | `RenderCommandEncoder::draw_patches` (runtime) |
| `MTLRenderCommandEncoder.drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:` | method | missing | M: indirect draws |
| `MTLRenderCommandEncoder.drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:` | method | implemented | `RenderCommandEncoder::draw_patches_indirect` (runtime): without a patch index buffer |
| `MTLRenderCommandEncoder.drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:` | method | missing | M: patches through a control-point index buffer |
| `MTLRenderCommandEncoder.drawIndexedPatches:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:indirectBuffer:indirectBufferOffset:` | method | missing | M: patches through a control-point index buffer, drawn indirectly |
| `MTLRenderCommandEncoder.tileWidth` | property | missing | L: tile render pipelines; metal2vulkan-runtime makes none |
+8 -8
View File
@@ -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 | 32: `crates/metal2vulkan-runtime/src/blit.rs (buffer_copy)`, `crates/metal2vulkan-runtime/src/blit.rs (copy_from_buffer_to_buffer)` (+27) | `-` |
| `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 | 33: `crates/metal2vulkan-runtime/src/blit.rs (buffer_copy)`, `crates/metal2vulkan-runtime/src/blit.rs (copy_from_buffer_to_buffer)` (+28) | `-` |
| `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) | `-` |
@@ -285,7 +285,7 @@ Columns:
| `SamplerIds` | A consumer's answer to `Device::new_compute_pipeline_state`'s numbered samplers with another count of indices | every device (a public call's own check of its arguments) | `ours`: each numbered sampler takes one index | 1: `crates/metal2vulkan-runtime/src/pipeline.rs (number_samplers)` | `-` |
| `NoBufferAtIndex` | `setBufferOffset` at an index where no buffer is bound, or a draw whose vertex descriptor reads a vertex buffer index where none is bound | every device (a public call's own check of its arguments) | `ours`: there is no buffer whose offset to change, and none whose vertices the draw reads; Metal's validation stops such a draw | 3: `crates/metal2vulkan-runtime/src/encoder.rs (set_buffer_offset)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (find)` (+1) | `-` |
| `ThreadgroupSize` | A threadgroup of no threads, or of more than Metal's `maxTotalThreadsPerThreadgroup` for the kernel (a required size's threads, where the... | every device (a public call's own check of its arguments) | `metal-documented`: a threadgroup's threads total at most the state's `maxTotalThreadsPerThreadgroup` | 2: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`, `crates/metal2vulkan-runtime/src/encoder.rs (size_checked)` | `-` |
| `IndirectOffset` | An indirect dispatch's argument offset that is not a multiple of 4, or that leaves fewer than 12 bytes (three 32-bit counts) in the buffer | every device (a public call's own check of its arguments) | `ours`: `vkCmdDispatchIndirect` reads three 32-bit counts at a 4-byte aligned offset inside the buffer | 1: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)` | `-` |
| `IndirectOffset` | An indirect dispatch's or draw's argument offset that is not a multiple of 4, or that leaves fewer than the arguments' bytes in the buffer | every device (a public call's own check of its arguments) | `ours`: `vkCmdDispatchIndirect`, `vkCmdDrawIndirect` and `vkCmdDrawIndexedIndirect` read their 32-bit words at a 4-byte aligned offset inside the buffer | 2: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (indirect)` | `-` |
| `BufferOffsetAlignment` | A dispatch whose kernel, or a draw whose vertex or fragment function, reaches a buffer bound where its address, the buffer's `gpuAddress` plus the... | every device (a public call's own check of its arguments) | `metal-documented`: Metal's API validation refuses the bind offset: "must be a multiple of 4 but was set to 2" for a `uint *` argument bound at offset 2, an Apple M3 Max, macOS 27.0.1, `probes/vector_access_placement.m` in the conformance crate | 1: `crates/metal2vulkan-runtime/src/encoder.rs (check_alignment)` | `-` |
| `IndicesGranted` | A grant of an index already granted (`Device::grant_indices`) | every device (a public call's own check of its arguments) | `ours`: each index has one grant, so each resource ID names one object | 1: `crates/metal2vulkan-runtime/src/arrays.rs (grant)` | `-` |
| `IndicesNotGranted` | A texture, a sampler state or a pipeline state's constexpr sampler at an index no live grant of its class holds (`Device::new_texture`,... | every device (a public call's own check of its arguments) | `ours`: an object takes an index the consumer was granted, and a grant is returned once | 2: `crates/metal2vulkan-runtime/src/arrays.rs (place)`, `crates/metal2vulkan-runtime/src/arrays.rs (release)` | `-` |
@@ -329,7 +329,7 @@ Columns:
| `VertexBufferOffset` | A draw whose vertex descriptor reads a vertex buffer at an offset at or past the buffer's length | every device (a public call's own check of its arguments) | `metal-documented`: a buffer's offset lies inside it; Metal's validation stops the bind | 1: `crates/metal2vulkan-runtime/src/render_encoder.rs (find)` | `-` |
| `IndexBufferOffset` | An indexed draw whose index buffer offset is not a multiple of the index size, or whose indices leave the buffer | every device (a public call's own check of its arguments) | `metal-documented`: the offset is a multiple of the index size and the indices lie in the buffer; Metal's validation stops the draw | 1: `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` | `-` |
| `TessellationFactorOffset` | A tessellation factor buffer whose factors, at its address plus the offset, start at an odd byte | every device (a public call's own check of its arguments) | `metal-documented`: `setTessellationFactorBuffer:offset:instanceStride:`'s offset is a multiple of 4; Metal's validation stops a patch draw with any other | 1: `crates/metal2vulkan-runtime/src/render_encoder.rs (set_tessellation_factor_buffer)` | `-` |
| `ArgumentPlace` | An indirect dispatch's arguments, or an indexed draw's indices, at a byte of the allocation the buffer's block lies in (its device copy's, for a... | every device (a public call's own check of its arguments) | `ours`: `vkCmdDispatchIndirect` reads its arguments at a multiple of 4 in the `VkBuffer`, and `vkCmdBindIndexBuffer` takes indices at a multiple of their size in the memory; a Metal buffer starts at an aligned address, so Metal's offset rule alone keeps both aligned there | 2: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` | `-` |
| `ArgumentPlace` | An indirect dispatch's arguments, or an indexed draw's indices, at a byte of the allocation the buffer's block lies in (its device copy's, for a... | every device (a public call's own check of its arguments) | `ours`: `vkCmdDispatchIndirect` reads its arguments at a multiple of 4 in the `VkBuffer`, and `vkCmdBindIndexBuffer` takes indices at a multiple of their size in the memory; a Metal buffer starts at an aligned address, so Metal's offset rule alone keeps both aligned there | 3: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` (+1) | `-` |
| `ViewportNotFinite` | A viewport with a field that is NaN or infinite (but its origin's x, which draws nothing) | every device (a public call's own check of its arguments) | `metal-measured`: an Apple M4, macOS 27.0.1: Metal's validation stops a NaN or infinite origin; the other fields are taken by the same rule | 1: `crates/metal2vulkan-runtime/src/render_encoder.rs (set_viewport)` | `-` |
| `StencilAttachment` | A draw under a depth-stencil state that tests the stencil, in a pass without a stencil attachment | every device (a public call's own check of its arguments) | `metal-measured`: an Apple M4, macOS 27.0.1: Metal's validation stops the draw; plain Metal tests it against a hidden stencil of 0 that the runtime does not keep | 1: `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` | `-` |
@@ -388,7 +388,7 @@ Columns:
| `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) | `-` |
| `Draw` | A draw or render encoder state the runtime does not build yet (`RenderCommandEncoder`) | every device (a public call's own check of its arguments) | `ours`: the replay streams draw lines and triangles through one viewport Vulkan's is, with pipeline states of their pass's formats, filled and clipped; each other kind is built when a replay stream draws one), and device for [`DrawKind::DividedBaseInstance`] (a device that does not report `supportsNonZeroFirstInstance` | 12: `crates/metal2vulkan-runtime/src/render_encoder.rs (attachment_reads, 3 sites)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` (+8) | `-` |
| `Draw` | A draw or render encoder state the runtime does not build yet (`RenderCommandEncoder`) | every device (a public call's own check of its arguments) | `ours`: the replay streams draw lines and triangles through one viewport Vulkan's is, with pipeline states of their pass's formats, filled and clipped; each other kind is built when a replay stream draws one), and device for [`DrawKind::DividedBaseInstance`] (a device that does not report `supportsNonZeroFirstInstance` | 13: `crates/metal2vulkan-runtime/src/render_encoder.rs (attachment_reads, 3 sites)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` (+9) | `-` |
| `LinearPlanePass` | A render pass over a surface plane that renders as a linear colour attachment alone, in a shape the device does not render... | at the device's limit | `device`: VK_NV_linear_color_attachment renders such a format as a colour attachment only "as long as all the color attachments in the render pass instance have VK_IMAGE_TILING_LINEAR tiling"; the RTX 3090's driver lost the device rendering a linear colour attachment beside a depth or stencil attachment | 1: `crates/metal2vulkan-runtime/src/pass.rs (check)` | `-` |
## Appendix: every site
@@ -568,7 +568,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/render_encoder.rs (use_resource, 2 sites)`; `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 (indirect)`; `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)`
@@ -581,7 +581,7 @@ Each refusal's sites, with the function that builds it.
- `rt:Refusal::SamplerIds`: `crates/metal2vulkan-runtime/src/pipeline.rs (number_samplers)`
- `rt:Refusal::NoBufferAtIndex`: `crates/metal2vulkan-runtime/src/encoder.rs (set_buffer_offset)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (find)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_buffer_offset)`
- `rt:Refusal::ThreadgroupSize`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`; `crates/metal2vulkan-runtime/src/encoder.rs (size_checked)`
- `rt:Refusal::IndirectOffset`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`
- `rt:Refusal::IndirectOffset`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (indirect)`
- `rt:Refusal::BufferOffsetAlignment`: `crates/metal2vulkan-runtime/src/encoder.rs (check_alignment)`
- `rt:Refusal::IndicesGranted`: `crates/metal2vulkan-runtime/src/arrays.rs (grant)`
- `rt:Refusal::IndicesNotGranted`: `crates/metal2vulkan-runtime/src/arrays.rs (place)`; `crates/metal2vulkan-runtime/src/arrays.rs (release)`
@@ -625,7 +625,7 @@ Each refusal's sites, with the function that builds it.
- `rt:Refusal::VertexBufferOffset`: `crates/metal2vulkan-runtime/src/render_encoder.rs (find)`
- `rt:Refusal::IndexBufferOffset`: `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`
- `rt:Refusal::TessellationFactorOffset`: `crates/metal2vulkan-runtime/src/render_encoder.rs (set_tessellation_factor_buffer)`
- `rt:Refusal::ArgumentPlace`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`
- `rt:Refusal::ArgumentPlace`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (indirect)`
- `rt:Refusal::ViewportNotFinite`: `crates/metal2vulkan-runtime/src/render_encoder.rs (set_viewport)`
- `rt:Refusal::StencilAttachment`: `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`
- `rt:Limit::BlockLen`: `crates/metal2vulkan-runtime/src/import.rs (check_len)`; `crates/metal2vulkan-runtime/src/memory.rs (round)`; `crates/metal2vulkan-runtime/src/surface.rs (copy_form)`; `crates/metal2vulkan-runtime/src/surface.rs (dma_buf_in_place)`
@@ -674,6 +674,6 @@ Each refusal's sites, with the function that builds it.
- `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)`
- `rt:Gap::Draw`: `crates/metal2vulkan-runtime/src/render_encoder.rs (attachment_reads, 3 sites)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw_patches)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_depth_clip_mode)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_scissor_rects)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_triangle_fill_mode)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_viewport)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_viewports)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_visibility_result_mode)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (shadow_copies)`
- `rt:Gap::Draw`: `crates/metal2vulkan-runtime/src/render_encoder.rs (attachment_reads, 3 sites)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw_patches)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw_patches_indirect)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_depth_clip_mode)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_scissor_rects)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_triangle_fill_mode)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_viewport)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_viewports)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_visibility_result_mode)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (shadow_copies)`
- `rt:Gap::LinearPlanePass`: `crates/metal2vulkan-runtime/src/pass.rs (check)`
+3 -3
View File
@@ -1636,15 +1636,15 @@ MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPrimitives:i
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset: I runtime RenderCommandEncoder::draw_indexed_primitives
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance: I runtime RenderCommandEncoder::draw_primitives
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance: I runtime RenderCommandEncoder::draw_indexed_primitives
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPrimitives:indirectBuffer:indirectBufferOffset: M indirect draws M encoder-calls
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset: M indirect draws M encoder-calls
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPrimitives:indirectBuffer:indirectBufferOffset: I runtime RenderCommandEncoder::draw_primitives_indirect
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset: I runtime RenderCommandEncoder::draw_indexed_primitives_indirect
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method textureBarrier yes M deprecated; Metal states it as `memoryBarrierWithScope:` of textures from fragment to fragment, which the runtime has S barriers
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method updateFence:afterStages: I runtime RenderCommandEncoder::update_fence
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method waitForFence:beforeStages: I runtime RenderCommandEncoder::wait_for_fence
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method setTessellationFactorBuffer:offset:instanceStride: I runtime RenderCommandEncoder::set_tessellation_factor_buffer
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method setTessellationFactorScale: M a tessellation factor scale; a state that enables one is refused (`RenderPipelineKind::Tessellation`) S encoder-calls
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance: I runtime RenderCommandEncoder::draw_patches
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset: M indirect draws M encoder-calls
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset: I runtime RenderCommandEncoder::draw_patches_indirect without a patch index buffer
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance: M patches through a control-point index buffer M encoder-calls
MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPatches:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:indirectBuffer:indirectBufferOffset: M patches through a control-point index buffer, drawn indirectly M encoder-calls
MTLRenderCommandEncoder.h MTLRenderCommandEncoder property tileWidth M tile render pipelines; metal2vulkan-runtime makes none L tile
1 header container kind name deprecated status crate counterpart note size group
1636 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset: I runtime RenderCommandEncoder::draw_indexed_primitives
1637 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPrimitives:vertexStart:vertexCount:instanceCount:baseInstance: I runtime RenderCommandEncoder::draw_primitives
1638 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance: I runtime RenderCommandEncoder::draw_indexed_primitives
1639 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPrimitives:indirectBuffer:indirectBufferOffset: M I runtime RenderCommandEncoder::draw_primitives_indirect indirect draws M encoder-calls
1640 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset: M I runtime RenderCommandEncoder::draw_indexed_primitives_indirect indirect draws M encoder-calls
1641 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method textureBarrier yes M deprecated; Metal states it as `memoryBarrierWithScope:` of textures from fragment to fragment, which the runtime has S barriers
1642 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method updateFence:afterStages: I runtime RenderCommandEncoder::update_fence
1643 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method waitForFence:beforeStages: I runtime RenderCommandEncoder::wait_for_fence
1644 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method setTessellationFactorBuffer:offset:instanceStride: I runtime RenderCommandEncoder::set_tessellation_factor_buffer
1645 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method setTessellationFactorScale: M a tessellation factor scale; a state that enables one is refused (`RenderPipelineKind::Tessellation`) S encoder-calls
1646 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance: I runtime RenderCommandEncoder::draw_patches
1647 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset: M I runtime RenderCommandEncoder::draw_patches_indirect indirect draws without a patch index buffer M encoder-calls
1648 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance: M patches through a control-point index buffer M encoder-calls
1649 MTLRenderCommandEncoder.h MTLRenderCommandEncoder method drawIndexedPatches:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:indirectBuffer:indirectBufferOffset: M patches through a control-point index buffer, drawn indirectly M encoder-calls
1650 MTLRenderCommandEncoder.h MTLRenderCommandEncoder property tileWidth M tile render pipelines; metal2vulkan-runtime makes none L tile
@@ -115,9 +115,9 @@ RUNTIME_FLOOR = {
"shaderStorageImageExtendedFormats", "samplerAnisotropy",
"shaderImageGatherExtended", "shaderInt16", "independentBlend",
"fragmentStoresAndAtomics", "alphaToOne", "logicOp", "fullDrawIndexUint32",
"depthBiasClamp", "shaderClipDistance", "tessellationShader",
"shaderTessellationAndGeometryPointSize", "largePoints", "dualSrcBlend",
"sampleRateShading", "vertexPipelineStoresAndAtomics")},
"depthBiasClamp", "drawIndirectFirstInstance", "shaderClipDistance",
"tessellationShader", "shaderTessellationAndGeometryPointSize", "largePoints",
"dualSrcBlend", "sampleRateShading", "vertexPipelineStoresAndAtomics")},
"VkPhysicalDeviceVulkan11Features": {member: True for member in (
"storageBuffer16BitAccess", "multiview", "shaderDrawParameters")},
"VkPhysicalDeviceVulkan12Features": {member: True for member in (