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

3DS: Implement dynamic graphics modes to improve performance #2021

Closed
wants to merge 1 commit into from

Conversation

@BallM4788
Copy link
Contributor

BallM4788 commented Jan 26, 2020

Because the 3DS is a low-power system, conversion from a game's pixel format to a dissimilar hardware pixel format can be taxing to the system, causing graphical slowdown. This is most evident with graphically intensive games such as Riven, which on the 3DS runs roughly half as fast as it should. Changing the pixel format of display texture surfaces when launching a game remedies this.

When launching a game, switch the graphics mode if necessary (and by extension the pixel formats used for Graphics::Surfaces and Sprites) to the one that most closely matches the pixel format used in-game.

Additional Fixes:

  • Fix to prevent cursor position from changing when exiting a menu.
  • Fix to prevent updating of Magnification viewport position when virtual keyboard is open.
  • Cosmetic code fixes for improper whitespace and missing curly brackets.
  • Remove RGB8 as a mode option because:
    • It was already commented out in the master 3DS backend.
    • There are currently no games that explicitly require it.

Notes:

  • As these graphics modes are automatically implemented on a per-game basis, they are meant for backend use only and are purposefully not accessible through the Options menu.
  • RGBA8 (aka RGBA8888) remains the default pixel format, being used for the launcher menu, CLUT8, and for games which do not specify a particular format.
@BallM4788 BallM4788 requested a review from bgK Jan 26, 2020
Copy link
Member

bgK left a comment

Thank you for your contribution. This is looking pretty good. However I have some comments / questions for you to address.

backends/platform/3ds/osystem-graphics.cpp Outdated Show resolved Hide resolved
backends/platform/3ds/osystem-graphics.cpp Outdated Show resolved Hide resolved
backends/platform/3ds/osystem-graphics.cpp Outdated Show resolved Hide resolved
backends/platform/3ds/osystem-graphics.cpp Outdated Show resolved Hide resolved
backends/platform/3ds/osystem-graphics.cpp Outdated Show resolved Hide resolved
backends/platform/3ds/osystem-graphics.cpp Outdated Show resolved Hide resolved
backends/platform/3ds/osystem-graphics.cpp Outdated Show resolved Hide resolved
backends/platform/3ds/osystem-graphics.cpp Outdated Show resolved Hide resolved
BallM4788 added a commit to BallM4788/scummvm that referenced this pull request Jan 29, 2020
Additional fixes:
- Change "svmScreenPF" in _modeRGBA8 and _modeCLUT8 to RGBA8 instead
of RGB8.
- Change backend to initialize screens to "GSP_RGBA8_OES" instead of
"GSP_BGR8_OES".
- Remove RGB8 as a mode option because:
  1) It was already commented out in the master 3DS backend.
  2) There are currently no games that explicitly require it.
BallM4788 added a commit to BallM4788/scummvm that referenced this pull request Jan 30, 2020
Additional fixes:
- Change "svmScreenPF" in _modeRGBA8 and _modeCLUT8 to RGBA8 instead
of RGB8.
- Change backend to initialize screens to "GSP_RGBA8_OES" instead of
"GSP_BGR8_OES".
- Remove RGB8 as a mode option because:
  1) It was already commented out in the master 3DS backend.
  2) There are currently no games that explicitly require it.
@BallM4788 BallM4788 force-pushed the BallM4788:3ds_graphicmodesfinal branch from 492a77b to 3d3470c Jan 30, 2020
@BallM4788

This comment has been minimized.

Copy link
Contributor Author

BallM4788 commented Jan 30, 2020

Rebased to fix conflict with the new keymapper commits (which works great on the 3DS BTW, great work guys).

@BallM4788 BallM4788 requested a review from bgK Jan 30, 2020
@BallM4788 BallM4788 force-pushed the BallM4788:3ds_graphicmodesfinal branch 2 times, most recently from 98a0dc9 to e84924f Feb 3, 2020
@BallM4788

This comment has been minimized.

Copy link
Contributor Author

BallM4788 commented Feb 3, 2020

@bgK Thanks for your suggestions. They allowed me excise a good chunk of code from the PR!

Copy link
Member

bgK left a comment

Thanks for your work. I still have a few remarks that need to be solved before we can merge this.

backends/platform/3ds/sprite.h Outdated Show resolved Hide resolved
backends/platform/3ds/sprite.cpp Outdated Show resolved Hide resolved
backends/platform/3ds/osystem-graphics.cpp Outdated Show resolved Hide resolved
backends/platform/3ds/osystem-graphics.cpp Outdated Show resolved Hide resolved
@BallM4788 BallM4788 force-pushed the BallM4788:3ds_graphicmodesfinal branch from e84924f to 494be0e Feb 6, 2020
When launching a game, switch the graphics mode if necessary
(and by extension the pixel formats used for Graphics::Surfaces
and Sprites) to the one that most closely matches the pixel format
used in-game.

Additional Fixes:
- Fix to prevent cursor position from changing when exiting a menu.
- Fix to prevent updating of Magnification viewport position when
virtual keyboard is open.
- Cosmetic code fixes for improper whitespace and missing curly brackets.
- Remove RGB8 as a mode option because:
  1) It was already commented out in the master 3DS backend.
  2) There are currently no games that explicitly require it.

Notes:
- As these graphics modes are automatically implemented on a per-game basis, they
are meant for backend use only and are purposefully not accessible through the
Options menu.
- RGBA8 (aka RGBA8888) remains the default pixel format, being used for the launcher
menu, CLUT8, and for games which do not specify a particular format.
@BallM4788 BallM4788 force-pushed the BallM4788:3ds_graphicmodesfinal branch from 494be0e to 76eb6d7 Feb 6, 2020
@BallM4788

This comment has been minimized.

Copy link
Contributor Author

BallM4788 commented Feb 6, 2020

That should be everything!

@BallM4788 BallM4788 requested a review from bgK Feb 6, 2020
@bgK

This comment has been minimized.

Copy link
Member

bgK commented Feb 7, 2020

Thanks again. Merged manually as b08ab0e.

@bgK bgK closed this Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.