Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for bindless textures from storage buffer on Vulkan #6721

Merged
merged 3 commits into from May 14, 2024

Conversation

gdkchan
Copy link
Member

@gdkchan gdkchan commented Apr 26, 2024

This has two changes. First, it has the change on #5936:

When the API or driver does not have native native support for quad primitives, we convert them to triangles. Because we convert each quad to 2 triangles, when we render quads, we have twice as many primitives than the game submitted. For this reason, the value for gl_PrimitiveID which is the index of the primitive on the shader is incorrect, and it is also double of what it should be.

To fix this issue, this change divides the ID by 2 if the primitive type is Quads or QuadStrip, the host does not support quads, and there is no geometry shader (as geometry shader must always generate new primitives, and they can't output quads).

And the second changes enables "full bindless" to also work when the handle comes from a storage buffer. Note that this still uses the code path where it loads all textures on the pool, rather than something that only loads the handles on the storage buffer.

This fixes some of the remaining issues that was originally fixed on the "full bindless" PR.

Castle Crashers Remastered.
Before:
image
After:
image
Mario Party Superstars.
Before:
image
After:
image

I tested this on the games that had massive performance regression when I enabled "full bindless" for everything, and none of them had performance regression with this change. Regardless, wider testing on UE4 games is welcome, since the number of games that I tested is low.

@github-actions github-actions bot added gpu Related to Ryujinx.Graphics graphics-backend:vulkan Graphical bugs when using the Vulkan API graphics-backend:opengl Graphical bugs when using the OpenGL API labels Apr 26, 2024
@ryujinx-mako ryujinx-mako bot requested review from riperiperi and a team April 26, 2024 03:02
@gdkchan gdkchan added the fix Fix something label Apr 26, 2024
Copy link
Member

@riperiperi riperiperi left a comment

Choose a reason for hiding this comment

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

Looks good, does fix those issues in superstars, and I imagine it'll help get crazier cases of using bindless textures working at a bare minimum.

This triggers every frame in clubhouse games (guest pass) with pool sizes of 4352 and 2304, but I can't see any visual difference. Same with Mario Party Superstars with similar pool sizes... I guess there's something that needs it, but I can't see it. Obviously superstars does need it when it's drawing shadows in some minigames, so maybe it's just something that runs all the time.

This could result in higher memory and CPU usage for these games, so it might be worth looking into reducing it to just use the handles on the storage buffer in future. Might not be feasible if they're written from GPU... I was a bit worried about resolution scale resets forcing the game to 1x resolution, but I didn't see any when playing a bunch of minigames.

MacOS in particular has huge performance issues in Mario Party Superstars now in most scenes. I imagine MoltenVK isn't happy with hundreds of potential bindings for each draw.

@AcK77 AcK77 merged commit 3a3b518 into Ryujinx:master May 14, 2024
12 checks passed
@legend800
Copy link

Just tried Super Mario Party on Vulkan but it crashes now post the Pad select screen. Log attached. Error:
"GUI.RenderThread Application : Unhandled exception caught: Ryujinx.Graphics.Vulkan.VulkanException: Unexpected API error "ErrorOutOfDeviceMemory".

Works fine on OGL but obviously missing shadows in many games. Tried vsync on/off and Memory mode=software/fast, clearing all caches but always crashes at that spot.

Config:
Windows 11 64-bit
GeForce GTX 3070
AMD Ryzen 5900x
32GB RAM

Log.txt

@MetrosexualGarbodor
Copy link
Collaborator

@legend800 this is completely unrelated to this PR, see #6478

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fix something gpu Related to Ryujinx.Graphics graphics-backend:opengl Graphical bugs when using the OpenGL API graphics-backend:vulkan Graphical bugs when using the Vulkan API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants