rt: a render encoder keeps a line width; a draw of lines at another width than 1 is Gap::Draw{LineWidth}
A gap against the old runtime. Apple's private setLineWidth: has no rt setter, so the rt player
refused the call ("not played on a render encoder") and every rt play of a stream that sets it
stopped at its first call, while the old runtime plays it.
RenderCommandEncoder::set_line_width(f32) keeps the width the encoder's later draws see, Metal's 1
until set, each encoder starting at 1. Every width is accepted, as on Metal. The runtime draws
lines at width 1 alone: its pipelines fix the width at 1, and Vulkan's wider lines are a device
feature (wideLines) that the floor does not require, so no second form is built on it. A draw of
lines or a line strip while the width is not 1 is the new DrawKind::LineWidth, refused at the
draw before anything is recorded; a draw of no vertices records nothing as at any width, and a
draw of triangles runs at any width, as Metal's filled triangles do. A triangle fill mode of lines,
which Metal draws at the width, is already refused where it is set (DrawKind::FillMode).
The player plays setLineWidth: into the setter; a line draw under another width is then the
runtime's gap, skipped and counted like any other.
Also: fill_push's doc comment had landed above `primitives`; it is back on its function.
Docs: the setter's doc names Metal's counterpart (the private setLineWidth: of
MTLRenderCommandEncoder) and what is refused; DrawKind::LineWidth says why; the rt README holds
the width in the encoder's state and the draw in its known gaps. api_signatures gains the method
and the variant. refusal_surface.py regenerates docs/REFUSALS.md with no change: it lists
Gap::Draw by its raise sites, and the new kind is raised in draw, already listed. api_surface pins
the translator's module roots alone, so no row moves.
Tests: tests::draw::on_device::every_device_draws_lines_at_width_1_alone (width 2: a line and a
line strip refused with DrawKind::LineWidth, an empty line draw and a triangle draw; width 1 again
and a later encoder's default: lines draw their rows) and
runtime_lane::rt_replay::a_line_width_plays_and_a_line_drawn_at_another_width_is_skipped (at 1
nothing skipped; at 2 the line is skipped and counted as Draw { kind: LineWidth } at its call).
Verified: the check job named at hand-over compiles it and runs the touched tests.
This commit is contained in:
1 parent
b119e71f6a
commit
c8fa4e9440
7 files changed
+212
-18
No files matched your search
@@ -2009,6 +2009,9 @@ or does not check is rebuilt from the generations' names, with young counted ful
|
||||
a compare function other than `Never` or `Always`) reads it at each draw, pushed as Metal's
|
||||
8-bit unorm code (`metal2vulkan::bind::alpha_test_code`), and its fragment function compares its
|
||||
color 0's alpha's code with it; a fragment that fails writes nothing.
|
||||
- An encoder also holds the line width (`set_line_width`, Apple's `setLineWidth:` SPI): 1 until
|
||||
the encoder sets it, every width kept. Lines draw at width 1 alone; a draw of triangles runs at
|
||||
any width, as Metal's filled triangles do.
|
||||
- `draw_primitives` and `draw_indexed_primitives` are one `vkCmdDraw` or `vkCmdDrawIndexed` each.
|
||||
A draw pushes its functions' fields in the one push range (the addresses of their buffer slots
|
||||
plus offsets, the resource IDs of their textures and sampler states, the state's constexpr
|
||||
@@ -2100,7 +2103,10 @@ or does not check is rebuilt from the generations' names, with young counted ful
|
||||
`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
|
||||
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
|
||||
viewport Vulkan's is not (a
|
||||
negative width, a depth range past `[0, 1]`, bounds past the device's viewport limits), a
|
||||
pipeline state whose formats are not the pass's attachments', a draw that binds a texture
|
||||
|
||||
@@ -1199,6 +1199,12 @@ pub enum DrawKind {
|
||||
FillMode,
|
||||
/// The depth clip mode `Clamp` (`setDepthClipMode:`), which no replay stream sets.
|
||||
DepthClamp,
|
||||
/// A draw of lines or a line strip while the encoder's line width (Apple's `setLineWidth:`
|
||||
/// SPI, [`RenderCommandEncoder::set_line_width`](crate::RenderCommandEncoder::set_line_width))
|
||||
/// is not 1: Metal draws such a line as a parallelogram that width wide; the runtime draws
|
||||
/// lines at width 1 alone, as Vulkan's wider lines are a device feature (`wideLines`) the
|
||||
/// floor does not require.
|
||||
LineWidth,
|
||||
/// More than one viewport or scissor rectangle, or none (`setViewports:count:`,
|
||||
/// `setScissorRects:count:`), which no replay stream sets.
|
||||
Viewports,
|
||||
|
||||
@@ -415,8 +415,9 @@ enum Call<'a> {
|
||||
/// Built: a render pipeline state, the vertex and fragment functions' buffers, bytes, textures
|
||||
/// and sampler states, one viewport and scissor rectangle, the cull mode, the front-facing
|
||||
/// winding, a depth-stencil state's depth and stencil tests, the depth bias without a clamp, the
|
||||
/// stencil references, the blend color, the store actions an encoder sets for an attachment whose
|
||||
/// pass left them unknown, memory barriers, fences, direct draws of lines and triangles,
|
||||
/// stencil references, the blend color, the line width (lines drawn at 1 alone: a draw of lines
|
||||
/// at another width is [`DrawKind::LineWidth`]), the store actions an encoder sets for an
|
||||
/// attachment whose pass left them unknown, memory barriers, fences, direct draws of lines and triangles,
|
||||
/// indexed or not, direct draws of patches with a tessellation factor buffer, and the `Disabled`
|
||||
/// visibility result mode (`Boolean` and `Counting` are [`DrawKind::VisibilityResults`]). Not
|
||||
/// built, and so not methods: indirect draws, several viewports or scissor rectangles, the
|
||||
@@ -463,6 +464,8 @@ pub struct RenderCommandEncoder {
|
||||
/// The alpha test reference's 8-bit unorm code (`metal2vulkan::bind::alpha_test_code`),
|
||||
/// Metal's 1 until set.
|
||||
alpha_test: u32,
|
||||
/// The line width `set_line_width` set last, Metal's 1 until set.
|
||||
line_width: f32,
|
||||
/// The depth bias's constant and slope scale, Metal's `depthBias` and `slopeScale`.
|
||||
depth_bias: [f32; 2],
|
||||
/// Whether the last draw recorded the depth bias enabled.
|
||||
@@ -547,6 +550,7 @@ impl CommandBuffer {
|
||||
stencil_reference: [0; 2],
|
||||
blend_color: [0.0; 4],
|
||||
alpha_test: alpha_test_code(1.0),
|
||||
line_width: 1.0,
|
||||
depth_bias: [0.0; 2],
|
||||
biased: false,
|
||||
recorded: None,
|
||||
@@ -1072,6 +1076,18 @@ impl RenderCommandEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
/// `setLineWidth:`, a method of Metal's render command encoders that Apple does not declare
|
||||
/// in its headers (SPI): the width the encoder's later lines are drawn at, each encoder
|
||||
/// starting at Metal's 1. Every width is accepted and kept, as on Metal; 1 records nothing.
|
||||
/// The runtime draws lines at width 1 alone: Vulkan's wide lines are a device feature
|
||||
/// (`wideLines`) the floor does not require, and no second form is built on it. A draw of
|
||||
/// lines or a line strip while the width is not 1 is refused; a draw of triangles runs at any
|
||||
/// width, as Metal draws filled triangles alike at every width (a triangle fill mode of
|
||||
/// lines, which Metal draws at the width, is refused where it is set).
|
||||
pub fn set_line_width(&mut self, width: f32) {
|
||||
self.line_width = width;
|
||||
}
|
||||
|
||||
/// The static precision note of a draw of triangles under a depth bias
|
||||
/// ([`set_depth_bias`](Self::set_depth_bias)).
|
||||
pub const DEPTH_BIAS_NOTE: PrecisionNote = PrecisionNote::DeviceDepthBias;
|
||||
@@ -1714,6 +1730,13 @@ impl RenderCommandEncoder {
|
||||
if draws.first_instance_zero && base_instance != 0 {
|
||||
return gap(DrawKind::DividedBaseInstance);
|
||||
}
|
||||
let lines = matches!(
|
||||
topology,
|
||||
vk::PrimitiveTopology::LINE_LIST | vk::PrimitiveTopology::LINE_STRIP
|
||||
);
|
||||
if lines && self.line_width != 1.0 {
|
||||
return gap(DrawKind::LineWidth);
|
||||
}
|
||||
let pipeline = compiled.pipeline(topology)?;
|
||||
let discards = compiled.discards();
|
||||
let writes_memory = draws.writes_memory;
|
||||
@@ -2274,10 +2297,6 @@ impl Drop for RenderCommandEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
/// Fills `push`, the push bytes of a draw of `state`, from the `tables`, a buffer argument bound to
|
||||
/// nothing taking `nil`, the nil buffer's address: a texture whose image the pass `moved` to the
|
||||
/// feedback layout reads through its second element in that layout, and one in `shadow_slots`,
|
||||
/// which reads a shadow, through its second element, the shadow's.
|
||||
/// The topology of a draw of `primitive_type`, and whether it restarts strips.
|
||||
///
|
||||
/// Err: [`Gap::Draw`] of [`DrawKind::Points`].
|
||||
@@ -2292,6 +2311,10 @@ fn primitives(primitive_type: PrimitiveType) -> Result<(vk::PrimitiveTopology, b
|
||||
Ok((topology, restart))
|
||||
}
|
||||
|
||||
/// Fills `push`, the push bytes of a draw of `state`, from the `tables`, a buffer argument bound to
|
||||
/// nothing taking `nil`, the nil buffer's address: a texture whose image the pass `moved` to the
|
||||
/// feedback layout reads through its second element in that layout, and one in `shadow_slots`,
|
||||
/// which reads a shadow, through its second element, the shadow's.
|
||||
fn fill_push(
|
||||
push: &mut Vec<u8>,
|
||||
(tables, nil, factors, alpha_test): (&[Tables; 2], u64, u64, u32),
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
//! instruction.
|
||||
//! - a draw of lines makes its content's line `VkPipeline` once, a first-use wait, and draws
|
||||
//! its row.
|
||||
//! - lines draw at width 1 alone: at width 2 a draw of lines or a line strip is
|
||||
//! `DrawKind::LineWidth` and a triangle draws; at 1 again, and in a later encoder, lines draw.
|
||||
//! - a stencil state that replaces the stencil marks what a draw covers, and one that tests it
|
||||
//! keeps a later draw to those pixels.
|
||||
//! - a pass clears, loads and stores a shader-read `Depth32Float` depth attachment that its
|
||||
@@ -606,6 +608,96 @@ pub(crate) mod on_device {
|
||||
});
|
||||
}
|
||||
|
||||
/// Lines draw at width 1 alone (`set_line_width`, Apple's `setLineWidth:`): at width 2 a draw
|
||||
/// of lines or of a line strip is `DrawKind::LineWidth` and records nothing, a draw of no
|
||||
/// vertices records nothing as at any width, and a triangle draws; at 1 again lines draw, and
|
||||
/// a later encoder starts at 1 whatever the earlier one set.
|
||||
#[test]
|
||||
fn every_device_draws_lines_at_width_1_alone() {
|
||||
let Some(library) = examples() else {
|
||||
return;
|
||||
};
|
||||
let d = descriptor(&library, "colored_fragment", PixelFormat::RGBA8Unorm);
|
||||
each_device("line_width", |name, _, device| {
|
||||
let state = state(name, &device, &d);
|
||||
// Lines across rows 2 and 0 through their centres, Metal's y up, then a triangle over
|
||||
// rows 4 to 7.
|
||||
let row = |y: f32| 1.0 - (y + 0.5) / 4.0;
|
||||
let (two, zero) = (row(2.0), row(0.0));
|
||||
let positions = [
|
||||
-1.0, two, 1.0, two, -1.0, zero, 1.0, zero, -1.0, 0.0, 3.0, 0.0, -1.0, -4.0,
|
||||
];
|
||||
let mut buffers = Buffers::new(&device);
|
||||
let positions = buffers.of(&device, &floats(&positions));
|
||||
let colors = [GREEN, GREEN, GREEN, GREEN, WHITE, WHITE, WHITE].concat();
|
||||
let colors = buffers.of(&device, &floats(&colors));
|
||||
let color = target(
|
||||
&device,
|
||||
PixelFormat::RGBA8Unorm,
|
||||
TextureUsage::RENDER_TARGET,
|
||||
);
|
||||
let queue = device.new_command_queue(4).expect("a queue");
|
||||
let command_buffer = queue.command_buffer().expect("a command buffer");
|
||||
let draw = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}"));
|
||||
let refused = |got: Result<(), Error>, case: &str| {
|
||||
let want = Error::Unsupported(Gap::Draw {
|
||||
kind: DrawKind::LineWidth,
|
||||
});
|
||||
assert_eq!(
|
||||
format!("{got:?}"),
|
||||
format!("{:?}", Err::<(), _>(want)),
|
||||
"{name}: {case}"
|
||||
);
|
||||
};
|
||||
let mut encoder = (command_buffer.render_command_encoder(&pass(&color, None)))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
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));
|
||||
encoder.set_line_width(2.0);
|
||||
refused(
|
||||
encoder.draw_primitives(PrimitiveType::Line, 0, 2, 1, 0),
|
||||
"lines at width 2",
|
||||
);
|
||||
refused(
|
||||
encoder.draw_primitives(PrimitiveType::LineStrip, 0, 2, 1, 0),
|
||||
"a line strip at width 2",
|
||||
);
|
||||
draw(encoder.draw_primitives(PrimitiveType::Line, 0, 0, 1, 0));
|
||||
draw(encoder.draw_primitives(PrimitiveType::Triangle, 4, 3, 1, 0));
|
||||
encoder.set_line_width(1.0);
|
||||
draw(encoder.draw_primitives(PrimitiveType::Line, 0, 2, 1, 0));
|
||||
encoder.set_line_width(0.5);
|
||||
encoder.end_encoding();
|
||||
let mut load = pass(&color, None);
|
||||
load.color_attachments[0].load_action = crate::LoadAction::Load;
|
||||
let mut encoder = (command_buffer.render_command_encoder(&load))
|
||||
.unwrap_or_else(|error| panic!("{name}: {error}"));
|
||||
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));
|
||||
draw(encoder.draw_primitives(PrimitiveType::Line, 2, 2, 1, 0));
|
||||
encoder.end_encoding();
|
||||
run(name, &command_buffer);
|
||||
let texels = read(&color, 4);
|
||||
let at = |x: u32, y: u32| {
|
||||
let i = ((y * SIDE + x) * 4) as usize;
|
||||
[texels[i], texels[i + 1], texels[i + 2], texels[i + 3]]
|
||||
};
|
||||
for x in 1..SIDE - 1 {
|
||||
for (y, want) in [(0, GREEN), (1, BLACK), (2, GREEN), (3, BLACK)] {
|
||||
assert_eq!(at(x, y), rgba8(want), "{name}: ({x}, {y})");
|
||||
}
|
||||
}
|
||||
for y in 4..SIDE {
|
||||
for x in 0..SIDE {
|
||||
assert_eq!(at(x, y), rgba8(WHITE), "{name}: ({x}, {y})");
|
||||
}
|
||||
}
|
||||
println!("{name}: lines at width 1, refused at 2 where a triangle draws");
|
||||
});
|
||||
}
|
||||
|
||||
/// 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() {
|
||||
|
||||
@@ -753,6 +753,16 @@ impl NewRuntime {
|
||||
let mode = metal(call, uint(call, 0)?)?;
|
||||
self.render(id).encoder.set_depth_clip_mode(mode)
|
||||
}
|
||||
// Apple's private line width: kept by the encoder, whose draw of lines at another
|
||||
// width than 1 is the runtime's gap, skipped and counted.
|
||||
"setLineWidth:" => {
|
||||
let width = match arg(call, 0)?.as_f64() {
|
||||
Some(value) => value as f32,
|
||||
None => return Err(refuse(call, "argument 0 is no float")),
|
||||
};
|
||||
self.render(id).encoder.set_line_width(width);
|
||||
Ok(())
|
||||
}
|
||||
_ => return Err(refuse(call, "not played on a render encoder")),
|
||||
};
|
||||
match result {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
//! which the stream checks green, and nothing is skipped.
|
||||
//! - A draw of points after it, which the runtime does not build, is skipped and counted, and the
|
||||
//! report says the play is no verdict past it: its gap, frame and call.
|
||||
//! - `setLineWidth:` plays: at width 1 a draw of lines after it plays; at width 2 a draw of
|
||||
//! triangles plays and one of lines is the runtime's gap, skipped and counted.
|
||||
//! - A compute pipeline state the runtime answers with a typed gap is skipped and counted by the
|
||||
//! gap, and a dispatch of it is skipped, and the play goes on.
|
||||
//! - A compute encoder's `setStageInRegion:` plays: the runtime takes it.
|
||||
@@ -238,13 +240,24 @@ pub(super) fn library_of(
|
||||
|
||||
/// A stream of a draw into a pass, its target copied to a buffer that the stream checks green
|
||||
/// (`green`); with `points`, a draw of points (call 19) after the draw.
|
||||
fn draw_into_a_pass(dir: &ScratchDir, green: &[u8], points: bool) -> PathBuf {
|
||||
draw_with_clamps(dir, green, points, None)
|
||||
fn draw_into_a_pass(dir: &ScratchDir, green: &[u8], then: Then) -> PathBuf {
|
||||
draw_with_clamps(dir, green, then, None)
|
||||
}
|
||||
|
||||
/// What [`draw_with_clamps`]' stream draws after its triangle.
|
||||
#[derive(Clone, Copy)]
|
||||
enum Then {
|
||||
Nothing,
|
||||
/// The triangle's vertices as points: call 19.
|
||||
Points,
|
||||
/// `setLineWidth:` of the width (call 19), the triangle again (call 20), and its first two
|
||||
/// vertices as a line (call 21).
|
||||
Lines(f32),
|
||||
}
|
||||
|
||||
/// [`draw_into_a_pass`]'s stream; where `clamp` is given, a sampler state of the default
|
||||
/// descriptor (#15) bound at fragment slot 0 with LOD clamps 0 and `clamp` before the draw.
|
||||
fn draw_with_clamps(dir: &ScratchDir, green: &[u8], points: bool, clamp: Option<f32>) -> PathBuf {
|
||||
fn draw_with_clamps(dir: &ScratchDir, green: &[u8], then: Then, clamp: Option<f32>) -> PathBuf {
|
||||
written(dir, |w| {
|
||||
let library = w.blob(&render_library(dir))?;
|
||||
w.call("MTLCreateSystemDefaultDevice", 0, 1, &[], &[])?;
|
||||
@@ -335,10 +348,20 @@ fn draw_with_clamps(dir: &ScratchDir, green: &[u8], points: bool, clamp: Option<
|
||||
// MTLPrimitiveTypeTriangle, from vertex 0, three vertices.
|
||||
let draw = [Value::Uint(3), Value::Uint(0), Value::Uint(3)];
|
||||
w.call("drawPrimitives:vertexStart:vertexCount:", 13, 0, &draw, &[])?;
|
||||
if points {
|
||||
// MTLPrimitiveTypePoint: call 19.
|
||||
let draw = [Value::Uint(0), Value::Uint(0), Value::Uint(3)];
|
||||
w.call("drawPrimitives:vertexStart:vertexCount:", 13, 0, &draw, &[])?;
|
||||
match then {
|
||||
Then::Nothing => {}
|
||||
Then::Points => {
|
||||
// MTLPrimitiveTypePoint: call 19.
|
||||
let draw = [Value::Uint(0), Value::Uint(0), Value::Uint(3)];
|
||||
w.call("drawPrimitives:vertexStart:vertexCount:", 13, 0, &draw, &[])?;
|
||||
}
|
||||
Then::Lines(width) => {
|
||||
w.call("setLineWidth:", 13, 0, &[Value::F32(width)], &[])?;
|
||||
w.call("drawPrimitives:vertexStart:vertexCount:", 13, 0, &draw, &[])?;
|
||||
// MTLPrimitiveTypeLine, vertices 0 and 1, along the target's bottom edge.
|
||||
let line = [Value::Uint(1), Value::Uint(0), Value::Uint(2)];
|
||||
w.call("drawPrimitives:vertexStart:vertexCount:", 13, 0, &line, &[])?;
|
||||
}
|
||||
}
|
||||
w.call("endEncoding", 13, 0, &[], &[])?;
|
||||
w.call("blitCommandEncoder", 12, 14, &[], &[])?;
|
||||
@@ -368,7 +391,7 @@ fn draw_with_clamps(dir: &ScratchDir, green: &[u8], points: bool, clamp: Option<
|
||||
fn a_draw_into_a_pass_plays_on_the_new_runtime() {
|
||||
let dir = ScratchDir::new("rt-replay-draw").unwrap();
|
||||
let green: Vec<u8> = [0u8, 255, 0, 255].repeat(16);
|
||||
let path = draw_into_a_pass(&dir, &green, false);
|
||||
let path = draw_into_a_pass(&dir, &green, Then::Nothing);
|
||||
let (report, _) = play("draw", &path);
|
||||
assert_eq!(Some(report.checks[0].sha256), report.checks[0].recorded);
|
||||
let executed = &report.total.executed;
|
||||
@@ -389,7 +412,7 @@ fn a_draw_into_a_pass_plays_on_the_new_runtime() {
|
||||
fn a_draw_the_runtime_does_not_build_is_skipped_and_ends_the_verdict() {
|
||||
let dir = ScratchDir::new("rt-replay-points").unwrap();
|
||||
let green: Vec<u8> = [0u8, 255, 0, 255].repeat(16);
|
||||
let path = draw_into_a_pass(&dir, &green, true);
|
||||
let path = draw_into_a_pass(&dir, &green, Then::Points);
|
||||
let (report, lines) = play("points", &path);
|
||||
assert_eq!(Some(report.checks[0].sha256), report.checks[0].recorded);
|
||||
let executed = &report.total.executed;
|
||||
@@ -401,6 +424,35 @@ fn a_draw_the_runtime_does_not_build_is_skipped_and_ends_the_verdict() {
|
||||
assert!(lines.iter().any(|l| l == line), "{lines:?}");
|
||||
}
|
||||
|
||||
/// `setLineWidth:` plays: at width 1 the triangle and the line after it play, nothing skipped; at
|
||||
/// width 2 the triangle draws and the line is the runtime's gap, skipped and counted.
|
||||
#[test]
|
||||
fn a_line_width_plays_and_a_line_drawn_at_another_width_is_skipped() {
|
||||
let green: Vec<u8> = [0u8, 255, 0, 255].repeat(16);
|
||||
let dir = ScratchDir::new("rt-replay-line-width-1").unwrap();
|
||||
let (report, _) = play(
|
||||
"line-width-1",
|
||||
&draw_into_a_pass(&dir, &green, Then::Lines(1.0)),
|
||||
);
|
||||
assert_eq!(Some(report.checks[0].sha256), report.checks[0].recorded);
|
||||
let executed = &report.total.executed;
|
||||
for skipped in ["skipped_render_commands", "skipped_draws", "skipped_calls"] {
|
||||
assert_eq!(executed[skipped], 0, "{skipped}: {executed:?}");
|
||||
}
|
||||
assert_eq!(report.first_skip, None);
|
||||
let dir = ScratchDir::new("rt-replay-line-width-2").unwrap();
|
||||
let (report, lines) = play(
|
||||
"line-width-2",
|
||||
&draw_into_a_pass(&dir, &green, Then::Lines(2.0)),
|
||||
);
|
||||
assert_eq!(Some(report.checks[0].sha256), report.checks[0].recorded);
|
||||
let executed = &report.total.executed;
|
||||
assert_eq!(executed["skipped_render_commands"], 1, "{executed:?}");
|
||||
assert_eq!(report.first_skip, Some((0, 21)));
|
||||
let line = "skipped render commands Draw { kind: LineWidth } 1, the first at frame 0, call 21";
|
||||
assert!(lines.iter().any(|l| l == line), "{lines:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_host_s_library_from_source_is_made_of_its_display_library() {
|
||||
let dir = ScratchDir::new("rt-replay-display").unwrap();
|
||||
@@ -435,7 +487,10 @@ fn a_sampler_bound_with_lod_clamps_plays_where_the_runtime_takes_them() {
|
||||
let green: Vec<u8> = [0u8, 255, 0, 255].repeat(16);
|
||||
// The sampler's own clamps, and (0, 1000), which reads as its own (0, FLT_MAX): both bind.
|
||||
for (test, clamp) in [("clamps-own", f32::MAX), ("clamps-1000", 1000.0)] {
|
||||
let (report, _) = play(test, &draw_with_clamps(&dir, &green, false, Some(clamp)));
|
||||
let (report, _) = play(
|
||||
test,
|
||||
&draw_with_clamps(&dir, &green, Then::Nothing, Some(clamp)),
|
||||
);
|
||||
assert_eq!(Some(report.checks[0].sha256), report.checks[0].recorded);
|
||||
let executed = &report.total.executed;
|
||||
assert_eq!(executed["skipped_clamped_samplers"], 0, "{executed:?}");
|
||||
@@ -444,7 +499,7 @@ fn a_sampler_bound_with_lod_clamps_plays_where_the_runtime_takes_them() {
|
||||
// (0, 2) reads otherwise: the runtime's gap, the bind and the draw skipped.
|
||||
let (report, _) = play(
|
||||
"clamps-2",
|
||||
&draw_with_clamps(&dir, &green, false, Some(2.0)),
|
||||
&draw_with_clamps(&dir, &green, Then::Nothing, Some(2.0)),
|
||||
);
|
||||
let executed = &report.total.executed;
|
||||
assert_eq!(executed["skipped_clamped_samplers"], 1, "{executed:?}");
|
||||
|
||||
@@ -9706,6 +9706,7 @@ method metal2vulkan-rt::RenderCommandEncoder::set_fragment_sampler_state pub fn
|
||||
method metal2vulkan-rt::RenderCommandEncoder::set_fragment_sampler_state_with_lod_clamps pub fn set_fragment_sampler_state_with_lod_clamps(&mut self, sampler: Option<&SamplerState>, lod_min_clamp: f32, lod_max_clamp: f32, index: u32) -> Result<(), Error>
|
||||
method metal2vulkan-rt::RenderCommandEncoder::set_fragment_texture pub fn set_fragment_texture(&mut self, texture: Option<&Texture>, index: u32) -> Result<(), Error>
|
||||
method metal2vulkan-rt::RenderCommandEncoder::set_front_facing_winding pub fn set_front_facing_winding(&mut self, winding: Winding)
|
||||
method metal2vulkan-rt::RenderCommandEncoder::set_line_width pub fn set_line_width(&mut self, width: f32)
|
||||
method metal2vulkan-rt::RenderCommandEncoder::set_render_pipeline_state pub fn set_render_pipeline_state(&mut self, state: &RenderPipelineState) -> Result<(), Error>
|
||||
method metal2vulkan-rt::RenderCommandEncoder::set_scissor_rect pub fn set_scissor_rect(&mut self, rect: ScissorRect)
|
||||
method metal2vulkan-rt::RenderCommandEncoder::set_scissor_rects pub fn set_scissor_rects(&mut self, rects: &[ScissorRect]) -> Result<(), Error>
|
||||
@@ -13747,6 +13748,7 @@ variant metal2vulkan-rt::DrawKind::DepthBiasClamp DepthBiasClamp
|
||||
variant metal2vulkan-rt::DrawKind::DepthClamp DepthClamp
|
||||
variant metal2vulkan-rt::DrawKind::DividedBaseInstance DividedBaseInstance
|
||||
variant metal2vulkan-rt::DrawKind::FillMode FillMode
|
||||
variant metal2vulkan-rt::DrawKind::LineWidth LineWidth
|
||||
variant metal2vulkan-rt::DrawKind::PatchIndexBuffer PatchIndexBuffer
|
||||
variant metal2vulkan-rt::DrawKind::Points Points
|
||||
variant metal2vulkan-rt::DrawKind::Viewport Viewport
|
||||
|
||||
|
Can't render this file because it is too large.
|
Reference in new issue
Block a user