NevolutionX icon indicating copy to clipboard operation
NevolutionX copied to clipboard

rendering: Adds SDL_gpu based rendering.

Open abaire opened this issue 3 years ago • 2 comments

Fixes #110

This leverages fgsfdsfgs/pbgl and grimfang4/sdl-gpu to add HW acceleration to SDL (at least the parts that are used by NevolutionX).

Both projects needed some patching:

  • pbgl has what I think is a bug with it's ability to do subtexturing when the source data and target texture have different pitches.
  • SDL_gpu needed a lot of conditional #ifdefing as it treats the nxdk as a full Windows target.

At the moment I've forked both and added dependencies on my forks. If this PR looks good I can try to get them upstreamed (I think the pbgl change is just a bugfix, but I suspect we'd need to maintain a fork of SDL_gpu).

I've also made it disable-able via FC_USE_SDL_GPU #ifdefs, but if this approach looks good I'd suggest removing them, particularly as I think SDL_gpu should work natively on Linux so we could add it to the CMake target and be accelerated everywhere.

I think this will also unblock more asynchronous tasks (e.g., the threaded XBE scanning) since the CPU usage should be dramatically lower (it's consistently at 60fps on my XBOX).

abaire avatar Oct 05 '21 20:10 abaire

Interesting stuff! There's also XboxDev/nxdk-sdl#37 for a less "intrusive" fix, not sure if we're interested? Less dependencies feels like a good thing IMO.

dracc avatar Oct 05 '21 21:10 dracc

Definitely agree that less deps would be better; I saw that PR when I was initially looking for the most straightforward solution and decided it looked like it was not going to be merged (given that it's nearly a year old with the last comment 6 months ago). The comment in XboxDev/nxdk/issues/480 reinforces my assumption that it's not likely to be merged.

My gut sense is that it'd be easier to maintain a ~permanent fork of SDL_gpu/pbgl (where NeX probably won't need further changes) than to depend on a patched version of the nxdk (which hopefully will be updated more often, e.g., with improvements to the persistent framebuffer and XLaunchXBE) where someone would likely have to continually rebase the patch.

In any case, if we do need to depend on forked deps, it might be worth creating an organization for the project as well so they can all be grouped in one place.

abaire avatar Oct 05 '21 22:10 abaire