GPU: speed up packed rectangle vertex expansion #196
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!196
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/196/head"
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?
@TG0000 on GitHub · 2026-11-24 01:18 UTC · original
TG0000:perf/rectangle-vertex-expansion→main· +162 −0 · 1 files · 1 commits · closed without mergingSummary
Rectangle draws expand their vertices on the CPU when the command list is submitted. For a 12-byte vertex with a float2 position and four UNORM8 color channels, select the layout once per batch and use fixed-size copies. Compute the fourth vertex's channels as
clamp(v0 + v2 - v1, 0, 255)on the original bytes. The generic calculation's floating-point error after rescaling is below half a channel step, so it rounds to the same byte.The fourth position uses the original addition and subtraction order. The generic path handles other layouts and nonfinite positions. The regression test compares every output byte across all four supported color formats, both element orders, floating-point edge cases, color saturation, and partial input and output.
Synthetic release benchmark
Windows, Ryzen 9 5900X, Rust 1.100.0 x86_64-pc-windows-msvc. The benchmark compares the original general-purpose implementation with the production dispatcher. Both paths use preallocated buffers and deterministic synthetic vertices. Times are medians of nine samples with alternating measurement order.
The benchmark measures CPU vertex expansion for this layout. GPU execution, layout frequency in live workloads, and frame time were unmeasured.
Validation
cargo +stable-x86_64-pc-windows-msvc test --workspace --locked -- --test-threads=1passed (265 passed, five ignored). Test host GPU was an AMD Radeon RX 6800 with Windows driver 32.0.21045.29003.cargo +stable-x86_64-pc-windows-msvc test --release --locked -p victory-gpu primitive::tests -- --test-threads=1passed.cargo +stable-x86_64-pc-windows-msvc clippy --locked -p victory-gpu --all-targetspassed with existing warnings in other files.cargo +stable-x86_64-pc-windows-msvc run --locked -p xtask -- policypassed.AI-assisted. The benchmark and new test use generated fixtures.
@DaviTostes on GitHub · 2026-11-24 01:31 UTC · original
Tested
3c0b609under Wine 11.22 + vkd3d-proton 3.1 (Arch Linux x86_64, AMD RX 9060 XT, RADV 26.3.1), Windows build with a native Microsoftd3dcompiler_47: pass, no regression.victory_gpu: 42 passed, 2 failed, 2 ignored — the two failures are the environment-onlya_rejected_blob_gives_an_empty_libraryand #128; the ignored ones are the texture-check benchmarks.No game data used.
@juliptree on GitHub · 2026-11-24 01:38 UTC · original
Independently tested
3c0b60969fon Windows with a Ryzen 7 7800X3D and Rust 1.100.0 MSVC. All three release primitive::tests passed. Across three runs of the included benchmark, median before → after times were 115.16 → 12.25 ns/rect for batches of 1, 118.28 → 3.08 for 64, and 90.41 → 2.61 for 1,024.These timings measure CPU vertex expansion for the synthetic packed position/color layout. AI-assisted testing and write-up.
(Chatgpt)
Pull request closed