-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Shader blending in Vulkan through input attachments #15944
Conversation
fd16769
to
3141971
Compare
Rebased on master, confirmed working in Outrun etc for the logic stuff. Still, work remains before this can be merged. |
3141971
to
df19bae
Compare
Rebased on top of #15982 , which should be merged first. Obviously, only the last three commits here need reviewing separately. I'm not using the new extensions yet, not sure if we'll need them. |
99b0baa
to
4b28ff8
Compare
Alright, rebased on master after merging #15982 . Will need more testing before merge. |
04a915c
to
6170f92
Compare
This now works fine on all platforms, except for some reason in Dragon Ball Z: TTT on Adreno, getting vertical artifacts between the rectangles in the strip. I'm guessing there's some small overlap in the draw, where behavior becomes undefined (and accidentally worse than without this...). Bah. EDIT: Actually no overlap in the draw, though there are multiple adjacent triangles next to each other. But that should work. Don't know what's going on then... Maybe I'll just disable this path on Adreno. EDIT2: I'm thinking of flattening rect strips like this into a single rectangle, that should also fix it: |
Helps an issue with #15944 (DBZ: TTT), and is a small GPU optimization (mainly less pixels on diagonals - those cause "quad overlap" even though the resulting pixels don't)
Actually doesn't fix it, still getting artifacts along the one remaining diagonal. Seems this type of shader blending isn't working on at least old Adreno drivers, or we're still getting some barrier wrong. I'm gonna add a bug flag for now, and only enable this on non-Adreno. |
6170f92
to
262a306
Compare
OK, let's see if anything else breaks, hopefully not :) |
This uses input attachments, a subpass self-dependency and barriers to implement limited shader blending for unextended Vulkan, avoiding copies.
This of course has the limitation that self-overlapping draw calls will not necessarily (although might on some hardware or if lucky) blend correctly with earlier parts of themselves, but it's generally not an issue and is also an issue of the copy-texture-based shader blending (though the wrong results will likely not be exactly the same).
Should be a modest performance boost for some games, and result in cleaner output in RenderDoc. And is simply the right thing to do, additionally opens up to more uses for this technique, such as implementing the self-depal horror used in Jackass (#13676).
Things left to do: