RDNA1 (RX 5700): mesh pipelines and barycentrics without host support #370
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem#370
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@buccanr on GitHub · 2026-12-03 20:58 UTC · original
Summary
First of all thank you for your work.
On an RX 5700 (Navi 10, RDNA1), xmem's unified memory works well, but about 40% of the pipelines are refused. RADV does not expose
VK_EXT_mesh_shaderorVK_KHR_fragment_shader_barycentricon RDNA1, so the scene is only ground, sky and hair.I (read Claude) ported three pieces of work onto xmem (base
45591b0) to fill those gaps:VICTORY_SKIP_PIPELINES. It leaves out a pass that hangs the GPU.With these changes, a new game on the RX 5700 plays from the intro through the prologue to the open world, with no GPU hang and no errors. Pipelines with no host pipeline drop from 36,442 to 44.
I'd like to know whether you want this upstream, and how you'd like it split, before I open pull requests.
I was able to play the prison prologue up to the robbery scene and fled the police at around 5 FPS in the open world.
Setup
setup.sh)run.confCONSOLE=series-s,VICTORY_BVH_BUILDER=0What's missing on RDNA1
SV_Barycentrics). vkd3d-proton reports none, so shaders that read them are refused. This mostly affects faces and skin.Changes
1. Mesh expansion (
victory-shaderemit +victory-gpu)New files are
emit/mesh_expand.rsandvictory-gpu/src/mesh_expansion.rs, with hooks inlower.rs,emit/mod.rs,pipeline/host.rs,draw.rsandhost.rs.SLOT_MESH_DATA): the vertex outputs, primitive indices and culled flags.DrawInstanced(group_vertices, groups)and reads the records back for the title's pixel shader.VICTORY_MESH_EXPANSION_MB, default 128 MiB split over a two-buffer ring).VICTORY_MESH_EXPANSION=0turns it off.VICTORY_MESH_EXPANSION_SKIP=<hashes>leaves the named pipelines unexpanded.VICTORY_MESH_COUNTSis part of the shader-cache key.mesh_expansion_of_saved_programs(#[ignore],VICTORY_EXPANSION_DIR) expands every saved*.mesh.cdxil. All 174 programs I captured expand.root_parts) that the expanded pipeline shares with the existing one.bind()now takes separate flags for reading title state and for binding host state (bind_from(compute, title_compute)). The expansion pass is a host compute pass for a title graphics draw.VICTORY_MESH_BATCH=1(withVICTORY_MESH_BATCH_KB) cuts barriers, but it's off by default. When on, it empties indirect draws for lack of room (5–19 per frame in the prison hall), and close-up faces then pop between black, translucent and textured.The approach follows ITzNomadic/VIctory and DanShag/deVIant.
2. Barycentrics without host support
New file
emit/barygs.rs, with hooks inlower.rsandpipeline/host.rs. This follows cyberclanker/victory-rhi30438d1(GPL-3.0-or-later, same licence as this repo).D3D12_OPTIONS3.BarycentricsSupporteddecides whether barycentrics are passed.VICTORY_PASSED_BARY=1|0forces it either way.VICTORY_BARYin rows 30–31).VICTORY_BARY_FLAT=1(off by default) gives per-corner attribute reads the provoking vertex's value instead of refusing the shader.3.
VICTORY_SKIP_PIPELINESin release buildsUntil now the switch worked only in
diagnosticsbuilds. Now it works in release builds too: draws, dispatches and indirect executions of a listed shader are skipped, and so are expanded mesh draws. The drop accounting (note_drop) stays diagnostics-only.On RDNA1,
VICTORY_SKIP_PIPELINES=24abbd85477b8da6is needed to get past the intro cinematic. Without it, that screen-tile pass (an indirect draw) hangs the GPU and causes a device reset.4. Small fix: a pipeline that loses its cache-file race is kept
Two threads can build the same native pipeline at once. The expansion's compute pipelines make this common. Wine then denies the second thread's write to the
.psofile.Before the fix, that failed the pipeline with an empty error (
error=Succès 0x0in a French locale), and its draws were lost. The pipeline is now kept, with a warning only when the file really wasn't written.Results (RX 5700, Series S settings)
45591b0FPS from the overlay:
In the open world, VRAM is at 94% of 8 GB. On this card the open world is limited purely by the GPU.
Known issues (not fixed by this work)
f22a76fcb967ee59draws slabs on RDNA1 without a built BVH. I skip it, currently through a live skip file (VICTORY_MESH_SKIP_FILE), a development tool. With part 3,VICTORY_SKIP_PIPELINESmay be enough, and the file can be dropped from the pull requests.Proposed pull requests
pipeline/prepared.rs). Small, independent.VICTORY_SKIP_PIPELINESin release builds (pipeline.rs,draw.rs). Small, independent.Each commit builds on its own, and
cargo test -p victory-shaderpasses (295 tests).Questions
VICTORY_BARY_FLATdefault to on when barycentrics are passed?@PNixx on GitHub · 2026-12-04 16:28 UTC · original
I waiting fix for RX 5700 XT)
@zawadul22 on GitHub · 2026-12-04 18:31 UTC · original
I am also waiting for the fix of RX 5700 XT. Menu loads perfectly, game starts but the 3D objects don't load.
@pikamob on GitHub · 2026-12-04 23:11 UTC · original
I can confirm with Rx 5700xt your fork loads models. not all tho like the doors in the beginning and some furniture but it's a step forward for RDNA1. Would like this to be in the official victory-xmem. Awesome.
@bogislaus on GitHub · 2026-12-05 07:47 UTC · original
RX 5700 XT (Navi 10, 8 GB) on a 16 GB DDR4 host here: this branch boots into the world and the geometry draws, on stock patched RADV with no fork driver.
Tested
buccanr/VIctory-xmem-RDNA1,pr/rdna1-mesh@ad503e2, with the two local patches an 8 GB RDNA1 card needs (percent_fromclamp(50, 97)to(50, 200),CARD_KEPT_FOR_HOST = 3 << 30). The driver is the tree's owndeps/RADV, noVK_DRIVER_FILES, noRADV_DIRECTMESH.Hardware and software: RX 5700 XT 8 GB (gfx1010), Ryzen 5 5600X, 16 GB DDR4, CachyOS, kernel
7.3.7-2-cachyos, cmdlineamdgpu.gttsize=9216 ttm.pages_limit=2359296 amdgpu.sched_hw_submission=8, wine 11.23 viaUSE_SYSTEM_WINE=1.Settings:
CONSOLE=series-s,VICTORY_OUTPUT=1920x1080,VICTORY_PRESET=low,VICTORY_BARY_FLAT=0,VICTORY_SKIP_PIPELINES=24abbd85477b8da6,f22a76fcb967ee59,VICTORY_WARM=0.Warm pass: 90,600 pipelines in 232 s, 79,634 on disk, 14,565 refused by the host. The run reached frame 4096 on the counter and kept presenting, with
draws=8,532,286 drawn=5,484,096in that window, no unhandled exceptions and no GPU resets. Memory sat at the edge but held: GTT 8.8-9.2 GB of 9.216, VRAM about 7.74 of 8.18 GB, free RAM never below about 1.85 GB, process about 5-6 GB. It ended ontitle suspended; ending the titlebecause I closed the game, not on a failure. At 720p the same tree reportsdraws=8031 drawn=8031per frame, so the geometry floor is gone on this branch.Two things that cost me runs, in case they help the next tester:
24abbd85477b8da6the run GPU-hangs around frame 2048:ring gfx_0.0.0 timeout, then0x887A0005 device removed, with no OOM (GTT 7,751/9,216 and 2.5 GB RAM free), so that hang should not be read as a memory wall.VICTORY_BARY_FLAT=1is unusable on this card. Three launches in a row died atvictory-image+0x19f4f58, the frame-0 graphics-init int3. Staying on 0 costs about 14.5k refused pipelines and roughly a third of the draws.VICTORY_PRESET=mediumat 1080p does not fit 8 GB: GTT 8,897/9,216 MB, VRAM 7,814 MB (about 96%), thenring gfx_0.0.0 timeoutat frame 4096, at the world-load peak and not at idle.lowat 1080p is this card's ceiling, andlowat 720p is what I actually play.For context, this removes the BC-250 DirectMesh driver from the picture on this card. That path worked, but it splits title meshes, hit its 128 MiB index-storage budget and pushed the process to about 5-6 GB. This branch runs on stock RADV and stays inside 16 GB.
Written by an AI assistant from this machine's logs and counters; I ran every test and reviewed the text.
@buccanr on GitHub · 2026-12-05 15:45 UTC · original · edited 2026-12-05 15:49 UTC
Hi guys, regarding the comments of @bogislaus I can confirm that the DirectMesh driver is only partially usable.
On my other fork here I only managed to got it working for fragment shaders barycentric coordinates support (so VICTORY_BARY_FLAT=0). Claude patched the Mesa driver to use DirectMesh to calculates the necessary values and kept a custom mesh shaders expansion script.
However the result is glitched reflections and glare on glass/mirror textures hit by sunlight as shown is this video.
Without DirectMesh bary support and VICTORY_BARY_FLAT=1 textures are blocky as the per-corners values of each fragment shader are "flattened" so not aligned with the physical reality of the in-game object (if I understand it correctly).
I have no access to the machine hosting my forks until Monday so I'll come back then with more info.