Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Due to the fact that the PSP overlaps stencil with color alpha, and PC interleaves stencil with depth instead, to get the semantics right we often have to copy the depth buffer from a previously bound framebuffer.
This avoids doing that if we never use depth after binding a color buffer, before binding the next one. This results in eliminated depth copies in several and perhaps many games, including God of War, saving some GPU performance.
This was made possible after #15700 and was @unknownbrackets 's idea (see comments in the issue) so cred goes to him.
Don't really have any numbers for the improvement, but eliminating unnecessary operations is always good. There is some extra checking per draw though.. wonder if there's a way to reduce that.
NOTE: This is draft because it doesn't avoid splitting render passes on OpenGL yet, in case the depth draw is not the first in a pass. That probably doesn't happen very often though.
EDIT: Regressions found during testing, check off once fixed:
EDIT: There's problem with the pass injection. It's too aggressive, it should not happen when we are on the first draw on a new framebuffer.