Validation: a fragment case of no attachment draws through the runtime
What: runs_render_through_runtime no longer keeps a fragment case with no color target and no
depth/stencil attachment on the executor's own context. runtime_render draws it in the oracle's
pass of no attachment (metal::platform): renderTargetWidth and renderTargetHeight 1, and
defaultRasterSampleCount the case's raster samples. The runtime builds such a pass as one
dynamic rendering of no attachment, its area and samples from those three fields. The routing
function's stale comment ("the runtime makes no pass without one") goes, along with the matching
VALIDATION.md sentence. ENGINE_EXECUTOR_ABI goes to vulkan-engine-v203, because these cases'
recorded rows came from the own context.
Executor code removed: multisampled::attachmentless_support and its call in the own context's
Targets::make, the framebufferNoAttachmentsSampleCounts check of a multisampled pass without
attachments. Nothing else reaches it now. The translator already refuses such a pipeline itself
(pipeline/graphics.rs sample_count_properties: RasterSampleCount needs
FramebufferNoAttachmentsSampleCount(N)), and the own context compiles before it makes targets,
so a --profiles-layer run still refuses typed.
What moves: 16 committed cases.
- Public (15): coverage-loop-records-each-sample-at-2x and -at-4x,
coverage-loop-sample-varying-at-2x, coverage-loop-union-of-runs-at-2x and -at-4x,
fragment-device-and-constant-pointer-integer-differences, msl-4-1-fragment-seq-cst-atomics,
coverage-and-pixel-center-read-by-each-run-at-4x, coverage-beside-a-sample-varying-at-2x and
-at-4x, coverage-beside-the-pixel-center-ored-over-its-runs-at-4x,
coverage-read-by-each-run-of-a-memory-writer-at-2x and -at-4x,
coverage-read-by-each-sample-run-at-2x and -at-4x.
- Private (1): void-fragment-no-writes.
- The 17th attachment-less fragment case, gaussian-splat-blended-over-an-authored-imageblock,
has an explicit imageblock and stays on the own context.
Verified on lavapipe (msi, no GPU), each case through corpus-vulkan against the committed
Apple M3 Max macOS 27.0.1 row, before at a8c2bfbfae (own context, m3-max-63297) and after at
48b14d9dc0 (this tree plus a runs-through-both-contexts edit of the engine_textures cube test that
the cube-array commit does not carry; m3-max-63285, m3-max-63306). Every run after logged through
the runtime path's own validation log; the before-run logged none. Every case gives the same
result on both paths.
- 7 match Metal: coverage-loop-union-of-runs-at-4x,
fragment-device-and-constant-pointer-integer-differences, void-fragment-no-writes,
msl-4-1-fragment-seq-cst-atomics, coverage-and-pixel-center-read-by-each-run-at-4x,
coverage-beside-the-pixel-center-ored-over-its-runs-at-4x,
coverage-read-by-each-run-of-a-memory-writer-at-4x.
- 3 differ from Metal with the same output digest on both paths (lavapipe's own 4x coverage):
coverage-loop-records-each-sample-at-4x, coverage-beside-a-sample-varying-at-4x,
coverage-read-by-each-sample-run-at-4x.
- 6 are refused not_supported{device_capability_missing:RasterSampleCount needs
Property(FramebufferNoAttachmentsSampleCount(2))} on both paths. lavapipe rasterizes no 2-sample
pass without attachments, a device gap: coverage-loop-records-each-sample-at-2x,
coverage-loop-sample-varying-at-2x, coverage-loop-union-of-runs-at-2x,
coverage-beside-a-sample-varying-at-2x, coverage-read-by-each-run-of-a-memory-writer-at-2x,
coverage-read-by-each-sample-run-at-2x.
Tests: engine/tests.rs's a_plain_draw_and_only_one_runs_through_the_runtime routes a fragment
pass of no attachment at 1 and 4 samples, which it refused before. engine_render's new
a_fragment_pass_of_no_attachment_runs_each_sample_once draws the owned coverage_natural
nat_sample with no attachment at 1 and 4 samples: each sample runs once and reads its own
coverage bit on the own context, and through the runtime the words are equal (passed on lavapipe
in m3-max-63306).
No file this touches is a classifier input, so the authoring-capability census does not move.
The compile census's executor key moves with the ABI (bless on development).
Landed after the nine refusal rows (v201) and the cube-array route (v202), so the bump is v203 here (v200 on the lane's branch).
This commit is contained in:
1 parent
cb6d9e8b1b
commit
cf87db0fb7
7 files changed
+106
-55
No files matched your search
@@ -123,7 +123,7 @@ use tables::{function_tables, table_buffers, FunctionTable, TableBuffers};
|
||||
/// how it decides a match. A change no recorded row can observe (a case kind no earlier executor
|
||||
/// ran, or one it refused) needs no bump; its commit says why. The commit that bumps it says what
|
||||
/// changed; this comment keeps no history.
|
||||
pub const ENGINE_EXECUTOR_ABI: &str = "vulkan-engine-v202";
|
||||
pub const ENGINE_EXECUTOR_ABI: &str = "vulkan-engine-v203";
|
||||
|
||||
/// One kernel case in the terms the binder takes: what this executor supports of an
|
||||
/// [`AuthoredCase`] (buffers, device buffer arrays, argument-buffer buffers and textures, command
|
||||
@@ -1393,8 +1393,8 @@ pub struct RuntimeKernel<'a> {
|
||||
/// filled and read back sample by sample, `platform::runtime_multisample`), its own stage's
|
||||
/// buffers, bound textures the runtime makes (`runtime_texture`) and bound samplers, function
|
||||
/// constants and linked functions, its vertex buffers at static strides, its color targets and a
|
||||
/// depth/stencil attachment of one aspect (a fragment case renders into at least one attachment:
|
||||
/// the runtime makes no pass without one, `Gap::RenderPass`), the encoder's depth-stencil state, cull mode and winding, and
|
||||
/// depth/stencil attachment of one aspect, or none (a fragment case's pass of no attachment is
|
||||
/// the oracle's 1x1 at its samples), the encoder's depth-stencil state, cull mode and winding, and
|
||||
/// one direct or indexed draw of primitives or one patch draw with no patch or control-point index
|
||||
/// buffer (a post-tessellation vertex function's, its factors bound as the tessellation factor
|
||||
/// buffer), observing a buffer, a texture, a color target, the depth/stencil attachment's aspect
|
||||
@@ -1406,7 +1406,7 @@ pub fn runs_render_through_runtime(authored: &AuthoredCase, case: &graphics::Ren
|
||||
vertex,
|
||||
fragment,
|
||||
vertex_buffers,
|
||||
color_targets,
|
||||
color_targets: _,
|
||||
depth_stencil,
|
||||
depth_stencil_state: _,
|
||||
render_target_array_length,
|
||||
@@ -1448,7 +1448,6 @@ pub fn runs_render_through_runtime(authored: &AuthoredCase, case: &graphics::Ren
|
||||
};
|
||||
bound(vertex)
|
||||
&& fragment.as_ref().is_none_or(bound)
|
||||
&& (fragment.is_none() || !color_targets.is_empty() || depth_stencil.is_some())
|
||||
&& vertex_buffers.iter().all(|buffer| !buffer.dynamic)
|
||||
&& depth_stencil.as_ref().is_none_or(one_aspect)
|
||||
&& *render_target_array_length == 0
|
||||
|
||||
@@ -2255,12 +2255,12 @@ fn a_plain_kernel_case_and_only_one_runs_through_the_runtime() {
|
||||
/// textures and samplers, static vertex strides, color targets, and one direct or indexed draw
|
||||
/// of primitives or one patch draw with no index buffer, observing a buffer, a texture, a color
|
||||
/// target or nothing; and a rasterization-disabled vertex case, which renders into the oracle's
|
||||
/// sink; a depth/stencil attachment of one aspect, of one sample or more, observed or not; and
|
||||
/// an attribute buffer's out-of-bounds target. A case with anything else (a depth/stencil
|
||||
/// attachment of both aspects, layered rendering, a dynamic vertex stride, an argument-buffer
|
||||
/// member, an explicit imageblock, a fragment pass with no attachment, which the runtime makes no
|
||||
/// pass of, a patch draw through a patch index buffer, or an index buffer's out-of-bounds target)
|
||||
/// stays on the executor's own context.
|
||||
/// sink; a depth/stencil attachment of one aspect, of one sample or more, observed or not; a
|
||||
/// fragment pass with no attachment, of one sample or more; and an attribute buffer's
|
||||
/// out-of-bounds target. A case with anything else (a depth/stencil attachment of both aspects,
|
||||
/// layered rendering, a dynamic vertex stride, an argument-buffer member, an explicit imageblock,
|
||||
/// a patch draw through a patch index buffer, or an index buffer's out-of-bounds target) stays on
|
||||
/// the executor's own context.
|
||||
#[test]
|
||||
fn a_plain_draw_and_only_one_runs_through_the_runtime() {
|
||||
use super::graphics::tests::two_stage_case;
|
||||
@@ -2421,6 +2421,16 @@ fn a_plain_draw_and_only_one_runs_through_the_runtime() {
|
||||
..plain.clone()
|
||||
};
|
||||
assert!(runs_render_through_runtime(&authored, &multisampled));
|
||||
// A fragment pass of no attachment, of one sample or more.
|
||||
for raster_sample_count in [None, Some(4)] {
|
||||
let attachmentless = RenderCase {
|
||||
color_targets: BTreeMap::new(),
|
||||
output: RenderOutput::None,
|
||||
raster_sample_count,
|
||||
..plain.clone()
|
||||
};
|
||||
assert!(runs_render_through_runtime(&authored, &attachmentless));
|
||||
}
|
||||
let others = [
|
||||
RenderCase {
|
||||
depth_stencil: Some(LiteralDepthStencil {
|
||||
@@ -2446,11 +2456,6 @@ fn a_plain_draw_and_only_one_runs_through_the_runtime() {
|
||||
}),
|
||||
..plain.clone()
|
||||
},
|
||||
RenderCase {
|
||||
color_targets: BTreeMap::new(),
|
||||
output: RenderOutput::None,
|
||||
..plain.clone()
|
||||
},
|
||||
bounded(
|
||||
OutOfBoundsResource::IndexBuffer,
|
||||
ContainmentForm::IndexBuffer,
|
||||
|
||||
@@ -1458,12 +1458,6 @@ impl<'a> Targets<'a> {
|
||||
if let Some([width, height]) = extent {
|
||||
targets.extent = vk::Extent2D { width, height };
|
||||
}
|
||||
// A multisampled subpass without attachments.
|
||||
let attached = graphics.color_attachments.iter().any(Option::is_some)
|
||||
|| targets.depth_stencil.is_some();
|
||||
if let (AttachmentTransfer::PerSample { samples }, false) = (transfer, attached) {
|
||||
multisampled::attachmentless_support(context, samples)?;
|
||||
}
|
||||
Ok(targets)
|
||||
}
|
||||
|
||||
|
||||
@@ -663,31 +663,6 @@ fn clear_stencil(
|
||||
recorded
|
||||
}
|
||||
|
||||
/// Whether the device rasterizes `samples` samples in a pass without attachments
|
||||
/// (`framebufferNoAttachmentsSampleCounts`).
|
||||
pub(super) fn attachmentless_support(
|
||||
context: &VulkanContext,
|
||||
samples: u32,
|
||||
) -> Result<(), ExecutorError> {
|
||||
// SAFETY: the physical device belongs to the live instance.
|
||||
let counts = unsafe {
|
||||
context
|
||||
.instance
|
||||
.get_physical_device_properties(context.physical)
|
||||
}
|
||||
.limits
|
||||
.framebuffer_no_attachments_sample_counts;
|
||||
if counts.contains(sample_flags(samples)?) {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(NotSupported::NotEnabled(vec![format!(
|
||||
"framebufferNoAttachmentsSampleCounts with {samples} samples (the device's: {:#b})",
|
||||
counts.as_raw()
|
||||
)])
|
||||
.into())
|
||||
}
|
||||
}
|
||||
|
||||
/// One multisampled attachment image's moves around the pass: every aspect of its format (a
|
||||
/// depth/stencil image's layout covers both), the writes that filled it, and the access and
|
||||
/// layout the pass keeps it in.
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
//! (`runtime_depth`, as the runtime takes no upload of one) or a Shared `Stencil8` written from its
|
||||
//! bytes, loaded and stored by the pass; in a pass of more samples, each attachment a Private
|
||||
//! multisampled texture of the pass's samples, filled and read back sample by sample
|
||||
//! (`runtime_multisample`), a stencil aspect cleared by the pass to its one value; the oracle's
|
||||
//! (`runtime_multisample`), a stencil aspect cleared by the pass to its one value; a fragment
|
||||
//! case of no attachment the oracle's pass of none, 1x1 at the case's samples; the oracle's
|
||||
//! depth-stencil state, stencil
|
||||
//! references, cull mode and winding; one draw, direct, indexed or of patches (its factors a Shared
|
||||
//! buffer bound as the tessellation factor buffer, as the oracle binds them), in one command
|
||||
@@ -143,7 +144,7 @@ fn run(
|
||||
|command_buffer| {
|
||||
let fail = |what: &'static str| move |error: rt::Error| runtime_error(what, error);
|
||||
let mut encoder = command_buffer
|
||||
.render_command_encoder(&targets.pass())
|
||||
.render_command_encoder(&targets.pass(case))
|
||||
.map_err(fail("the render encoder"))?;
|
||||
encoder
|
||||
.set_render_pipeline_state(&state)
|
||||
@@ -527,10 +528,16 @@ impl Targets {
|
||||
})
|
||||
}
|
||||
|
||||
/// The pass: each attachment loaded and stored, a multisampled stencil aspect cleared to its
|
||||
/// one value.
|
||||
fn pass(&self) -> rt::RenderPassDescriptor {
|
||||
/// The pass of `case`: each attachment loaded and stored, a multisampled stencil aspect
|
||||
/// cleared to its one value; with no attachment, the oracle's (`metal::platform`) 1x1 area at
|
||||
/// the case's samples (`renderTargetWidth`, `renderTargetHeight`, `defaultRasterSampleCount`).
|
||||
fn pass(&self, case: &RenderCase) -> rt::RenderPassDescriptor {
|
||||
let mut pass = rt::RenderPassDescriptor::default();
|
||||
if self.textures.is_empty() && self.depth_stencil.is_none() {
|
||||
pass.render_target_width = 1;
|
||||
pass.render_target_height = 1;
|
||||
pass.default_raster_sample_count = case.raster_sample_count.unwrap_or(1);
|
||||
}
|
||||
for (&index, texture) in &self.textures {
|
||||
let attachment = &mut pass.color_attachments[index as usize];
|
||||
attachment.texture = Some(texture.clone());
|
||||
|
||||
@@ -563,6 +563,76 @@ fn each_sample_of_a_multisampled_target_keeps_its_own_contents() {
|
||||
assert_eq!(run.output, expected, "on the executor's own context");
|
||||
}
|
||||
|
||||
/// A fragment case of no attachment draws into the oracle's 1x1 pass at its samples:
|
||||
/// `nat_sample` ORs each run's coverage, marked by 0x100, into its sample's word and counts the
|
||||
/// run 8 words on, so at 1 and at 4 samples each sample runs once and reads its own bit. Through
|
||||
/// the runtime the pass is `renderTargetWidth` by `renderTargetHeight` at
|
||||
/// `defaultRasterSampleCount`, and its words are the executor's own.
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
#[test]
|
||||
fn a_fragment_pass_of_no_attachment_runs_each_sample_once() {
|
||||
let fragment = public("engine/coverage_natural.ll");
|
||||
for samples in [1u32, 4] {
|
||||
let mut authored = crate::companion::tests::case(
|
||||
Stage::Fragment,
|
||||
"nat_sample",
|
||||
TextureFormat::Rgba32Float,
|
||||
);
|
||||
authored.render_targets.clear();
|
||||
authored.raster_sample_count = (samples > 1).then_some(samples);
|
||||
authored.buffers.push(crate::case::BufferResource {
|
||||
binding: 0,
|
||||
role: crate::case::ResourceRole::InOut,
|
||||
bytes_b64: None,
|
||||
initial_bytes_b64: Some(b64(&[0; 64])),
|
||||
rasterization_rate_map: None,
|
||||
});
|
||||
authored.output = OutputSelection::Buffer {
|
||||
binding: 0,
|
||||
offset: 0,
|
||||
length: 64,
|
||||
};
|
||||
let (case, companion) = with_companion(&authored, &fragment);
|
||||
let drawn = run(
|
||||
&case,
|
||||
RenderLibraries {
|
||||
vertex: &companion,
|
||||
fragment: Some(&fragment),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
let words: Vec<u32> = drawn
|
||||
.output
|
||||
.as_chunks::<4>()
|
||||
.0
|
||||
.iter()
|
||||
.map(|word| u32::from_le_bytes(*word))
|
||||
.collect();
|
||||
for sample in 0..8 {
|
||||
let ran = sample < samples;
|
||||
let own = 0x100 | (1 << sample);
|
||||
let word = words[sample as usize];
|
||||
assert_eq!(word & own, if ran { own } else { 0 }, "{samples}: {sample}");
|
||||
assert_eq!(
|
||||
words[8 + sample as usize],
|
||||
u32::from(ran),
|
||||
"{samples}: {sample}"
|
||||
);
|
||||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
assert!(crate::candidate::engine::runs_render_through_runtime(
|
||||
&authored, &case
|
||||
));
|
||||
let through = run_on_runtime(&case, &fragment, Some(&companion)).unwrap();
|
||||
assert_eq!(
|
||||
through.output, drawn.output,
|
||||
"{samples} through the runtime"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A tessellation case drawn through the render executor's patch path: the factor buffer bound
|
||||
/// where the plan's factor write names it, the probe as the evaluation stage, and the case's cull
|
||||
/// mode. `k7_tess_quad_probe` draws patch 0 over the target's left half and patch 1, its mirror
|
||||
|
||||
+4
-3
@@ -505,9 +505,10 @@ cargo run -p metal2vulkan-validation --release --bin corpus-vulkan -- \
|
||||
runtime device's own translator: the runtime's floor enables no buffer robustness, so a
|
||||
fixed-function vertex fetch past its buffer is checked nowhere and the case is refused as
|
||||
`not_supported{uncontained:unchecked vertex_input}`. A rasterization-disabled vertex case renders
|
||||
into the oracle's 1x1 `R8Unorm` attachment. Layered rendering, an argument-buffer member, a
|
||||
patch index buffer, an out-of-bounds target other than an attribute buffer or a fragment pass
|
||||
with no attachment (the runtime makes no pass without one) keeps the case on the executor's own
|
||||
into the oracle's 1x1 `R8Unorm` attachment, and a fragment case of no attachment into the
|
||||
oracle's pass of none: `renderTargetWidth` and `renderTargetHeight` 1, `defaultRasterSampleCount`
|
||||
the case's samples. Layered rendering, an argument-buffer member, a patch index buffer or an
|
||||
out-of-bounds target other than an attribute buffer keeps the case on the executor's own
|
||||
context. A vertex buffer's dynamic stride carries `dynamic_vertex_stride` and a fragment
|
||||
function's imageblock `fragment_imageblock`, each the runtime's limit. An indexed
|
||||
draw past its index buffer, which the runtime refuses as Metal's validation does
|
||||
|
||||
Reference in new issue
Block a user