feat(rhi): a pipeline that generates its own vertices can cast a shadow - #273
Open
CagdasErturk wants to merge 2 commits into
Open
feat(rhi): a pipeline that generates its own vertices can cast a shadow#273CagdasErturk wants to merge 2 commits into
CagdasErturk wants to merge 2 commits into
Conversation
`PipelineDesc::depth_only(vertex_spirv, vertex_count)`: no per-vertex stream, no fragment stage, no colour attachment. Until now that shape could not be spelled. The only depth-only constructor hard-sets `vertex_input: Some(layout)`, and the frame contract asserts that an item names geometry exactly when its pipeline declares per-vertex input - so a pipeline that writes its own vertex list and draws an instance stream could reach a colour target and no depth-only one. A renderer of that shape could be seen and could not cast, which is not a limitation anybody chose. `vertex_count` is what the stage generates for one instance, kept for the same reason `Shaders` bundles it: too low renders part of the geometry and too high indexes past the end of the stage's own constant array. Two tests, at two distances from the hardware. The unit test pins that the two depth-only shapes differ in exactly one field, and that it is the one `Item`'s rule reads. `vertex_input` is not a detail of these constructors - it is the whole difference between them, one demanding geometry and one demanding its absence - so an edit that made them differ anywhere else is a compile-time-invisible change to what a caller may pass. The device test builds the pipeline and submits a depth pass whose item names no geometry, with no validation error. It deliberately does not read the depth back, and says so: the only stage available writes z = 0.0, which under reversed-Z is the clear value, so a readback cannot separate a draw that happened from one that did not. Claiming otherwise would be a test that looks like it checked something. Probed twice, both watched red and restored. Swapping `depth_only` for `depth_mesh` makes the frame contract refuse the item, in the words that made this constructor necessary. Giving `depth_only` a vertex input makes the unit test name the refusal it would cause. cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings and cargo test --workspace all green on a real adapter with validation active, exit codes read directly.
Adding `depth_only` and its doc pushed crates/rhi/src/vk/pipeline.rs down forty-six lines, so the exemption for the DepthUnsupported pipeline-creation arm pointed at covered code while the arm itself pointed at nothing. Content compared rather than the offset trusted, because the checker warns that a block which moved and a block which changed look identical from where it stands: lines 1318-1324 on main and 1364-1370 here are byte-identical, the same `Some(format) => Some(format), None => return Err(DepthUnsupported)` match. Re-pinned; the reason is unchanged, since the arm is still unreachable on every measuring lane's adapter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PipelineDesc::depth_only(vertex_spirv, vertex_count)— no per-vertex stream, no fragment stage, no colour attachment.Until now that shape could not be spelled. The only depth-only constructor hard-sets
vertex_input: Some(layout), and the frame contract asserts that an item names geometry exactly when its pipeline declares per-vertex input:So a pipeline that writes its own vertex list and draws an instance stream could reach a colour target and no depth-only one. A renderer of that shape could be seen and could not cast, which is not a limitation anybody chose.
Two tests, at two distances from the hardware
The unit test pins that the two depth-only shapes differ in exactly one field, and that it is the one
Item's rule reads.vertex_inputis not a detail of these constructors — it is the whole difference between them, one demanding geometry and one demanding its absence.The device test builds the pipeline and submits a depth pass whose item names no geometry, with no validation error. It deliberately does not read the depth back, and says so in its doc: the only stage available here writes
z = 0.0, which under reversed-Z is the clear value, so a readback cannot separate a draw that happened from one that did not. Claiming otherwise would be a test that looks like it checked something.Probes
Both watched red and restored. Swapping
depth_onlyfordepth_meshmakes the frame contract refuse the item, in the words that made this constructor necessary. Givingdepth_onlya vertex input makes the unit test name the refusal it would cause.cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspaceall green on a real adapter with validation active, exit codes read directly.