GS/HW: HLE the Burnout games bloom effect #9336
Merged
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.
Description of Changes
Shamelessly stolen from the source because I can't be bothered to re-type it.
Burnout has a... creative way of achieving its bloom effect, to avoid horizontal page breaks.
First they double strip clear a single page column to (191, 191, 191), then blend the main framebuffer into this column, with (Cs - Cd) * 2. So anything lower than 191 clamps to zero, and anything larger boosts up a bit. Then that column gets downsampled to half size, makes sense right?
The fun bit is when they move to the next page, instead of being sensible and using another double strip clear, they write Z to the next page as part of the blended draw, setting it to 191 (in Z24 terms). Then the buffers are swapped for the next column, 0x1a40 and 0x1a60 in US.
We could handle that, except for the fact that instead of pointing the texture at 0x1a60 for the downsample of the second column, they point it at 0x1a40, and offset the coordinates by a page. This would need "tex outside RT", and no way that's happening.
So, I present to you, dear reader, the first state machine within a CRC hack, in all its disgusting glory. This effectively reduces the multi-pass effect to a single pass, by replacing the column-wide draws with a fullscreen sprite, and skipping the extra passes.
After this, they do a blur on the buffer, which is fine, because all the buffer swap BS has finished, so we can return to normal.
Rationale behind Changes
Closes #1415.
Closes #5602.
Before without CRC hack:
Before with CRC hack:
After:
Suggested Testing Steps
Test burnout games. I've tried to make the hack general, so hopefully it'll work across the series for both PAL and NTSC, assuming the effect is implemented relatively similarly.