Skip to content

GS/HW: ROV revisions.#14555

Merged
F0bes merged 7 commits into
PCSX2:masterfrom
TJnotJT:gs-rov-revisions
Jun 28, 2026
Merged

GS/HW: ROV revisions.#14555
F0bes merged 7 commits into
PCSX2:masterfrom
TJnotJT:gs-rov-revisions

Conversation

@TJnotJT

@TJnotJT TJnotJT commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Description of Changes

  • GSTexture: Add ShaderAccess flag to indicate a texture is shader writeable, and remove RWTexture.
  • GSTexture*: Remove unordered access/storage image specifier from regular RenderTarget.
  • GSRendererHW: Do ROV type conversion to shader writeable when color/depth is used as ROV (is needed).
  • GSRendererHW: Force color ROV if depth ROV is used.
  • GSDevice12/11/VK: Make sure the formats for ROV support UAV/storage image.
  • GSDeviceVK: Detect max supported framebuffer dimensions for null framebuffer.
  • GSDevice12/VK: Change 'UnorderedAccess' terminology to 'RW' for consistency.
  • GSDevice12: Fix render pass restart optimization rebase error.
  • Multiple files: Change instance of CreateRenderTarget() to CreateCompatible() if possible, so that same type (i.e. RenderTarget or RWRenderTarget) is preserved.
  • Multiple files: Change equality type checking like texture->GetType() == GSTexture::Type::RenderTarget to texture->IsRenderTarget() (cosmetic change).
  • Fix bug with temporary DS for stencil incorrectly attempting being used as a ROV (causes validation errors).
  • Simplify the ROV activation heuristic a bit (only consider barriers instead of alpha passes).
  • Code cleanup, remove unused variables, etc.

If possible, the following reviews would be helpful. Thanks in advance.

Rationale behind Changes

Usage enum was added to avoid adding unordered access/storage image/shader write flags to all RTs, since this may have a negative performance impact when ROV is not used. It also maps better to the way backends specify texture creation flags.

Other changes are explained in the description above.

Suggested Testing Steps

Test DX11/DX12/VK with ROV enabled.

Testing with dump runs at max blend (DX11/DX12/VK) and max blend + AAT + AA1 (DX11/DX12/VK/GL).

Tested on Metal by @SternXD with AA1 + AAT and FB fetch enabled/disabled.

Future Work

The logic for handling attachments in RenderHW() is a bit complicated since we now have RT, DS, RT ROV, DS ROV, DS as RT, so it might be nice to organize this better, such as by putting them in a RenderAttachments struct.

We might need to make the ROV heuristic less aggressive since it may cause performance regressions, especially with lower blend levels.

Did you use AI to help find, test, or implement this issue or feature?

Yes, for some questions about texture creation on difference backends.

Comment thread pcsx2/GS/Renderers/DX11/GSDevice11.cpp Outdated
@TJnotJT
TJnotJT force-pushed the gs-rov-revisions branch from 7b35432 to 7fbae61 Compare June 6, 2026 20:58

@AmandaRoseChaqueta AmandaRoseChaqueta left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick smoke test with several dumps that use blending, couldn't see a difference compared to master on linux.

@TJnotJT
TJnotJT force-pushed the gs-rov-revisions branch from 7fbae61 to 1f52483 Compare June 7, 2026 03:58
@TJnotJT

TJnotJT commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Last push rewrites a good chunk on the PR. Instead of having shader access flags tied to the format, it's made a separate flags for greater flexibility (shader write access can be added to RenderTarget or Texture separately).

@TJnotJT
TJnotJT force-pushed the gs-rov-revisions branch 3 times, most recently from 65d53c1 to 8159cd8 Compare June 7, 2026 16:02

@TellowKrinkle TellowKrinkle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding a separate bool for rw, maybe make type a usage enum, since that's how all the backends (except OpenGL) treat it anyways. (You can make the read / srv usage implcit, since we never make unreadable textures.)

There's an EnumOps.h in common that defines a MARK_ENUM_AS_FLAGS(T) to define boolean operators on an enum class for you.

Comment thread pcsx2/GS/Renderers/Vulkan/GSTextureVK.cpp Outdated
Comment thread pcsx2/GS/Renderers/Metal/GSDeviceMTL.mm Outdated
@TellowKrinkle

Copy link
Copy Markdown
Member

Actually while you're at it, could you add a separate usage bit for feedback loop to separate GS RTs from postprocessing effects? Given the mess that was depth feedback on non-Vulkan, I suspect drivers are disabling some optimizations for depth textures with feedback as well.

@TJnotJT
TJnotJT force-pushed the gs-rov-revisions branch 2 times, most recently from 3b9fc86 to e33e2bd Compare June 8, 2026 02:07
@TJnotJT

TJnotJT commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Instead of adding a separate bool for rw, maybe make type a usage enum, since that's how all the backends (except OpenGL) treat it anyways. (You can make the read / srv usage implcit, since we never make unreadable textures.)

There's an EnumOps.h in common that defines a MARK_ENUM_AS_FLAGS(T) to define boolean operators on an enum

Yes, that sounds liks a good approach to simplifying things.

Actually while you're at it, could you add a separate usage bit for feedback loop to separate GS RTs from postprocessing effects? Given the mess that was depth feedback on non-Vulkan, I suspect drivers are disabling some optimizations for depth textures with feedback as well.

Sure, can do.

@TheLastRar Is the simultaneous texture flag in DX12 similar to the feedback loop flag in VK? I'm wondering whether it would also be okay to omit it for postprocessing RTs.

@TheLastRar

TheLastRar commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

@TheLastRar Is the simultaneous texture flag in DX12 similar to the feedback loop flag in VK? I'm wondering whether it would also be okay to omit it for postprocessing RTs.

Yes, we only use that flag for feedback support, so we can omit it for the postprocessing RTs.
We currently already omit it for CAS's RWTextures.

@TJnotJT

TJnotJT commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Yes, we only use that flag for feedback support, so we can omit it for the postprocessing RTs. We currently already omit it for CAS's RWTextures.

That makes sense, thanks.

@TJnotJT

TJnotJT commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Last push adds back feedback flags to colorclip textures on all backends, which had been incorrectly omitted. Test dump is attached, which otherwises crashes on my system on DX12.

Chronicles of Narnia, The - Prince Caspian_SLES-55145_20230405202229.gs.xz.zip

@TJnotJT
TJnotJT force-pushed the gs-rov-revisions branch from 42f0062 to 97ace65 Compare June 21, 2026 00:50
@TJnotJT
TJnotJT force-pushed the gs-rov-revisions branch 2 times, most recently from aa51aa7 to c31df35 Compare June 21, 2026 02:20
Comment thread pcsx2/GS/Renderers/Common/GSTexture.cpp Outdated
@TJnotJT
TJnotJT force-pushed the gs-rov-revisions branch 2 times, most recently from 35fe8f7 to 4d56f93 Compare June 21, 2026 19:36
@TJnotJT
TJnotJT force-pushed the gs-rov-revisions branch 2 times, most recently from 30ae28a to c89af13 Compare June 21, 2026 23:10
TJnotJT added 7 commits June 26, 2026 18:20
Usage fits more cleanly with API flags.
Also separates out feedback and write usage from render target.

Co-authored-by: TellowKrinkle
Use GSTexture::FeedbackTarget RTs by default (not GSTexture::ShaderWriteTarget).
Do ROV type conversion for both color and depth (if needed).
Make sure the formats for ROV actually support UAV/storage image.
Change 'PSSetUnorderedAccess' to 'PSSetROVs' for clarity.
DX12: Use enum names instead of raw constants in PSSetShaderResource().
Some string format cleanup to GL_*() macros.
VK: Do not enable ROV if FB fetch is available.
Other misc cosmetic changes such as whitespace, etc.

Co-authored-by: TellowKrinkle
Force color ROV if depth ROV is used.
Only force color/depth ROV if the draw actually uses both color/depth (fixes a bug with temporary DS for stencil being used as a ROV).
Simplify the ROV activation heuristic a bit (removed unused variables, simplify barrier counting, etc.)
…vice::FetchSurface().

prefer_reuse is the opposite of prefer_unused_texture, so all corresponding arguments are inverted.
@TJnotJT
TJnotJT force-pushed the gs-rov-revisions branch from f897c19 to 3ca8266 Compare June 26, 2026 22:21
@F0bes
F0bes merged commit c3ace64 into PCSX2:master Jun 28, 2026
16 checks passed
@Mrlinkwii Mrlinkwii added this to the Release 2.8 milestone Jun 28, 2026
jpolo1224 added a commit to ARMSX2/ARMSX2 that referenced this pull request Jun 29, 2026
…oggles, AF + 8x upscale

- GS: port PCSX2 PCSX2#14555 ROV revisions + PCSX2#14465 anisotropic-filter shader
  optimization (early isotropic fallback, cheaper math); bump ShaderCacheVersion
- Renderer: add Vulkan framebuffer-fetch (ROAA) accurate-blending fast path on
  Adreno via EnableAdrenoFramebufferFetch (default off, experimental) - the
  mobile-native equivalent of ROV, restart to apply, no effect on Mali/OpenGL
- Renderer: add ROV, Accurate Alpha Test, and HW AA1 toggles; raise internal
  upscale range to 8x
- GameDB: surface an on-screen notice when a game recommends Accurate Alpha
  Test or AA1
- TextureCache: port upstream Move correctness fix for destination-target match
- Controllers: fall back to the device's own vibration motor when the gamepad
  exposes no usable rumble actuator (#241; e.g. Odin 3)
- Skins: read newer per-side analog filenames (analog_stick_left/right);
  older single analog_stick + analog_base packs still import
- Settings: rename "Game Fixes" to "GameDB Fixes" for clarity
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.

7 participants