GPU: keep v0 as the leading vertex in CPU-expanded rectangles #2994
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2994
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2994"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@steven-seagull27 on GitHub · 2026-11-26 02:47 UTC · original
steven-seagull27:codex/cpu-rectangle-leading-vertex→main· +511 −47 · 3 files · 7 commits · openThe CPU rectangle-list fallback can give the second triangle a different leading vertex when the input rectangle's right angle is at v0 or v2. A flat pixel input then changes halfway across the rectangle. This is the CPU follow-up requested by @fuzeofficlal on #2970. The diagonal and vertex ordering follow their geometry-shader work.
This is stacked on #2729. Please merge that PR first. The current head includes @andrewpozdnakov7-jpg's original
857f394, which computes each rectangle's corner order once using its position stream and shares it across the draw. It also handles inputs before a named POSITION and stride-zero streams. The small two-commit overlay directly on #2729 contains the v0 ordering and its regression.Both output triangles start at v0 and keep the input winding. The synthesized vertex retains v0's bytes for unknown/integer formats and interpolates recognized components. The CPU primitive test checks all six emitted vertices for all three right-angle orderings and both windings.
Split positions and colors
The review regression binds a float POSITION buffer and a separate RGBA8_UNORM color buffer through the guest command-list vtable. One pixel shader returns interpolated RG and flat RG together. The test draws all three vertex rotations under both windings, checks all four pixels of each 2×2 rectangle, and verifies that the CPU fallback ran. Each adapter produced the same counts.
0b144bc857f394With the right angle at v0, the first pixel on
0b144bcread smooth RG(0.25, 0.0)against(0.25, 0.25). With #2729 alone, the smooth value at the next pixel was correct, but flat RG read(1, 0)against v0's(0, 0). The shared position order and the v0-leading indices address those two errors together.Other verification
The earlier 32×32 readback compared CPU-expanded triangle-list draws to #2970's geometry-shader reference. With both fixes, all 24 draws matched on each adapter (24,576 texels per adapter), across interleaved and split streams, both windings, and flat and interpolated pixel inputs. On the final head, the new draw regression, the existing three-layout test including stride zero, and the primitive v0 regression passed with RTX 5080 (driver 621.40) and built-in Microsoft WARP selected separately. Strict all-feature
victory-gpuClippy and the asset-policy check passed.AI-assisted with Codex. Synthetic fixtures only.
@steven-seagull27 on GitHub · 2026-11-26 02:54 UTC · original
The CI failure is reproducible on unmodified main
63bcca43. Both workspace Clippy jobs and all rectangle tests passed on the runner. Its sole failure wasframe::tests::waits_end_on_ticks_and_count_framesatframe.rs:231: after a 2 ms tick, the zero-timeout poll returnedS_OK(0) when the test expectedTIMEOUT(1).I built that exact base and ran just the unchanged frame test. It passed 50/50 in isolation. Under synthetic scheduling contention (eight test processes and two CPU workers sharing one logical processor), 37/40 hit the identical line and 0-vs-1 assertion. The other three missed timing expectations at lines 230 or 235. This is the same failure already tracked in #2861 and #2877.
Could a maintainer re-run the failed job? GitHub requires repository-admin access for my rerun request. I kept this PR confined to the rectangle expander.
@steven-seagull27 on GitHub · 2026-11-26 03:20 UTC · original
@fuzeofficlal Your split-stream example reproduces on the old head. I fast-forwarded this PR to include @andrewpozdnakov7-jpg's original #2729 commit. The draw now computes the right-angle corner from POSITION once and passes the same order to the color stream. The v0-leading change applies to that shared order.
At
c314918, the new regression binds separate POSITION and RGBA8_UNORM streams through the regular guest draw vtable. It reads smooth RG and flat RG simultaneously at all four pixels for three vertex rotations and both windings. Both adapters gave the same result: 14/24 incorrect pixels on the old0b144bc, 12/24 on #2729 alone, and 0/24 on the updated PR. The original float-first, UNORM and constant-stride checks also passed on both. The PR description now links the small overlay on top of #2729.Could you take another look at this head?
@futurepro62 on GitHub · 2026-11-26 04:07 UTC · original
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
c314918(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 869 passed, 0 failed, 10 ignored.cpu_rectangle_uses_the_position_corner_order_for_split_vertex_streams,split_rectangle_keeps_the_leading_color_on_both_triangles,both_triangles_keep_v0_for_every_right_angle_and_winding.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
@Marvisak on GitHub · 2026-11-26 05:37 UTC · original
Automated triage for the maintainers.
Needs work. The rectangle changes themselves look right to me. In
expand_rects_with_corners(victory-gpu/src/primitive.rs) the three index orders ([0,1,3,0,3,2],[0,1,2,0,2,3],[0,1,2,0,3,1]) each split the quad along the diagonal opposite the right angle, keep the input winding, and start both triangles at v0.draw.rsnow picks one corner order per rectangle from the POSITION stream and applies it to every stream, so split position/color buffers stay consistent. CI passed after a re-run, and a full NVIDIA test run is reported in the thread.What stops it as is:
0b144bcand the regression commit, with no merge commits.CI: passing.
Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.