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

gb: Use only 4-LSB in LCD data #55

Open
deltabeard opened this issue Jul 24, 2022 · 1 comment
Open

gb: Use only 4-LSB in LCD data #55

deltabeard opened this issue Jul 24, 2022 · 1 comment
Labels
diff: intermediate Medium difficulty enhancement New feature or request feat: medium Rationale is clear and reasonable. Performance Issues or bugs related to performance improvements & regressions.
Milestone

Comments

@deltabeard
Copy link
Owner

The LCD pixel data that Peanut-GB produces uses bits 0 and 1 for shade data, and bits 4 and 5 for layer data. If only bits 0-3 are used, then colour mapping using a look up table can be faster. A basic test on the RP2040 showed an improvement of approximately 8 FPS with this change.

This will require an API change.

@deltabeard deltabeard added enhancement New feature or request diff: intermediate Medium difficulty feat: medium Rationale is clear and reasonable. Performance Issues or bugs related to performance improvements & regressions. labels Jul 24, 2022
@deltabeard deltabeard added this to the v2 milestone Jul 24, 2022
@deltabeard
Copy link
Owner Author

The layer data is masked from the registers on the DMG. When this data is set by the ROM, Peanut-GB can store these values in a separate variable in bits 2 and 3, for use in a faster look-up table when rendering the LCD. Where bits 0 and 1 are for shade data, and bits 2 and 3 are for layer data. This should then allow for 4-bit colour in the LSB of a single byte. Further work would then be required to get packed 4-bit data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diff: intermediate Medium difficulty enhancement New feature or request feat: medium Rationale is clear and reasonable. Performance Issues or bugs related to performance improvements & regressions.
Projects
None yet
Development

No branches or pull requests

1 participant