rt: visibility results, one precise occlusion query per mode, copied into the buffer at the pass's end
What: `setVisibilityResultMode:offset:` builds `Boolean` and `Counting`. Each such mode set is one segment counted by one precise occlusion query (`VK_QUERY_CONTROL_PRECISE_BIT`), begun in the pass's rendering before the segment's first draw and ended there at the next mode set or the encoder's end; a segment with no draw begins and ends its query as it ends, so its word is 0. After `vkCmdEndRendering` the pass copies the counts (`vkCmdCopyQueryPoolResults`, 64-bit, WAIT) straight into the visibility result buffer's `VkBuffer` at place+offset, one copy for each run of consecutive offsets in one pool, before the pass's second barrier (recorded or owed), which orders them before every later command; a Shared buffer's segment end barrier reaches the host, and a Managed buffer's write and a texture over the buffer in an image of its own are kept as a blit's write is. `Boolean` writes the count too, nonzero exactly where a sample passed (Metal documents a nonzero word; the M3 Max writes 1): an accepted difference in docs/API.md section 10, and the conformance cases compare a `Boolean` word as nonzero alone. A command buffer takes its queries from occlusion pools of 256 the device lends it (`crate::visibility`), each query reset on the host (`hostQueryReset`) as the command buffer retires or drops uncommitted; the device keeps at most 16 pools free and destroys the rest (`Gauges::occlusion_pools`). `occlusionQueryPrecise` joins the floor's required features (every venue's profile reports it; Roadmap 2022 requires it), with the README floor table, the runtime-floor profile's `m2v_runtime_floor` block and the regeneration script's list. Refusals: Metal's own, each where the mode is set, the encoder's mode unchanged: `Refusal::NoVisibilityResultBuffer`, `Refusal::VisibilityResultOffset` (not a multiple of 8, or past the buffer), `Refusal::VisibilityResultOffsetTaken` (Apple documents each offset as set once per pass; Metal's validation stops it), and `Refusal::ArgumentPlace` at alignment 8 for an offset at an allocation byte off a multiple of 8 (VUID-vkCmdCopyQueryPoolResults-flags-00823). Gaps, each counted and a README known gap: `DrawKind::AccumulatedVisibilityResults` (a mode in an `Accumulate` pass; `Metrics::accumulated_visibility_refused`) and `DrawKind::VisibilityResultInterrupt` (a command that would end the rendering while a query counts: a memory barrier after a writing draw, a draw that moves an attachment to the feedback layout, pays an owed barrier before an attachment read or copies into a shadow, and, bounded, a draw that looks at textures over a buffer in an image of their own or reaches a Managed buffer with textures over its device copy; `Metrics::visibility_interrupts_refused`). Every refusal is checked before the encoder changes state; a segment's first draw may still end the rendering, before its query begins. `DrawKind::VisibilityResults` is gone. `RenderPassDescriptor::visibility_result_type` (`VisibilityResultType`, Metal's `visibilityResultType`) is a field now. Translator: `PrecisionNote::DeviceOcclusionCount`, the static note of a `Boolean` or `Counting` result (`RenderCommandEncoder::VISIBILITY_NOTE`), quoting Vulkan's "Occlusion Queries" (precise counts differ between implementations: fragments killed before rasterization, counts multiplied per colour output) and "Fragment Operations" (`earlyFragmentMultisampleCoverageAfterSampleCounting`); its codec tag, ARTIFACT_FORMAT_VERSION 588, validation's allowance (unbounded, no tolerance), the conformance degradation `device-occlusion-count` among the native notes, and docs/API.md's catalogue. The dead `Feature::CountingVisibility` (no construction site) is removed with its reach row. The old runtime's `Device::new` is untouched; the runtime-floor test profile now states `occlusionQueryPrecise`, which re-keys that profile's fingerprint. Why: the visibility-cut ruling. A guest that sets a mode got a refusal; it now gets its results, or a typed, counted refusal where the cut does not build the shape (continuations and a combine are not built). Verified: cargo fmt; scripts/api-signatures --bless/--check, refusal_surface (0 without reach or basis), metal-coverage and conformance-coverage regenerated, check_device_profiles (0 findings). The compile job (fmt, signatures, clippy plain / --cfg m2v_gpu / --cfg m2v_cpu_icd, workspace Rustdoc -D warnings) and the lavapipe rt suite, with tests/visibility.rs (Boolean and Counting against the CPU's counts, pool reuse and the 16-pool bound past 17, Metal's refusals, Accumulate, the barrier and attachment-read interrupts), are named in the lane's report.
This commit is contained in:
1 parent
7c1baad228
commit
b5ac9fd07b
34 files changed
+1442
-206
No files matched your search
@@ -12,8 +12,9 @@
|
||||
//! recordings against the table. A fresh answer that disagrees with the table is a finding about
|
||||
//! one of the two chips, not a nuisance.
|
||||
//!
|
||||
//! Every word compares exactly, a `Boolean` result's included: the M3 Max writes 1 where a sample
|
||||
//! passed.
|
||||
//! Every word compares exactly but a `Boolean` result's, which compares as zero or nonzero alone:
|
||||
//! the M3 Max writes 1 where a sample passed, Metal documents a nonzero word, and the runtime
|
||||
//! writes the count (`docs/API.md`'s accepted difference `BOOLEAN_COUNT`).
|
||||
//!
|
||||
//! The shapes, each its own case so a device that lacks precise occlusion queries loses only the
|
||||
//! counted rows:
|
||||
@@ -61,6 +62,7 @@
|
||||
//!
|
||||
//! //! Nothing here can fault a GPU: one 4 by 4 target a pass, three vertices a draw, no loop.
|
||||
|
||||
use crate::allowance::{Allowance, Justification, Loosening};
|
||||
use crate::case::{Abort, Case, Failure, Handle, Input, MetalSource, Side};
|
||||
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
|
||||
use crate::recording::ShaderRef;
|
||||
@@ -166,6 +168,10 @@ const OFF: VisibilityResultMode = VisibilityResultMode::Disabled;
|
||||
const RESET: VisibilityResultType = VisibilityResultType::Reset;
|
||||
const ACCUMULATE: VisibilityResultType = VisibilityResultType::Accumulate;
|
||||
|
||||
/// The slug of `docs/API.md`'s accepted difference that a `Boolean` result is the count of samples
|
||||
/// that passed.
|
||||
const BOOLEAN_COUNT: &str = "a-boolean-visibility-result-is-the-count-of-samples-that-passed";
|
||||
|
||||
/// A word whose low half a count of 16 takes past 32 bits.
|
||||
const CARRY: u64 = 0xffff_fff8;
|
||||
|
||||
@@ -778,6 +784,35 @@ impl Case for Visibility {
|
||||
self.shape.name
|
||||
}
|
||||
|
||||
/// Each word whose last mode, as a command buffer's words are read, is `Boolean` compares as
|
||||
/// zero or nonzero alone (`BOOLEAN_COUNT`).
|
||||
fn allowances(&self) -> Vec<Allowance> {
|
||||
let mut boolean = std::collections::BTreeMap::new();
|
||||
let mut allowances = Vec::new();
|
||||
for group in groups(self.shape) {
|
||||
for &index in &group {
|
||||
for act in self.shape.passes[index] {
|
||||
if let Act::Mode(mode, offset) = act {
|
||||
match mode {
|
||||
VisibilityResultMode::Boolean => boolean.insert(*offset, true),
|
||||
VisibilityResultMode::Counting => boolean.insert(*offset, false),
|
||||
VisibilityResultMode::Disabled => None,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
let last = group.last().copied().unwrap_or_default();
|
||||
for (offset, _) in boolean.iter().filter(|(_, boolean)| **boolean) {
|
||||
allowances.push(Allowance::new(
|
||||
format!("case/pass-{last}/words/{offset}"),
|
||||
Loosening::Nonzero,
|
||||
Justification::AcceptedDifference(BOOLEAN_COUNT.to_owned()),
|
||||
));
|
||||
}
|
||||
}
|
||||
allowances
|
||||
}
|
||||
|
||||
fn metal_source(&self) -> MetalSource {
|
||||
MetalSource::Run
|
||||
}
|
||||
|
||||
@@ -179,6 +179,8 @@ pub enum Degradation {
|
||||
DeviceLineRasterization,
|
||||
/// `metal2vulkan-degrade-device-fragment-runs`.
|
||||
DeviceFragmentRuns,
|
||||
/// `metal2vulkan-degrade-device-occlusion-count`.
|
||||
DeviceOcclusionCount,
|
||||
}
|
||||
|
||||
impl Degradation {
|
||||
@@ -268,6 +270,7 @@ impl Degradation {
|
||||
Degradation::SwizzledOpaqueBlackBorder,
|
||||
Degradation::DeviceLineRasterization,
|
||||
Degradation::DeviceFragmentRuns,
|
||||
Degradation::DeviceOcclusionCount,
|
||||
];
|
||||
|
||||
/// The kind's code, `metal2vulkan-degrade-<kind>`.
|
||||
@@ -401,6 +404,7 @@ impl Degradation {
|
||||
"metal2vulkan-degrade-device-line-rasterization"
|
||||
}
|
||||
Degradation::DeviceFragmentRuns => "metal2vulkan-degrade-device-fragment-runs",
|
||||
Degradation::DeviceOcclusionCount => "metal2vulkan-degrade-device-occlusion-count",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,6 +499,7 @@ impl Degradation {
|
||||
PrecisionNote::SimdgroupAccessOrder => Degradation::SimdgroupAccessOrder,
|
||||
PrecisionNote::DeviceLineRasterization => Degradation::DeviceLineRasterization,
|
||||
PrecisionNote::DeviceFragmentRuns => Degradation::DeviceFragmentRuns,
|
||||
PrecisionNote::DeviceOcclusionCount => Degradation::DeviceOcclusionCount,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -480,7 +480,9 @@ pub fn reads_opaque_black_border(spec: &crate::case::SamplerSpec) -> bool {
|
||||
/// alpha to one draws its lines in, Vulkan's Bresenham mode taking neither
|
||||
/// (`device-line-rasterization`), announced by every such state whether or not it draws lines;
|
||||
/// - **depth bias**: the device's own slope measure and unit of a draw of triangles under a depth
|
||||
/// bias (`device-depth-bias`), announced by every such draw.
|
||||
/// bias (`device-depth-bias`), announced by every such draw;
|
||||
/// - **visibility results**: the device's own precise occlusion count of a `Boolean` or `Counting`
|
||||
/// visibility result (`device-occlusion-count`), announced by every such mode set.
|
||||
///
|
||||
/// **What is not here**, and stays each case's to declare: a note of what the device **lacks**
|
||||
/// (`device-signed-zero-inf-nan`, `device-anisotropic-filter`, `device-point-size`,
|
||||
@@ -534,6 +536,7 @@ pub const NATIVE_NOTES: &[crate::degradation::Degradation] = {
|
||||
D::DeviceAlphaCoverage,
|
||||
D::DeviceLineRasterization,
|
||||
D::DeviceDepthBias,
|
||||
D::DeviceOcclusionCount,
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ use crate::render::{
|
||||
use crate::transcript::{Negative, Value};
|
||||
use crate::values::{
|
||||
LoadAction, MultisampleDepthResolveFilter, MultisampleStencilResolveFilter, StoreAction,
|
||||
StoreActionOptions, VisibilityResultMode,
|
||||
StoreActionOptions, VisibilityResultMode, VisibilityResultType,
|
||||
};
|
||||
use crate::work::Plane;
|
||||
use metal2vulkan_runtime as rt;
|
||||
@@ -331,6 +331,10 @@ impl RtSide<'_> {
|
||||
RenderStep::DepthStencilState(state) => (self.depth_stencils)
|
||||
.get(state.0 as usize)
|
||||
.and_then(rt::DepthStencilState::precision_note),
|
||||
RenderStep::VisibilityResultMode {
|
||||
mode: VisibilityResultMode::Boolean | VisibilityResultMode::Counting,
|
||||
..
|
||||
} => Some(rt::RenderCommandEncoder::VISIBILITY_NOTE),
|
||||
_ => None,
|
||||
});
|
||||
let notes: Vec<rt::PrecisionNote> = notes.collect();
|
||||
@@ -419,11 +423,13 @@ impl RtSide<'_> {
|
||||
attachment.store_action = store(stencil.store)?;
|
||||
attachment.clear_stencil = stencil.clear;
|
||||
}
|
||||
// `visibilityResultType` is not the runtime's field: it decides only what an enabled mode
|
||||
// writes, and the runtime builds `Disabled` alone.
|
||||
if let Some(visibility) = pass.visibility {
|
||||
descriptor.visibility_result_buffer = Some(self.held(visibility)?.clone());
|
||||
}
|
||||
descriptor.visibility_result_type = match pass.visibility_type {
|
||||
VisibilityResultType::Reset => rt::VisibilityResultType::Reset,
|
||||
VisibilityResultType::Accumulate => rt::VisibilityResultType::Accumulate,
|
||||
};
|
||||
if !pass.positions.is_empty() {
|
||||
return Err(Failure::unavailable("setSamplePositions:count:"));
|
||||
}
|
||||
|
||||
@@ -3443,10 +3443,11 @@ cache is answered compile-required on both.
|
||||
without `fillModeNonSolid` (KosmicKrisp on the M3 Max, of the venues dumped, m3-max-48737) and
|
||||
the fill mode of raw value 2, which no SDK header declares (`FillMode`,
|
||||
`set_triangle_fill_mode`), no viewport or scissor rectangle, or more than 16 (`Viewports`,
|
||||
`set_viewports`, `set_scissor_rects`), a visibility result mode but `Disabled`
|
||||
(`VisibilityResults`, `set_visibility_result_mode`), each refused where it is set, the
|
||||
encoder's state unchanged; the replay streams set Metal's defaults alone, which those setters
|
||||
take as nothing; a draw of lines or a line strip while the encoder's line width
|
||||
`set_viewports`, `set_scissor_rects`), and a `Boolean` or `Counting` visibility result mode in a
|
||||
pass whose `visibility_result_type` is `Accumulate` (`AccumulatedVisibilityResults`,
|
||||
`set_visibility_result_mode`; counted in `Metrics::accumulated_visibility_refused`), each
|
||||
refused where it is set, the encoder's state unchanged; the replay streams set Metal's defaults
|
||||
alone, which those setters take as nothing; a draw of lines or a line strip while the encoder's line width
|
||||
(`set_line_width`, which keeps every width) is not 1 (`LineWidth`): Metal draws such a line as
|
||||
a parallelogram that width wide, and Vulkan's wider lines are a device feature (`wideLines`)
|
||||
the floor does not require; a
|
||||
@@ -3518,15 +3519,43 @@ cache is answered compile-required on both.
|
||||
robustness, so there is no bounds guarantee beyond the device's. A post-tessellation function's
|
||||
control points and a kernel's stage-in are fetched in the shader instead, checked as a buffer
|
||||
argument's access is (see "Known gaps").
|
||||
- A pass's visibility result buffer (`visibility_result_buffer`, Metal's
|
||||
`visibilityResultBuffer`) is kept by the command buffer until it retires, and its bytes stay as
|
||||
they were: no command of the pass reaches it, and it joins no hazard tracking.
|
||||
`set_visibility_result_mode` (`setVisibilityResultMode:offset:`) takes `Disabled` at any offset
|
||||
and records nothing. Metal's pass leaves the buffer's bytes as they were under either
|
||||
`visibilityResultType` where its encoder enables no mode (an Apple M3 Max, macOS 27.0.1; the
|
||||
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.
|
||||
- Visibility results (`set_visibility_result_mode`, Metal's `setVisibilityResultMode:offset:`):
|
||||
each `Boolean` or `Counting` mode set counts the samples its later draws pass, up to the next
|
||||
mode set or the encoder's end, in one precise occlusion query (`occlusionQueryPrecise`, the
|
||||
floor's), begun in the pass's rendering before the mode's first draw and ended there as the
|
||||
mode ends; a mode with no draw counts none. After the rendering ends, the pass copies each
|
||||
count, 64 bits, into the visibility result buffer (`visibility_result_buffer`, Metal's
|
||||
`visibilityResultBuffer`) at its offset, one `vkCmdCopyQueryPoolResults` for each run of
|
||||
offsets 8 bytes apart, before the pass's second barrier, which orders the copies before every
|
||||
later command; the host sees them once the command buffer completes, as a blit's write. Every
|
||||
other byte of the buffer keeps its value, as Metal's pass keeps it; a pass whose encoder
|
||||
enables no mode leaves the buffer as it was under either `visibility_result_type` (an Apple M3
|
||||
Max, macOS 27.0.1; the conformance cases `visibility-disabled-reset` and
|
||||
`visibility-disabled-accumulate`). `Disabled` takes any offset, with or without a buffer. A
|
||||
`Boolean` mode writes the count too, which is nonzero exactly where a sample passed (Metal
|
||||
documents a nonzero word; an Apple M3 Max writes 1), and the count is the device's own
|
||||
(`RenderCommandEncoder::VISIBILITY_NOTE`, `PrecisionNote::DeviceOcclusionCount`). Metal's own
|
||||
refusals, each where the mode is set, the encoder's mode unchanged: a mode with no visibility
|
||||
result buffer (`Refusal::NoVisibilityResultBuffer`), at an offset that is not a multiple of 8
|
||||
or whose 8 bytes run past the buffer (`Refusal::VisibilityResultOffset`), and at an offset a
|
||||
mode of the encoder took before (`Refusal::VisibilityResultOffsetTaken`: Apple documents each
|
||||
offset as set once per pass). A command buffer takes its queries from pools of its own, 256
|
||||
queries each, which the device lends it and takes back as it retires, each query reset on the
|
||||
host (`hostQueryReset`); the device keeps at most 16 free (`Gauges::occlusion_pools`).
|
||||
- While a `Boolean` or `Counting` mode's query counts the draws (from the mode's first draw to the
|
||||
next mode set or the encoder's end), a command that would end the pass's rendering is refused,
|
||||
`Gap::Draw` of `VisibilityResultInterrupt`, the encoder as it was, and counted in
|
||||
`Metrics::visibility_interrupts_refused`: a memory barrier after a draw that wrote memory; a
|
||||
draw that moves an attachment to the feedback layout, pays the barrier owed before an
|
||||
attachment read, or copies into an attachment's shadow what it reads; and, whether or not a
|
||||
copy is owed, a draw that looks at textures over a buffer in images of their own (one bound or
|
||||
declared, or, while such a texture lives, a draw through addresses outside its resources, an
|
||||
execution of an indirect command buffer, or a draw while such a texture's image is ahead of its
|
||||
buffer) or that reaches a Managed buffer with textures over its device copy. Vulkan's query
|
||||
begins and ends inside one rendering, and carrying a count across the rendering's end into a
|
||||
second query, with the parts added, is not built. A mode's first draw may still end the
|
||||
rendering, before the query begins, and so may every command after a mode set before its first
|
||||
draw.
|
||||
- `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
|
||||
@@ -4013,6 +4042,7 @@ Presenting runs on the runtime's own device; nothing is exported or imported.
|
||||
| `dualSrcBlend` | `VkPhysicalDeviceFeatures` | a fragment function's second output for colour attachment 0 (`[[color(0), index(1)]]`) as the blend's second source (`Source1Color`, `Source1Alpha` and their complements) |
|
||||
| `sampleRateShading` | `VkPhysicalDeviceFeatures` | a fragment function that reads its `[[sample_id]]`, or an interpolant at a sample, run once per covered sample as Metal runs it; Vulkan 1.4 requires it |
|
||||
| `vertexPipelineStoresAndAtomics` | `VkPhysicalDeviceFeatures` | a vertex or post-tessellation vertex function's writes and atomics on device memory |
|
||||
| `occlusionQueryPrecise` | `VkPhysicalDeviceFeatures` | a `Boolean` or `Counting` visibility result (`set_visibility_result_mode`), a precise occlusion query's count; Roadmap 2022 requires it, and every venue's device profile reports it |
|
||||
| `multiview` | `VkPhysicalDeviceVulkan11Features` | Vulkan 1.1 requires it; the translator's multiview forms |
|
||||
| `shaderDrawParameters` | `VkPhysicalDeviceVulkan11Features` | a vertex function's `[[base_vertex]]` and `[[base_instance]]` as the draw's own `BaseVertex` and `BaseInstance`, so no draw pushes its bases; Vulkan 1.1 requires it where the device lists `VK_KHR_shader_draw_parameters`, Roadmap 2024 of every device |
|
||||
| `shaderSubgroupExtendedTypes` | `VkPhysicalDeviceVulkan12Features` | SIMD-group operations on 8-, 16- and 64-bit values; Vulkan 1.2 requires it |
|
||||
@@ -4020,7 +4050,7 @@ Presenting runs on the runtime's own device; nothing is exported or imported.
|
||||
| `shaderTerminateInvocation` | `VkPhysicalDeviceVulkan13Features` | a fragment's termination; Vulkan 1.3 requires it |
|
||||
| `shaderZeroInitializeWorkgroupMemory` | `VkPhysicalDeviceVulkan13Features` | threadgroup memory zeroed at its declaration where the translator zeroes it; Vulkan 1.3 requires it |
|
||||
| `timelineSemaphore` | `VkPhysicalDeviceVulkan12Features` | submission and completion |
|
||||
| `hostQueryReset` | `VkPhysicalDeviceVulkan12Features` | a command buffer's timestamp queries reset on the host as it retires |
|
||||
| `hostQueryReset` | `VkPhysicalDeviceVulkan12Features` | a command buffer's timestamp and occlusion queries reset on the host as it retires |
|
||||
| `synchronization2` | `VkPhysicalDeviceVulkan13Features` | barriers, layout changes and submission |
|
||||
| `dynamicRendering` | `VkPhysicalDeviceVulkan13Features` | render passes |
|
||||
| `pipelineCreationCacheControl` | `VkPhysicalDeviceVulkan13Features` | a kernel past the stage bound created from its helper's cache data alone, never compiled in the process (Kernels past the stage bound); Vulkan 1.3 requires it |
|
||||
|
||||
@@ -21,6 +21,7 @@ use crate::ring::{Placed, Writes};
|
||||
use crate::sampler::SamplerState;
|
||||
use crate::texture::{Image, OverCopy, Texture, TextureInner, TextureObject};
|
||||
use crate::times::{self, Pair, Times};
|
||||
use crate::visibility::{Queries, Query};
|
||||
use ash::vk;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::atomic::Ordering::Relaxed;
|
||||
@@ -280,6 +281,9 @@ pub(crate) struct Gpu {
|
||||
/// Its executions of indirect command buffers' layouts and preprocess regions, each region
|
||||
/// given back to the device's pool as it retires (`crate::indirect`).
|
||||
pub(crate) executed: Vec<crate::indirect::Executed>,
|
||||
/// The occlusion queries of its render encoders' visibility results, from pools of its own,
|
||||
/// each given back to the device as it retires (`crate::visibility`).
|
||||
pub(crate) queries: Queries,
|
||||
}
|
||||
|
||||
impl Gpu {
|
||||
@@ -390,6 +394,7 @@ impl CommandBuffer {
|
||||
images: Vec::new(),
|
||||
fences: Fences::default(),
|
||||
executed: Vec::new(),
|
||||
queries: Queries::default(),
|
||||
},
|
||||
handlers: Handlers {
|
||||
scheduled: Vec::new(),
|
||||
@@ -1258,6 +1263,13 @@ impl Building {
|
||||
self.gpu.executed.push(executed);
|
||||
}
|
||||
|
||||
/// The next occlusion query, from the command buffer's own pools (`crate::visibility`).
|
||||
///
|
||||
/// Err: [`Error::Vulkan`] where the device makes no pool.
|
||||
pub(crate) fn take_query(&mut self) -> Result<Query, Error> {
|
||||
self.gpu.queries.take(self.device.core())
|
||||
}
|
||||
|
||||
/// The push bytes are undefined from now: an execution of an indirect command buffer's
|
||||
/// commands left them so, and the next draw pushes its own again.
|
||||
pub(crate) fn pushes_lost(&mut self) {
|
||||
@@ -1530,8 +1542,8 @@ pub(crate) fn run_scheduled(inner: Arc<CbInner>, handlers: Vec<Handler>) {
|
||||
|
||||
/// On the completion thread: retires a command buffer that completed (`error` None), with its GPU
|
||||
/// times where they were read (`completion`), or ended, recycling its recorder and giving up its
|
||||
/// blocks, its pair of timestamp queries with the `written` of them reset, and its place in the
|
||||
/// queue, then runs its handlers.
|
||||
/// blocks, its pair of timestamp queries with the `written` of them reset, its occlusion queries'
|
||||
/// pools, and its place in the queue, then runs its handlers.
|
||||
pub(crate) fn retire(
|
||||
core: &Core,
|
||||
inner: Arc<CbInner>,
|
||||
@@ -1590,12 +1602,14 @@ pub(crate) fn retire(
|
||||
images,
|
||||
fences,
|
||||
executed,
|
||||
queries,
|
||||
} = gpu;
|
||||
if let Some(recorder) = recorder {
|
||||
core.recorders.give_back(core, recorder);
|
||||
}
|
||||
ring.give_back(core);
|
||||
drop((segments, blocks, images, fences, executed));
|
||||
queries.give_back(core);
|
||||
kept.clear();
|
||||
if let Some(pair) = stamps {
|
||||
times::reset(&core.device, pair.pool, pair.first, written);
|
||||
@@ -1628,8 +1642,8 @@ impl Drop for CbInner {
|
||||
fn drop(&mut self) {
|
||||
let state = self.state.get_mut().unwrap_or_else(PoisonError::into_inner);
|
||||
// A command buffer never committed gives back its recorder, its pair of timestamp
|
||||
// queries, which no submission wrote, so they stay reset, and its place in the queue; a
|
||||
// committed one did so when it retired.
|
||||
// queries, which no submission wrote, so they stay reset, its occlusion queries' pools,
|
||||
// and its place in the queue; a committed one did so when it retired.
|
||||
if let Some(Building {
|
||||
device,
|
||||
gpu,
|
||||
@@ -1647,6 +1661,7 @@ impl Drop for CbInner {
|
||||
recorder,
|
||||
mut kept,
|
||||
ring,
|
||||
queries,
|
||||
..
|
||||
} = gpu;
|
||||
if let Some(recorder) = recorder {
|
||||
@@ -1656,6 +1671,7 @@ impl Drop for CbInner {
|
||||
if let Some(pair) = stamps {
|
||||
core.stamps.give_back(pair);
|
||||
}
|
||||
queries.give_back(core);
|
||||
kept.clear();
|
||||
self.queue.release(kept);
|
||||
}
|
||||
|
||||
@@ -260,10 +260,14 @@ pub(crate) enum Metric {
|
||||
StageFills,
|
||||
/// [`Metrics::pipelines_from_stage_fills`].
|
||||
PipelinesFromStageFills,
|
||||
/// [`Metrics::visibility_interrupts_refused`].
|
||||
VisibilityInterruptsRefused,
|
||||
/// [`Metrics::accumulated_visibility_refused`].
|
||||
AccumulatedVisibilityRefused,
|
||||
}
|
||||
|
||||
/// The number of [`Metric`]s.
|
||||
const METRICS: usize = Metric::PipelinesFromStageFills as usize + 1;
|
||||
const METRICS: usize = Metric::AccumulatedVisibilityRefused as usize + 1;
|
||||
|
||||
/// Every [`Metric`], in its order: each at its own index.
|
||||
const METRIC_ORDER: [Metric; METRICS] = [
|
||||
@@ -305,6 +309,8 @@ const METRIC_ORDER: [Metric; METRICS] = [
|
||||
Metric::PreprocessRegionsRemade,
|
||||
Metric::StageFills,
|
||||
Metric::PipelinesFromStageFills,
|
||||
Metric::VisibilityInterruptsRefused,
|
||||
Metric::AccumulatedVisibilityRefused,
|
||||
];
|
||||
|
||||
// Each metric of the order is at its own index.
|
||||
@@ -404,6 +410,8 @@ pub(crate) enum Gauge {
|
||||
TexturesCopiedOver,
|
||||
/// [`Gauges::timestamp_pools`].
|
||||
TimestampPools,
|
||||
/// [`Gauges::occlusion_pools`].
|
||||
OcclusionPools,
|
||||
/// [`Gauges::imports`].
|
||||
Imports,
|
||||
/// [`Gauges::exports`].
|
||||
@@ -668,6 +676,8 @@ struct Atomics {
|
||||
preprocess_regions_remade: AtomicU64,
|
||||
stage_fills: AtomicU64,
|
||||
pipelines_from_stage_fills: AtomicU64,
|
||||
visibility_interrupts_refused: AtomicU64,
|
||||
accumulated_visibility_refused: AtomicU64,
|
||||
/// Each [`Part`]'s calls, at its index: their count, bytes, total and longest nanoseconds,
|
||||
/// and those over each of [`OVER_NANOS`].
|
||||
parts: [[AtomicU64; 7]; PARTS],
|
||||
@@ -715,6 +725,7 @@ struct Atomics {
|
||||
shadow_bytes: AtomicU64,
|
||||
textures_copied_over: AtomicU64,
|
||||
timestamp_pools: AtomicU64,
|
||||
occlusion_pools: AtomicU64,
|
||||
imports: AtomicU64,
|
||||
exports: AtomicU64,
|
||||
surface_imports: AtomicU64,
|
||||
@@ -816,6 +827,8 @@ impl Counters {
|
||||
Metric::PreprocessRegionsRemade => &a.preprocess_regions_remade,
|
||||
Metric::StageFills => &a.stage_fills,
|
||||
Metric::PipelinesFromStageFills => &a.pipelines_from_stage_fills,
|
||||
Metric::VisibilityInterruptsRefused => &a.visibility_interrupts_refused,
|
||||
Metric::AccumulatedVisibilityRefused => &a.accumulated_visibility_refused,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1399,6 +1412,7 @@ impl Counters {
|
||||
Gauge::ShadowBytes => &a.shadow_bytes,
|
||||
Gauge::TexturesCopiedOver => &a.textures_copied_over,
|
||||
Gauge::TimestampPools => &a.timestamp_pools,
|
||||
Gauge::OcclusionPools => &a.occlusion_pools,
|
||||
Gauge::Imports => &a.imports,
|
||||
Gauge::Exports => &a.exports,
|
||||
Gauge::SurfaceImports => &a.surface_imports,
|
||||
@@ -1640,6 +1654,8 @@ impl Counters {
|
||||
preprocess_regions_remade: a.preprocess_regions_remade.load(Relaxed),
|
||||
stage_fills: a.stage_fills.load(Relaxed),
|
||||
pipelines_from_stage_fills: a.pipelines_from_stage_fills.load(Relaxed),
|
||||
visibility_interrupts_refused: a.visibility_interrupts_refused.load(Relaxed),
|
||||
accumulated_visibility_refused: a.accumulated_visibility_refused.load(Relaxed),
|
||||
takes: part(Part::Take),
|
||||
take_lock_waits: part(Part::TakeLock),
|
||||
take_makes: part(Part::TakeMake),
|
||||
@@ -1710,6 +1726,7 @@ impl Counters {
|
||||
shadow_bytes: a.shadow_bytes.load(Relaxed),
|
||||
textures_copied_over: a.textures_copied_over.load(Relaxed),
|
||||
timestamp_pools: a.timestamp_pools.load(Relaxed),
|
||||
occlusion_pools: a.occlusion_pools.load(Relaxed),
|
||||
imports: a.imports.load(Relaxed),
|
||||
exports: a.exports.load(Relaxed),
|
||||
surface_imports: a.surface_imports.load(Relaxed),
|
||||
@@ -2446,6 +2463,16 @@ pub struct Metrics {
|
||||
/// so the driver compiled nothing for them in this process. Each is counted in
|
||||
/// [`pipelines_created`](Self::pipelines_created) too.
|
||||
pub pipelines_from_stage_fills: u64,
|
||||
/// Commands a render encoder refused because they would end its pass's rendering while a
|
||||
/// `Boolean` or `Counting` visibility result's query counts the draws
|
||||
/// ([`DrawKind::VisibilityResultInterrupt`](crate::DrawKind::VisibilityResultInterrupt)):
|
||||
/// memory barriers and draws the guest asked for that did not run.
|
||||
pub visibility_interrupts_refused: u64,
|
||||
/// `setVisibilityResultMode:offset:` calls of a `Boolean` or `Counting` mode refused in a pass
|
||||
/// whose `visibilityResultType` is `Accumulate`
|
||||
/// ([`DrawKind::AccumulatedVisibilityResults`](crate::DrawKind::AccumulatedVisibilityResults)):
|
||||
/// results the guest asked for that were not written.
|
||||
pub accumulated_visibility_refused: u64,
|
||||
/// Takes from the pool on the consumer's threads, each whole: a block of
|
||||
/// [`Device::take_block`](crate::Device::take_block) and a texture block, carved from a free
|
||||
/// range or from an allocation the take made ([`take_makes`](Self::take_makes)); their bytes
|
||||
@@ -2725,6 +2752,10 @@ pub struct Gauges {
|
||||
/// from its first record until its times are read at its completion: made as command buffers
|
||||
/// need them, and kept until the device drops.
|
||||
pub timestamp_pools: u64,
|
||||
/// The device's occlusion query pools, each of 256 queries, for render encoders' visibility
|
||||
/// results: a command buffer takes them as its encoders set `Boolean` and `Counting` modes,
|
||||
/// and gives them back as it retires; at most 16 are kept free, and the rest destroyed.
|
||||
pub occlusion_pools: u64,
|
||||
/// Imports whose memory is not yet freed: one for each imported block
|
||||
/// (`Device::import_dma_buf` on Unix,
|
||||
/// [`Device::import_host_memory`](crate::Device::import_host_memory)), and one for each
|
||||
|
||||
@@ -27,6 +27,7 @@ use crate::sampler::{Constexpr, SamplerTable};
|
||||
use crate::submit::{self, Work};
|
||||
use crate::submit_calls::SubmitCalls;
|
||||
use crate::times::{StampPools, Ticks};
|
||||
use crate::visibility::OcclusionPools;
|
||||
use ash::vk;
|
||||
use metal2vulkan::device::{ApiVersion, DeviceDescription, DevicePolicy};
|
||||
use metal2vulkan::metal::{ArgumentBuffersTier, ReadWriteTextureTier};
|
||||
@@ -338,6 +339,8 @@ pub(crate) struct Core {
|
||||
pub(crate) reaper: Reaper,
|
||||
/// The timestamp pools every command buffer takes its pair of queries from.
|
||||
pub(crate) stamps: StampPools,
|
||||
/// The occlusion query pools command buffers take their visibility results' queries from.
|
||||
pub(crate) occlusion: OcclusionPools,
|
||||
/// The one pipeline layout of every pipeline: the empty set 0, set 1, and the push window
|
||||
/// over every stage.
|
||||
pub(crate) layout: vk::PipelineLayout,
|
||||
@@ -792,6 +795,7 @@ impl Device {
|
||||
done,
|
||||
reaper: Reaper::new(),
|
||||
stamps: StampPools::new(),
|
||||
occlusion: OcclusionPools::new(),
|
||||
layout,
|
||||
arrays,
|
||||
samplers: Mutex::new(SamplerTable::new(sampler_cap)),
|
||||
@@ -1679,6 +1683,7 @@ impl Drop for Core {
|
||||
#[cfg(unix)]
|
||||
self.imports.destroy(&self.device);
|
||||
self.stamps.destroy(&self.device, &self.counters);
|
||||
self.occlusion.destroy(&self.device, &self.counters);
|
||||
// SAFETY: the device is idle; nothing reads the ring.
|
||||
let ring_blocks = unsafe { self.ring.destroy(&self.device) };
|
||||
let filler = self.filler.take();
|
||||
|
||||
@@ -908,28 +908,29 @@ pub enum Refusal {
|
||||
/// The offset asked for.
|
||||
offset: u64,
|
||||
},
|
||||
/// 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 Managed buffer with one)
|
||||
/// that is not a multiple of 4, or of the index size.
|
||||
/// An indirect dispatch's arguments, an indexed draw's indices, or a visibility result, at a
|
||||
/// byte of the allocation the buffer's block lies in (its device copy's, for a Managed buffer
|
||||
/// with one) that is not a multiple of 4, of the index size, or of 8.
|
||||
///
|
||||
/// Metal's offset rules keep both at such a multiple of the buffer's start, so only a buffer
|
||||
/// Metal's offset rules keep each at such a multiple of the buffer's start, so only a buffer
|
||||
/// that starts off it meets this: a no-copy buffer
|
||||
/// (`newBufferWithBytesNoCopy:length:options:deallocator:`) over a pointer that is not a
|
||||
/// multiple of 4 (indirect arguments) or of the index size (indexed draws), which documented
|
||||
/// Metal does not allow, its pointer being page-aligned. The consumer places every other
|
||||
/// buffer at an aligned byte. Such a buffer is still made, and every other use of it runs:
|
||||
/// only the dispatch or draw that reads its arguments or indices is refused.
|
||||
/// (`newBufferWithBytesNoCopy:length:options:deallocator:`) over a pointer that is not such a
|
||||
/// multiple, which documented Metal does not allow, its pointer being page-aligned. The
|
||||
/// consumer places every other buffer at an aligned byte. Such a buffer is still made, and
|
||||
/// every other use of it runs: only the dispatch or draw that reads its arguments or indices,
|
||||
/// or the visibility result mode set at the offset, is refused.
|
||||
///
|
||||
/// Basis: 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).
|
||||
/// `VkBuffer`, `vkCmdBindIndexBuffer` takes indices at a multiple of their size in the
|
||||
/// memory, and `vkCmdCopyQueryPoolResults` writes 64-bit results at a multiple of 8,
|
||||
/// `VUID-vkCmdCopyQueryPoolResults-flags-00823`; a Metal buffer starts at an aligned address,
|
||||
/// so Metal's offset rules alone keep each aligned there).
|
||||
ArgumentPlace {
|
||||
/// The byte of the allocation the arguments or indices start at: their block's offset
|
||||
/// there ([`BlockInfo::offset`](crate::BlockInfo::offset)) plus their place in the
|
||||
/// The byte of the allocation the arguments, indices or result start at: their block's
|
||||
/// offset there ([`BlockInfo::offset`](crate::BlockInfo::offset)) plus their place in the
|
||||
/// block.
|
||||
place: u64,
|
||||
/// The multiple Vulkan reads them at: 4, or the index size.
|
||||
/// The multiple Vulkan reads or writes them at: 4, the index size, or 8.
|
||||
alignment: u64,
|
||||
},
|
||||
/// A viewport with a field that is NaN or infinite (but its origin's x, which draws nothing).
|
||||
@@ -943,6 +944,37 @@ pub enum Refusal {
|
||||
/// Basis: 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).
|
||||
StencilAttachment,
|
||||
/// A visibility result mode but `Disabled` (`setVisibilityResultMode:offset:`) in a pass
|
||||
/// with no visibility result buffer.
|
||||
///
|
||||
/// Basis: metal-documented (Apple's page for `setVisibilityResultMode(_:offset:)`: "To create
|
||||
/// a render pass that can enable visibility testing, assign an MTLBuffer instance to the
|
||||
/// visibilityResultBuffer property of an MTLRenderPassDescriptor").
|
||||
NoVisibilityResultBuffer,
|
||||
/// A visibility result mode but `Disabled` at an offset that is not a multiple of 8, or whose
|
||||
/// 8 bytes run past the visibility result buffer.
|
||||
///
|
||||
/// Basis: metal-documented (`MTLRenderCommandEncoder.h`: "offset must be a multiple of 8";
|
||||
/// Apple's page for `visibilityResultBuffer`: "The GPU stores visibility results as 64-bit
|
||||
/// integers, so you need to reserve 8 bytes for each visibility result").
|
||||
VisibilityResultOffset {
|
||||
/// The offset asked for.
|
||||
offset: u64,
|
||||
/// The visibility result buffer's length.
|
||||
length: u64,
|
||||
},
|
||||
/// A visibility result mode but `Disabled` at an offset a mode of the encoder took before,
|
||||
/// `Disabled` between them or not.
|
||||
///
|
||||
/// Basis: metal-documented (Apple's page for `setVisibilityResultMode(_:offset:)`: "You can
|
||||
/// set a specific offset value only once per render pass"; Metal's validation stops it, "using
|
||||
/// the same offset (0) in the visibility buffer twice in the same command encoder is not
|
||||
/// allowed", an Apple M3 Max, macOS 27.0.1, the conformance case
|
||||
/// `visibility-counting-revisit`, where plain Metal adds the later draws to the result).
|
||||
VisibilityResultOffsetTaken {
|
||||
/// The offset asked for.
|
||||
offset: u64,
|
||||
},
|
||||
}
|
||||
|
||||
/// A Metal feature the runtime does not build yet, with what it was asked. Each is refused until a
|
||||
@@ -1594,9 +1626,23 @@ pub enum DrawKind {
|
||||
/// no replay stream's patch draws name: the control stage takes each patch's index from its
|
||||
/// position.
|
||||
PatchIndexBuffer,
|
||||
/// A visibility result mode but `Disabled` (`setVisibilityResultMode:offset:`'s `Boolean` or
|
||||
/// `Counting`), which no replay stream sets: the runtime records no occlusion query.
|
||||
VisibilityResults,
|
||||
/// A command that ends the pass's rendering to record between, while a `Boolean` or
|
||||
/// `Counting` visibility result's query counts the draws (from the first draw after its
|
||||
/// `setVisibilityResultMode:offset:` to the next mode set): a memory barrier after draws that
|
||||
/// wrote memory, a draw that moves an attachment to the feedback layout, pays a barrier owed
|
||||
/// before an attachment read or copies what it reads into an attachment's shadow, and a draw
|
||||
/// that binds or declares a texture over a buffer in an image of its own, that draws while
|
||||
/// such a texture the segment used has its image ahead of its buffer, or that reaches a Managed
|
||||
/// buffer with textures over its device copy, whether or not it owes a copy. Vulkan's query
|
||||
/// begins and ends inside one render pass instance, and a query's count carried across one
|
||||
/// into the next is not built. Counted in
|
||||
/// [`Metrics::visibility_interrupts_refused`](crate::Metrics::visibility_interrupts_refused).
|
||||
VisibilityResultInterrupt,
|
||||
/// A `Boolean` or `Counting` visibility result mode in a pass whose `visibilityResultType` is
|
||||
/// `Accumulate`, which takes each result into the word at its offset: adding a result to a
|
||||
/// word is not built. Counted in
|
||||
/// [`Metrics::accumulated_visibility_refused`](crate::Metrics::accumulated_visibility_refused).
|
||||
AccumulatedVisibilityResults,
|
||||
}
|
||||
|
||||
/// What a render pass asks that the runtime does not build ([`Gap::RenderPass`]).
|
||||
@@ -2376,6 +2422,17 @@ impl fmt::Display for Refusal {
|
||||
Refusal::StencilAttachment => {
|
||||
f.write_str("a draw tests the stencil in a pass without a stencil attachment")
|
||||
}
|
||||
Refusal::NoVisibilityResultBuffer => {
|
||||
f.write_str("a visibility result mode is set in a pass without a visibility result buffer")
|
||||
}
|
||||
Refusal::VisibilityResultOffset { offset, length } => write!(
|
||||
f,
|
||||
"a visibility result at offset {offset} of a {length}-byte buffer is misaligned or past its end"
|
||||
),
|
||||
Refusal::VisibilityResultOffsetTaken { offset } => write!(
|
||||
f,
|
||||
"the visibility result offset {offset} is taken a second time in one encoder"
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,6 +530,10 @@ pub(crate) const REQUIRED: &[Feature] = &[
|
||||
// A vertex or post-tessellation vertex function writes and atomically updates device memory,
|
||||
// as Metal's may. A device without it is below the floor.
|
||||
feature!(core.vertex_pipeline_stores_and_atomics => VertexPipelineStoresAndAtomics),
|
||||
// A `Counting` visibility result is the count of samples that passed: a precise occlusion
|
||||
// query's, which `Boolean` takes too. Roadmap 2022 requires it of every device, and every
|
||||
// venue's driver reports it.
|
||||
feature!(core.occlusion_query_precise => OcclusionQueryPrecise),
|
||||
// What Vulkan 1.1 to 1.3 require of every device and the translator's shaders use where they
|
||||
// are enabled: multiview, subgroup operations on 8-, 16- and 64-bit values, a fragment's
|
||||
// demotion to a helper and its termination, and workgroup memory zeroed at its declaration.
|
||||
@@ -544,8 +548,9 @@ pub(crate) const REQUIRED: &[Feature] = &[
|
||||
feature!(vulkan13.shader_zero_initialize_workgroup_memory => ShaderZeroInitializeWorkgroupMemory),
|
||||
// Submission, barriers and render passes.
|
||||
feature!(vulkan12.timeline_semaphore),
|
||||
// GPU times: a command buffer's two timestamp queries reset on the host as it retires, so no
|
||||
// command buffer the GPU runs resets a query. Vulkan 1.2 requires it.
|
||||
// GPU times and visibility results: a command buffer's timestamp and occlusion queries reset
|
||||
// on the host as it retires, so no command buffer the GPU runs resets a query. Vulkan 1.2
|
||||
// requires it.
|
||||
feature!(vulkan12.host_query_reset),
|
||||
feature!(vulkan13.synchronization2 => Synchronization2),
|
||||
feature!(vulkan13.dynamic_rendering),
|
||||
|
||||
@@ -64,6 +64,7 @@ mod surface;
|
||||
mod tests;
|
||||
mod texture;
|
||||
mod times;
|
||||
mod visibility;
|
||||
|
||||
pub use arrays::{IndexClass, IndexGrant, ResourceId};
|
||||
pub use blit::{BlitCommandEncoder, BlitOption, BufferLayout, TexturePlace};
|
||||
@@ -133,7 +134,8 @@ pub use metal2vulkan::pipeline::{
|
||||
pub use pass::{
|
||||
ClearColor, LoadAction, MultisampleDepthResolveFilter, MultisampleStencilResolveFilter,
|
||||
RenderPassColorAttachmentDescriptor, RenderPassDepthAttachmentDescriptor, RenderPassDescriptor,
|
||||
RenderPassStencilAttachmentDescriptor, StoreAction, MAX_COLOR_ATTACHMENTS,
|
||||
RenderPassStencilAttachmentDescriptor, StoreAction, VisibilityResultType,
|
||||
MAX_COLOR_ATTACHMENTS,
|
||||
};
|
||||
pub use pipeline::{ComputePipelineState, DispatchVariant};
|
||||
pub use pixel_format_info::{PixelFormatInfo, TextureLevelInfo, TextureLevelQuery};
|
||||
|
||||
@@ -68,6 +68,23 @@ pub enum LoadAction {
|
||||
Clear,
|
||||
}
|
||||
|
||||
/// `MTLVisibilityResultType`: what a pass's visibility results do with the words of the
|
||||
/// visibility result buffer they are written to.
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub enum VisibilityResultType {
|
||||
/// `MTLVisibilityResultTypeReset`, Metal's default: each offset a mode of the encoder takes
|
||||
/// is written its result; every other word keeps its bytes, as an Apple M3 Max's do (macOS
|
||||
/// 27.0.1).
|
||||
#[default]
|
||||
Reset,
|
||||
/// `MTLVisibilityResultTypeAccumulate`: each result is added to its word. Not built: a
|
||||
/// `Boolean` or `Counting` mode in such a pass is
|
||||
/// [`DrawKind::AccumulatedVisibilityResults`](crate::DrawKind::AccumulatedVisibilityResults);
|
||||
/// a pass whose encoder sets none leaves the buffer as it was, as Metal's does.
|
||||
Accumulate,
|
||||
}
|
||||
|
||||
/// `MTLStoreAction`: what an attachment keeps as its pass ends.
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
@@ -342,9 +359,7 @@ impl Default for RenderPassStencilAttachmentDescriptor {
|
||||
/// ([`CommandBuffer::render_command_encoder`](crate::CommandBuffer::render_command_encoder)).
|
||||
///
|
||||
/// Not built, and so not fields: a rasterization rate map, tile sizes, imageblock and threadgroup
|
||||
/// memory lengths and sample buffer attachments. `visibilityResultType` is not a field:
|
||||
/// it decides only what an enabled visibility result mode writes, and no mode but `Disabled` is
|
||||
/// built.
|
||||
/// memory lengths and sample buffer attachments.
|
||||
#[derive(Clone, Default)]
|
||||
pub struct RenderPassDescriptor {
|
||||
/// `colorAttachments`.
|
||||
@@ -380,13 +395,16 @@ pub struct RenderPassDescriptor {
|
||||
/// would render; a length past the device's `maxFramebufferLayers`, [`Gap::RenderPass`] of
|
||||
/// [`RenderPassKind::ArrayLength`].
|
||||
pub render_target_array_length: u32,
|
||||
/// `visibilityResultBuffer`: `None` by default. The command buffer keeps it until it retires,
|
||||
/// and the pass leaves its bytes as they were: Metal's pass does so under either
|
||||
/// `visibilityResultType` where its encoder enables no mode (an Apple M3 Max, macOS 27.0.1),
|
||||
/// and `Disabled` is the only mode
|
||||
/// [`RenderCommandEncoder::set_visibility_result_mode`](crate::RenderCommandEncoder::set_visibility_result_mode)
|
||||
/// builds. It joins no hazard tracking: no command of the pass reaches it.
|
||||
/// `visibilityResultBuffer`: `None` by default. The command buffer keeps it until it retires.
|
||||
/// The pass writes the 8 bytes at each offset a `Boolean` or `Counting` mode of its encoder
|
||||
/// takes
|
||||
/// ([`RenderCommandEncoder::set_visibility_result_mode`](crate::RenderCommandEncoder::set_visibility_result_mode)),
|
||||
/// after its rendering and before its second barrier, ordered as a blit's write is; every other
|
||||
/// byte keeps its value, as Metal's pass keeps it under either `visibilityResultType` where its
|
||||
/// encoder enables no mode (an Apple M3 Max, macOS 27.0.1).
|
||||
pub visibility_result_buffer: Option<Buffer>,
|
||||
/// `visibilityResultType`: [`VisibilityResultType::Reset`] by default.
|
||||
pub visibility_result_type: VisibilityResultType,
|
||||
}
|
||||
|
||||
impl RenderPassDescriptor {
|
||||
|
||||
@@ -57,6 +57,14 @@
|
||||
//! every shadow holding nothing, so the next draw that reads an attachment copies what it reads
|
||||
//! again, after what the earlier draws rendered; it records nothing itself.
|
||||
//!
|
||||
//! A `Boolean` or `Counting` visibility result mode counts the draws after it in one precise
|
||||
//! occlusion query, begun before its first draw and ended in the rendering as the next mode set
|
||||
//! or the encoder's end ends it; after the rendering ends, the pass copies each count into the
|
||||
//! visibility result buffer (`crate::visibility`). Vulkan's query begins and ends inside one
|
||||
//! rendering, so while it counts, a command that would end the rendering is refused
|
||||
//! ([`DrawKind::VisibilityResultInterrupt`]); a segment's first draw may still end it, before the
|
||||
//! query begins.
|
||||
//!
|
||||
//! A draw sets Metal's state as dynamic state: every state at the encoder's first draw, Metal's
|
||||
//! defaults where the encoder set none, and after that what changed. A viewport is Vulkan's with
|
||||
//! its height negated (from `y + height`), so framebuffer rows, the fragment position and
|
||||
@@ -91,6 +99,7 @@ use crate::memory::BlockId;
|
||||
use crate::over::{self, Reached};
|
||||
use crate::pass::{
|
||||
layout_barrier, ops, resolving, LoadAction, Pass, RenderPassDescriptor, StoreAction, Target,
|
||||
VisibilityResultType,
|
||||
};
|
||||
use crate::pipeline::{address_word, FieldValue, PUSH_STAGES};
|
||||
use crate::record::{memory_barrier, Reach};
|
||||
@@ -99,6 +108,7 @@ use crate::ring::{Placed, CHUNK};
|
||||
use crate::sampler::SamplerState;
|
||||
use crate::shadow::{self, Area, Held};
|
||||
use crate::texture::{Texture, TextureInner, TextureObject};
|
||||
use crate::visibility::Results;
|
||||
use ash::vk;
|
||||
use metal2vulkan::bind::alpha_test_code;
|
||||
use metal2vulkan::metal::format::{integer_channels_word, BICUBIC_TEXELS_UNBOUND};
|
||||
@@ -140,19 +150,27 @@ pub struct ScissorRect {
|
||||
}
|
||||
|
||||
/// `MTLVisibilityResultMode`, which
|
||||
/// [`RenderCommandEncoder::set_visibility_result_mode`] takes: `Disabled` alone is built.
|
||||
/// [`RenderCommandEncoder::set_visibility_result_mode`] takes.
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub enum VisibilityResultMode {
|
||||
/// `MTLVisibilityResultModeDisabled`, Metal's default: the draws write no result.
|
||||
#[default]
|
||||
Disabled,
|
||||
/// `MTLVisibilityResultModeBoolean`: not built, [`DrawKind::VisibilityResults`].
|
||||
/// `MTLVisibilityResultModeBoolean`: the draws write whether a sample passed the depth and
|
||||
/// stencil tests, as the count of such samples, nonzero exactly where one did; Metal documents
|
||||
/// a nonzero result, and an Apple M3 Max writes 1 (docs/API.md, accepted differences).
|
||||
Boolean,
|
||||
/// `MTLVisibilityResultModeCounting`: not built, [`DrawKind::VisibilityResults`].
|
||||
/// `MTLVisibilityResultModeCounting`: the draws write the count of samples that passed the
|
||||
/// depth and stencil tests, the device's own
|
||||
/// ([`RenderCommandEncoder::VISIBILITY_NOTE`]).
|
||||
Counting,
|
||||
}
|
||||
|
||||
/// A pass's visibility result buffer, borrowed from what the command buffer keeps
|
||||
/// (`crate::kept`), and its `visibilityResultType`.
|
||||
type Visibility = (Lent<Buffer>, VisibilityResultType);
|
||||
|
||||
/// The index buffer of an indexed draw
|
||||
/// ([`RenderCommandEncoder::draw_indexed_primitives`]): `indexBuffer`, `indexBufferOffset` and
|
||||
/// `indexType`.
|
||||
@@ -572,10 +590,10 @@ struct Declarations {
|
||||
/// [`DrawKind::LineWidth`]), the store actions an encoder sets for an 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, executions of an
|
||||
/// indirect command buffer's indexed triangle draws, `useResource:`, `useHeap:`, and the
|
||||
/// `Disabled` visibility result mode (`Boolean` and `Counting` are
|
||||
/// [`DrawKind::VisibilityResults`]). Not built, and so not methods: the store action options
|
||||
/// setters, tile functions, the `setVertexBuffer:offset:attributeStride:atIndex:` family,
|
||||
/// indirect command buffer's indexed triangle draws, `useResource:`, `useHeap:`, and every
|
||||
/// visibility result mode in a pass of the `Reset` type (in an `Accumulate` pass, `Boolean` and
|
||||
/// `Counting` are [`DrawKind::AccumulatedVisibilityResults`]). Not built, and so not methods: 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
|
||||
@@ -638,6 +656,10 @@ pub struct RenderCommandEncoder {
|
||||
dirty: u32,
|
||||
/// The topology and primitive restart the last draw set.
|
||||
topology: Option<(vk::PrimitiveTopology, bool)>,
|
||||
/// The pass's visibility result buffer and its `visibilityResultType`.
|
||||
visibility: Option<Visibility>,
|
||||
/// The visibility results' segments and their queries.
|
||||
results: Results,
|
||||
/// A draw since the rendering began wrote memory: a memory barrier ends the rendering.
|
||||
wrote: bool,
|
||||
/// A draw since the encoder last ordered its draws rendered.
|
||||
@@ -692,7 +714,7 @@ impl CommandBuffer {
|
||||
// nothing uses the borrow after that, and a refused descriptor drops it with no use.
|
||||
let core = unsafe { Uncounted::of(building.device.core()) };
|
||||
match begin(&mut building, &core, descriptor) {
|
||||
Ok((pass, command)) => {
|
||||
Ok((pass, command, visibility)) => {
|
||||
let [width, height] = pass.area;
|
||||
Ok(RenderCommandEncoder {
|
||||
command_buffer: self.clone(),
|
||||
@@ -728,6 +750,8 @@ impl CommandBuffer {
|
||||
recorded: None,
|
||||
dirty: ALL,
|
||||
topology: None,
|
||||
visibility,
|
||||
results: Results::default(),
|
||||
wrote: false,
|
||||
drew: false,
|
||||
pass_drew: false,
|
||||
@@ -753,12 +777,13 @@ impl CommandBuffer {
|
||||
}
|
||||
|
||||
/// Checks `descriptor` and records its pass's first barrier, where it has one, and its
|
||||
/// `vkCmdBeginRendering`.
|
||||
/// `vkCmdBeginRendering`; the visibility result buffer borrowed, with the pass's
|
||||
/// `visibilityResultType`.
|
||||
fn begin(
|
||||
building: &mut Building,
|
||||
core: &Arc<Core>,
|
||||
descriptor: &RenderPassDescriptor,
|
||||
) -> Result<(Pass, vk::CommandBuffer), Error> {
|
||||
) -> Result<(Pass, vk::CommandBuffer, Option<Visibility>), Error> {
|
||||
let pass = Pass::check(core, descriptor)?;
|
||||
// The attachments, and where the pass resolves the resolve textures, which the pass writes:
|
||||
// a pass that resolves nothing walks no resolve.
|
||||
@@ -788,11 +813,12 @@ fn begin(
|
||||
building.wrote_texture_managed(&r.texture);
|
||||
}
|
||||
}
|
||||
// Kept as Metal's pass holds it, and no access declared: no draw writes it while `Disabled`
|
||||
// is the only mode built.
|
||||
if let Some(buffer) = &descriptor.visibility_result_buffer {
|
||||
building.keep(buffer);
|
||||
}
|
||||
// Kept as Metal's pass holds it; its writes are the encoder's, at its first mode and its end.
|
||||
let visibility = (descriptor.visibility_result_buffer.as_ref()).map(|buffer| {
|
||||
// SAFETY: the encoder holds the borrow, and it ends before its command buffer commits.
|
||||
let lent = unsafe { building.lend_buffer(buffer) };
|
||||
(lent, descriptor.visibility_result_type)
|
||||
});
|
||||
building.overs_before(overs(), false)?;
|
||||
let opens = building.opens_command_buffer();
|
||||
let command = building.ordered_command()?;
|
||||
@@ -838,7 +864,7 @@ fn begin(
|
||||
// SAFETY: the command buffer records outside any render pass and keeps each attachment's
|
||||
// texture until it retires; each attachment is in the layout the pass names.
|
||||
unsafe { pass.begin(device, command, false) };
|
||||
Ok((pass, command))
|
||||
Ok((pass, command, visibility))
|
||||
}
|
||||
|
||||
impl RenderCommandEncoder {
|
||||
@@ -1359,25 +1385,140 @@ impl RenderCommandEncoder {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// `setVisibilityResultMode:offset:`: `Disabled`, Metal's default, is every draw's, at any
|
||||
/// offset, and records nothing; `Boolean` and `Counting` are not built. A program may set
|
||||
/// `Disabled` with no visibility result buffer and at an offset it never enables.
|
||||
/// The static precision note of a `Boolean` or `Counting` visibility result
|
||||
/// ([`set_visibility_result_mode`](Self::set_visibility_result_mode)).
|
||||
pub const VISIBILITY_NOTE: PrecisionNote = PrecisionNote::DeviceOcclusionCount;
|
||||
|
||||
/// `setVisibilityResultMode:offset:`: from the next draw, the encoder's draws count the
|
||||
/// samples that pass the depth and stencil tests into the 8 bytes at `offset` of the pass's
|
||||
/// visibility result buffer, until the next mode set or the encoder's end; `Disabled`, Metal's
|
||||
/// default, counts none, at any offset, with or without a buffer. Each `Boolean` or `Counting`
|
||||
/// mode set is one precise occlusion query (`crate::visibility`), begun in the rendering
|
||||
/// before its first draw and ended there as the next mode set or the encoder's end ends it;
|
||||
/// the pass copies its count, 64 bits, to the offset after its rendering ends, and a mode with
|
||||
/// no draw writes 0. `Boolean` writes the count too, nonzero exactly where a sample passed
|
||||
/// ([`VisibilityResultMode::Boolean`]). Which samples a device counts is its own
|
||||
/// ([`VISIBILITY_NOTE`](Self::VISIBILITY_NOTE)). The first such mode of the encoder records
|
||||
/// the copies a texture over the buffer in an image of its own owes before the buffer is
|
||||
/// written (`crate::over`), ending the rendering to record them.
|
||||
///
|
||||
/// Err: [`Gap::Draw`] of [`DrawKind::VisibilityResults`] for `Boolean` and `Counting`.
|
||||
/// Once a mode's query has begun, nothing may end the rendering until the next mode set: a
|
||||
/// command that would is refused ([`DrawKind::VisibilityResultInterrupt`]).
|
||||
///
|
||||
/// Err, for `Boolean` and `Counting`, the encoder's mode unchanged:
|
||||
/// [`Refusal::NoVisibilityResultBuffer`]; [`Refusal::VisibilityResultOffset`] for an offset
|
||||
/// that is not a multiple of 8 or whose 8 bytes run past the buffer;
|
||||
/// [`Refusal::ArgumentPlace`] for an offset at a byte of the buffer's allocation that is not a
|
||||
/// multiple of 8; [`Refusal::VisibilityResultOffsetTaken`]; [`Gap::Draw`] of
|
||||
/// [`DrawKind::AccumulatedVisibilityResults`] in a pass whose `visibilityResultType` is
|
||||
/// `Accumulate`; [`Error::Vulkan`] where the device makes no query pool or the command buffer
|
||||
/// cannot record.
|
||||
pub fn set_visibility_result_mode(
|
||||
&mut self,
|
||||
mode: VisibilityResultMode,
|
||||
offset: u64,
|
||||
) -> Result<(), Error> {
|
||||
// Metal reads the offset only for an enabled mode: `Disabled` takes any.
|
||||
match (mode, offset) {
|
||||
(VisibilityResultMode::Disabled, _) => Ok(()),
|
||||
(VisibilityResultMode::Boolean | VisibilityResultMode::Counting, _) => {
|
||||
Err(Error::Unsupported(Gap::Draw {
|
||||
kind: DrawKind::VisibilityResults,
|
||||
}))
|
||||
}
|
||||
if mode == VisibilityResultMode::Disabled {
|
||||
// SAFETY: the command buffer is inside the pass's rendering and keeps the query's pool
|
||||
// until it retires.
|
||||
unsafe { self.results.end(&self.core.device, self.command) };
|
||||
return Ok(());
|
||||
}
|
||||
let accumulate = {
|
||||
let Some((buffer, kind)) = &self.visibility else {
|
||||
return Err(Error::Refused(Refusal::NoVisibilityResultBuffer));
|
||||
};
|
||||
let length = buffer.length();
|
||||
if !offset.is_multiple_of(8) || offset.checked_add(8).is_none_or(|end| end > length) {
|
||||
return Err(Error::Refused(Refusal::VisibilityResultOffset {
|
||||
offset,
|
||||
length,
|
||||
}));
|
||||
}
|
||||
let place = buffer.device_range().1 + offset;
|
||||
if !place.is_multiple_of(8) {
|
||||
return Err(Error::Refused(Refusal::ArgumentPlace {
|
||||
place,
|
||||
alignment: 8,
|
||||
}));
|
||||
}
|
||||
*kind == VisibilityResultType::Accumulate
|
||||
};
|
||||
if self.results.taken(offset) {
|
||||
return Err(Error::Refused(Refusal::VisibilityResultOffsetTaken {
|
||||
offset,
|
||||
}));
|
||||
}
|
||||
if accumulate {
|
||||
self.building().count(Metric::AccumulatedVisibilityRefused);
|
||||
return Err(Error::Unsupported(Gap::Draw {
|
||||
kind: DrawKind::AccumulatedVisibilityResults,
|
||||
}));
|
||||
}
|
||||
if self.results.is_empty() {
|
||||
self.results_owed()?;
|
||||
}
|
||||
let query = self.building().take_query()?;
|
||||
// SAFETY: as above.
|
||||
unsafe { self.results.end(&self.core.device, self.command) };
|
||||
self.results.start(offset, query);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Before the encoder's first `Boolean` or `Counting` mode, while no query counts its draws:
|
||||
/// the copies that the visibility result buffer's write at the pass's end needs first, of
|
||||
/// textures over it in images of their own and over its device copy (`crate::over`), each
|
||||
/// recorded between the rendering's end and its new beginning; nothing where none is owed.
|
||||
///
|
||||
/// Err: [`Error::Vulkan`] where the command buffer cannot record.
|
||||
fn results_owed(&mut self) -> Result<(), Error> {
|
||||
let (Some((buffer, _)), Some(building)) = (&self.visibility, self.building.as_mut()) else {
|
||||
return Ok(());
|
||||
};
|
||||
let written = [(Reached::Buffer(buffer.span()), Access::Write)];
|
||||
let copies = building.overs_owed(written, false);
|
||||
let backs = over::backs(&**buffer, None, true);
|
||||
if copies.is_empty() && backs.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
self.interrupt(|building, _| {
|
||||
building.record_overs(copies)?;
|
||||
building.managed_backs(backs)
|
||||
})
|
||||
}
|
||||
|
||||
/// After the pass's rendering ends: each visibility result copied into the buffer, written
|
||||
/// as a blit's copy writes it, for textures over it in images of their own and over its
|
||||
/// device copy, and for the host where it is Shared; before the pass's second barrier, which
|
||||
/// orders the copies before every later command.
|
||||
fn copy_results(&self, building: &mut Building) {
|
||||
let Some((buffer, _)) = &self.visibility else {
|
||||
return;
|
||||
};
|
||||
if self.results.is_empty() {
|
||||
return;
|
||||
}
|
||||
// SAFETY: every segment ended; the command buffer records outside any rendering and keeps
|
||||
// the buffer until it retires; each offset was checked a multiple of 8 in its allocation,
|
||||
// its 8 bytes in the buffer (`set_visibility_result_mode`).
|
||||
unsafe {
|
||||
self.results
|
||||
.copy(&self.core.device, self.command, buffer.device_range())
|
||||
};
|
||||
building.overs_after([(Reached::Buffer(buffer.span()), Access::Write)], false);
|
||||
building.wrote_managed(&**buffer);
|
||||
if buffer.is_shared() {
|
||||
building.wrote_host();
|
||||
}
|
||||
}
|
||||
|
||||
/// A command that would end the rendering while a visibility result's query counts the
|
||||
/// draws: refused, and counted.
|
||||
fn interrupt_refused(&mut self) -> Error {
|
||||
self.building().count(Metric::VisibilityInterruptsRefused);
|
||||
Error::Unsupported(Gap::Draw {
|
||||
kind: DrawKind::VisibilityResultInterrupt,
|
||||
})
|
||||
}
|
||||
|
||||
/// `setDepthClipMode:` for the encoder's later draws: `Clip`, Metal's default, or `Clamp`,
|
||||
@@ -1485,8 +1626,13 @@ impl RenderCommandEncoder {
|
||||
/// without the feedback loop, after draws, every shadow holds nothing from then, so the next
|
||||
/// draw that reads an attachment copies what it reads again (`crate::shadow`).
|
||||
///
|
||||
/// Err: [`Error::Vulkan`] where the command buffer cannot record.
|
||||
/// Err: [`Gap::Draw`] of [`DrawKind::VisibilityResultInterrupt`] after a draw that wrote
|
||||
/// memory while a visibility result's query counts the draws, the encoder as it was;
|
||||
/// [`Error::Vulkan`] where the command buffer cannot record.
|
||||
pub fn memory_barrier(&mut self) -> Result<(), Error> {
|
||||
if self.wrote && self.results.counting() {
|
||||
return Err(self.interrupt_refused());
|
||||
}
|
||||
if self.drew {
|
||||
for shadowed in &mut self.shadowed {
|
||||
shadowed.held.clear();
|
||||
@@ -2374,6 +2520,10 @@ impl RenderCommandEncoder {
|
||||
}
|
||||
}
|
||||
self.record_state(topology, restart, hidden);
|
||||
// A mode's query begins at its first draw, after what that draw ended the rendering
|
||||
// to record first: the command buffer is inside the pass's rendering, and keeps the
|
||||
// query's pool until it retires.
|
||||
self.results.draw(&self.core.device, command);
|
||||
}
|
||||
let core = &*self.core;
|
||||
let device = &core.device;
|
||||
@@ -2760,6 +2910,9 @@ impl RenderCommandEncoder {
|
||||
overs: bool,
|
||||
commands: bool,
|
||||
) -> Result<(), Error> {
|
||||
if self.results.counting() && self.ends_rendering(reads.as_ref(), index, overs) {
|
||||
return Err(self.interrupt_refused());
|
||||
}
|
||||
let reads_attachment = match reads {
|
||||
Some(found) => {
|
||||
if !found.moves.is_empty() {
|
||||
@@ -2847,6 +3000,51 @@ impl RenderCommandEncoder {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Whether [`draw_reaches`](Self::draw_reaches) may end the rendering for the draw: where it
|
||||
/// moves an image to the feedback layout, pays the barrier owed before an attachment read, or
|
||||
/// reads what an attachment's shadow does not hold; and, not looking at whether a copy is
|
||||
/// owed, where it looks at textures over a buffer in an image of their own (`overs`), or
|
||||
/// reaches a Managed buffer with textures over its device copy.
|
||||
fn ends_rendering(
|
||||
&self,
|
||||
reads: Option<&AttachmentReads>,
|
||||
index: [Option<&Buffer>; 2],
|
||||
overs: bool,
|
||||
) -> bool {
|
||||
if overs {
|
||||
return true;
|
||||
}
|
||||
if let Some(found) = reads {
|
||||
let held = |(texture, areas): &(Arc<TextureInner>, Vec<Area>)| {
|
||||
let hazard = texture.hazard_id();
|
||||
(self.shadowed.iter())
|
||||
.find(|s| s.hazard == hazard)
|
||||
.map_or_else(|| Held::default().holds(areas), |s| s.held.holds(areas))
|
||||
};
|
||||
if !found.moves.is_empty()
|
||||
|| (found.reads && self.owed)
|
||||
|| !found.shadow_reads.iter().all(held)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
let Some(state) = &self.pipeline else {
|
||||
return false;
|
||||
};
|
||||
let draws = &state.inner.compiled.draws;
|
||||
let tables = &self.tables;
|
||||
let managed = |buffer: &Arc<BufferInner>| buffer.managed_overs().is_some();
|
||||
let factors = (self.factors.as_ref())
|
||||
.filter(|_| draws.patches)
|
||||
.map(|(buffer, _)| &**buffer);
|
||||
(draws.buffers.iter())
|
||||
.filter_map(|&(table, slot, _)| tables[table].buffer(slot))
|
||||
.chain((draws.bindings.iter()).filter_map(|&(_, index)| tables[VERTEX].buffer(index)))
|
||||
.chain(index.into_iter().flatten().map(BufferObject::object))
|
||||
.chain(factors)
|
||||
.any(managed)
|
||||
}
|
||||
|
||||
/// After a draw of the pipeline state: what it wrote, for the textures over a buffer in an
|
||||
/// image of their own (`crate::over`). An execution's (`commands`) writes where its commands'
|
||||
/// slots reach, outside its resources, where the state writes memory.
|
||||
@@ -3059,6 +3257,10 @@ impl RenderCommandEncoder {
|
||||
&mut self,
|
||||
record: impl FnOnce(&mut Building, &Core) -> Result<(), Error>,
|
||||
) -> Result<(), Error> {
|
||||
debug_assert!(
|
||||
!self.results.counting(),
|
||||
"no command ends the rendering while a visibility result's query counts the draws"
|
||||
);
|
||||
let building = (self.building.as_mut())
|
||||
.expect("an encoder holds its command buffer's recording until it ends");
|
||||
let core = &*self.core;
|
||||
@@ -3075,8 +3277,8 @@ impl RenderCommandEncoder {
|
||||
recorded
|
||||
}
|
||||
|
||||
/// `endEncoding`: ends the pass, one `vkCmdEndRendering` and the pass's second barrier, owed
|
||||
/// where no attachment moves home.
|
||||
/// `endEncoding`: ends the pass, one `vkCmdEndRendering`, the copies of its visibility
|
||||
/// results, and the pass's second barrier, owed where no attachment moves home.
|
||||
pub fn end_encoding(mut self) {
|
||||
self.end();
|
||||
}
|
||||
@@ -3107,8 +3309,12 @@ impl RenderCommandEncoder {
|
||||
}
|
||||
let device = &core.device;
|
||||
// SAFETY: the command buffer is inside the pass's rendering, which nothing else records
|
||||
// into while the encoder holds it.
|
||||
unsafe { device.cmd_end_rendering(self.command) };
|
||||
// into while the encoder holds it, and keeps the query's pool until it retires.
|
||||
unsafe {
|
||||
self.results.end(device, self.command);
|
||||
device.cmd_end_rendering(self.command);
|
||||
}
|
||||
self.copy_results(&mut building);
|
||||
if self.pass.resolving {
|
||||
for _ in self.pass.resolves() {
|
||||
building.count(Metric::Resolves);
|
||||
|
||||
@@ -222,6 +222,12 @@ impl Held {
|
||||
copies
|
||||
}
|
||||
|
||||
/// Whether the shadow holds every read of `reads`: whether [`plan`](Self::plan) copies none.
|
||||
pub(crate) fn holds(&self, reads: &[Area]) -> bool {
|
||||
(reads.iter().filter(|read| !read.is_empty()))
|
||||
.all(|read| (self.areas.iter()).any(|held| read.past(held).is_empty()))
|
||||
}
|
||||
|
||||
/// The shadow holds `area`: a held area inside it is dropped, and past [`HELD`] the oldest.
|
||||
fn hold(&mut self, area: Area) {
|
||||
self.areas.retain(|held| !area.contains(held));
|
||||
|
||||
@@ -68,9 +68,9 @@
|
||||
//! a pipeline state of other formats than the pass's, a depth test, a stencil test without a
|
||||
//! stencil attachment, a misaligned index offset, a non-finite viewport and a mirrored one.
|
||||
//! - a pass with a visibility result buffer draws, its command buffer keeps the buffer until it
|
||||
//! retires, and its bytes stay as they were; `Disabled` at any offset records nothing, the
|
||||
//! pass takes the submission, barrier and pass one without the buffer takes, and `Boolean`
|
||||
//! and `Counting` are `DrawKind::VisibilityResults`.
|
||||
//! retires, and its bytes stay as they were; `Disabled` at any offset records nothing, and the
|
||||
//! pass takes the submission, barrier and pass one without the buffer takes (`Boolean` and
|
||||
//! `Counting` are `tests::visibility`'s).
|
||||
//!
|
||||
//! `llvm-as` assembles the fixtures; without it a device test skips visibly.
|
||||
|
||||
@@ -3003,8 +3003,8 @@ define internal void @_GLOBAL__sub_I_() section "air.static_init" {
|
||||
/// A pass with a visibility result buffer draws, keeps the buffer until its command buffer
|
||||
/// retires, and leaves its bytes as they were, as Metal's pass does where its encoder enables
|
||||
/// no mode: `Disabled` at any offset records nothing, and the pass takes the submission,
|
||||
/// barrier and pass one without the buffer takes, as the buffer joins no hazard tracking.
|
||||
/// `Boolean` and `Counting` are `DrawKind::VisibilityResults`.
|
||||
/// barrier and pass one without the buffer takes, as no command of an encoder that enables no
|
||||
/// mode reaches the buffer.
|
||||
#[test]
|
||||
fn every_device_keeps_a_pass_s_visibility_buffer_and_leaves_its_bytes() {
|
||||
let Some(library) = examples() else {
|
||||
@@ -3041,21 +3041,6 @@ define internal void @_GLOBAL__sub_I_() section "air.static_init" {
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
draw(encoder.set_visibility_result_mode(VisibilityResultMode::Disabled, 8));
|
||||
draw(encoder.set_visibility_result_mode(VisibilityResultMode::Disabled, 1 << 40));
|
||||
for mode in [
|
||||
VisibilityResultMode::Boolean,
|
||||
VisibilityResultMode::Counting,
|
||||
] {
|
||||
assert_eq!(
|
||||
format!("{:?}", encoder.set_visibility_result_mode(mode, 0)),
|
||||
format!(
|
||||
"{:?}",
|
||||
Err::<(), _>(Error::Unsupported(Gap::Draw {
|
||||
kind: DrawKind::VisibilityResults
|
||||
}))
|
||||
),
|
||||
"{name}: {mode:?}"
|
||||
);
|
||||
}
|
||||
draw(encoder.set_render_pipeline_state(&state));
|
||||
draw(encoder.set_vertex_buffer(Some(&positions), 0, 0));
|
||||
draw(encoder.set_vertex_buffer(Some(&colors), 0, 1));
|
||||
|
||||
@@ -92,6 +92,7 @@ fn at_the_floor() -> Queried {
|
||||
features.core.dual_src_blend = vk::TRUE;
|
||||
features.core.sample_rate_shading = vk::TRUE;
|
||||
features.core.vertex_pipeline_stores_and_atomics = vk::TRUE;
|
||||
features.core.occlusion_query_precise = vk::TRUE;
|
||||
features.vulkan11.multiview = vk::TRUE;
|
||||
features.vulkan11.shader_draw_parameters = vk::TRUE;
|
||||
features.vulkan12.shader_subgroup_extended_types = vk::TRUE;
|
||||
@@ -430,6 +431,7 @@ fn a_device_at_the_floor_is_above_it() {
|
||||
assert_eq!(enabled.core.tessellation_shader, vk::TRUE);
|
||||
assert_eq!(enabled.core.dual_src_blend, vk::TRUE);
|
||||
assert_eq!(enabled.core.vertex_pipeline_stores_and_atomics, vk::TRUE);
|
||||
assert_eq!(enabled.core.occlusion_query_precise, vk::TRUE);
|
||||
assert_eq!(enabled.vulkan11.multiview, vk::TRUE);
|
||||
assert_eq!(enabled.vulkan11.shader_draw_parameters, vk::TRUE);
|
||||
assert_eq!(enabled.vulkan12.shader_subgroup_extended_types, vk::TRUE);
|
||||
@@ -583,6 +585,10 @@ fn each_missing_feature_is_named() {
|
||||
|f| f.core.vertex_pipeline_stores_and_atomics = vk::FALSE,
|
||||
feature(CORE, "vertexPipelineStoresAndAtomics"),
|
||||
),
|
||||
(
|
||||
|f| f.core.occlusion_query_precise = vk::FALSE,
|
||||
feature(CORE, "occlusionQueryPrecise"),
|
||||
),
|
||||
(
|
||||
|f| f.vulkan11.multiview = vk::FALSE,
|
||||
feature(V11, "multiview"),
|
||||
|
||||
@@ -109,6 +109,7 @@ mod upload;
|
||||
mod validation;
|
||||
mod view;
|
||||
mod viewports;
|
||||
mod visibility;
|
||||
|
||||
/// This crate's directory: the test process's `CARGO_MANIFEST_DIR` where it holds the crate's
|
||||
/// sources (cargo and nextest set it for each test, and an archive run elsewhere remaps it to the
|
||||
|
||||
@@ -0,0 +1,485 @@
|
||||
//! Visibility results (`setVisibilityResultMode:offset:`), under a device cfg on every device of the
|
||||
//! cfg's kind, each pass an 8 by 8 `RGBA8Unorm` target that `colored_vertex` and
|
||||
//! `colored_fragment` draw into, its visibility result buffer starting as `0xaa` bytes:
|
||||
//!
|
||||
//! - `Counting` and `Boolean` write the samples their draws pass, the CPU's count of the pixels
|
||||
//! each triangle covers at one sample: 64 for the whole target, 32 for its top half, three
|
||||
//! instances three times that, 0 for a triangle that covers no pixel and for a mode with no
|
||||
//! draw; `Disabled` counts nothing, and an offset no mode took keeps its bytes, a second pass
|
||||
//! rewriting only its own offset.
|
||||
//! - A command buffer takes its occlusion queries from pools the device lends it and takes back as
|
||||
//! it retires, or as it drops uncommitted: 17 held at once are 17 pools, of which the device
|
||||
//! keeps 16 free and destroys the rest; a later command buffer of 300 modes takes two of them
|
||||
//! again, and makes none.
|
||||
//! - What Metal refuses is refused, the encoder's mode unchanged: a mode with no visibility result
|
||||
//! buffer, at an offset off a multiple of 8 or past the buffer, at an offset the encoder took
|
||||
//! before, and at a byte of the buffer's allocation off a multiple of 8.
|
||||
//! - A mode in an `Accumulate` pass is `DrawKind::AccumulatedVisibilityResults`, counted, and the
|
||||
//! buffer keeps its bytes.
|
||||
//! - While a mode's query counts the draws, a memory barrier after a draw that wrote memory, and a
|
||||
//! draw that reads its pass's attachment through a texture, which would end the rendering, are
|
||||
//! `DrawKind::VisibilityResultInterrupt`, counted; the same commands after a mode set and
|
||||
//! before its first draw run.
|
||||
//!
|
||||
//! `llvm-as` assembles the fixtures; without it a device test skips visibly.
|
||||
|
||||
#[cfg(any(m2v_gpu, m2v_cpu_icd))]
|
||||
mod on_device {
|
||||
use crate::tests::command::on_device::{each_device, within};
|
||||
use crate::tests::draw::on_device::{
|
||||
descriptor, examples, floats, library, pass, readable, run, state, target, Buffers, BLUE,
|
||||
};
|
||||
use crate::{
|
||||
Buffer, ColorAttachmentDescriptor, DrawKind, Error, FunctionDescriptor, Gap, IndexClass,
|
||||
PixelFormat, PrimitiveType, Refusal, RenderCommandEncoder, RenderPipelineDescriptor,
|
||||
StageSource, TextureUsage, VisibilityResultMode, VisibilityResultType,
|
||||
};
|
||||
use metal2vulkan_devtools::engine_dir;
|
||||
|
||||
/// A word no mode wrote.
|
||||
const UNWRITTEN: u64 = 0xaaaa_aaaa_aaaa_aaaa;
|
||||
|
||||
/// The fixture's triangles for `colored_vertex`: the top half of clip space, the whole of it,
|
||||
/// and one of no area, three vertices each, all blue.
|
||||
fn triangles(device: &crate::Device, buffers: &mut Buffers) -> (Buffer, Buffer) {
|
||||
let top = [-1.0, 0.0, 3.0, 0.0, -1.0, 4.0];
|
||||
let whole = [-1.0, -1.0, 3.0, -1.0, -1.0, 3.0];
|
||||
let none = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5];
|
||||
let positions: Vec<f32> = [top, whole, none].concat();
|
||||
let colors: Vec<f32> = [BLUE; 9].concat();
|
||||
(
|
||||
buffers.of(device, &floats(&positions)),
|
||||
buffers.of(device, &floats(&colors)),
|
||||
)
|
||||
}
|
||||
|
||||
/// The first vertex of each triangle of [`triangles`].
|
||||
const TOP: u32 = 0;
|
||||
const WHOLE: u32 = 3;
|
||||
const NONE: u32 = 6;
|
||||
|
||||
/// The 64-bit words of `buffer`, `count` of them.
|
||||
fn words(buffer: &Buffer, count: usize) -> Vec<u64> {
|
||||
let contents = buffer.contents().expect("a Shared buffer");
|
||||
// SAFETY: the buffer holds `count` words, which the finished command buffers wrote and
|
||||
// whose writes reach the host.
|
||||
let bytes = unsafe { std::slice::from_raw_parts(contents.as_ptr(), 8 * count) };
|
||||
(bytes.chunks_exact(8))
|
||||
.map(|word| u64::from_le_bytes(word.try_into().expect("8 bytes")))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// `result` as text, for comparing errors.
|
||||
fn text(result: Result<(), Error>) -> String {
|
||||
format!("{result:?}")
|
||||
}
|
||||
|
||||
/// A refusal of `refusal`, as text.
|
||||
fn refused(refusal: Refusal) -> String {
|
||||
text(Err(Error::Refused(refusal)))
|
||||
}
|
||||
|
||||
/// A gap of `kind`, as text.
|
||||
fn gap(kind: DrawKind) -> String {
|
||||
text(Err(Error::Unsupported(Gap::Draw { kind })))
|
||||
}
|
||||
|
||||
/// `Counting` and `Boolean` count the samples their draws pass; `Disabled` counts none; an
|
||||
/// offset no mode took keeps its bytes; offsets 0 to 32, one run, and 56, another, are copied
|
||||
/// at the pass's end; a second pass rewrites its own offset alone.
|
||||
#[test]
|
||||
fn every_device_counts_the_samples_each_mode_s_draws_pass() {
|
||||
let Some(library) = examples() else {
|
||||
return;
|
||||
};
|
||||
let d = descriptor(&library, "colored_fragment", PixelFormat::RGBA8Unorm);
|
||||
each_device("visibility_counts", |name, _, device| {
|
||||
let state = state(name, &device, &d);
|
||||
let mut buffers = Buffers::new(&device);
|
||||
let (positions, colors) = triangles(&device, &mut buffers);
|
||||
let visibility = buffers.of(&device, &[0xaa; 64]);
|
||||
let color = target(
|
||||
&device,
|
||||
PixelFormat::RGBA8Unorm,
|
||||
TextureUsage::RENDER_TARGET,
|
||||
);
|
||||
let queue = device.new_command_queue(4).expect("a queue");
|
||||
let ok = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}"));
|
||||
let encoder = |command_buffer: &crate::CommandBuffer| {
|
||||
let mut d = pass(&color, None);
|
||||
d.visibility_result_buffer = Some(visibility.clone());
|
||||
let mut encoder = (command_buffer.render_command_encoder(&d))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
ok(encoder.set_render_pipeline_state(&state));
|
||||
ok(encoder.set_vertex_buffer(Some(&positions), 0, 0));
|
||||
ok(encoder.set_vertex_buffer(Some(&colors), 0, 1));
|
||||
encoder
|
||||
};
|
||||
let draw = |encoder: &mut RenderCommandEncoder, first: u32, instances: u32| {
|
||||
ok(encoder.draw_primitives(PrimitiveType::Triangle, first, 3, instances, 0))
|
||||
};
|
||||
let (counting, boolean, disabled) = (
|
||||
VisibilityResultMode::Counting,
|
||||
VisibilityResultMode::Boolean,
|
||||
VisibilityResultMode::Disabled,
|
||||
);
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut e = encoder(&command_buffer);
|
||||
ok(e.set_visibility_result_mode(counting, 0));
|
||||
draw(&mut e, WHOLE, 1);
|
||||
ok(e.set_visibility_result_mode(counting, 8));
|
||||
draw(&mut e, TOP, 1);
|
||||
draw(&mut e, WHOLE, 1);
|
||||
ok(e.set_visibility_result_mode(boolean, 16));
|
||||
draw(&mut e, WHOLE, 1);
|
||||
ok(e.set_visibility_result_mode(boolean, 24));
|
||||
draw(&mut e, NONE, 1);
|
||||
ok(e.set_visibility_result_mode(counting, 32));
|
||||
ok(e.set_visibility_result_mode(disabled, 40));
|
||||
draw(&mut e, WHOLE, 1);
|
||||
ok(e.set_visibility_result_mode(counting, 56));
|
||||
draw(&mut e, WHOLE, 3);
|
||||
e.end_encoding();
|
||||
run(name, &command_buffer);
|
||||
// `Boolean` writes the count, nonzero exactly where a sample passed.
|
||||
let first = [64, 96, 64, 0, 0, UNWRITTEN, UNWRITTEN, 192];
|
||||
assert_eq!(
|
||||
words(&visibility, 8),
|
||||
first,
|
||||
"{name}: the first pass's words"
|
||||
);
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut e = encoder(&command_buffer);
|
||||
ok(e.set_visibility_result_mode(counting, 48));
|
||||
draw(&mut e, TOP, 1);
|
||||
e.end_encoding();
|
||||
run(name, &command_buffer);
|
||||
let second = [64, 96, 64, 0, 0, UNWRITTEN, 32, 192];
|
||||
assert_eq!(
|
||||
words(&visibility, 8),
|
||||
second,
|
||||
"{name}: the second pass's words"
|
||||
);
|
||||
println!("{name}: visibility results {second:x?}");
|
||||
});
|
||||
}
|
||||
|
||||
/// A command buffer's pools come from the device and go back as it retires or drops: 17
|
||||
/// command buffers that each set a mode, held at once, hold 17 pools; dropped uncommitted,
|
||||
/// the device keeps 16 free and destroys one. A command buffer of 300 modes in one encoder,
|
||||
/// whose queries fill one pool and start a second, takes two of the free ones, makes none,
|
||||
/// and writes 0 at each of the 300 offsets, a mode with no draw counting none; after it
|
||||
/// retires the device holds 16 again, and none once it drops.
|
||||
#[test]
|
||||
fn every_device_takes_back_and_bounds_its_occlusion_pools() {
|
||||
each_device("visibility_pools", |name, _, device| {
|
||||
let mut buffers = Buffers::new(&device);
|
||||
let visibility = buffers.of(&device, &[0xaa; 8 * 301]);
|
||||
let color = target(
|
||||
&device,
|
||||
PixelFormat::RGBA8Unorm,
|
||||
TextureUsage::RENDER_TARGET,
|
||||
);
|
||||
let queue = device.new_command_queue(32).expect("a queue");
|
||||
let counters = device.counters();
|
||||
let pools = || counters.gauges().occlusion_pools;
|
||||
let ok = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}"));
|
||||
let encode = |modes: u64| {
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut d = pass(&color, None);
|
||||
d.visibility_result_buffer = Some(visibility.clone());
|
||||
let mut encoder = (command_buffer.render_command_encoder(&d))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
for at in 0..modes {
|
||||
ok(encoder.set_visibility_result_mode(VisibilityResultMode::Counting, 8 * at));
|
||||
}
|
||||
encoder.end_encoding();
|
||||
command_buffer
|
||||
};
|
||||
assert_eq!(pools(), 0, "{name}: a new device's pools");
|
||||
let held: Vec<_> = (0..17).map(|_| encode(1)).collect();
|
||||
assert_eq!(pools(), 17, "{name}: one pool for each command buffer");
|
||||
drop(held);
|
||||
assert_eq!(pools(), 16, "{name}: the pools kept free");
|
||||
let command_buffer = encode(300);
|
||||
assert_eq!(pools(), 16, "{name}: 300 queries from two free pools");
|
||||
run(name, &command_buffer);
|
||||
drop(command_buffer);
|
||||
within("the pools' return", || pools() == 16);
|
||||
let mut want = vec![0; 300];
|
||||
want.push(UNWRITTEN);
|
||||
assert_eq!(words(&visibility, 301), want, "{name}: the 300 words");
|
||||
println!("{name}: 17 pools held, 16 kept free, 300 queries from two of them");
|
||||
});
|
||||
}
|
||||
|
||||
/// Metal's refusals of a mode, each leaving the encoder's mode as it was: no visibility result
|
||||
/// buffer, an offset off a multiple of 8, past the buffer, taken before in the encoder, and
|
||||
/// one at a byte of the buffer's allocation off a multiple of 8. `Disabled` takes any offset
|
||||
/// with no buffer. The mode set after them counts the encoder's draw.
|
||||
#[test]
|
||||
fn every_device_refuses_what_metal_refuses_of_a_visibility_mode() {
|
||||
let Some(library) = examples() else {
|
||||
return;
|
||||
};
|
||||
let d = descriptor(&library, "colored_fragment", PixelFormat::RGBA8Unorm);
|
||||
each_device("visibility_refusals", |name, _, device| {
|
||||
let state = state(name, &device, &d);
|
||||
let mut buffers = Buffers::new(&device);
|
||||
let (positions, colors) = triangles(&device, &mut buffers);
|
||||
let visibility = buffers.of(&device, &[0xaa; 16]);
|
||||
let skewed = buffers.at(&device, &[0xaa; 16], 4);
|
||||
let color = target(
|
||||
&device,
|
||||
PixelFormat::RGBA8Unorm,
|
||||
TextureUsage::RENDER_TARGET,
|
||||
);
|
||||
let queue = device.new_command_queue(4).expect("a queue");
|
||||
let ok = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}"));
|
||||
let counting = VisibilityResultMode::Counting;
|
||||
// No buffer: `Disabled` at any offset, and no other mode.
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut e = (command_buffer.render_command_encoder(&pass(&color, None)))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
ok(e.set_visibility_result_mode(VisibilityResultMode::Disabled, 1 << 40));
|
||||
assert_eq!(
|
||||
text(e.set_visibility_result_mode(VisibilityResultMode::Boolean, 0)),
|
||||
refused(Refusal::NoVisibilityResultBuffer),
|
||||
"{name}: no buffer"
|
||||
);
|
||||
e.end_encoding();
|
||||
run(name, &command_buffer);
|
||||
// A buffer whose allocation byte is off a multiple of 8.
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut d = pass(&color, None);
|
||||
d.visibility_result_buffer = Some(skewed.clone());
|
||||
let mut e = (command_buffer.render_command_encoder(&d))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let (_, at) = crate::buffer::BufferObject::device_range(&skewed);
|
||||
assert_eq!(
|
||||
text(e.set_visibility_result_mode(counting, 8)),
|
||||
refused(Refusal::ArgumentPlace {
|
||||
place: at + 8,
|
||||
alignment: 8
|
||||
}),
|
||||
"{name}: a skewed buffer"
|
||||
);
|
||||
e.end_encoding();
|
||||
run(name, &command_buffer);
|
||||
// Offsets off 8, past the buffer and taken again.
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut d = pass(&color, None);
|
||||
d.visibility_result_buffer = Some(visibility.clone());
|
||||
let mut e = (command_buffer.render_command_encoder(&d))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
ok(e.set_render_pipeline_state(&state));
|
||||
ok(e.set_vertex_buffer(Some(&positions), 0, 0));
|
||||
ok(e.set_vertex_buffer(Some(&colors), 0, 1));
|
||||
for offset in [4, 16, u64::MAX - 7] {
|
||||
assert_eq!(
|
||||
text(e.set_visibility_result_mode(counting, offset)),
|
||||
refused(Refusal::VisibilityResultOffset { offset, length: 16 }),
|
||||
"{name}: offset {offset}"
|
||||
);
|
||||
}
|
||||
ok(e.set_visibility_result_mode(counting, 0));
|
||||
ok(e.draw_primitives(PrimitiveType::Triangle, WHOLE, 3, 1, 0));
|
||||
ok(e.set_visibility_result_mode(VisibilityResultMode::Disabled, 0));
|
||||
assert_eq!(
|
||||
text(e.set_visibility_result_mode(VisibilityResultMode::Boolean, 0)),
|
||||
refused(Refusal::VisibilityResultOffsetTaken { offset: 0 }),
|
||||
"{name}: offset 0 again"
|
||||
);
|
||||
ok(e.set_visibility_result_mode(counting, 8));
|
||||
ok(e.draw_primitives(PrimitiveType::Triangle, TOP, 3, 1, 0));
|
||||
e.end_encoding();
|
||||
run(name, &command_buffer);
|
||||
assert_eq!(words(&visibility, 2), [64, 32], "{name}: the words");
|
||||
println!("{name}: Metal's refusals of a visibility mode refused");
|
||||
});
|
||||
}
|
||||
|
||||
/// A `Boolean` or `Counting` mode in an `Accumulate` pass is not built, and counted; the pass
|
||||
/// draws, and the buffer keeps its bytes.
|
||||
#[test]
|
||||
fn every_device_refuses_an_accumulated_mode_and_counts_it() {
|
||||
let Some(library) = examples() else {
|
||||
return;
|
||||
};
|
||||
let d = descriptor(&library, "colored_fragment", PixelFormat::RGBA8Unorm);
|
||||
each_device("visibility_accumulate", |name, _, device| {
|
||||
let state = state(name, &device, &d);
|
||||
let mut buffers = Buffers::new(&device);
|
||||
let (positions, colors) = triangles(&device, &mut buffers);
|
||||
let visibility = buffers.of(&device, &[0xaa; 16]);
|
||||
let color = target(
|
||||
&device,
|
||||
PixelFormat::RGBA8Unorm,
|
||||
TextureUsage::RENDER_TARGET,
|
||||
);
|
||||
let queue = device.new_command_queue(4).expect("a queue");
|
||||
let counters = device.counters();
|
||||
let before = counters.metrics().accumulated_visibility_refused;
|
||||
let ok = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}"));
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut d = pass(&color, None);
|
||||
d.visibility_result_buffer = Some(visibility.clone());
|
||||
d.visibility_result_type = VisibilityResultType::Accumulate;
|
||||
let mut e = (command_buffer.render_command_encoder(&d))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
ok(e.set_render_pipeline_state(&state));
|
||||
ok(e.set_vertex_buffer(Some(&positions), 0, 0));
|
||||
ok(e.set_vertex_buffer(Some(&colors), 0, 1));
|
||||
for mode in [
|
||||
VisibilityResultMode::Boolean,
|
||||
VisibilityResultMode::Counting,
|
||||
] {
|
||||
assert_eq!(
|
||||
text(e.set_visibility_result_mode(mode, 0)),
|
||||
gap(DrawKind::AccumulatedVisibilityResults),
|
||||
"{name}: {mode:?}"
|
||||
);
|
||||
}
|
||||
ok(e.set_visibility_result_mode(VisibilityResultMode::Disabled, 0));
|
||||
ok(e.draw_primitives(PrimitiveType::Triangle, WHOLE, 3, 1, 0));
|
||||
e.end_encoding();
|
||||
run(name, &command_buffer);
|
||||
assert_eq!(
|
||||
counters.metrics().accumulated_visibility_refused - before,
|
||||
2,
|
||||
"{name}: the refusals counted"
|
||||
);
|
||||
assert_eq!(
|
||||
words(&visibility, 2),
|
||||
[UNWRITTEN; 2],
|
||||
"{name}: the buffer's bytes"
|
||||
);
|
||||
println!("{name}: an accumulated mode refused and counted");
|
||||
});
|
||||
}
|
||||
|
||||
/// While a mode's query counts the draws, a memory barrier after a draw that wrote memory is
|
||||
/// refused and counted, the encoder as it was; after the next mode set, before its first
|
||||
/// draw, the same barrier runs. The draws store and rasterize nothing, so both words are 0.
|
||||
#[test]
|
||||
fn every_device_refuses_a_memory_barrier_while_a_mode_counts() {
|
||||
let Some(engine) = library(&engine_dir().join("rvc_draw_bases.ll")) else {
|
||||
return;
|
||||
};
|
||||
let mut d = RenderPipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new(
|
||||
(engine.function("draw_bases_in_a_vertex_function")).expect("the function"),
|
||||
)));
|
||||
d.color_attachments[0] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm));
|
||||
d.rasterization_enabled = false;
|
||||
each_device("visibility_barrier", |name, _, device| {
|
||||
let state = state(name, &device, &d);
|
||||
let mut buffers = Buffers::new(&device);
|
||||
let out = buffers.of(&device, &[0u8; 32 * 16]);
|
||||
let visibility = buffers.of(&device, &[0xaa; 16]);
|
||||
let color = target(
|
||||
&device,
|
||||
PixelFormat::RGBA8Unorm,
|
||||
TextureUsage::RENDER_TARGET,
|
||||
);
|
||||
let queue = device.new_command_queue(4).expect("a queue");
|
||||
let counters = device.counters();
|
||||
let before = counters.metrics();
|
||||
let ok = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}"));
|
||||
let counting = VisibilityResultMode::Counting;
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut d = pass(&color, None);
|
||||
d.visibility_result_buffer = Some(visibility.clone());
|
||||
let mut e = (command_buffer.render_command_encoder(&d))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
ok(e.set_render_pipeline_state(&state));
|
||||
ok(e.set_vertex_buffer(Some(&out), 0, 0));
|
||||
ok(e.set_visibility_result_mode(counting, 0));
|
||||
ok(e.draw_primitives(PrimitiveType::Triangle, 0, 3, 1, 0));
|
||||
assert_eq!(
|
||||
text(e.memory_barrier()),
|
||||
gap(DrawKind::VisibilityResultInterrupt),
|
||||
"{name}: a barrier while the query counts"
|
||||
);
|
||||
ok(e.draw_primitives(PrimitiveType::Triangle, 0, 3, 1, 0));
|
||||
ok(e.set_visibility_result_mode(counting, 8));
|
||||
ok(e.memory_barrier());
|
||||
ok(e.draw_primitives(PrimitiveType::Triangle, 0, 3, 1, 0));
|
||||
e.end_encoding();
|
||||
run(name, &command_buffer);
|
||||
let after = counters.metrics();
|
||||
assert_eq!(
|
||||
after.visibility_interrupts_refused - before.visibility_interrupts_refused,
|
||||
1,
|
||||
"{name}: the refusal counted"
|
||||
);
|
||||
assert_eq!(words(&visibility, 2), [0, 0], "{name}: the words");
|
||||
println!("{name}: a memory barrier refused while a mode counted, run before one");
|
||||
});
|
||||
}
|
||||
|
||||
/// While a mode's query counts the draws, a draw that reads its pass's attachment through a
|
||||
/// texture, which ends the rendering first (a move to the feedback layout, or a copy into the
|
||||
/// attachment's shadow), is refused and counted; after the next mode set it draws, ending the
|
||||
/// rendering before its query begins. A device without the attachment reads refuses the read
|
||||
/// as `DrawKind::AttachmentRead` in either place.
|
||||
#[test]
|
||||
fn every_device_refuses_an_attachment_read_while_a_mode_counts() {
|
||||
let Some(library) = examples() else {
|
||||
return;
|
||||
};
|
||||
let plain = descriptor(&library, "colored_fragment", PixelFormat::RGBA8Unorm);
|
||||
let own = descriptor(&library, "own_pixel_fragment", PixelFormat::RGBA8Unorm);
|
||||
each_device("visibility_attachment_read", |name, _, device| {
|
||||
(device.grant_indices(IndexClass::Texture, 4096, 1))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
let reads = device.core().attachment_reads;
|
||||
let plain = state(name, &device, &plain);
|
||||
let own = state(name, &device, &own);
|
||||
let mut buffers = Buffers::new(&device);
|
||||
let (positions, colors) = triangles(&device, &mut buffers);
|
||||
let visibility = buffers.of(&device, &[0xaa; 16]);
|
||||
let color = readable(&device, PixelFormat::RGBA8Unorm, 1, 4096);
|
||||
let queue = device.new_command_queue(4).expect("a queue");
|
||||
let counters = device.counters();
|
||||
let before = counters.metrics().visibility_interrupts_refused;
|
||||
let ok = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}"));
|
||||
let counting = VisibilityResultMode::Counting;
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let mut d = pass(&color, None);
|
||||
d.visibility_result_buffer = Some(visibility.clone());
|
||||
let mut e = (command_buffer.render_command_encoder(&d))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
ok(e.set_vertex_buffer(Some(&positions), 0, 0));
|
||||
ok(e.set_vertex_buffer(Some(&colors), 0, 1));
|
||||
ok(e.set_fragment_texture(Some(&color), 0));
|
||||
ok(e.set_render_pipeline_state(&plain));
|
||||
ok(e.set_visibility_result_mode(counting, 0));
|
||||
ok(e.draw_primitives(PrimitiveType::Triangle, WHOLE, 3, 1, 0));
|
||||
ok(e.set_render_pipeline_state(&own));
|
||||
let read = |e: &mut RenderCommandEncoder| {
|
||||
text(e.draw_primitives(PrimitiveType::Triangle, WHOLE, 3, 1, 0))
|
||||
};
|
||||
let want = match reads {
|
||||
true => gap(DrawKind::VisibilityResultInterrupt),
|
||||
false => gap(DrawKind::AttachmentRead),
|
||||
};
|
||||
assert_eq!(read(&mut e), want, "{name}: a read while the query counts");
|
||||
ok(e.set_visibility_result_mode(counting, 8));
|
||||
let want = match reads {
|
||||
true => text(Ok(())),
|
||||
false => gap(DrawKind::AttachmentRead),
|
||||
};
|
||||
assert_eq!(read(&mut e), want, "{name}: a read before the query begins");
|
||||
e.end_encoding();
|
||||
run(name, &command_buffer);
|
||||
let refusals = counters.metrics().visibility_interrupts_refused - before;
|
||||
let (count, words_want) = match reads {
|
||||
true => (1, [64, 64]),
|
||||
false => (0, [64, 0]),
|
||||
};
|
||||
assert_eq!(refusals, count, "{name}: the refusals counted");
|
||||
assert_eq!(words(&visibility, 2), words_want, "{name}: the words");
|
||||
println!("{name}: an attachment read refused while a mode counted, run before one");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
//! Visibility results (`setVisibilityResultMode:offset:`): the occlusion queries a render encoder
|
||||
//! counts its draws in, the copies of their results into the pass's visibility result buffer,
|
||||
//! and the pools the queries come from.
|
||||
//!
|
||||
//! Each `Boolean` or `Counting` mode set starts a segment, which the next mode set or the
|
||||
//! encoder's end ends. A segment counts its draws in one precise occlusion query
|
||||
//! (`VK_QUERY_CONTROL_PRECISE_BIT`, the floor's `occlusionQueryPrecise`), begun in the pass's
|
||||
//! rendering before the segment's first draw and ended there as the segment ends; a segment with
|
||||
//! no draw begins and ends its query as it ends, which counts no sample, so its offset is
|
||||
//! written 0, as Metal writes it. After the pass's rendering ends, `vkCmdCopyQueryPoolResults`
|
||||
//! writes each segment's 64-bit count, once the query is available
|
||||
//! (`VK_QUERY_RESULT_WAIT_BIT`), into the visibility result buffer at its offset: one copy for
|
||||
//! each run of segments whose offsets follow each other by 8 bytes and whose queries follow each
|
||||
//! other in one pool. The pass's second barrier, recorded or owed, reaches every later command,
|
||||
//! and the segment's end barrier the host where the buffer is Shared. An offset no mode of the
|
||||
//! encoder took keeps its bytes.
|
||||
//!
|
||||
//! A command buffer takes its queries in order from pools of its own ([`Queries`]),
|
||||
//! [`POOL_QUERIES`] a pool, which the device lends it ([`OcclusionPools`]); it gives them back as
|
||||
//! it retires, or as it drops uncommitted, each query it took reset on the host first
|
||||
//! (`hostQueryReset`, the floor's), so no command the GPU runs resets a query, and no work that
|
||||
//! names a pool is pending while it is reset.
|
||||
|
||||
use crate::counters::{Counters, Gauge};
|
||||
use crate::device::{lock, Core};
|
||||
use crate::error::Error;
|
||||
use crate::times;
|
||||
use ash::vk;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::{Mutex, PoisonError};
|
||||
|
||||
/// The queries of an occlusion query pool.
|
||||
pub(crate) const POOL_QUERIES: u32 = 256;
|
||||
|
||||
/// The most pools the device keeps free: a pool given back past them is destroyed.
|
||||
pub(crate) const FREE_POOLS: usize = 16;
|
||||
|
||||
/// An occlusion query: its pool and its index there.
|
||||
#[derive(Clone, Copy)]
|
||||
pub(crate) struct Query {
|
||||
pool: vk::QueryPool,
|
||||
index: u32,
|
||||
}
|
||||
|
||||
/// The device's occlusion query pools that no command buffer holds: at most [`FREE_POOLS`], every
|
||||
/// query of each reset. Every pool alive is counted ([`Gauge::OcclusionPools`]).
|
||||
pub(crate) struct OcclusionPools {
|
||||
free: Mutex<Vec<vk::QueryPool>>,
|
||||
}
|
||||
|
||||
impl OcclusionPools {
|
||||
pub(crate) fn new() -> OcclusionPools {
|
||||
OcclusionPools {
|
||||
free: Mutex::new(Vec::new()),
|
||||
}
|
||||
}
|
||||
|
||||
/// A pool, every query reset: a free one, else a new one.
|
||||
///
|
||||
/// Err: [`Error::Vulkan`] where the device makes none.
|
||||
fn take(&self, core: &Core) -> Result<vk::QueryPool, Error> {
|
||||
if let Some(pool) = lock(&self.free).pop() {
|
||||
return Ok(pool);
|
||||
}
|
||||
let info = vk::QueryPoolCreateInfo::default()
|
||||
.query_type(vk::QueryType::OCCLUSION)
|
||||
.query_count(POOL_QUERIES);
|
||||
// SAFETY: the info is complete.
|
||||
let pool = unsafe { core.device.create_query_pool(&info, None) }
|
||||
.map_err(Error::vulkan("vkCreateQueryPool"))?;
|
||||
times::reset(&core.device, pool, 0, POOL_QUERIES);
|
||||
core.counters.rise(Gauge::OcclusionPools);
|
||||
Ok(pool)
|
||||
}
|
||||
|
||||
/// Takes back `pool`, whose first `used` queries a command buffer took, once no work that
|
||||
/// names it is pending: those queries reset on the host, and the pool kept free, or destroyed
|
||||
/// where [`FREE_POOLS`] are.
|
||||
fn give_back(&self, core: &Core, pool: vk::QueryPool, used: u32) {
|
||||
times::reset(&core.device, pool, 0, used);
|
||||
let mut free = lock(&self.free);
|
||||
if free.len() < FREE_POOLS {
|
||||
free.push(pool);
|
||||
return;
|
||||
}
|
||||
drop(free);
|
||||
// SAFETY: no pending work names the pool, and no call reads it.
|
||||
unsafe { core.device.destroy_query_pool(pool, None) };
|
||||
core.counters.fall(Gauge::OcclusionPools);
|
||||
}
|
||||
|
||||
/// At the device's teardown, once it is idle: destroys every free pool.
|
||||
pub(crate) fn destroy(&mut self, device: &ash::Device, counters: &Counters) {
|
||||
let free = self.free.get_mut().unwrap_or_else(PoisonError::into_inner);
|
||||
for pool in free.drain(..) {
|
||||
// SAFETY: the device is idle, and no call reads the pool.
|
||||
unsafe { device.destroy_query_pool(pool, None) };
|
||||
counters.fall(Gauge::OcclusionPools);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A command buffer's occlusion queries: the pools it took, in order, and how many of the last
|
||||
/// one's queries it took.
|
||||
#[derive(Default)]
|
||||
pub(crate) struct Queries {
|
||||
pools: Vec<vk::QueryPool>,
|
||||
next: u32,
|
||||
}
|
||||
|
||||
impl Queries {
|
||||
/// The next query: of the last pool taken, or the first of a pool taken now where every one
|
||||
/// of that pool's is taken.
|
||||
///
|
||||
/// Err: [`Error::Vulkan`] where the device makes no pool.
|
||||
pub(crate) fn take(&mut self, core: &Core) -> Result<Query, Error> {
|
||||
let pool = match self.pools.last() {
|
||||
Some(&pool) if self.next < POOL_QUERIES => pool,
|
||||
_ => {
|
||||
let pool = core.occlusion.take(core)?;
|
||||
self.pools.push(pool);
|
||||
self.next = 0;
|
||||
pool
|
||||
}
|
||||
};
|
||||
self.next += 1;
|
||||
Ok(Query {
|
||||
pool,
|
||||
index: self.next - 1,
|
||||
})
|
||||
}
|
||||
|
||||
/// As its command buffer retires, or drops uncommitted: gives every pool back to the device,
|
||||
/// each query it took reset.
|
||||
pub(crate) fn give_back(self, core: &Core) {
|
||||
let last = self.pools.len().saturating_sub(1);
|
||||
for (at, pool) in self.pools.into_iter().enumerate() {
|
||||
let used = match at == last {
|
||||
true => self.next,
|
||||
false => POOL_QUERIES,
|
||||
};
|
||||
core.occlusion.give_back(core, pool, used);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A render encoder's visibility results: the segment of the mode set last, and the segments
|
||||
/// ended, each an offset and its query.
|
||||
#[derive(Default)]
|
||||
pub(crate) struct Results {
|
||||
/// The `Boolean` or `Counting` mode set last, where no mode set or end of the encoder ended
|
||||
/// it: its offset, its query, and whether a draw began the query.
|
||||
segment: Option<(u64, Query, bool)>,
|
||||
/// The segments ended, in order.
|
||||
ended: Vec<(u64, Query)>,
|
||||
/// The offsets the encoder's modes took.
|
||||
taken: HashSet<u64>,
|
||||
}
|
||||
|
||||
impl Results {
|
||||
/// Whether a mode of the encoder took `offset`.
|
||||
pub(crate) fn taken(&self, offset: u64) -> bool {
|
||||
self.taken.contains(&offset)
|
||||
}
|
||||
|
||||
/// Whether no mode of the encoder took an offset.
|
||||
pub(crate) fn is_empty(&self) -> bool {
|
||||
self.taken.is_empty()
|
||||
}
|
||||
|
||||
/// Whether a query counts the draws: begun in the rendering, it ends there, so nothing may
|
||||
/// end the rendering before the segment does.
|
||||
pub(crate) fn counting(&self) -> bool {
|
||||
matches!(self.segment, Some((_, _, true)))
|
||||
}
|
||||
|
||||
/// A segment of `query` at `offset` starts, the one before it ended ([`end`](Self::end)).
|
||||
pub(crate) fn start(&mut self, offset: u64, query: Query) {
|
||||
self.taken.insert(offset);
|
||||
self.segment = Some((offset, query, false));
|
||||
}
|
||||
|
||||
/// Before a draw: begins the segment's query where no draw of it began it.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// `command` is inside the pass's rendering, and keeps the query's pool until it retires.
|
||||
pub(crate) unsafe fn draw(&mut self, device: &ash::Device, command: vk::CommandBuffer) {
|
||||
if let Some((_, query, begun @ false)) = &mut self.segment {
|
||||
// SAFETY: by the caller; the query was reset on the host before any submission of it,
|
||||
// and no other query is active.
|
||||
unsafe { begin(device, command, *query) };
|
||||
*begun = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// Ends the segment, where one is: its query, begun first where no draw began it, so it
|
||||
/// counts no sample.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// As [`draw`](Self::draw).
|
||||
pub(crate) unsafe fn end(&mut self, device: &ash::Device, command: vk::CommandBuffer) {
|
||||
let Some((offset, query, begun)) = self.segment.take() else {
|
||||
return;
|
||||
};
|
||||
// SAFETY: by the caller; a query no draw began is reset, and no other is active.
|
||||
unsafe {
|
||||
if !begun {
|
||||
begin(device, command, query);
|
||||
}
|
||||
device.cmd_end_query(command, query.pool, query.index);
|
||||
}
|
||||
self.ended.push((offset, query));
|
||||
}
|
||||
|
||||
/// After the pass's rendering: copies each segment's result into the visibility result
|
||||
/// buffer, `buffer` from byte `at` of it, one `vkCmdCopyQueryPoolResults` for each run of
|
||||
/// segments whose offsets and queries follow each other.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Every segment ended ([`end`](Self::end)); `command` records outside any rendering and
|
||||
/// keeps the buffer until it retires; `at` plus each offset is a multiple of 8 whose 8 bytes
|
||||
/// lie in `buffer`.
|
||||
pub(crate) unsafe fn copy(
|
||||
&self,
|
||||
device: &ash::Device,
|
||||
command: vk::CommandBuffer,
|
||||
(buffer, at): (vk::Buffer, u64),
|
||||
) {
|
||||
let flags = vk::QueryResultFlags::TYPE_64 | vk::QueryResultFlags::WAIT;
|
||||
let mut results = self.ended.iter().peekable();
|
||||
while let Some(&(offset, first)) = results.next() {
|
||||
let mut count = 1;
|
||||
while let Some(&&(next, query)) = results.peek() {
|
||||
let follows = query.pool == first.pool
|
||||
&& query.index == first.index + count
|
||||
&& next == offset + 8 * u64::from(count);
|
||||
if !follows {
|
||||
break;
|
||||
}
|
||||
count += 1;
|
||||
results.next();
|
||||
}
|
||||
// SAFETY: by the caller; the queries are ended, and their run lies in their pool.
|
||||
unsafe {
|
||||
device.cmd_copy_query_pool_results(
|
||||
command,
|
||||
first.pool,
|
||||
first.index,
|
||||
count,
|
||||
buffer,
|
||||
at + offset,
|
||||
8,
|
||||
flags,
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Begins `query`, precise.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// `command` is inside a rendering, and keeps the query's pool until it retires; the query is
|
||||
/// reset, and no other occlusion query is active.
|
||||
unsafe fn begin(device: &ash::Device, command: vk::CommandBuffer, query: Query) {
|
||||
// SAFETY: by the caller; the floor enables `occlusionQueryPrecise`.
|
||||
unsafe {
|
||||
device.cmd_begin_query(
|
||||
command,
|
||||
query.pool,
|
||||
query.index,
|
||||
vk::QueryControlFlags::PRECISE,
|
||||
)
|
||||
};
|
||||
}
|
||||
@@ -1150,7 +1150,8 @@
|
||||
"dualSrcBlend": true,
|
||||
"sampleRateShading": true,
|
||||
"vertexPipelineStoresAndAtomics": true,
|
||||
"multiViewport": true
|
||||
"multiViewport": true,
|
||||
"occlusionQueryPrecise": true
|
||||
},
|
||||
"VkPhysicalDeviceVulkan11Features": {
|
||||
"storageBuffer16BitAccess": true,
|
||||
|
||||
@@ -336,7 +336,8 @@ pub fn allowance(note: PrecisionNote) -> Allowance {
|
||||
| N::SharedExponentKept
|
||||
| N::SwizzledOpaqueBlackBorder
|
||||
| N::DeviceLineRasterization
|
||||
| N::DeviceFragmentRuns => Allowance::Unbounded,
|
||||
| N::DeviceFragmentRuns
|
||||
| N::DeviceOcclusionCount => Allowance::Unbounded,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ fn every_precision_note_has_its_table_row() {
|
||||
(N::SimdgroupAccessOrder, Allowance::Unbounded),
|
||||
(N::DeviceLineRasterization, Allowance::Unbounded),
|
||||
(N::DeviceFragmentRuns, Allowance::Unbounded),
|
||||
(N::DeviceOcclusionCount, Allowance::Unbounded),
|
||||
];
|
||||
for (note, expected) in rows {
|
||||
assert_eq!(allowance(note), expected, "{note:?}");
|
||||
|
||||
+1
@@ -1471,6 +1471,7 @@ codec_enum! {
|
||||
SimdgroupAccessOrder,
|
||||
DeviceLineRasterization,
|
||||
DeviceFragmentRuns,
|
||||
DeviceOcclusionCount,
|
||||
}
|
||||
BindingSource {
|
||||
Buffer(f0), Texture(f0), Sampler(f0), CombinedTextureSampler { texture, sampler },
|
||||
|
||||
@@ -43,14 +43,13 @@ fn every_committed_profile_derives() {
|
||||
}
|
||||
}
|
||||
|
||||
/// `occlusionQueryPrecise` is read from each committed profile whose source states it, and enabled
|
||||
/// there: every venue's source does; the derived Vulkan 1.2 floor, whose base
|
||||
/// (`VP_LUNARG_minimum_requirements_1_2`) does not require it, leaves it unstated.
|
||||
/// `occlusionQueryPrecise` is read from each committed profile, and enabled there: every venue's
|
||||
/// source states it, and the runtime floor's block (`m2v_runtime_floor`) requires it.
|
||||
#[test]
|
||||
fn occlusion_query_precise_follows_each_source() {
|
||||
for (stem, text) in committed_profiles() {
|
||||
let stated = text.contains("\"occlusionQueryPrecise\": true");
|
||||
assert_eq!(stated, stem != "runtime-floor", "{stem}");
|
||||
assert!(stated, "{stem}");
|
||||
let desc = DeviceDescription::from_khronos_json(&text, None).unwrap();
|
||||
assert_eq!(
|
||||
desc.features.contains(&VkFeature::OcclusionQueryPrecise),
|
||||
|
||||
@@ -880,9 +880,6 @@ pub enum Feature {
|
||||
/// A command buffer's GPU times (`GPUStartTime`, `GPUEndTime`) on a device whose queue
|
||||
/// family writes no timestamps (`timestampValidBits` 0).
|
||||
GpuTimes,
|
||||
/// A `Counting` visibility result (`MTLVisibilityResultModeCounting`) on a device without
|
||||
/// `occlusionQueryPrecise`: the samples that passed are a precise occlusion query's count.
|
||||
CountingVisibility,
|
||||
/// A texture view whose format has other components, or components of other widths, than
|
||||
/// its texture's (`RGBA8Unorm` as `R32Uint`), on a device whose `VK_KHR_portability_subset`
|
||||
/// withholds `imageViewFormatReinterpretation`, or that the runtime adopted without being
|
||||
|
||||
@@ -2114,6 +2114,25 @@ pub enum PrecisionNote {
|
||||
/// Validation derives no tolerance from it: a difference stays a mismatch, which the note
|
||||
/// explains.
|
||||
DeviceFragmentRuns,
|
||||
/// A `Boolean` or `Counting` visibility result (`setVisibilityResultMode:offset:`): the count
|
||||
/// of samples that passed is the device's precise occlusion query's
|
||||
/// (`VK_QUERY_CONTROL_PRECISE_BIT`), where Metal documents "the number of samples that passed
|
||||
/// depth and stencil tests". Vulkan lets devices count otherwise ("Occlusion Queries"):
|
||||
/// "Setting VK_QUERY_CONTROL_PRECISE_BIT does not guarantee that different implementations
|
||||
/// return the same number of samples in an occlusion query. Some implementations may kill
|
||||
/// fragments in the pre-rasterization shader stage, and these killed fragments do not
|
||||
/// contribute to the final result of the query", and "Some implementations may track the
|
||||
/// number of samples that pass the per-fragment tests multiplied for each color output"; and
|
||||
/// on a device whose `earlyFragmentMultisampleCoverageAfterSampleCounting` is false, a fragment
|
||||
/// function with early fragment tests may have its shading and its coverage "performed before
|
||||
/// sample counting" ("Fragment Operations"). A `Boolean` result is the same count, nonzero
|
||||
/// exactly where the count is. Static per operation: no pipeline stage records it;
|
||||
/// `metal2vulkan-runtime`'s render encoder carries it
|
||||
/// (`RenderCommandEncoder::VISIBILITY_NOTE`).
|
||||
///
|
||||
/// Validation derives no tolerance from it: a difference stays a mismatch, which the note
|
||||
/// explains.
|
||||
DeviceOcclusionCount,
|
||||
}
|
||||
|
||||
/// Which lowering strategies a module used, with their word costs.
|
||||
|
||||
@@ -53,6 +53,7 @@ assoc-const metal2vulkan-runtime::IndirectCommandType::DRAW_MESH_THREADS pub con
|
||||
assoc-const metal2vulkan-runtime::IndirectCommandType::DRAW_PATCHES pub const DRAW_PATCHES: IndirectCommandType
|
||||
assoc-const metal2vulkan-runtime::PixelFormatInfo::INVALID pub const INVALID: PixelFormatInfo
|
||||
assoc-const metal2vulkan-runtime::RenderCommandEncoder::DEPTH_BIAS_NOTE pub const DEPTH_BIAS_NOTE: PrecisionNote
|
||||
assoc-const metal2vulkan-runtime::RenderCommandEncoder::VISIBILITY_NOTE pub const VISIBILITY_NOTE: PrecisionNote
|
||||
assoc-const metal2vulkan-runtime::ResourceUsage::READ pub const READ: ResourceUsage
|
||||
assoc-const metal2vulkan-runtime::ResourceUsage::SAMPLE pub const SAMPLE: ResourceUsage
|
||||
assoc-const metal2vulkan-runtime::ResourceUsage::WRITE pub const WRITE: ResourceUsage
|
||||
@@ -274,6 +275,7 @@ assoc-const-value metal2vulkan-runtime::IndirectCommandType::DRAW_MESH_THREADS I
|
||||
assoc-const-value metal2vulkan-runtime::IndirectCommandType::DRAW_PATCHES IndirectCommandType(1 <<2)
|
||||
assoc-const-value metal2vulkan-runtime::PixelFormatInfo::INVALID PixelFormatInfo
|
||||
assoc-const-value metal2vulkan-runtime::RenderCommandEncoder::DEPTH_BIAS_NOTE PrecisionNote::DeviceDepthBias
|
||||
assoc-const-value metal2vulkan-runtime::RenderCommandEncoder::VISIBILITY_NOTE PrecisionNote::DeviceOcclusionCount
|
||||
assoc-const-value metal2vulkan-runtime::ResourceUsage::READ ResourceUsage(1)
|
||||
assoc-const-value metal2vulkan-runtime::ResourceUsage::SAMPLE ResourceUsage(4)
|
||||
assoc-const-value metal2vulkan-runtime::ResourceUsage::WRITE ResourceUsage(2)
|
||||
@@ -791,6 +793,7 @@ enum metal2vulkan-runtime::SurfaceForm #[derive(Clone, Copy, Debug, PartialEq, E
|
||||
enum metal2vulkan-runtime::TextureViewKind #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum TextureViewKind
|
||||
enum metal2vulkan-runtime::VariantStart #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum VariantStart
|
||||
enum metal2vulkan-runtime::VisibilityResultMode #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum VisibilityResultMode
|
||||
enum metal2vulkan-runtime::VisibilityResultType #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum VisibilityResultType
|
||||
enum metal2vulkan-runtime::floor::Missing #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum Missing
|
||||
enum metal2vulkan::bind::AccessClass #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum AccessClass
|
||||
enum metal2vulkan::bind::ArgumentLayoutError #[derive(Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum ArgumentLayoutError
|
||||
@@ -1523,6 +1526,7 @@ field metal2vulkan-runtime::Gauges.indirect_command_buffers pub indirect_command
|
||||
field metal2vulkan-runtime::Gauges.kernel_entries pub kernel_entries: u64
|
||||
field metal2vulkan-runtime::Gauges.kernels pub kernels: u64
|
||||
field metal2vulkan-runtime::Gauges.managed_spilled_bytes pub managed_spilled_bytes: u64
|
||||
field metal2vulkan-runtime::Gauges.occlusion_pools pub occlusion_pools: u64
|
||||
field metal2vulkan-runtime::Gauges.pipeline_cache_bytes pub pipeline_cache_bytes: u64
|
||||
field metal2vulkan-runtime::Gauges.pipelines pub pipelines: u64
|
||||
field metal2vulkan-runtime::Gauges.preprocess_idle_bytes pub preprocess_idle_bytes: u64
|
||||
@@ -1583,6 +1587,7 @@ field metal2vulkan-runtime::IndirectCommandBufferDescriptor.inherit_pipeline_sta
|
||||
field metal2vulkan-runtime::IndirectCommandBufferDescriptor.max_fragment_buffer_bind_count pub max_fragment_buffer_bind_count: u32
|
||||
field metal2vulkan-runtime::IndirectCommandBufferDescriptor.max_kernel_buffer_bind_count pub max_kernel_buffer_bind_count: u32
|
||||
field metal2vulkan-runtime::IndirectCommandBufferDescriptor.max_vertex_buffer_bind_count pub max_vertex_buffer_bind_count: u32
|
||||
field metal2vulkan-runtime::Metrics.accumulated_visibility_refused pub accumulated_visibility_refused: u64
|
||||
field metal2vulkan-runtime::Metrics.allocation_map_refusals pub allocation_map_refusals: u64
|
||||
field metal2vulkan-runtime::Metrics.allocations_freed pub allocations_freed: u64
|
||||
field metal2vulkan-runtime::Metrics.allocations_mapped pub allocations_mapped: u64
|
||||
@@ -1754,6 +1759,7 @@ field metal2vulkan-runtime::Metrics.translations pub translations: u64
|
||||
field metal2vulkan-runtime::Metrics.translations_loaded pub translations_loaded: u64
|
||||
field metal2vulkan-runtime::Metrics.untimed_command_buffers pub untimed_command_buffers: u64
|
||||
field metal2vulkan-runtime::Metrics.upload_waits pub upload_waits: u64
|
||||
field metal2vulkan-runtime::Metrics.visibility_interrupts_refused pub visibility_interrupts_refused: u64
|
||||
field metal2vulkan-runtime::Metrics.waits_behind_counter pub waits_behind_counter: u64
|
||||
field metal2vulkan-runtime::Metrics.zero_source_allocations pub zero_source_allocations: SiteAllocations
|
||||
field metal2vulkan-runtime::Metrics.zero_writes pub zero_writes: Timed
|
||||
@@ -1804,6 +1810,7 @@ field metal2vulkan-runtime::RenderPassDescriptor.render_target_height pub render
|
||||
field metal2vulkan-runtime::RenderPassDescriptor.render_target_width pub render_target_width: u32
|
||||
field metal2vulkan-runtime::RenderPassDescriptor.stencil_attachment pub stencil_attachment: RenderPassStencilAttachmentDescriptor
|
||||
field metal2vulkan-runtime::RenderPassDescriptor.visibility_result_buffer pub visibility_result_buffer: Option<Buffer>
|
||||
field metal2vulkan-runtime::RenderPassDescriptor.visibility_result_type pub visibility_result_type: VisibilityResultType
|
||||
field metal2vulkan-runtime::RenderPassStencilAttachmentDescriptor.clear_stencil pub clear_stencil: u32
|
||||
field metal2vulkan-runtime::RenderPassStencilAttachmentDescriptor.level pub level: u32
|
||||
field metal2vulkan-runtime::RenderPassStencilAttachmentDescriptor.load_action pub load_action: LoadAction
|
||||
@@ -9206,6 +9213,7 @@ variant metal2vulkan-runtime::Dispatch::Threadgroups Threadgroups([u32; 3])
|
||||
variant metal2vulkan-runtime::Dispatch::Threads Threads([u32; 3])
|
||||
variant metal2vulkan-runtime::DispatchType::Concurrent Concurrent
|
||||
variant metal2vulkan-runtime::DispatchType::Serial Serial
|
||||
variant metal2vulkan-runtime::DrawKind::AccumulatedVisibilityResults AccumulatedVisibilityResults
|
||||
variant metal2vulkan-runtime::DrawKind::AttachmentFormats AttachmentFormats
|
||||
variant metal2vulkan-runtime::DrawKind::AttachmentRead AttachmentRead
|
||||
variant metal2vulkan-runtime::DrawKind::DividedBaseInstance DividedBaseInstance
|
||||
@@ -9215,7 +9223,7 @@ variant metal2vulkan-runtime::DrawKind::LineWidth LineWidth
|
||||
variant metal2vulkan-runtime::DrawKind::PatchIndexBuffer PatchIndexBuffer
|
||||
variant metal2vulkan-runtime::DrawKind::Viewport Viewport
|
||||
variant metal2vulkan-runtime::DrawKind::Viewports Viewports
|
||||
variant metal2vulkan-runtime::DrawKind::VisibilityResults VisibilityResults
|
||||
variant metal2vulkan-runtime::DrawKind::VisibilityResultInterrupt VisibilityResultInterrupt
|
||||
variant metal2vulkan-runtime::Error::BelowFloor BelowFloor(BelowFloor)
|
||||
variant metal2vulkan-runtime::Error::Fd Fd(io::Error)
|
||||
variant metal2vulkan-runtime::Error::Limit Limit(Limit)
|
||||
@@ -9348,6 +9356,7 @@ variant metal2vulkan-runtime::PrecisionNote::DeviceInterpolation DeviceInterpola
|
||||
variant metal2vulkan-runtime::PrecisionNote::DeviceInterpolationOffset DeviceInterpolationOffset
|
||||
variant metal2vulkan-runtime::PrecisionNote::DeviceLineRasterization DeviceLineRasterization
|
||||
variant metal2vulkan-runtime::PrecisionNote::DeviceNanEncoding DeviceNanEncoding
|
||||
variant metal2vulkan-runtime::PrecisionNote::DeviceOcclusionCount DeviceOcclusionCount
|
||||
variant metal2vulkan-runtime::PrecisionNote::DevicePackConversion DevicePackConversion
|
||||
variant metal2vulkan-runtime::PrecisionNote::DevicePointSize DevicePointSize
|
||||
variant metal2vulkan-runtime::PrecisionNote::DeviceRayIntersection DeviceRayIntersection
|
||||
@@ -9460,6 +9469,7 @@ variant metal2vulkan-runtime::Refusal::NoBufferAtIndex NoBufferAtIndex { index:
|
||||
variant metal2vulkan-runtime::Refusal::NoCommandBuffers NoCommandBuffers
|
||||
variant metal2vulkan-runtime::Refusal::NoPipeline NoPipeline
|
||||
variant metal2vulkan-runtime::Refusal::NoTessellationFactorBuffer NoTessellationFactorBuffer
|
||||
variant metal2vulkan-runtime::Refusal::NoVisibilityResultBuffer NoVisibilityResultBuffer
|
||||
variant metal2vulkan-runtime::Refusal::NotDrawable NotDrawable
|
||||
variant metal2vulkan-runtime::Refusal::NotExported NotExported { block: BlockId }
|
||||
variant metal2vulkan-runtime::Refusal::OtherDevice OtherDevice
|
||||
@@ -9491,6 +9501,8 @@ variant metal2vulkan-runtime::Refusal::TextureZeroExtent TextureZeroExtent
|
||||
variant metal2vulkan-runtime::Refusal::ThreadgroupSize ThreadgroupSize { size: [u32; 3], max: u32 }
|
||||
variant metal2vulkan-runtime::Refusal::VertexBufferOffset VertexBufferOffset { index: u32, offset: u64, length: u64 }
|
||||
variant metal2vulkan-runtime::Refusal::ViewportNotFinite ViewportNotFinite
|
||||
variant metal2vulkan-runtime::Refusal::VisibilityResultOffset VisibilityResultOffset { offset: u64, length: u64 }
|
||||
variant metal2vulkan-runtime::Refusal::VisibilityResultOffsetTaken VisibilityResultOffsetTaken { offset: u64 }
|
||||
variant metal2vulkan-runtime::Refusal::WaitOnOwnThread WaitOnOwnThread
|
||||
variant metal2vulkan-runtime::Refusal::ZeroRangePastBlock ZeroRangePastBlock { offset: u64, length: u64, block_len: u64 }
|
||||
variant metal2vulkan-runtime::Refusal::ZeroRangeShared ZeroRangeShared { block: BlockId }
|
||||
@@ -9568,6 +9580,8 @@ variant metal2vulkan-runtime::VariantStart::State State
|
||||
variant metal2vulkan-runtime::VisibilityResultMode::Boolean Boolean
|
||||
variant metal2vulkan-runtime::VisibilityResultMode::Counting Counting
|
||||
variant metal2vulkan-runtime::VisibilityResultMode::Disabled Disabled
|
||||
variant metal2vulkan-runtime::VisibilityResultType::Accumulate Accumulate
|
||||
variant metal2vulkan-runtime::VisibilityResultType::Reset Reset
|
||||
variant metal2vulkan-runtime::floor::Missing::Extension Extension(&'static CStr)
|
||||
variant metal2vulkan-runtime::floor::Missing::Feature Feature { structure: &'static str, member: String }
|
||||
variant metal2vulkan-runtime::floor::Missing::Limit Limit { name: &'static str, device: u32, needed: u32 }
|
||||
@@ -10477,7 +10491,6 @@ variant metal2vulkan::error::Feature::ComputeDerivativesWithSimd ComputeDerivati
|
||||
variant metal2vulkan::error::Feature::Constant Constant { record: ConstantRecord }
|
||||
variant metal2vulkan::error::Feature::ConstantAlphaBlendFactor ConstantAlphaBlendFactor
|
||||
variant metal2vulkan::error::Feature::ConstantGlobalEscaping ConstantGlobalEscaping
|
||||
variant metal2vulkan::error::Feature::CountingVisibility CountingVisibility
|
||||
variant metal2vulkan::error::Feature::CubeArray CubeArray
|
||||
variant metal2vulkan::error::Feature::DepthBiasClamp DepthBiasClamp
|
||||
variant metal2vulkan::error::Feature::DepthClipClamp DepthClipClamp
|
||||
@@ -10894,6 +10907,7 @@ variant metal2vulkan::pipeline::PrecisionNote::DeviceInterpolation DeviceInterpo
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DeviceInterpolationOffset DeviceInterpolationOffset
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DeviceLineRasterization DeviceLineRasterization
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DeviceNanEncoding DeviceNanEncoding
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DeviceOcclusionCount DeviceOcclusionCount
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DevicePackConversion DevicePackConversion
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DevicePointSize DevicePointSize
|
||||
variant metal2vulkan::pipeline::PrecisionNote::DeviceRayIntersection DeviceRayIntersection
|
||||
|
||||
|
Can't render this file because it is too large.
|
+20
-2
@@ -1676,9 +1676,10 @@ the translated module, the pixel format, the descriptor or the state, on every d
|
||||
- `DepthStencilState::precision_note`: `DepthDenormals` where the state tests or writes depth;
|
||||
- `RenderPassDescriptor::precision_note`: `DeviceRoundedResolve` where a color attachment
|
||||
resolves;
|
||||
- `BlitCommandEncoder::GENERATE_MIPMAPS_NOTE` (`DeviceFilteredMipmaps`, of `generate_mipmaps`) and
|
||||
- `BlitCommandEncoder::GENERATE_MIPMAPS_NOTE` (`DeviceFilteredMipmaps`, of `generate_mipmaps`),
|
||||
`RenderCommandEncoder::DEPTH_BIAS_NOTE` (`DeviceDepthBias`, of a draw of triangles under a depth
|
||||
bias).
|
||||
bias) and `RenderCommandEncoder::VISIBILITY_NOTE` (`DeviceOcclusionCount`, of a `Boolean` or
|
||||
`Counting` visibility result).
|
||||
|
||||
A note is never fatal: the work runs on every device. The runtime prints and sends no note; a
|
||||
consumer reads them through these items. The translator's own API gives a stage's notes
|
||||
@@ -2564,6 +2565,17 @@ bound.
|
||||
documented Metal names no count (MSL section 5.5 makes a function run per sample only for a
|
||||
sample-qualified input, `[[sample_id]]` or `[[color(m)]]`). Vulkan runs a fragment shader
|
||||
without sample shading at least once per pixel and more where the device chooses (vkspec 35.5).
|
||||
- `metal2vulkan-degrade-device-occlusion-count` (precision). `PrecisionNote::DeviceOcclusionCount`:
|
||||
A `Boolean` or `Counting` visibility result (`set_visibility_result_mode`), the static note
|
||||
`RenderCommandEncoder::VISIBILITY_NOTE` on every device. The count is the device's precise
|
||||
occlusion query's, where Metal documents "the number of samples that passed depth and stencil
|
||||
tests". Vulkan does not hold devices to one count ("Occlusion Queries"): a device may kill
|
||||
fragments before rasterization, which then count nothing, and may count the samples that pass
|
||||
once for each colour output; and where `earlyFragmentMultisampleCoverageAfterSampleCounting` is
|
||||
false, a fragment function with early fragment tests may shade and drop coverage before the
|
||||
samples are counted. No bound against Metal's count is measured. Cost: a count can differ from
|
||||
Metal's, and a `Boolean` result with it, where a sample is killed, dropped or counted once per
|
||||
colour output.
|
||||
|
||||
## 10. Accepted differences
|
||||
|
||||
@@ -2596,6 +2608,12 @@ named states the rule in full.
|
||||
`PrecisionNote::DeviceFragmentRuns` (section 9). The conformance case `a2c-off-4-alpha-50` records
|
||||
four runs of a fully covered pixel at four samples on an Apple M3 Max, and compares the runs word
|
||||
as nonzero alone.
|
||||
- **A `Boolean` visibility result is the count of samples that passed.** Metal documents a
|
||||
nonzero result where a sample passed the depth and stencil tests and 0 where none did
|
||||
(`MTLVisibilityResultModeBoolean`); an Apple M3 Max writes 1. Here a `Boolean` mode writes the
|
||||
same precise count as `Counting`, nonzero exactly where a sample passed
|
||||
(`RenderCommandEncoder::VISIBILITY_NOTE`, section 9). The conformance cases `visibility-boolean-*`
|
||||
compare its word as nonzero alone.
|
||||
|
||||
**Resource IDs and identifiers**
|
||||
|
||||
|
||||
@@ -30,14 +30,14 @@ Its limits, measured rather than asserted:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| implemented Metal items | 619 |
|
||||
| implemented Metal items | 620 |
|
||||
| of those, unreachable: `objc2-metal` binds no name for them | 1 |
|
||||
| so reachable by some case | 618 |
|
||||
| of the reachable, exercised by the suite's Metal leg | 542 |
|
||||
| so reachable by some case | 619 |
|
||||
| of the reachable, exercised by the suite's Metal leg | 543 |
|
||||
| of the reachable, not exercised | 76 |
|
||||
| share of the reachable exercised | 88% |
|
||||
| of those exercised, no case reaching it loosens anything | 325 |
|
||||
| of those exercised, a case reaching it loosens some site | 217 |
|
||||
| of those exercised, no case reaching it loosens anything | 323 |
|
||||
| of those exercised, a case reaching it loosens some site | 220 |
|
||||
| case modules | 179 |
|
||||
| committed recordings | 1319 |
|
||||
| distinct SDK items the Metal leg reaches, of any status | 806 |
|
||||
@@ -420,7 +420,7 @@ Every container with an implemented item, by how much of it the suite reaches. *
|
||||
| `MTLRenderPassColorAttachmentDescriptor` | 2 | 0 | 2 | 0 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… |
|
||||
| `MTLRenderPassColorAttachmentDescriptorArray` | 3 | 0 | 3 | 0 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… |
|
||||
| `MTLRenderPassDepthAttachmentDescriptor` | 3 | 0 | 3 | 0 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… |
|
||||
| `MTLRenderPassDescriptor` | 9 | 0 | 9 | 0 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… |
|
||||
| `MTLRenderPassDescriptor` | 10 | 0 | 10 | 0 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… |
|
||||
| `MTLRenderPassStencilAttachmentDescriptor` | 3 | 0 | 3 | 0 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… |
|
||||
| `MTLRenderPipelineColorAttachmentDescriptor` | 10 | 0 | 10 | 0 | `alpha_coverage_pairs`, `binary_archives`, `blend_interactions`, `blend_sweeps`… |
|
||||
| `MTLRenderPipelineDescriptor` | 33 | 0 | 33 | 0 | `alpha_coverage_pairs`, `binary_archives`, `blend_interactions`, `blend_sweeps`… |
|
||||
@@ -468,7 +468,7 @@ A container is one Objective-C type; the SDK header it sits in is the family of
|
||||
| `MTLFence.h` | 1 | 0 | 1 |
|
||||
| `MTLIndirectCommandBuffer.h` | 10 | 9 | 1 |
|
||||
| `MTLPipeline.h` | 5 | 4 | 1 |
|
||||
| `MTLRenderPass.h` | 31 | 30 | 1 |
|
||||
| `MTLRenderPass.h` | 32 | 31 | 1 |
|
||||
| `MTLTexture.h` | 39 | 38 | 1 |
|
||||
| `MTLAllocation.h` | 1 | 1 | 0 |
|
||||
| `MTLBlitCommandEncoder.h` | 14 | 14 | 0 |
|
||||
@@ -509,10 +509,10 @@ An implemented container no case's Metal leg touches. These are the families of
|
||||
| cases whose Metal answer is `metal_run` | 1235 |
|
||||
| cases whose Metal answer is `carried` | 80 |
|
||||
| cases whose Metal answer is `never_returned` | 4 |
|
||||
| modules that loosen a measured value | 16 |
|
||||
| tolerances in all | 20 |
|
||||
| modules that loosen a measured value | 17 |
|
||||
| tolerances in all | 21 |
|
||||
| modules declaring a notice (loosening no value) | 44 |
|
||||
| loosenings used | `Unchecked`, `AnyOf`, `Absolute`, `Nonzero` |
|
||||
| loosenings used | `Unchecked`, `AnyOf`, `Nonzero`, `Absolute` |
|
||||
| justifications named | `Degradation`, `AcceptedDifference`, `WithoutCompression` |
|
||||
| modules forbidding a re-record | 8 |
|
||||
| `Side` methods (the suite's whole device vocabulary) | 133 |
|
||||
@@ -530,7 +530,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
|
||||
|
||||
| family | cases | Metal ran | compared | items reached |
|
||||
|---|---|---|---|---|
|
||||
| `alpha_coverage_pairs` | 17 | 17 | 1 tolerance(s): `Degradation` | 114 |
|
||||
| `alpha_coverage_pairs` | 17 | 17 | 1 tolerance(s): `Degradation` | 115 |
|
||||
| `argument_encoder_crossings` | 4 | 4 | every field | 41 |
|
||||
| `argument_encoders` | 5 | 5 | every field | 57 |
|
||||
| `astc_textures` | 42 | 42 | 1 tolerance(s): `Degradation` | 41 |
|
||||
@@ -538,20 +538,20 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
|
||||
| `attribute_strides` | 4 | 4 | every field | 46 |
|
||||
| `bicubic_texel_classes` | 1 | 1 | every field | 31 |
|
||||
| `binary_archives` | 6 | 6 | every field | 27 |
|
||||
| `blend_interactions` | 4 | 4 | every field | 118 |
|
||||
| `blend_sweeps` | 12 | 12 | every field | 118 |
|
||||
| `blend_interactions` | 4 | 4 | every field | 119 |
|
||||
| `blend_sweeps` | 12 | 12 | every field | 119 |
|
||||
| `blit_encoder_commands` | 11 | 11 | every field | 48 |
|
||||
| `blit_indirect_commands` | 3 | 3 | every field | 96 |
|
||||
| `blit_indirect_commands` | 3 | 3 | every field | 97 |
|
||||
| `border_swizzles` | 8 | 8 | every field | 58 |
|
||||
| `buffer_bind_off_alignment` | 1 | 1 | every field | 22 |
|
||||
| `buffer_blits` | 4 | 4 | every field | 21 |
|
||||
| `buffer_depth_samples` | 5 | 5 | every field | 59 |
|
||||
| `buffer_tails` | 2 | 2 | every field | 50 |
|
||||
| `buffer_target_clears` | 6 | 6 | 1 tolerance(s): `AcceptedDifference` | 59 |
|
||||
| `buffer_target_clears` | 6 | 6 | 1 tolerance(s): `AcceptedDifference` | 60 |
|
||||
| `buffer_texture_blits` | 2 | 2 | every field | 38 |
|
||||
| `buffer_textures` | 3 | 2 | every field | 44 |
|
||||
| `chroma_pairs` | 6 | 6 | every field | 66 |
|
||||
| `color_write_masks` | 5 | 5 | every field | 115 |
|
||||
| `color_write_masks` | 5 | 5 | every field | 116 |
|
||||
| `command_buffer_facts` | 1 | 1 | every field | 23 |
|
||||
| `command_queues` | 1 | 1 | every field | 5 |
|
||||
| `compressed_blits` | 4 | 4 | every field | 40 |
|
||||
@@ -561,38 +561,38 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
|
||||
| `compute_encoder_commands` | 8 | 8 | every field | 62 |
|
||||
| `compute_heap_residency` | 1 | 1 | every field | 42 |
|
||||
| `compute_pipeline_descriptors` | 3 | 3 | 1 tolerance(s): `AcceptedDifference` | 22 |
|
||||
| `compute_render_chains` | 3 | 3 | every field | 142 |
|
||||
| `compute_render_chains` | 3 | 3 | every field | 143 |
|
||||
| `compute_threadgroups` | 2 | 1 | every field | 27 |
|
||||
| `copy_out_strides` | 1 | 1 | every field | 38 |
|
||||
| `denormal_word_fetches` | 1 | 1 | every field | 41 |
|
||||
| `depth_resolve_pairs` | 2 | 2 | every field | 132 |
|
||||
| `depth_stencil_space` | 8 | 8 | every field | 135 |
|
||||
| `depth_resolve_pairs` | 2 | 2 | every field | 133 |
|
||||
| `depth_stencil_space` | 8 | 8 | every field | 136 |
|
||||
| `depth_texel_reads` | 1 | 1 | every field | 48 |
|
||||
| `device_queries` | 5 | 5 | every field | 3 |
|
||||
| `discard_hoist` | 1 | 1 | 1 tolerance(s): `Degradation` | 136 |
|
||||
| `draw_state_changes` | 1 | 1 | every field | 138 |
|
||||
| `discard_hoist` | 1 | 1 | 1 tolerance(s): `Degradation` | 137 |
|
||||
| `draw_state_changes` | 1 | 1 | every field | 139 |
|
||||
| `dynamic_libraries` | 3 | 3 | every field | 6 |
|
||||
| `empty_command_buffers` | 1 | 1 | every field | 20 |
|
||||
| `etc_textures` | 10 | 10 | every field | 41 |
|
||||
| `event_orders` | 5 | 5 | 4 tolerance(s): `AcceptedDifference` | 27 |
|
||||
| `extended_range_blends` | 18 | 18 | every field | 125 |
|
||||
| `extended_range_gamut` | 39 | 39 | every field | 116 |
|
||||
| `extended_range_gradients` | 8 | 8 | every field | 117 |
|
||||
| `extended_range_blends` | 18 | 18 | every field | 126 |
|
||||
| `extended_range_gamut` | 39 | 39 | every field | 117 |
|
||||
| `extended_range_gradients` | 8 | 8 | every field | 118 |
|
||||
| `extended_range_planes` | 4 | 4 | every field | 28 |
|
||||
| `extended_range_targets` | 22 | 22 | every field | 122 |
|
||||
| `extended_range_targets` | 22 | 22 | every field | 123 |
|
||||
| `extended_range_two_planes` | 2 | 2 | every field | 32 |
|
||||
| `extended_swizzles` | 15 | 15 | every field | 58 |
|
||||
| `fence_orders` | 6 | 6 | 1 tolerance(s): `AcceptedDifference` | 27 |
|
||||
| `fetch_ordered` | 6 | 6 | every field | 117 |
|
||||
| `fetch_ordered` | 6 | 6 | every field | 118 |
|
||||
| `format_copies` | 16 | 16 | every field | 39 |
|
||||
| `format_footprints` | 6 | 6 | 1 tolerance(s): `AcceptedDifference` | 19 |
|
||||
| `fragment_imageblock_reflection` | 1 | 1 | every field | 74 |
|
||||
| `frame_chains` | 1 | 1 | every field | 139 |
|
||||
| `frame_chains` | 1 | 1 | every field | 140 |
|
||||
| `fresh_contents` | 87 | 87 | every field | 41 |
|
||||
| `function_bindings` | 15 | 15 | every field | 64 |
|
||||
| `function_constants_half3` | 1 | 1 | every field | 27 |
|
||||
| `function_facts` | 15 | 15 | every field | 32 |
|
||||
| `half_output_blends` | 6 | 6 | every field | 118 |
|
||||
| `half_output_blends` | 6 | 6 | every field | 119 |
|
||||
| `half_read_nans` | 6 | 6 | every field | 48 |
|
||||
| `half_storage_writes` | 9 | 9 | every field | 32 |
|
||||
| `half_texel_nans` | 8 | 8 | every field | 31 |
|
||||
@@ -601,12 +601,12 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
|
||||
| `heap_facts` | 5 | 5 | every field | 5 |
|
||||
| `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 | 162 |
|
||||
| `indirect_commands` | 9 | 9 | every field | 164 |
|
||||
| `host_page_writes` | 4 | 4 | every field | 125 |
|
||||
| `indirect_command_depth` | 6 | 6 | every field | 163 |
|
||||
| `indirect_commands` | 9 | 9 | every field | 165 |
|
||||
| `indirect_private_types` | 1 | 0 | every field | 0 |
|
||||
| `int_attributes` | 1 | 1 | every field | 103 |
|
||||
| `layered_targets` | 5 | 5 | every field | 132 |
|
||||
| `int_attributes` | 1 | 1 | every field | 104 |
|
||||
| `layered_targets` | 5 | 5 | every field | 133 |
|
||||
| `level_sizes` | 2 | 2 | every field | 41 |
|
||||
| `library_facts` | 9 | 9 | every field | 38 |
|
||||
| `math_routines` | 2 | 2 | every field | 25 |
|
||||
@@ -619,13 +619,13 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
|
||||
| `nan_integer_conversions` | 1 | 1 | 1 tolerance(s): `AcceptedDifference` | 56 |
|
||||
| `nearest_positions` | 1 | 1 | every field | 48 |
|
||||
| `norm_storage_writes` | 7 | 7 | every field | 43 |
|
||||
| `padded_blends` | 17 | 17 | every field | 117 |
|
||||
| `padded_fetch` | 11 | 11 | every field | 117 |
|
||||
| `pass_attachment_pairs` | 2 | 2 | every field | 117 |
|
||||
| `pass_bound_pairs` | 1 | 1 | every field | 118 |
|
||||
| `padded_blends` | 17 | 17 | every field | 118 |
|
||||
| `padded_fetch` | 11 | 11 | every field | 118 |
|
||||
| `pass_attachment_pairs` | 2 | 2 | every field | 118 |
|
||||
| `pass_bound_pairs` | 1 | 1 | every field | 119 |
|
||||
| `pass_bytes` | 4 | 4 | every field | 25 |
|
||||
| `pass_sequence_actions` | 2 | 2 | 1 tolerance(s): `AcceptedDifference` | 133 |
|
||||
| `pass_start_reads` | 14 | 14 | 2 tolerance(s): `AcceptedDifference` | 123 |
|
||||
| `pass_sequence_actions` | 2 | 2 | 1 tolerance(s): `AcceptedDifference` | 134 |
|
||||
| `pass_start_reads` | 14 | 14 | 2 tolerance(s): `AcceptedDifference` | 124 |
|
||||
| `pipeline_descriptors` | 3 | 3 | every field | 75 |
|
||||
| `pipeline_facts` | 9 | 9 | every field | 67 |
|
||||
| `pipeline_functions` | 8 | 8 | every field | 5 |
|
||||
@@ -635,7 +635,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
|
||||
| `pipeline_options` | 21 | 21 | every field | 76 |
|
||||
| `pixel_downscales` | 7 | 7 | every field | 51 |
|
||||
| `pixel_samplers` | 20 | 20 | every field | 51 |
|
||||
| `primitive_type_crossings` | 1 | 1 | every field | 116 |
|
||||
| `primitive_type_crossings` | 1 | 1 | every field | 117 |
|
||||
| `pvrtc_cpu_order` | 6 | 6 | every field | 39 |
|
||||
| `pvrtc_rows` | 8 | 8 | every field | 39 |
|
||||
| `rate_map_degenerate_forms` | 3 | 3 | every field | 19 |
|
||||
@@ -643,69 +643,69 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
|
||||
| `rate_maps` | 2 | 2 | every field | 14 |
|
||||
| `read_through` | 13 | 13 | every field | 61 |
|
||||
| `read_write_tiers` | 6 | 6 | every field | 46 |
|
||||
| `render_chains` | 3 | 3 | every field | 136 |
|
||||
| `render_depth_stencil_state` | 3 | 3 | every field | 136 |
|
||||
| `render_draw_forms` | 4 | 4 | every field | 123 |
|
||||
| `render_chains` | 3 | 3 | every field | 137 |
|
||||
| `render_depth_stencil_state` | 3 | 3 | every field | 137 |
|
||||
| `render_draw_forms` | 4 | 4 | every field | 124 |
|
||||
| `render_pass_descriptors` | 12 | 12 | every field | 30 |
|
||||
| `render_residency` | 2 | 2 | every field | 130 |
|
||||
| `render_state` | 3 | 3 | every field | 156 |
|
||||
| `resolve_then_load` | 1 | 1 | every field | 124 |
|
||||
| `render_residency` | 2 | 2 | every field | 131 |
|
||||
| `render_state` | 3 | 3 | every field | 157 |
|
||||
| `resolve_then_load` | 1 | 1 | every field | 125 |
|
||||
| `resource_facts` | 4 | 4 | every field | 23 |
|
||||
| `rgb10a2_srgb` | 8 | 8 | every field | 76 |
|
||||
| `rotated_planes` | 20 | 20 | every field | 115 |
|
||||
| `rotated_targets` | 14 | 14 | every field | 118 |
|
||||
| `rotated_planes` | 20 | 20 | every field | 116 |
|
||||
| `rotated_targets` | 14 | 14 | every field | 119 |
|
||||
| `sample_fills` | 17 | 0 | every field | 0 |
|
||||
| `sample_positions` | 19 | 16 | every field | 116 |
|
||||
| `sample_positions` | 19 | 16 | every field | 117 |
|
||||
| `sampler_crossings` | 8 | 8 | every field | 59 |
|
||||
| `sampler_filtering` | 15 | 15 | every field | 59 |
|
||||
| `scheduled_handlers` | 1 | 1 | every field | 16 |
|
||||
| `shader_stencil` | 2 | 2 | every field | 132 |
|
||||
| `shader_stencil` | 2 | 2 | every field | 133 |
|
||||
| `shared_creator_formats` | 2 | 2 | every field | 23 |
|
||||
| `shared_events` | 2 | 2 | every field | 13 |
|
||||
| `shared_exponent_storage` | 5 | 5 | every field | 42 |
|
||||
| `simdgroup_lockstep` | 2 | 2 | every field | 25 |
|
||||
| `snorm_tile_store` | 7 | 7 | 1 tolerance(s): `Degradation` | 115 |
|
||||
| `snorm_tile_store` | 7 | 7 | 1 tolerance(s): `Degradation` | 116 |
|
||||
| `sparse_heaps` | 6 | 6 | every field | 15 |
|
||||
| `sparse_mappings` | 14 | 14 | every field | 32 |
|
||||
| `sparse_tiles` | 4 | 4 | every field | 1 |
|
||||
| `srgb_fetch` | 2 | 2 | every field | 131 |
|
||||
| `srgb_fetch` | 2 | 2 | every field | 132 |
|
||||
| `stage_in_regions` | 1 | 1 | every field | 48 |
|
||||
| `stage_in_unread` | 1 | 1 | every field | 48 |
|
||||
| `stencil_resolve_pairs` | 2 | 2 | every field | 133 |
|
||||
| `stencil_resolved_sample` | 1 | 1 | every field | 133 |
|
||||
| `stencil_resolve_pairs` | 2 | 2 | every field | 134 |
|
||||
| `stencil_resolved_sample` | 1 | 1 | every field | 134 |
|
||||
| `surface_fills` | 1 | 0 | every field | 0 |
|
||||
| `surface_textures` | 10 | 10 | every field | 29 |
|
||||
| `swizzled_storage` | 6 | 6 | every field | 43 |
|
||||
| `tessellation_crossings` | 6 | 6 | every field | 103 |
|
||||
| `tessellation_rendered` | 1 | 1 | every field | 119 |
|
||||
| `tessellation_sweeps` | 7 | 7 | every field | 104 |
|
||||
| `tessellation_crossings` | 6 | 6 | every field | 104 |
|
||||
| `tessellation_rendered` | 1 | 1 | every field | 120 |
|
||||
| `tessellation_sweeps` | 7 | 7 | every field | 105 |
|
||||
| `texel_swizzles` | 6 | 6 | every field | 41 |
|
||||
| `texture_accesses` | 1 | 1 | every field | 20 |
|
||||
| `texture_buffer_fills` | 3 | 0 | every field | 0 |
|
||||
| `texture_buffer_tails` | 1 | 1 | every field | 49 |
|
||||
| `texture_descriptor_pairs` | 5 | 5 | 1 tolerance(s): `AcceptedDifference` | 27 |
|
||||
| `texture_fills` | 54 | 2 | every field | 42 |
|
||||
| `texture_view_casts` | 5 | 5 | every field | 78 |
|
||||
| `texture_view_casts` | 5 | 5 | every field | 79 |
|
||||
| `texture_views` | 4 | 4 | every field | 37 |
|
||||
| `textures` | 76 | 76 | every field | 10 |
|
||||
| `threadgroup_start` | 1 | 1 | every field | 24 |
|
||||
| `tile_pipeline_descriptors` | 3 | 3 | every field | 31 |
|
||||
| `tile_pipeline_reflection` | 1 | 1 | every field | 77 |
|
||||
| `tile_threadgroups` | 8 | 8 | every field | 49 |
|
||||
| `topology_classes` | 2 | 2 | every field | 114 |
|
||||
| `topology_classes` | 2 | 2 | every field | 115 |
|
||||
| `two_plane_copies` | 3 | 1 | every field | 42 |
|
||||
| `two_plane_heap_blits` | 1 | 1 | every field | 40 |
|
||||
| `two_plane_samples` | 16 | 16 | every field | 48 |
|
||||
| `vector_word_phases` | 4 | 4 | every field | 23 |
|
||||
| `vertex_attribute_strides` | 2 | 2 | every field | 103 |
|
||||
| `vertex_constant_step` | 1 | 1 | every field | 104 |
|
||||
| `vertex_fetch_reach` | 1 | 1 | every field | 104 |
|
||||
| `vertex_formats` | 4 | 4 | every field | 103 |
|
||||
| `vertex_step_rate` | 1 | 1 | every field | 103 |
|
||||
| `visibility` | 16 | 16 | every field | 129 |
|
||||
| `vertex_attribute_strides` | 2 | 2 | every field | 104 |
|
||||
| `vertex_constant_step` | 1 | 1 | every field | 105 |
|
||||
| `vertex_fetch_reach` | 1 | 1 | every field | 105 |
|
||||
| `vertex_formats` | 4 | 4 | every field | 104 |
|
||||
| `vertex_step_rate` | 1 | 1 | every field | 104 |
|
||||
| `visibility` | 16 | 16 | 1 tolerance(s): `AcceptedDifference` | 130 |
|
||||
| `visible_tables` | 18 | 18 | every field | 38 |
|
||||
| `wide_int_attributes` | 2 | 2 | every field | 103 |
|
||||
| `wide_points` | 1 | 1 | every field | 117 |
|
||||
| `wide_int_attributes` | 2 | 2 | every field | 104 |
|
||||
| `wide_points` | 1 | 1 | every field | 118 |
|
||||
| `ycbcr_gathers` | 4 | 4 | every field | 50 |
|
||||
| `ycbcr_minify` | 2 | 2 | every field | 50 |
|
||||
| `ycbcr_textures` | 2 | 2 | 1 tolerance(s): `AcceptedDifference` | 39 |
|
||||
@@ -1378,6 +1378,7 @@ One row per implemented item of the SDK, in the coverage map's order. *exercised
|
||||
| `renderTargetArrayLength` | yes | `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` | 376 |
|
||||
| `renderTargetWidth` | yes | `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` | 376 |
|
||||
| `renderTargetHeight` | yes | `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` | 376 |
|
||||
| `visibilityResultType` | yes | `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_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` | 364 |
|
||||
|
||||
### `MTLRenderPassStencilAttachmentDescriptor`
|
||||
|
||||
@@ -1944,7 +1945,6 @@ An item the suite's Metal leg calls whose coverage-map status is not implemented
|
||||
| `MTLRenderPassDescriptor` `threadgroupMemoryLength` | missing | a pass's threadgroup memory, which tile functions use | `render_pass_descriptors` |
|
||||
| `MTLRenderPassDescriptor` `tileHeight` | missing | tile render pipelines; metal2vulkan-runtime makes none | `render_pass_descriptors`, `tile_threadgroups` |
|
||||
| `MTLRenderPassDescriptor` `tileWidth` | missing | tile render pipelines; metal2vulkan-runtime makes none | `render_pass_descriptors`, `tile_threadgroups` |
|
||||
| `MTLRenderPassDescriptor` `visibilityResultType` | missing | what an enabled visibility result mode writes; only `Disabled` is built | `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_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` |
|
||||
| `MTLRenderPipelineDescriptor` `binaryArchives` | out of scope | the consumer's (metal2vulkan-runtime's README, What the consumer implements) | `binary_archives`, `pipeline_descriptors` |
|
||||
| `MTLRenderPipelineDescriptor` `label` | out of scope | the consumer's (metal2vulkan-runtime's README, What the consumer implements) | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `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`, `pipeline_descriptors`, `pipeline_facts`, `pipeline_handlers`, `primitive_type_crossings`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `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`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `visibility`, `wide_int_attributes`, `wide_points` |
|
||||
| `MTLRenderPipelineFunctionsDescriptor` `fragmentAdditionalBinaryFunctions` | missing | function tables, function handles and dynamic libraries; a kernel or a draw's function that reads a function table is refused (`Gap::KernelInput`, `Gap::DrawInput`) | `pipeline_functions` |
|
||||
|
||||
@@ -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 | 620 | 29 |
|
||||
| missing | 1091 | 34 |
|
||||
| implemented | 621 | 29 |
|
||||
| missing | 1090 | 34 |
|
||||
| out of scope | 424 | 5 |
|
||||
| all | 2135 | 68 |
|
||||
|
||||
Implemented by the runtime: 264; by the translator's values: 356. Missing by size: S 183, M 205, L 327, XL 376.
|
||||
Implemented by the runtime: 265; by the translator's values: 356. Missing by size: S 182, M 205, L 327, XL 376.
|
||||
|
||||
## Missing, in build order
|
||||
|
||||
@@ -32,7 +32,7 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app
|
||||
| plain-value constructors (`MTLOriginMake` and the rest) | S | 7 | `MTLOriginMake`, `MTLSizeMake`, `MTLRegionMake1D`, ... |
|
||||
| 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`, ... |
|
||||
| render pass descriptor fields | S/M/L | 8 | `MTLRenderPassAttachmentDescriptor.depthPlane`, `MTLRenderPassAttachmentDescriptor.storeActionOptions`, `MTLRenderPassDescriptor.imageblockSampleLength`, ... |
|
||||
| encoder calls (stride setters, indirect draws, store action options, a render encoder's heap uses) | S/M/L | 25 | `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` |
|
||||
@@ -2191,7 +2191,7 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app
|
||||
| `MTLRenderPassDescriptor.getSamplePositions:count:` | method | missing | M: programmable sample positions |
|
||||
| `MTLRenderPassDescriptor.rasterizationRateMap` | property | missing | L: rasterization rate maps |
|
||||
| `MTLRenderPassDescriptor.sampleBufferAttachments` | property | missing | M: counter sample buffers |
|
||||
| `MTLRenderPassDescriptor.visibilityResultType` | property | missing | S: what an enabled visibility result mode writes; only `Disabled` is built |
|
||||
| `MTLRenderPassDescriptor.visibilityResultType` | property | implemented | `RenderPassDescriptor.visibility_result_type` (runtime) |
|
||||
| `MTLRenderPassDescriptor.supportColorAttachmentMapping` | property | missing | M: color attachment mapping |
|
||||
| `MTLClearColorMake` | function | implemented | `ClearColor::new` (runtime) |
|
||||
|
||||
|
||||
+14
-9
@@ -26,13 +26,13 @@ Columns:
|
||||
|
||||
| Kind | Variants | With a site | Reach system | Reach app | Reach rare | Reach none | Unassessed |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| Translator and front-end refusals | 134 | 119 | 8 | 33 | 72 | 21 | 0 |
|
||||
| Translator and front-end refusals | 133 | 119 | 8 | 33 | 71 | 21 | 0 |
|
||||
| Binder refusals at a device limit | 9 | 9 | 0 | 1 | 7 | 1 | 0 |
|
||||
| Translation caps | 14 | 14 | 0 | 0 | 7 | 7 | 0 |
|
||||
| Rate maps the compile layer does not compile | 5 | 5 | 0 | 0 | 4 | 1 | 0 |
|
||||
| The translation deadline | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
|
||||
| Devices below the runtime's floor | 8 | 8 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 77 | 77 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 80 | 80 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 17 | 17 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Gap` | 31 | 31 | 0 | 0 | 0 | 0 | 0 |
|
||||
|
||||
@@ -40,13 +40,13 @@ Columns:
|
||||
|
||||
| Kind | `metal-measured` | `metal-documented` | `metal-takes` | `device` | `ours` | `unknown` | `delegated` | `-` |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| Translator and front-end refusals | 0 | 0 | 0 | 43 | 54 | 0 | 0 | 37 |
|
||||
| Translator and front-end refusals | 0 | 0 | 0 | 43 | 54 | 0 | 0 | 36 |
|
||||
| Binder refusals at a device limit | 0 | 0 | 0 | 9 | 0 | 0 | 0 | 0 |
|
||||
| Translation caps | 0 | 0 | 0 | 0 | 14 | 0 | 0 | 0 |
|
||||
| Rate maps the compile layer does not compile | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 |
|
||||
| The translation deadline | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
|
||||
| Devices below the runtime's floor | 0 | 0 | 0 | 8 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 22 | 21 | 0 | 0 | 34 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 22 | 24 | 0 | 0 | 34 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 0 | 0 | 0 | 13 | 4 | 0 | 0 | 0 |
|
||||
| The runtime's `Gap` | 0 | 0 | 0 | 3 | 28 | 0 | 0 | 0 |
|
||||
|
||||
@@ -169,7 +169,6 @@ Columns:
|
||||
| `MipmapGeneration` | `generateMipmapsForTexture:` that cannot run on the device | - | `-` | 0 | `app`: generateMipmapsForTexture: of a format or chain neither the device's blits nor the compute filter can run |
|
||||
| `HostMemory` | A buffer over the caller's host memory without a copy (`newBufferWithBytesNoCopy:`) | - | `-` | 0 | `system`: newBufferWithBytesNoCopy: where the device cannot import the memory |
|
||||
| `GpuTimes` | A command buffer's GPU times (`GPUStartTime`, `GPUEndTime`) on a device whose queue family writes no timestamps (`timestampValidBits` 0) | - | `-` | 0 | `rare`: GPU times on a queue without timestamps |
|
||||
| `CountingVisibility` | A `Counting` visibility result (`MTLVisibilityResultModeCounting`) on a device without `occlusionQueryPrecise` | - | `-` | 0 | `rare`: counting occlusion queries on a device without precise queries |
|
||||
| `ViewFormatReinterpretation` | A texture view whose format has other components, or components of other widths, than its texture's (`RGBA8Unorm` as `R32Uint`), on a device whose... | - | `-` | 0 | `app`: a view of another component layout on a portability subset (MoltenVK) |
|
||||
| `SeparateMultisampledDepthStencil` | A render pass whose depth and stencil attachments are separate multisampled textures that it loads or may store, on a device without maintenance8 | - | `-` | 0 | `rare`: separate multisampled depth and stencil textures |
|
||||
| `PrivateMemory` | A stage whose private memory (its `thread` variables and arrays, and the constants it holds per thread) takes more Function storage a thread than... | devices without a capability the site computes (`limit`) | `device` | 1: `crates/metal2vulkan/src/lower/access/local.rs (device_arena)` | `rare`: very large per-thread arrays |
|
||||
@@ -329,9 +328,12 @@ 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 | 3: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` (+1) | `-` |
|
||||
| `ArgumentPlace` | An indirect dispatch's arguments, an indexed draw's indices, or a visibility result, at a byte of the allocation the buffer's block lies in (its... | every device (a public call's own check of its arguments) | `ours`: `vkCmdDispatchIndirect` reads its arguments at a multiple of 4 in the `VkBuffer`, `vkCmdBindIndexBuffer` takes indices at a multiple of their size in the memory, and `vkCmdCopyQueryPoolResults` writes 64-bit results at a multiple of 8, `VUID-vkCmdCopyQueryPoolResults-flags-00823`; a Metal buffer starts at an aligned address, so Metal's offset rules alone keep each aligned there | 4: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch_threadgroups_with_indirect_buffer)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` (+2) | `-` |
|
||||
| `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 (checked)` | `-` |
|
||||
| `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)` | `-` |
|
||||
| `NoVisibilityResultBuffer` | A visibility result mode but `Disabled` (`setVisibilityResultMode:offset:`) in a pass with no visibility result buffer | every device (a public call's own check of its arguments) | `metal-documented`: Apple's page for `setVisibilityResultMode(_:offset:)`: "To create a render pass that can enable visibility testing, assign an MTLBuffer instance to the visibilityResultBuffer property of an MTLRenderPassDescriptor" | 1: `crates/metal2vulkan-runtime/src/render_encoder.rs (set_visibility_result_mode)` | `-` |
|
||||
| `VisibilityResultOffset` | A visibility result mode but `Disabled` at an offset that is not a multiple of 8, or whose 8 bytes run past the visibility result buffer | every device (a public call's own check of its arguments) | `metal-documented`: `MTLRenderCommandEncoder.h`: "offset must be a multiple of 8"; Apple's page for `visibilityResultBuffer`: "The GPU stores visibility results as 64-bit integers, so you need to reserve 8 bytes for each visibility result" | 1: `crates/metal2vulkan-runtime/src/render_encoder.rs (set_visibility_result_mode)` | `-` |
|
||||
| `VisibilityResultOffsetTaken` | A visibility result mode but `Disabled` at an offset a mode of the encoder took before, `Disabled` between them or not | every device (a public call's own check of its arguments) | `metal-documented`: Apple's page for `setVisibilityResultMode(_:offset:)`: "You can set a specific offset value only once per render pass"; Metal's validation stops it, "using the same offset (0) in the visibility buffer twice in the same command encoder is not allowed", an Apple M3 Max, macOS 27.0.1, the conformance case `visibility-counting-revisit`, where plain Metal adds the later draws to the result | 1: `crates/metal2vulkan-runtime/src/render_encoder.rs (set_visibility_result_mode)` | `-` |
|
||||
|
||||
## 8. The runtime's `Limit` (`Error::Limit(Limit)`)
|
||||
|
||||
@@ -387,7 +389,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 (checked)` (+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 (checked)` (+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)` | `-` |
|
||||
| `StageSize` | A pipeline of a function whose module weighs more than the compiled stage bound (`metal2vulkan::pipeline::COMPILED_STAGE_WEIGHT`, the heaviest... | at the device's limit | `device`: ANV, Mesa 26.2.6, took 3.65 GiB to compile a stage of entry weight 99,109 and passed 16 GiB on one of 532,213; a driver whose helper's compile met its cap or time, or that keeps no pipeline cache data, gives no data to make the pipeline from | 3: `crates/metal2vulkan-runtime/src/pipeline.rs (past_stage_bound)`, `crates/metal2vulkan-runtime/src/render.rs (of)` (+1) | `-` |
|
||||
|
||||
@@ -625,9 +627,12 @@ 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)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (indirect)`
|
||||
- `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)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_visibility_result_mode)`
|
||||
- `rt:Refusal::ViewportNotFinite`: `crates/metal2vulkan-runtime/src/render_encoder.rs (checked)`
|
||||
- `rt:Refusal::StencilAttachment`: `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`
|
||||
- `rt:Refusal::NoVisibilityResultBuffer`: `crates/metal2vulkan-runtime/src/render_encoder.rs (set_visibility_result_mode)`
|
||||
- `rt:Refusal::VisibilityResultOffset`: `crates/metal2vulkan-runtime/src/render_encoder.rs (set_visibility_result_mode)`
|
||||
- `rt:Refusal::VisibilityResultOffsetTaken`: `crates/metal2vulkan-runtime/src/render_encoder.rs (set_visibility_result_mode)`
|
||||
- `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)`
|
||||
- `rt:Limit::BlockIds`: `crates/metal2vulkan-runtime/src/memory.rs (allocation_number)`; `crates/metal2vulkan-runtime/src/memory.rs (number)`
|
||||
- `rt:Limit::ThreadgroupMemory`: `crates/metal2vulkan-runtime/src/encoder.rs (threadgroup_memory)`
|
||||
@@ -673,7 +678,7 @@ 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 (checked)`; `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_scissor_rects)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_triangle_fill_mode)`; `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 (checked)`; `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 (interrupt_refused)`; `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_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)`
|
||||
- `rt:Gap::StageSize`: `crates/metal2vulkan-runtime/src/pipeline.rs (past_stage_bound)`; `crates/metal2vulkan-runtime/src/render.rs (of)`; `crates/metal2vulkan-runtime/src/stage.rs (gap)`
|
||||
|
||||
@@ -1730,7 +1730,7 @@ MTLRenderPass.h MTLRenderPassDescriptor method setSamplePositions:count: M pr
|
||||
MTLRenderPass.h MTLRenderPassDescriptor method getSamplePositions:count: M programmable sample positions M render-pass
|
||||
MTLRenderPass.h MTLRenderPassDescriptor property rasterizationRateMap M rasterization rate maps L render-pass
|
||||
MTLRenderPass.h MTLRenderPassDescriptor property sampleBufferAttachments M counter sample buffers M counters
|
||||
MTLRenderPass.h MTLRenderPassDescriptor property visibilityResultType M what an enabled visibility result mode writes; only `Disabled` is built S render-pass
|
||||
MTLRenderPass.h MTLRenderPassDescriptor property visibilityResultType I runtime RenderPassDescriptor.visibility_result_type
|
||||
MTLRenderPass.h MTLRenderPassDescriptor property supportColorAttachmentMapping M color attachment mapping M colormap
|
||||
MTLRenderPass.h function MTLClearColorMake I runtime ClearColor::new
|
||||
MTLRenderPipeline.h MTLRenderPipelineColorAttachmentDescriptor class MTLRenderPipelineColorAttachmentDescriptor I translator ColorAttachmentDescriptor
|
||||
|
||||
|
@@ -117,7 +117,6 @@ feature TextureSwizzle app texture swizzles whose Metal behaviour is unmeasured
|
||||
feature MipmapGeneration app generateMipmapsForTexture: of a format or chain neither the device's blits nor the compute filter can run
|
||||
feature HostMemory system newBufferWithBytesNoCopy: where the device cannot import the memory
|
||||
feature GpuTimes rare GPU times on a queue without timestamps
|
||||
feature CountingVisibility rare counting occlusion queries on a device without precise queries
|
||||
feature ViewFormatReinterpretation app a view of another component layout on a portability subset (MoltenVK)
|
||||
feature SeparateMultisampledDepthStencil rare separate multisampled depth and stencil textures
|
||||
feature PostDepthCoverage rare the coverage after early depth and stencil tests on a device without VK_EXT_post_depth_coverage
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 17 and column 65.
|
@@ -118,7 +118,7 @@ RUNTIME_FLOOR = {
|
||||
"imageCubeArray", "depthBiasClamp", "drawIndirectFirstInstance", "depthClamp",
|
||||
"shaderClipDistance", "tessellationShader", "shaderTessellationAndGeometryPointSize",
|
||||
"largePoints", "dualSrcBlend", "sampleRateShading", "vertexPipelineStoresAndAtomics",
|
||||
"multiViewport")},
|
||||
"multiViewport", "occlusionQueryPrecise")},
|
||||
"VkPhysicalDeviceVulkan11Features": {member: True for member in (
|
||||
"storageBuffer16BitAccess", "multiview", "shaderDrawParameters")},
|
||||
"VkPhysicalDeviceVulkan12Features": {member: True for member in (
|
||||
|
||||
Reference in new issue
Block a user