runtime: a point-size function's state is refused under the line and triangle class
Metal's pipeline creation fails for a vertex function that writes `[[point_size]]` under the line
or the triangle input primitive topology class ("Vertex shader writes point size but
inputPrimitiveTopology is MTLPrimitiveTopologyClassLine", measured on an M3 Max, macOS 27.0.1,
the conformance crate's topology_classes probe), and makes it under the point and the
unspecified class. The runtime made all four, so the round's
topology-class-point-size-function on the RX 7900 XTX recorded render-pipeline:line and
:triangle true where Metal recorded false, and drew lines and triangles Metal never drew
(drawn:, target:line and :triangle).
RenderCompiled::of now refuses such a state with the new
Refusal::PointSizeTopology { class }, read from the translator's graphics.writes_point_size and
the descriptor's class, before any Vulkan object is made. The descriptor key already covers the
class, so a cached content of another class never answers for it.
The ledger's row for the case's drawn:unspecified refusal ("a draw with Points is not built") is
stale: points are drawn now, and the round reports it no longer refuses. Dropped.
The runtime README's point bullet states the refusal and the 1.0 stored for a size not greater
than 0 (the previous point-size commit); docs/REFUSALS.md regenerated and the api_signatures
table blessed (one variant row).
Test: draw's every_device_refuses_a_point_size_function_under_the_line_and_triangle_class
(`draw_point_size_class`): rt6_point's state is refused with the class under Line and Triangle and
made under Unspecified and Point.
This commit is contained in:
1 parent
b4dec683dd
commit
3653240b57
7 files changed
+102
-20
No files matched your search
@@ -6622,7 +6622,6 @@ tile-pipeline-reflection-imageblock * refused case/options-none Err(Unavailable(
|
||||
tile-simd-blur-columns * refused case/state Err(Unavailable({call: "tile_pipeline"})) refused: no stream uses it yet (full selector census 11-19, m3-max-53207-53208, 53213, 53217-53221: 26 streams, no tile render pipeline). The rt side of the suite answers `tile_pipeline` Unavailable: rt has no counterpart of the call, and no replay stream makes it.
|
||||
tile-simd-blur-rows * refused case/state Err(Unavailable({call: "tile_pipeline"})) refused: no stream uses it yet (full selector census 11-19, m3-max-53207-53208, 53213, 53217-53221: 26 streams, no tile render pipeline). The rt side of the suite answers `tile_pipeline` Unavailable: rt has no counterpart of the call, and no replay stream makes it.
|
||||
tile-state-thread-limits * refused case/state-limited-1024 Err(Unavailable({call: "tile_pipeline"})) refused: no stream uses it yet (full selector census 11-19, m3-max-53207-53208, 53213, 53217-53221: 26 streams, no tile render pipeline). The rt side of the suite answers `tile_pipeline` Unavailable: rt has no counterpart of the call, and no replay stream makes it.
|
||||
topology-class-point-size-function * refused case/drawn:unspecified/calls/0-render Err(Error::Unsupported("a draw with Points is not built")) refused: no stream uses it yet (full selector census 11-19, m3-max-53207-53208, 53213, 53217-53221: 26 streams, no draw of MTLPrimitiveTypePoint). rt refuses it (a draw with Points is not built), and no replay stream asks it.
|
||||
two-plane-announced-row-blits * refused case/work/0 Err({refused: Error::Unsupported("no texture of RGB10A82PXR10 is made on this device for the usage"), resource: 0 (0x0)}) refused: no stream uses it yet (full selector census 11-19, m3-max-53207-53208, 53213, 53217-53221: 26 streams, no texture or view of MTLPixelFormatRGB10A8_2P_XR10). rt makes no texture of MTLPixelFormatRGB10A8_2P_XR10 for the usage the case asks on any venue (Gap::TextureFormat, or the creator's NotMade).
|
||||
two-plane-heap-blits * refused case/work/a48 Err({refused: Error::Unsupported("a heap texture of RGB10A82PXR10 is not placed in this heap on this device"), resource: 1 (0x1)}) refused: no stream uses it yet (full selector census 11-19, m3-max-53207-53208, 53213, 53217-53221: 26 streams, no texture or view of MTLPixelFormatRGB10A8_2P_XR10). rt makes no texture of MTLPixelFormatRGB10A8_2P_XR10 for the usage the case asks on any venue (Gap::TextureFormat, or the creator's NotMade).
|
||||
two-plane-pad-fills * refused case/work/0 Err({refused: Error::Unsupported("no texture of RGB10A82PXR10 is made on this device for the usage"), resource: 0 (0x0)}) refused: no stream uses it yet (full selector census 11-19, m3-max-53207-53208, 53213, 53217-53221: 26 streams, no texture or view of MTLPixelFormatRGB10A8_2P_XR10). rt makes no texture of MTLPixelFormatRGB10A8_2P_XR10 for the usage the case asks on any venue (Gap::TextureFormat, or the creator's NotMade).
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -2751,17 +2751,20 @@ or does not check is rebuilt from the generations' names, with young counted ful
|
||||
(`Metrics::first_use_waits`, `first_use_line_waits`, `first_use_point_waits`). Of the two replay streams' 537 render contents
|
||||
drawn, 527 draw only triangles and 2 lines and triangles; a content drawn only as lines (8 of
|
||||
them) makes a triangle `VkPipeline` it never uses.
|
||||
- A point is as wide as the `PointSize` the vertex module writes: the function's
|
||||
`[[point_size]]`, stored as Metal's largest point, 511 pixels, where it is past it, which the
|
||||
device draws through `largePoints` (Floor) and clamps to its `pointSizeRange`
|
||||
(`PrecisionNote::DevicePointSize` where the range ends below 511), or 1.0 for a function
|
||||
without one. Metal draws a point of a function without `[[point_size]]` only under a state whose
|
||||
descriptor names the point class, 1 pixel wide; under any other class it rasterizes nothing and
|
||||
runs the vertex function all the same (Metal probes, an M4), so such a draw records its points
|
||||
behind an empty scissor: the vertex function runs, its stores land, and no fragment runs.
|
||||
A point near the viewport's edge or the clip volume is clipped or culled by the device's own
|
||||
rule (its `pointClippingBehavior` and the driver's handling of the viewport), as Metal states no
|
||||
rule for it (docs/API.md, section 10).
|
||||
- A point is as wide as the `PointSize` the vertex module writes: the function's `[[point_size]]`,
|
||||
stored as Metal's largest point, 511 pixels, where it is past it, which the device draws through
|
||||
`largePoints` (Floor) and clamps to its `pointSizeRange` (`PrecisionNote::DevicePointSize` where
|
||||
the range ends below 511), or 1.0 for a function without one, and 1.0 too where the function's
|
||||
size is not greater than 0: a zero, a negative or a NaN, which Vulkan's `PointSize` does not take
|
||||
(Metal's answer for them is undocumented and unmeasured). Metal draws a point of a function
|
||||
without `[[point_size]]` only under a state whose descriptor names the point class, 1 pixel wide;
|
||||
under any other class it rasterizes nothing and runs the vertex function all the same (Metal
|
||||
probes, an M4), so such a draw records its points behind an empty scissor: the vertex function
|
||||
runs, its stores land, and no fragment runs. A state whose vertex function writes `[[point_size]]`
|
||||
under the line or the triangle class is refused at its make (`Refusal::PointSizeTopology`), as
|
||||
Metal's creation refuses it. A point near the viewport's edge or the clip volume is clipped or
|
||||
culled by the device's own rule (its `pointClippingBehavior` and the driver's handling of the
|
||||
viewport), as Metal states no rule for it (docs/API.md, section 10).
|
||||
- A post-tessellation vertex function's state draws its patches through the device's tessellator
|
||||
(`tessellationShader`, Floor). Its one `VkPipeline` is the patch class's, made with the state:
|
||||
the translator's synthesized vertex stage (each patch one vertex of a `PATCH_LIST` of one control
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::floor::BelowFloor;
|
||||
use crate::import::ImportHandle;
|
||||
use crate::memory::{BlockId, MemoryClass};
|
||||
use ash::vk;
|
||||
use metal2vulkan::metal::{PixelFormat, TextureType};
|
||||
use metal2vulkan::metal::{PixelFormat, PrimitiveTopologyClass, TextureType};
|
||||
use std::{fmt, io};
|
||||
|
||||
/// What a failing call returns.
|
||||
@@ -292,6 +292,18 @@ pub enum Refusal {
|
||||
/// at a quad patch draw with no tessellation factor buffer, where the same draw with one set
|
||||
/// runs and paints the target, the API validation layer off).
|
||||
NoTessellationFactorBuffer,
|
||||
/// [`Device::new_render_pipeline_state`](crate::Device::new_render_pipeline_state) of a vertex
|
||||
/// function that writes `[[point_size]]` under the line or the triangle input primitive
|
||||
/// topology class (`inputPrimitiveTopology`). The point and the unspecified class make it.
|
||||
///
|
||||
/// Basis: metal-measured (an Apple M3 Max, macOS 27.0.1, every class crossed with both shapes
|
||||
/// of vertex function: Metal's pipeline creation fails with `Vertex shader writes point size
|
||||
/// but inputPrimitiveTopology is MTLPrimitiveTopologyClassLine`, and its `Triangle`
|
||||
/// counterpart; the conformance crate's `topology-class-point-size-function` compares it).
|
||||
PointSizeTopology {
|
||||
/// The class the descriptor names: `Line` or `Triangle`.
|
||||
class: PrimitiveTopologyClass,
|
||||
},
|
||||
/// A buffer argument index past Metal's 31 entries (`setBuffer`, `setBytes`,
|
||||
/// `setBufferOffset`, `setThreadgroupMemoryLength`).
|
||||
///
|
||||
@@ -1953,6 +1965,11 @@ impl fmt::Display for Refusal {
|
||||
Refusal::NoTessellationFactorBuffer => {
|
||||
f.write_str("a draw of patches needs a tessellation factor buffer")
|
||||
}
|
||||
Refusal::PointSizeTopology { class } => write!(
|
||||
f,
|
||||
"the vertex function writes a point size, which the {class:?} input primitive \
|
||||
topology class does not take"
|
||||
),
|
||||
Refusal::BufferIndex { index } => {
|
||||
write!(f, "buffer index {index} is past the 31 entries")
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
use crate::cache::{self, Lowerings};
|
||||
use crate::counters::{FirstUse, Gauge, Metric};
|
||||
use crate::device::{lock, Core};
|
||||
use crate::error::{Error, Gap, RenderPipelineKind};
|
||||
use crate::error::{Error, Gap, Refusal, RenderPipelineKind};
|
||||
use crate::hazard::Access;
|
||||
use crate::kernel_map::KernelKey;
|
||||
use crate::pass::Pass;
|
||||
@@ -299,10 +299,11 @@ impl crate::Device {
|
||||
///
|
||||
/// Err: [`Error::Translation`], the translator's typed refusal or a descriptor Metal refuses;
|
||||
/// [`Gap::IndirectCommandBuffers`]; [`Gap::RenderPipeline`] for what the runtime does not
|
||||
/// build, naming it; [`Refusal::SamplerIds`](crate::Refusal::SamplerIds) where `sampler_ids`
|
||||
/// answers another count; [`Refusal::IndicesNotGranted`](crate::Refusal::IndicesNotGranted)
|
||||
/// for a constexpr sampler's index;
|
||||
/// [`Limit::DeviceSamplers`](crate::Limit::DeviceSamplers); [`Error::Vulkan`].
|
||||
/// build, naming it; [`Refusal::PointSizeTopology`](crate::Refusal::PointSizeTopology) for a
|
||||
/// vertex function that writes `[[point_size]]` under the line or the triangle class;
|
||||
/// [`Refusal::SamplerIds`](crate::Refusal::SamplerIds) where `sampler_ids` answers another
|
||||
/// count; [`Refusal::IndicesNotGranted`](crate::Refusal::IndicesNotGranted) for a constexpr
|
||||
/// sampler's index; [`Limit::DeviceSamplers`](crate::Limit::DeviceSamplers); [`Error::Vulkan`].
|
||||
pub fn new_render_pipeline_state(
|
||||
&self,
|
||||
descriptor: &RenderPipelineDescriptor,
|
||||
@@ -842,6 +843,17 @@ impl RenderCompiled {
|
||||
let translator = &core.translator;
|
||||
let pipeline = translating(core, || translator.compile_render_pipeline(lowered, budget))
|
||||
.map_err(Error::Translation)?;
|
||||
// Metal makes no pipeline of a vertex function that writes `[[point_size]]` under the line
|
||||
// or the triangle class.
|
||||
let class = lowered.input_primitive_topology;
|
||||
if pipeline.graphics.writes_point_size
|
||||
&& matches!(
|
||||
class,
|
||||
PrimitiveTopologyClass::Line | PrimitiveTopologyClass::Triangle
|
||||
)
|
||||
{
|
||||
return Err(Error::Refused(Refusal::PointSizeTopology { class }));
|
||||
}
|
||||
if let Some(kind) = unbuilt(&pipeline, translator.profile().enabled()) {
|
||||
return Err(Error::Unsupported(Gap::RenderPipeline { kind }));
|
||||
}
|
||||
|
||||
@@ -973,6 +973,54 @@ pub(crate) mod on_device {
|
||||
});
|
||||
}
|
||||
|
||||
/// A state of a vertex function that writes `[[point_size]]` (`rt6_point`) is refused under
|
||||
/// the line and the triangle class (`Refusal::PointSizeTopology`), as Metal's creation is, and
|
||||
/// made under the unspecified and the point class.
|
||||
#[test]
|
||||
fn every_device_refuses_a_point_size_function_under_the_line_and_triangle_class() {
|
||||
use metal2vulkan::metal::PrimitiveTopologyClass as Class;
|
||||
|
||||
let Some(engine) = library(&engine_dir().join("rt6_render_state.ll")) else {
|
||||
return;
|
||||
};
|
||||
let function = |name: &str| {
|
||||
StageSource::Function(FunctionDescriptor::new(
|
||||
engine.function(name).expect("the function"),
|
||||
))
|
||||
};
|
||||
let mut sized = RenderPipelineDescriptor::new(function("rt6_point"));
|
||||
sized.fragment = Some(function("rt6_white"));
|
||||
sized.color_attachments[0] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA8Unorm));
|
||||
each_device("draw_point_size_class", |name, _, device| {
|
||||
for class in [
|
||||
Class::Unspecified,
|
||||
Class::Point,
|
||||
Class::Line,
|
||||
Class::Triangle,
|
||||
] {
|
||||
let mut d = sized.clone();
|
||||
d.input_primitive_topology = class;
|
||||
let made =
|
||||
device.new_render_pipeline_state(&d, crate::tests::no_constexpr_samplers);
|
||||
match (class, made) {
|
||||
(Class::Line | Class::Triangle, Err(Error::Refused(refusal))) => assert_eq!(
|
||||
refusal,
|
||||
Refusal::PointSizeTopology { class },
|
||||
"{name}: {class:?}"
|
||||
),
|
||||
(Class::Line | Class::Triangle, Err(error)) => {
|
||||
panic!("{name}: {class:?}: {error}")
|
||||
}
|
||||
(Class::Line | Class::Triangle, Ok(_)) => panic!("{name}: {class:?}: made"),
|
||||
(_, made) => {
|
||||
made.unwrap_or_else(|error| panic!("{name}: {class:?}: {error}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("{name}: a point-size function's state refused under Line and Triangle");
|
||||
});
|
||||
}
|
||||
|
||||
/// A stencil state that replaces marks the top half; one that tests keeps a later draw there.
|
||||
#[test]
|
||||
fn every_device_marks_and_tests_the_stencil() {
|
||||
|
||||
@@ -10500,6 +10500,7 @@ variant metal2vulkan-runtime::Refusal::NotDrawable NotDrawable
|
||||
variant metal2vulkan-runtime::Refusal::NotExported NotExported { block: BlockId }
|
||||
variant metal2vulkan-runtime::Refusal::OtherDevice OtherDevice
|
||||
variant metal2vulkan-runtime::Refusal::PatchDraw PatchDraw
|
||||
variant metal2vulkan-runtime::Refusal::PointSizeTopology PointSizeTopology { class: PrimitiveTopologyClass }
|
||||
variant metal2vulkan-runtime::Refusal::ResolveFormat ResolveFormat { pixel_format: PixelFormat }
|
||||
variant metal2vulkan-runtime::Refusal::ResolveTexture ResolveTexture
|
||||
variant metal2vulkan-runtime::Refusal::SamplerArgumentIndex SamplerArgumentIndex { index: u32 }
|
||||
|
||||
|
Can't render this file because it is too large.
|
+4
-2
@@ -32,7 +32,7 @@ Columns:
|
||||
| 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` | 75 | 75 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 76 | 76 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 17 | 17 | 0 | 0 | 0 | 0 | 0 |
|
||||
| The runtime's `Gap` | 30 | 30 | 0 | 0 | 0 | 0 | 0 |
|
||||
|
||||
@@ -46,7 +46,7 @@ Columns:
|
||||
| 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` | 20 | 20 | 0 | 0 | 35 | 0 | 0 | 0 |
|
||||
| The runtime's `Refusal` | 21 | 20 | 0 | 0 | 35 | 0 | 0 | 0 |
|
||||
| The runtime's `Limit` | 0 | 0 | 0 | 13 | 4 | 0 | 0 | 0 |
|
||||
| The runtime's `Gap` | 0 | 0 | 0 | 2 | 28 | 0 | 0 | 0 |
|
||||
|
||||
@@ -278,6 +278,7 @@ Columns:
|
||||
| `NoPipeline` | A dispatch or a draw with no pipeline state set | every device (a public call's own check of its arguments) | `metal-documented`: a compute dispatch needs a compute pipeline state set first, and a draw a render pipeline state | 3: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` (+1) | `-` |
|
||||
| `PatchDraw` | A draw of patches with a render pipeline state whose vertex function is not a post-tessellation one, or a draw of primitives with one whose vertex... | every device (a public call's own check of its arguments) | `metal-measured`: an M4: plain Metal stops its process over a patch draw with a pipeline that is not a tessellation one, its validation off; Metal's validation stops a draw of primitives with a tessellation pipeline | 1: `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` | `-` |
|
||||
| `NoTessellationFactorBuffer` | A draw of patches while the encoder has no tessellation factor buffer (`setTessellationFactorBuffer:offset:instanceStride:`) | every device (a public call's own check of its arguments) | `metal-measured`: an Apple M3 Max, macOS 27.0.1: plain Metal ends the process, SIGSEGV, at a quad patch draw with no tessellation factor buffer, where the same draw with one set runs and paints the target, the API validation layer off | 1: `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)` | `-` |
|
||||
| `PointSizeTopology` | `Device::new_render_pipeline_state` of a vertex function that writes `[[point_size]]` under the line or the triangle input primitive topology... | every device (a public call's own check of its arguments) | `metal-measured`: an Apple M3 Max, macOS 27.0.1, every class crossed with both shapes of vertex function: Metal's pipeline creation fails with `Vertex shader writes point size but inputPrimitiveTopology is MTLPrimitiveTopologyClassLine`, and its `Triangle` counterpart; the conformance crate's `topology-class-point-size-function` compares it | 1: `crates/metal2vulkan-runtime/src/render.rs (of)` | `-` |
|
||||
| `BufferIndex` | A buffer argument index past Metal's 31 entries (`setBuffer`, `setBytes`, `setBufferOffset`, `setThreadgroupMemoryLength`) | every device (a public call's own check of its arguments) | `metal-documented`: the buffer argument table has 31 entries per stage | 2: `crates/metal2vulkan-runtime/src/encoder.rs (slot)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (slot)` | `-` |
|
||||
| `TextureArgumentIndex` | A texture argument index past Metal's 128 entries (`setTexture`) | every device (a public call's own check of its arguments) | `metal-documented`: the texture argument table has 128 entries per stage on Apple GPUs | 2: `crates/metal2vulkan-runtime/src/encoder.rs (set_texture)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (set_texture)` | `-` |
|
||||
| `SamplerArgumentIndex` | A sampler argument index past Metal's 16 entries (`setSamplerState`) | every device (a public call's own check of its arguments) | `metal-documented`: the sampler argument table has 16 entries per stage | 2: `crates/metal2vulkan-runtime/src/encoder.rs (set_sampler_state)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (set_sampler_state)` | `-` |
|
||||
@@ -572,6 +573,7 @@ Each refusal's sites, with the function that builds it.
|
||||
- `rt:Refusal::NoPipeline`: `crates/metal2vulkan-runtime/src/encoder.rs (dispatch)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (draw_reaches)`
|
||||
- `rt:Refusal::PatchDraw`: `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`
|
||||
- `rt:Refusal::NoTessellationFactorBuffer`: `crates/metal2vulkan-runtime/src/render_encoder.rs (draw)`
|
||||
- `rt:Refusal::PointSizeTopology`: `crates/metal2vulkan-runtime/src/render.rs (of)`
|
||||
- `rt:Refusal::BufferIndex`: `crates/metal2vulkan-runtime/src/encoder.rs (slot)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (slot)`
|
||||
- `rt:Refusal::TextureArgumentIndex`: `crates/metal2vulkan-runtime/src/encoder.rs (set_texture)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_texture)`
|
||||
- `rt:Refusal::SamplerArgumentIndex`: `crates/metal2vulkan-runtime/src/encoder.rs (set_sampler_state)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (set_sampler_state)`
|
||||
|
||||
Reference in new issue
Block a user