Repository navigation
gpu: packed 16-bit render targets are R8G8B8A8 where the GPU cannot render to them - #89
HenriqueSBueno wants to merge 2 commits into
Conversation
|
Confirmed the two allocation cases on an RTX 3060 Ti, Windows 10 22H2, NVIDIA 610.88. A synthetic hardware test of the patch created both 2560×1440 resources with the original flags and optimized clear values. Guest format 86 (flags 5) and 115 (flags 1) both became host format 28. Sampled-only textures retained their packed formats. One integration detail for transfers: a guest buffer footprint in either packed format still describes two bytes per pixel. Directly forwarding that footprint to a widened RGBA8 texture, or copying between a sampled-only packed texture and a widened render target, can record incompatible host copies. Resolves between widened targets also need the effective host format. In the downstream test we allowed transfers with matching representations and declined unsupported mixed transfers before recording barriers or marking the destination written. This was a native resource test. It did not run the title or establish an effect on the world hang. AI-assisted with Codex. |
|
Verified
AI-assisted. |
…ender to them AI-assisted (Claude Code)
85ea36d to
da580e4
Compare
|
Tested
No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent). |
…argets - Buffer-to-texture CopyTextureRegion: widen packed 16-bit (86/115) placed footprints to R8G8B8A8_UNORM and expand texels on the CPU at submission (packed <-> RGBA8 helpers and unit tests added for uploads and readbacks). - texture::upload: detile widened packed 16-bit textures into a tight 2-byte buffer before expanding rows into the 4-byte host staging footprint. - GPU-to-GPU CopyResource, CopyTextureRegion, and ResolveSubresource: skip mixed native-packed <-> widened copies once per format before barriers or host_written, and map resolve formats through target_format. - view_format: return None for typed widened targets so null view descriptions inherit the host resource dimension. AI-assisted (Claude Code)
|
Thanks for the reviews and the numbers on three more cards.
Checks on Windows 11, RTX 3080 (616.92): AI-assisted (Claude Code) |
|
I tested the packed texture fallback on a desktop RTX 5090 (621.24) and the integrated AMD Radeon GPU in the same PC. This builds on martingouv's note about one-bit alpha. The 5090 can't write formats 86 and 115 as typed UAVs, but the AMD GPU can. I compared the actual AMD writes against a widened RGBA8 shader running on the 5090. Rounding at each store and using the nearest expanded byte on the dependent read matched all 262,144 packed results across both formats. A different rule matched native format 86 render-target draws on the 5090. Overlapping triangles showed why converting only after a draw can still give wrong colors. For format 115 unblended draws, two inputs could become the same RTX byte but different native AMD packed values. I tried correcting the original shader output before storing it to RGBA8. That matched all 196,608 pixels across two random input sets and a rounding-boundary test. The ZIP has the shaders, a standalone GPU-to-packed-buffer readback prototype, raw logs and separate texture-layout patches. The patches apply to main at d2a4bae and PR #89 at 081afbd. All 17 standalone test programs passed locally. I haven't compiled the patched VIctory crate or tested gameplay. AI-assisted with Codex. VIctory-RTX5090-graphics-tests.zip Complete outputs folder — includes the DirectX test report, the project test results, and the graphics-test package linked above. |
…e GPU cannot render to them Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested
This confirms the texture compatibility work on the real title path, but not a fix for #97. Only aggregate counts and error classes shared. AI-assisted (Kimi Code). |
|
Automated triage for the maintainers. Needs rebase. This PR does not merge cleanly into current The content has not been reviewed yet; it will be once the branch is rebased onto Generated by Claude Code |
Marvisak#168, Marvisak#89) Under `VICTORY_LATE_WAIT` and `VICTORY_RELAY`, `Shadow::stale_under_writes` and `Shadow::merge_under_writes` (`crates/victory-gpu/src/shadow.rs`) only iterated pages returned by the write-watch delta (`written`). Any page inside a pending shader `GpuWrite` range whose `copied` timestamp was still `0` (never copied into the host copy yet) and that did not appear in `written` was silently skipped, leaving it zeroed on the GPU while `Shadow::update` also skipped the pending range. Mirror `Shadow::copy_stale` by extracting `stale_pages_in` and scanning every page in `[a, e)` for `copied == 0 || write > copied` in both `stale_under_writes` and `merge_under_writes`. Add `shadow::relay_tests::stale_pages_include_uncopied_pages_absent_from_write_watch`.
…nder targets are R8G8B8A8 where the GPU cannot render to them Conflicts resolved against the upstream resync (f0df6a5): skip_mixed_packed_copy runs before the title_written upload in CopyResource and CopyTextureRegion; the footprint upload keeps defer_fill; texture staging keeps both the watch tracking and widened_from and uses footprint_len; fits() checks widened views before the castable rule; RENDER_TARGET defined where make_texture reads the clear value; both test sets kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er targets are R8G8B8A8 where the GPU cannot render to them Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 081afbd ported onto our fork's main (upstream 70564ae plus our merges) on Windows 11, RTX 5070, MSVC: builds, clippy -D warnings clean with and without --all-features, and the diagnostics build compiles. cargo test --workspace --no-fail-fast: 716 passed. The 7 failures are the same 7 that fail on our main without this PR (stride, rect, gather4-at-a-level, row order, memory table, dynamic slots), so none comes from it. The 4 new tests pass on the hardware device:
packed_16_conversion_matches_dxgi_layout(including the exhaustive 65,536-value round trip);target_format_is_identity_for_non_packed_formats;packed_16_targets_copy_and_skip_mixed_transfers;detile_widened_packed16_expands_into_rgba8_staging.
On reading:
- Widening only when
CheckFeatureSupportlacks RT or typed-UAV support (asked once per format) is the right gate. The RTX 5070 here is one of the cards that lacks them, and AMD keeps its native formats. - The format follows the texture everywhere it has to: creation, clear value, RTV and PSO formats,
fits()for views, and resolves. The unpack layout (B in the low bits, bit replication) matches DXGI, and so does the decode. - The transfer paths raised in review are handled:
- buffer-to-texture footprints are widened and expanded at submission;
- title-written uploads are detiled tight and then expanded;
- mixed native/widened GPU copies are skipped before any barrier or
host_written, with one warning per format.
Things to know (not blockers):
- Precision differs from the console for B5G5R5A1/B4G4R4A4 targets. A shader writing alpha 0.3 into a B5G5R5A1 target now keeps 0.3 instead of 0, and colour channels keep 8 bits instead of 5 or 4. A later pass that reads the target (alpha tests, masks) can see different values. yuniskh's measurements show store-time quantization can match the native results, and that's worth a follow-up.
- Memory sharing in current upstream. Since the resync, host textures are shared by memory, and
takesrequires the format family or the castable list to match. If the title later describes the same memory as a sampled-only 86/115 texture, it gets a separate host texture instead of the widened one, with no sync between them. Same class as the skipped mixed copies, just through aliasing. - Readback (RGBA8 to packed) is implemented but unused until texture-to-buffer copies land, as the PR says.
Porting notes for upstream (this conflicts with current main):
- In
CopyResource/CopyTextureRegion,skip_mixed_packed_copyhas to run before the newtitle_writtenupload. - The footprint upload should keep
defer_fill(the Wine fix) instead ofdefer_copy. - Texture staging keeps both
trackedandwidened_from, andfootprint_lenalready covers the widened slice length. fits()checks the widened view before the new castable rule.RENDER_TARGETmust be defined wheremake_texturenow reads the clear value.
Merged into our fork's main as a port.
AI-assisted (Claude Code).
|
@HenriqueSBueno, both commits of this PR on today's Checks on an RTX 5080 (driver 32.0.16.1742): both clippy configurations clean; In the game (diag, DRED; one run without and one with the debug layer),
AI-assisted. |
There was a problem hiding this comment.
RTX 3050 8GB – PR #89 reaches intro cutscene, crashes before gameplay
Hi! I tested PR #89 on my PC, and the results were impressive!
My specs:
- GPU: NVIDIA RTX 3050 8GB
- CPU: AMD Ryzen 5 5600GT
- RAM: 16GB DDR4
- OS: Windows 11 (Build 26200)
- VIctory: PR #89, commit
081afbd - Build: Diagnostics enabled
Results:
- The previous B5G5R5A1_UNORM error was resolved.
- The game successfully displayed its menus.
- I reached the opening cutscene.
- When transitioning into gameplay, the GPU crashed.
Error:
DXGI_ERROR_DEVICE_HUNG (0x887A0006)
D3D12 debugging and DRED were enabled.
This is a huge improvement over the previous build, which crashed before displaying the menus.
I've attached a screenshot of the error. Hopefully this helps with further NVIDIA compatibility improvements!
Thanks for your work!
(Report written with AI assistance. All hardware specifications and test results are from my own testing)
|
Tested a locally adapted version of Base: main
Before #89, format 115 still failed to create its 2560x1440 host render target. After #89, both 86 and 115 logged RGBA8 widening, with zero With D3D12 debug enabled, the title reached ongoing 3D intro rendering and was manually stopped after 300.4 seconds, without reported device removal. No pipeline skips or reduced loop limit; GPU timing off. The preceding integration already survived a 321.1-second run, so I am not attributing improved stability to #89. Rendering remains badly malformed/dark/overexposed at roughly 0.5–0.65 seconds per frame. There were 171 distinct refused host pipeline records; remaining D3D12 errors include Wave64 requested on a 32-lane device (ID 622), blending on R8_UINT (676), and resource-state mismatches (527/538). This is not a validation-clean or playable run. Validation:
Adapting to newer main preserved castable-format and typed-UAV checks, tracked texture uploads, staging bounds and No game assets or raw dumps attached. Integration and testing were assisted by OpenAI Codex; credit for the upstream changes remains with their authors. Venom |
|
Tested on RTX 3070 Ti, driver 610.88, Windows 11 26300, rustc 1.98.1. main 13f91ca. Does not merge into main (conflicts), so only the head 081afbd was tested.
(Claude Code, Claude Opus 5.5.) |
What
On a GPU that can't render to the console's packed 16-bit colour formats, or can't write them as typed UAVs, render-target and unordered-access textures in those formats are made as R8G8B8A8_UNORM. The formats are B5G5R5A1_UNORM (86) and B4G4R4A4_UNORM (115). Textures that are only sampled keep their format.
Why
On NVIDIA (RTX 3080, driver 616.92) the title asks for two 2560x1440 targets the driver refuses:
NVIDIA has no render-target support for B4G4R4A4 and no typed UAV for B5G5R5A1. AMD has both, so this doesn't show on an RX 6700 XT.
How
resource::target_formatstands the R8G8B8A8_UNORM format in for 86/115. It applies only whenCheckFeatureSupport(FORMAT_SUPPORT)lacksRENDER_TARGETorTYPED_UNORDERED_ACCESS_VIEW, asked once per format, so AMD keeps the native formats. Each channel keeps its value, with more precision.target_format, and so does its optimized clear value.target_format, so views, PSOs and resources agree.fits: a shader-resource or unordered-access view naming 86/115 on such a texture takes the texture's format.Tested
Windows 11, RTX 3080 (NVIDIA 616.92), i5-10400F:
cargo test -p victory-gpu: 39 pass.cargo clippy -p victory-gpu: clean.cargo xtask policy: ok.packed 16-bit render targets are R8G8B8A8_UNORM on this GPUfor format 86 and format 115, and there are nono host texturewarnings.AI-assisted (Claude Code)