-
Notifications
You must be signed in to change notification settings - Fork 8
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
video: Add hardware-accelerated rendering backend #37
base: nxdk
Are you sure you want to change the base?
Conversation
Ive tested this in SDLPop and Xenium-Tools. both work quite well. I definitely notice a performance gain in 720p Xenium-Tools. Good work with this. |
src/video/xbox/SDL_xbframebuffer_c.h
Outdated
@@ -37,7 +37,7 @@ Uint32 pixelFormatSelector(int bpp) { | |||
ret_val = SDL_PIXELFORMAT_RGB565; | |||
break; | |||
case 32: | |||
ret_val = SDL_PIXELFORMAT_RGB888; | |||
ret_val = SDL_PIXELFORMAT_ARGB8888; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RGB888
is a 32-bit mode (XRGB, X is implied), but it's alphaless. I believe we chose it because the existing framebuffer is alphaless at application startup.
Other nxdk APIs which share the same framebuffer (like debug.h) also don't support alpha.
Therefore, I consider RGB888
to be more correct.
I believe this was also a format that was taken from existing backends, because some popular backends (or those we took as reference) are also alphaless:
- Windows backend is alphaless
- Wayland backend is alphaless
- dummy backend is alphaless
- offscreen backend is alphaless
- haiku backend is alphaless
For this change, we should verify that apps aren't broken. I believe I actually had some trouble with some apps not working correctly with alpha channel (maybe it was even zombie-breakout?).
I believe some PSP ports of SDL apps also required a hack to avoid issues with the framebuffer having the alpha channel.
If we want to use alpha based modes we'll also have to modify RGB555 for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Truth be told I actually don't remember what issues this was causing and why I changed it. I assumed it was 24-bit because of the name, since there's SDL_PIXELFORMAT_RGBX8888
I would expect the other one to be named _XRGB8888
.
Could've been something related to surface blitting in the Odamex renderer.
What's the status on this? I was looking into the intrinsics in SDL and noticed we had a PR here already addressing it. Could we perhaps open a 2nd PR to fix just that if this is deadlocked? |
It works but doesn't support some things like render targets. I tried to use it in my fixed Zombie Breakout port but due to not having render targets the zombies weren't properly rendered. I also tried it on some more things that don't use render targets (like an old project of mine) and it seems that it gives quite the performance boost, even when just going software mode now that MMX and SSE work. |
since we're not actually using MSVC
results in no video output afterwards for some reason
since all the writes happen directly to it anyway
…mode" it actually WAS reporting the correct format
this is apparently not a problem anymore
largely untested
The SSE define fix and the ARGB8888 change have been reverted, since there appears to be no need for them anymore. I've also added (barely tested) support for rendertargets and (untested) |
nope, still a problem because nxdk-sdl is outdated
Adds a hardware accelerated SDL renderer backend that uses pbkit. Could be useful for upscaling screen-sized textures, especially in games like Chocolate Doom, where a 320x200 software rendered framebuffer texture is stretched all the way up to cover (almost) the entire screen.
In addition, this fixes a couple issues that I found in nxdk-sdl:
xbox_window
pointer was never set toNULL
upon window destruction, meaning recreating windows was impossible;GetDisplayModes
was unimplemented, meaningSDL_GetDisplayMode
would always fail.There are still some issues with the renderer left to solve, namely:
SDL_RenderReadPixels
is unimplemented;DestroyRenderer
and then recreating the renderer causes a loss of video output (black screen, but the app is still running) for some unknown reason.This was tested in my Odamex fork and appears to work fine.
UPD: The SSE define fix and the ARGB8888 change have been reverted, since there appears to be no need for them anymore.