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

Detect framebuffers that live in the "stride gap" of others, fix size #15900

Merged
merged 3 commits into from
Aug 24, 2022

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Aug 24, 2022

Some games, including the ones mentioned in #15898, place a small buffer in the vertical gap, created between a 480px wide main framebuffer, and a stride of 512 pixels. For some reason 512 is regarded as a better stride than 480, so many games size their buffers that way, leaving the gap.

This detects such buffers in a pretty safe and strict way, and make sure that their drawing_width is set accordingly, leading to less memory use and a slightly more sane debugging experience.

This does not solve #15898, but is a small, separate step on the way so let's get it in for testing.

@hrydgard hrydgard added the GE emulation Backend-independent GPU issues label Aug 24, 2022
@hrydgard hrydgard added this to the v1.14.0 milestone Aug 24, 2022
@hrydgard hrydgard merged commit 3ce59ce into master Aug 24, 2022
@hrydgard hrydgard deleted the stride-gap branch August 24, 2022 18:03
@@ -271,7 +304,7 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(const Frame
// As there are no clear "framebuffer width" and "framebuffer height" registers,
// we need to infer the size of the current framebuffer somehow.
int drawing_width, drawing_height;
EstimateDrawingSize(params.fb_address, params.fb_format, params.viewportWidth, params.viewportHeight, params.regionWidth, params.regionHeight, params.scissorWidth, params.scissorHeight, std::max(params.fb_stride, (u16)4), drawing_width, drawing_height);
EstimateDrawingSize(params.fb_address, std::max(params.fb_stride, (u16)16), params.fb_format, params.viewportWidth, params.viewportHeight, params.regionWidth, params.regionHeight, params.scissorWidth, params.scissorHeight, drawing_width, drawing_height);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, it can be specified as 4 iirc, I'm not sure it's true that the floor is 16. It might have a minimum of 16 bytes.

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

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

4 just looked suspiciously small. I'll restore it though, not like it'll matter very often anyway...

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.

2 participants