Skip to content

GS/DX12/VK: ROV support for feedback draws.#13754

Draft
TJnotJT wants to merge 1 commit intoPCSX2:masterfrom
TJnotJT:gs-rov
Draft

GS/DX12/VK: ROV support for feedback draws.#13754
TJnotJT wants to merge 1 commit intoPCSX2:masterfrom
TJnotJT:gs-rov

Conversation

@TJnotJT
Copy link
Copy Markdown
Contributor

@TJnotJT TJnotJT commented Dec 28, 2025

Intro/status

Description of changes

Adds ROV (rasterizer ordered view) support to DX12 for feedback draws (i.e., where writing the new color/depth value for each pixel requires reading the current color/depth value).

Rationale behind Changes

Can help improve performance and accuracy in feedback draws with overlapping geometry by reducing draw call count and barriers.

Suggested testing steps

  • Select the DX12 API and add the following to the PCSX2 INI:
    [EmuCore/GS]
    ...
    HWROV = 1
    HWROVPreset = 1 # described below
    HWROVUseBarriersVK = 0 # described below
    
  • Higher blend levels may be required for ROVs to be used.
  • Graphically, there should not be any difference in games with Maximum blend with/without ROVs (other than issues noted below).
  • We generally expect to see improvement in frame stats such as reduced barriers and draw calls (other than issues with barriers noted below).
  • The new stat that is added temporarily, 'Target Transitions' (number times we switch in and out of UAV mode), should ideally be less than 100 per frame.
  • Testing a range of games both with/without heavy overdraw/feedback would be helpful.

Tuning ROV usage

The INI setting HWROVPreset controls when ROVs are activated and can have the following values:

  • 1: Default.
  • 2: Conservative (activated when we encounter 4x larger overlap compared to default; not recommended).
  • 3: Always on (activated every reasonable draw).
  • 4: Force always on (activated every possible draw; testing only).

The setting HWROVUseBarriersVK has the following values and affects only Vulkan:

  • HWROVUseBarriersVK = 0: Disable barriers.
  • HWROVUseBarriersVK = 1: Use barriers before every ROV draw.
  • HWROVUseBarriersVK = 2: Use barriers on every UAV change and on render pass begin/end. Less barriers than setting 1.
    Some dumps are known to have flickers/missing effects when barriers are not used.

Results/shortcomings

  • Stats: based on initial tests, the draw call/barrier count is reduced significantly in some dumps. Actual FPS benchmarking hasn't been done yet.
  • Accuracy: some dumps appears to have large differences in frames when compared in tools like WinMerge, but there should not be much visual difference.
  • There are some dumps (e.g., 'Sly 2 - Band of Thieves_SCUS-97316_20240110145658.gs.xz') where the number of UAV barriers spikes and draw call doesn't drop enough to result in FPS improvement (in fact, the FPS can be worse). This may require tuning the heuristics.
  • In some dumps, depth ROVs have small inaccuracies than can manifest as Z-fighting-like acne (some examples below). Other times it appears to fix certain elements, but this is likely by chance. A possible solution is to emulate full 32-bit Z in the pixel shader (future work).

Examples of Z inaccuracy

Edit: Seems to not affect all systems.

Conspiracy - Weapons of Mass Destruction_SLES-53098_20250214222606.gs.xz

Master DX12
S044932_f00001_fr1_00a00_C_32_Conspiracy - Weapons of Mass Destruction_SLES-53098_20250214222606 gs xz_master

PR DX12
S044932_f00001_fr1_00a00_C_32_Conspiracy - Weapons of Mass Destruction_SLES-53098_20250214222606 gs xz_rov

Haunting Ground_SLES-52877_20230724220957.gs.xz (see mirror)

Master DX12
S043379_f00003_fr1_00000_C_32_Haunting Ground_SLES-52877_20230724220957 gs xz_master

PR DX12
S043379_f00003_fr1_00000_C_32_Haunting Ground_SLES-52877_20230724220957 gs xz_rov

Example that look like it fixes Z fighting but is likely by chance

Energy_Airforce_SLES-51646_20220814050022.gs.xz (see shadows)

Master DX12
f00003_fr-1_00000_C_32

PR DX12
f00003_fr-1_00000_C_32

TODO

  • Port to DX11/OpenGL (might be done in a separate PR).
  • (Done by GS/DX12: Use Enhanced Barriers API #13792) Give DX12 textures a state enum instead of manipulating D3D12_RESOURCE_STATE* directly (similarly to how Vulkan does layouts) and replace the current UAV state tracking.
  • (Done) Allow tweaking the ROV usage heuristic to see if it might benefit games differently.
  • (Done) Combine the DX12 descriptor tables for RT, depth, and UAVs into a single descriptor table to reduce root parameters and number of updates, since at least one table must be updated anyway each time an RT changes.
  • Future work: Emulate 32 bit Z in the pixel shader with custom interpolation.

AI usage

AI was used as a reference for graphics API usage and to brainstorm ideas for correctness/efficiency of UAV usage. The heuristic described above and its implementation was obtained in part with AI, though the approach is likely well known. Additionally, AI was used to review parts of the code (in particular, helper classes used to track the feedback history in GSRendererHW.h).

@JordanTheToaster
Copy link
Copy Markdown
Member

Using way too many barriers even at basic and minimum breaks rendering.

image

@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Dec 28, 2025

Using way too many barriers even at basic and minimum breaks rendering.

Thanks for the test and catching that.

There was a bug in tracking ROV feedback history, which is hopefully resolved in the last push.

I also changed the heuristic to only vote for ROVs if barriers are already configured. It was unnecessarily using barriers for blends that could be done in HW.

Haven't yet looked into the issue with the minimum blend.

@bigol83
Copy link
Copy Markdown

bigol83 commented Dec 28, 2025

GTA San Andreas maximum blending just 120 barriers with dx12 and huge speed improvement

PR
immagine

Master
immagine

Unfortunately the improvement is not always this big

PR
immagine

Master

immagine

Added the second scenario dump
gtasa.zip

@SlimDread
Copy link
Copy Markdown

GTA: LCS (NTSC U)

Master (UHD 770)
image

PR (UHD 770)
image

Master (RTX 2060 SUPER)
image

PR (RTX 2060 SUPER)
image

GS Dump
gta lcs.zip

Nice improvement on NVIDIA but a regression on Intel

@AmandaRoseChaqueta
Copy link
Copy Markdown

AmandaRoseChaqueta commented Dec 28, 2025

I will test on linux once it gets Vulkan support. Great work bringing ROV back :).

@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Dec 28, 2025

Unfortunately the improvement is not always this big

Nice improvement on NVIDIA but a regression on Intel

Thanks all for the tests. Looks like these scenes have spiky barrier usage so ROVs were not being activated enough. I think we may need to change the heuristic again and have it account for how many barriers can be saved on each pass. Also, instead of hardcoding constants into the heuristic it might be useful to expose these via the INI for tuning. Will try to get to this soon.

I will test on linux once it gets Vulkan support. Great work bring ROV back :).

Thanks, it's in the works, hopefully not too long.

@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Dec 29, 2025

The last push adds some INI config settings to try and tweak how aggressively ROVs are used and how frequently to switch between ROV/non-ROV usage (described in detail in the OP). If anyone is so inclined, please try tweaking them to see if certain games benefit differently from different parameters.

The code is a bit volatile at the moment as Vulkan ROV is partially implemented and is not functional. Some bugs might have creeped into the other APIs also so be warned.

@bigol83
Copy link
Copy Markdown

bigol83 commented Dec 29, 2025

I know you wrote Vulkan is still not functional but just in case, with latest push Vulkan has broken graphics but performance improvement is huge, default settings

immagine immagine

Default settings with DX12 has a great performance improvement in that particular scenario

immagine immagine

@bigol83
Copy link
Copy Markdown

bigol83 commented Dec 29, 2025

with previous commits this was fixed, with latest commit it has that line just like it does on master
immagine

Shadow of the Colossus_SCES-53326_20251229110248.gs.zip

@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Dec 29, 2025

with previous commits this was fixed, with latest commit it has that line just like it does on master

Thanks for spotting that. I haven't stepped through the dump carefully, but I think that might be due to Z inaccuracy, since the heuristics are still being tweaked and Z conversions can happen at different times. In some cases it appears to fix things but it's likely by chance.

Vulkan should hopefully be functional on the last push and some small bug fixes.

@bigol83
Copy link
Copy Markdown

bigol83 commented Dec 30, 2025

GTA San Andreas looks good now and it still has the big speed improvement with Vulkan, Shadow of the Colossus though still has some issues
you can see this one quite easily on main menu

immagine

this is how it looks on master with the same settings using Vulkan
immagine

dump
Shadow of the Colossus_SCES-53326_20251230031827.gs.zip

@Mrlinkwii Mrlinkwii added this to the Release 2.8 milestone Dec 30, 2025
@TJnotJT TJnotJT force-pushed the gs-rov branch 3 times, most recently from b4565fd to 16a031a Compare January 1, 2026 05:12
@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Jan 1, 2026

GTA San Andreas looks good now and it still has the big speed improvement with Vulkan, Shadow of the Colossus though still has some issues you can see this one quite easily on main menu

Should hopefully be fixed now. It might have been an issue with depth not being enabled correctly.

@bigol83
Copy link
Copy Markdown

bigol83 commented Jan 1, 2026

Graphics issues with Vulkan have been fixed but now Dx12 crashes both with GTA San Andreas and Shadow of the Colossus

the error window is this one

Immagine 2026-01-01 120909

@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Jan 1, 2026

Graphics issues with Vulkan have been fixed but now Dx12 crashes both with GTA San Andreas and Shadow of the Colossus

the error window is this one

That might be due to a mistake I made somewhere while rebasing. However, I wasn't able to reproduce on my end with basic/maximum blend and tweaking the ROV settings a bit. Could you please attach the INI you used to test?

On a side note, I changed the INI settings again, so any ROV related settings can be deleted from the INI so that the defaults are used. I'll try to make some presets so that it is easier to test in the future.

@bigol83
Copy link
Copy Markdown

bigol83 commented Jan 1, 2026

Graphics issues with Vulkan have been fixed but now Dx12 crashes both with GTA San Andreas and Shadow of the Colossus
the error window is this one

That might be due to a mistake I made somewhere while rebasing. However, I wasn't able to reproduce on my end with basic/maximum blend and tweaking the ROV settings a bit. Could you please attach the INI you used to test?

On a side note, I changed the INI settings again, so any ROV related settings can be deleted from the INI so that the defaults are used. I'll try to make some presets so that it is easier to test in the future.

i am going to delete the ini settings for the specific game and see if i can reproduce the issue with the newest commit. If i can i will post the ini like you asked

@bigol83
Copy link
Copy Markdown

bigol83 commented Jan 1, 2026

It still crashes for me
this is the specific game ini
SCES-53326_0F0C4A9C.zip

and this is the general pcsx2 ini
PCSX2.zip

@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Feb 7, 2026

Issue with Valkyrie Profile 2 is fixed, no issue with Shadow of the Colossus, no change with Burnout Revenge without using HWROVUseBarriersVK.

Thanks, I just pushed a fix based on findings from TheLastRar that may help in VK without needing to use HWROVUseBarriersVK on RDNA2. Out of curiosity, what GPU model are you using (sorry if you already mentioned this earlier)?

@mrrguest
Copy link
Copy Markdown

mrrguest commented Feb 7, 2026

Just tried the last push but unfortunately it still happens, I'm using 780M IGPU RDNA3 on Linux .

@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Feb 8, 2026

Just tried the last push but unfortunately it still happens, I'm using 780M IGPU RDNA3 on Linux .

I see, thank you for checking it. Maybe that's just the behavior of VK FSI on RDNA2/3.

@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Feb 10, 2026

@mrrguest We've been experimenting with different barrier settings to try and reduce the issues on VK/Linux/RDNA2/3. If you have the time, could you try the Burnout dump with HWROVUseBarriersVK = 2?
Burnout Revenge_SLUS-21242_20260120194002.gs.zip

@kamfretoz
Copy link
Copy Markdown
Contributor

Settings:

HWROV = 1
HWROVPreset = 3
HWROVUseBarriersVK = 0

GPU: Intel 13th Gen Core i3-1315U's iGPU

image

@mrrguest
Copy link
Copy Markdown

Sorry for the delay, the issue is fixed with HWROVUseBarriersVK = 2, but with preset 1 and max blend a texture is missing, with preset 3 the texture is missing with any blend
Screenshot_20260210_041846
Screenshot_20260210_041946

@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Feb 11, 2026

Sorry for the delay, the issue is fixed with HWROVUseBarriersVK = 2, but with preset 1 and max blend a texture is missing, with preset 3 the texture is missing with any blend

No worries, of course, and thanks for checking it. There was a small bug with the recent barriers additions, though hopefully it's fixed on the last push.

@mrrguest
Copy link
Copy Markdown

With the last push the issue is fixed, also tried other games no issue with all 3 presets and different blends.

@TJnotJT TJnotJT force-pushed the gs-rov branch 2 times, most recently from 3471fb0 to cd632cf Compare February 14, 2026 17:11
@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Feb 14, 2026

Cleaned up the code after a while, including documenting the RDNA2 feedback loop transition fix discovered by Air, and revising the new barrier setting for VK.

@mrrguest
Copy link
Copy Markdown

Tested the new build no issues.

@bigol83
Copy link
Copy Markdown

bigol83 commented Feb 15, 2026

Checked latest build with MGS3 and Shadow of the Colossus, with both renderers Vulkan and Dx12 with Accurate Alpha always enabled.

All three settings stay fullspeed or above with both renderers in both games.

No graphics issues.

@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Mar 7, 2026

@bigol83 @mrrguest We’re planning to submit a bug report to Mesa, as we’ve reproduced the flickering issue on two Linux/Wayland systems with AMD GPUs.

If I recall correctly, both of your systems also showed the flickering with VK when the extra barriers weren’t enabled. Could you share a few details about your setup: OS, whether you're using Wayland (if on Linux), and your GPU model? (I believe @mrrguest's is RDNA3.)

Thanks in advance if you’re able to help

@mrrguest
Copy link
Copy Markdown

mrrguest commented Mar 7, 2026

RDNA3 AMD 780M IGPU, Wayland, CachyOS. I didn't notice any flickering just graphics issue with Burnout Revenge which was fixed with HWROVUseBarriersVK = 2.
I believe @AmandaRoseChaqueta has RDNA2 GPU on Linux and noticed flickering with Black.

EDIT: I just tried the Black single and multi frame gs dumps @AmandaRoseChaqueta posted: #13754 (comment)

I didn't notice any flickering with the following setings:
HWROV = 1
HWROVPreset = 1,2,3
HWROVUseBarriersVK = 0

@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented Mar 8, 2026

RDNA3 AMD 780M IGPU, Wayland, CachyOS. I didn't notice any flickering just graphics issue with Burnout Revenge which was fixed with HWROVUseBarriersVK = 2. I believe @AmandaRoseChaqueta has RDNA2 GPU on Linux and noticed flickering with Black.

EDIT: I just tried the Black single and multi frame gs dumps @AmandaRoseChaqueta posted: #13754 (comment)

I didn't notice any flecking with the following setings: HWROV = 1 HWROVPreset = 1,2,3 HWROVUseBarriersVK = 0

Got it, thanks for the information. This appears to confirm that Linux/Wayland/RDNA2 is the only setup that's affected so far.

@TJnotJT TJnotJT force-pushed the gs-rov branch 2 times, most recently from 43f1aa3 to 1cdb6ac Compare March 14, 2026 16:37
@TJnotJT TJnotJT force-pushed the gs-rov branch 2 times, most recently from 5372760 to ba107ef Compare March 22, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.