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: Add fallback handling for bounding box when disabled or unsupported #9773

Merged
merged 2 commits into from Jun 1, 2021

Conversation

Techjar
Copy link
Contributor

@Techjar Techjar commented May 31, 2021

The SDK seems to write "default" bounding box values before every draw (1023 0 1023 0 are the only values encountered so far, which happen to be the extents allowed by the BP registers) to reset the registers for comparison in the pixel engine, and presumably to detect whether GX has updated the registers with real values. Handling these writes and returning them on read when bounding box emulation is disabled or unsupported, even without computing real values from rendering, seems to prevent games from corrupting memory or crashing.

This obviously does not fix any effects that rely on bounding box emulation, but having the game not clobber its own code/data or just outright crash is a definite improvement.

@JMC47
Copy link
Contributor

JMC47 commented May 31, 2021

This makes it so we can run Bounding Box titles without them crashing if Bounding Box is disabled, instead just breaking Visual Effects. It's actually really useful for examining what they do.

Copy link
Member

@phire phire left a comment

Choose a reason for hiding this comment

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

If these "default values" have been written by the sdk before this draw call, then we would have received them in SetBoundingBox.

Rather than hardcoded these "default values" if the desired result is to preserve what was written, then we should modify how BBdisabled works so it accepts writes and just never fetches new results from the host gpu.

@Techjar Techjar changed the title VideoCommon: Return default bounding box values instead of 0 VideoCommon: Add fallback handling for bounding box when disabled or unsupported May 31, 2021
@Techjar Techjar force-pushed the bbox-default-values branch 2 times, most recently from 74988af to 0dcd5ae Compare May 31, 2021 22:08
Source/Core/VideoCommon/RenderBase.h Outdated Show resolved Hide resolved
@Techjar Techjar force-pushed the bbox-default-values branch 3 times, most recently from d39c669 to 9288b6b Compare May 31, 2021 23:43
…unsupported

The SDK seems to write "default" bounding box values before every draw
(1023 0 1023 0 are the only values encountered so far, which happen to
be the extents allowed by the BP registers) to reset the registers for
comparison in the pixel engine, and presumably to detect whether GX has
updated the registers with real values. Handling these writes and
returning them on read when bounding box emulation is disabled or
unsupported, even without computing real values from rendering, seems
to prevent games from corrupting memory or crashing.

This obviously does not fix any effects that rely on bounding box
emulation, but having the game not clobber its own code/data or just
outright crash is a definite improvement.
@phire phire merged commit a3c89ac into dolphin-emu:master Jun 1, 2021
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants