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

rendering: Adds SDL_gpu based rendering. #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abaire
Copy link
Contributor

@abaire abaire commented Oct 5, 2021

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).

@dracc
Copy link
Owner

dracc commented Oct 5, 2021

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.

@abaire
Copy link
Contributor Author

abaire commented Oct 5, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Implement hardware accelerated rendering
2 participants