Repository navigation
GPU: keep rectangle corners consistent across vertex streams - #2729
andrewpozdnakov7-jpg wants to merge 4 commits into
Conversation
DrDarkDK
left a comment
There was a problem hiding this comment.
A lower-numbered float attribute stream can choose the corner for the position stream. For example, put TEXCOORD in slot 0 with [(0,1), (0,0), (1,0)] and POSITION in slot 1 with the three positions from your test. The UVs pick vertex 1, while the positions pick vertex 0. Applying the UV choice changes the generated fourth position from (1,-1) to (1,3).
Could the draw prefer an identified position input when choosing the shared corner? Swapping the slots in the existing fixture and using float UVs that choose a different corner would cover this regression.
AI-assisted with Codex.
|
Correct fix for a real per-stream divergence: expand_rects previously picked the right-angle corner independently per stream, so an RGBA8 color stream could choose a different corner than the position stream and scramble the second triangle's attributes. Choosing corners once via find_map over streams (first stream whose elements yield a usable float position) and sharing them across all expands is the right shape; corners.as_deref().unwrap_or_default() keeps a sane fallback when no stream yields one. Collapsing the per-slot defer_host calls into one closure is also tidier. The regression test (separate position/color buffers, nonzero start vertex, texel asserts) reproduces the exact failure. |
|
I reran the rectangle with float colors in slot 0 and POSITION in slot 1. On f701a1d the fallback chose its angle from color and left the bottom-right texel clear. 5f92980 prioritizes the named position and reads [0.75, 1.5, 0, 1]. The original separate RGBA8 case still passes. Six paired WARP runs, the serial GPU suite (199 passed, one ignored) in both debug settings, strict Clippy and asset policy passed. I also ran DrDarkDK's exact TEXCOORD example with [(0,1), (0,0), (1,0)] in slot 0. The bottom-right texel is clear on f701a1d and reads [0.75, -0.5, 0, 1] on 5f92980. CI passed on the updated head. Please keep the Git author on cherry-pick or rebase. If the solution or tests are folded into another commit, please add: Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com |
|
The expanded draw also needs to keep a valid zero-stride vertex stream. I added a four-byte RGBA8 buffer containing opaque red. Both sampled texels are clear on 5f92980. bd0226e reuses the bound vertex view and both read [1, 0, 0, 1] on WARP. The two earlier layouts pass. Six paired runs, the serial GPU suite (199 passed, one ignored) in both debug settings, strict Clippy and asset policy passed. Please retain the Git author on cherry-pick or rebase. If you fold the change or test into another commit, please add: Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com The GitHub check failed on the frame-pacing test, whose source is identical to main at 13f91ca. I reproduced its S_OK versus TIMEOUT assertion with a simulated late poll and updated the existing fixture PR, #2265, in 303be14. A maintainer rerun of the check on bd0226e would help verify the current rectangle head independently. |
|
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and review of Verification (
|
|
I resolved the test-module conflict and merged current main The same WARP draw on Please retain the Git author when moving the fix or tests. If squashing them into another commit, please add this trailer. Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com |
|
Automated triage for the maintainers. The CPU rectangle expansion in I checked the new Generated by Claude Code |
|
@andrewpozdnakov7-jpg I tested your The two changes together matched the reference GS on all 24 draws on both an RTX 5080 and built-in WARP. I also ran your three-layout draw-vtable regression on each adapter; its sampled colors all passed. For integration there's one commit directly on your current head which keeps your expander signature and original commit history. No action needed on your branch. |
…nt across vertex streams
…with the branch The refreshed community PRs merge cleanly as text but did not build together with the branch: - Marvisak#2935 returns `None` for an unaccepted present, but on this branch `present_planes_with_compositor` returns the primary plane's state too. The unaccepted present now returns `(None, primary_state)`: the present copy has already run, so the plane is back in that state. - Marvisak#2509 makes `Staging::layout` the whole texture (all planes). The levels-on-demand check (Marvisak#2389) reads plane 0's level layout, so it now passes `layout.planes[0].layout`, as before Marvisak#2509. - Tests from Marvisak#1933, Marvisak#2336 and Marvisak#2729 used older APIs: the depth twin test imports `D3DCompile` itself (the branch's twin.rs writes its DXIL and no longer imports it), `HostShader` and `Translated` gained `written_root_uavs`, `threads` and `atomics64`, `hand_out` takes the title's bytecode pointers and `emit::emit` a `Target`. Marvisak#3005's test reads `queued` as the `Once` Marvisak#2223 makes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CPU fallback for rectangle draws chose a right-angle vertex in each vertex buffer. A separate RGBA8 color stream could use its fallback vertex even when the position stream chose a different one. Its attributes then went to the wrong vertices of the second triangle.
Choose the corners once from the explicit POSITION input when available, with the existing float-position heuristic as fallback. Use the same corners to expand every per-vertex stream.
The same WARP regression submits a rectangle through VIctory's draw vtable with positions and colors in separate buffers and a nonzero start vertex. On 13f91ca the bottom-right texel reads [0.75, 0, 0, 1]. On f701a1d it reads [0.75, 0.75, 0, 1]. The top-left control reads [0.25, 0.25, 0, 1] in both. Six paired runs reproduced the result across both D3D12 debug settings.
The second case puts a float color in slot 0 and POSITION in slot 1. On f701a1d the bottom-right texel is clear. On 5f92980 it reads [0.75, 1.5, 0, 1]. The original RGBA8 case still passes. Six paired WARP runs reproduce the second result across both debug settings.
The third case binds a four-byte RGBA8 buffer with stride zero, so the input assembler reads one color for every vertex. On 5f92980 both sampled texels are clear. On bd0226e both read [1, 0, 0, 1]. The expanded draw keeps the input assembler view for this constant stream. The two earlier layouts still pass.
The serial GPU suite passed 199 tests with one ignored in each setting. Strict GPU Clippy with both feature configurations and asset policy passed. AI-assisted using Codex. Synthetic vertex data.
Coordination claim
Please keep the Git author when reapplying the commit. If you fold the change or test into another commit, please add:
Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com