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

VideoCommon: Round bounding box coordinates down and remove pixel center offset #9781

Merged
merged 1 commit into from Jun 5, 2021

Conversation

Techjar
Copy link
Contributor

@Techjar Techjar commented Jun 5, 2021

Fragment coordinates always have a 0.5 offset from a whole integer, as that's where the pixel center is on modern GPUs. Therefore, we want to always round the fragment coordinates down for bounding box calculations. This also renders the pixel center offset useless, as 0.5 vs ~0.5833333 makes no difference when rounding down.

Fixes softlocks in certain cutscenes of Paper Mario: TTYD and Super Paper Mario, caused (presumably) by rounding up to a coordinate outside the render area.

…ter offset

Fragment coordinates always have a 0.5 offset from a whole integer, as
that's where the pixel center is on modern GPUs. Therefore, we want to
always round the fragment coordinates down for bounding box
calculations. This also renders the pixel center offset useless, as 0.5
vs ~0.5833333 makes no difference when rounding down.
@JMC47
Copy link
Contributor

JMC47 commented Jun 5, 2021

For OpenGL/Vulkan, this causes artifacts in Disney's Magical Mirror, Disney's Hide and Sneak, and whatever the third one I have is that's in Japanese that I don't feel like looking up.

Super Paper Mario, Paper Mario TTYD hangs are fixed. Ultimate Spider-Man is still fine. Speed Challenge hangs before I can test Bounding Box.

@JMC47 JMC47 requested a review from stenzek June 5, 2021 05:54
@JMC47
Copy link
Contributor

JMC47 commented Jun 5, 2021

I'm merging this because it literally can't make things worse at this point. We can review/perfect things after the progress report.

@JMC47 JMC47 merged commit 36871c9 into dolphin-emu:master Jun 5, 2021
11 checks passed
// The rightmost shaded pixel is not included in the right bounding box register,
// such that width = right - left + 1. This has been verified on hardware.
int2 pos = iround(rawpos * cefbscale + offset);
int2 pos = int2(rawpos * cefbscale);
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this produce correct result for cefbscale > 1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants