nba-emu / NanoBoyAdvance

A cycle-accurate Nintendo Game Boy Advance emulator.
GNU General Public License v3.0
955 stars 53 forks source link

Rendering loop rewrite #339

Closed GranMinigun closed 7 months ago

GranMinigun commented 7 months ago

Tested on Intel Core i5-7400 with integrated Intel HD Graphics 630 (max. clock is 1000 MHz), DDR4 2400 MHz, Mesa 23.2.1. Enabled xBRZ scaler, GBA colour correction, and LCD ghosting effect, the window size was set to 6x. Metrics reported by intel_gpu_top utility.

The current renderer results in 60+% utilization, at ~600 MHz GPU clock. This PR reduces that to 45-50% utilization, at 230±30 MHz GPU clock. May be a bit lower in fullscreen mode, possibly results will vary depending on showed content.

The output of xBRZ shader differs slightly due to being moved to the end of the chain, but it's barely noticeable. When both xBRZ and LCD ghosting are enabled, the former is placed before the latter.

Shout if you'd like to see commit messages changed, code style adjusted, and more comments added. I intentionally omitted whitespace and line ending changes, for the sake of simpler review process. Can introduce them in a separate commit.

Extracted from and is a prerequisite to #332.

fleroviux commented 7 months ago

I tested this on macOS and Windows and it's looking good to me. I think the source code is fine as is. Thanks a lot @GranMinigun. Should I go ahead and merge or do you still want to make some changes?

GranMinigun commented 7 months ago

Missed indentation in one place, no functional changes. I can commit CRLF => LF conversion for touched files, if you want. But otherwise, go ahead.

fleroviux commented 7 months ago

Thanks!