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

Fit viewport to scissor #13251

Merged
merged 3 commits into from
Aug 5, 2020
Merged

Fit viewport to scissor #13251

merged 3 commits into from
Aug 5, 2020

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Aug 5, 2020

The PSP's GPU doesn't have any real triangle clipping to the sides - all it does is scissor off the pixels outside. Thus, the viewport only positions and scales the rendering, it doesn't restrict it. So if a game sets a viewport that would result in a PC GPU viewport rectangle that's smaller than the scissor rectangle, we need to expand the viewport to fill it up.

Fortunately we already had code to do the opposite - cut the viewport down in case it was outside the framebuffer and scale the projection matrix to compensate. This logic can easily do the reverse, too.

Dante's Inferno's bloom effect used a weird viewport when clearing the bloom subtract buffer, where the viewport didn't end up covering the whole thing. That resulted in #4845, which this PR fixes. Who knows what else it might fix...

Fixes #4845.

I have not yet written a hardware test to confirm this (though I plan to), but it makes sense and if it's not like this, the bug in Dante's Inferno makes zero sense.

… all need to work anyway.

Required fixing a bug in ShaderUniforms.cpp (used by D3D11 and Vulkan,
the two backends that previously exposed LARGE_VIEWPORTS).
@hrydgard hrydgard added the GE emulation Backend-independent GPU issues label Aug 5, 2020
@hrydgard hrydgard added this to the v1.11.0 milestone Aug 5, 2020
@hrydgard hrydgard merged commit 937042b into master Aug 5, 2020
@hrydgard hrydgard deleted the fit-viewport-to-scissor branch August 5, 2020 21:48
@hrydgard
Copy link
Owner Author

hrydgard commented Aug 5, 2020

I mean, thinking about it some more, it pretty much has to be like this. The viewport you set up on the PSP is just a center and a scale factor, you don't set any boundaries, and it's unlikely the hardware would compute the boundaries just to add another scissor inside the already existing scissor rectangle feature.

http://lukasz.dk/mirror/forums.ps2dev.org/viewtopic7cdf.html?t=3644

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GE emulation Backend-independent GPU issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dante's Inferno - Graphics issue - Bloom
1 participant