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

Floating point FBO in SDL_gpu #235

Open
NTxC opened this issue May 5, 2022 · 3 comments
Open

Floating point FBO in SDL_gpu #235

NTxC opened this issue May 5, 2022 · 3 comments

Comments

@NTxC
Copy link

NTxC commented May 5, 2022

I was wondering whether SDL_gpu supports floating point framebuffer objects.

I'm working on a remake of an older game in C/C++ and I used SDL_gpu to be able to utilize shaders. However, when I draw using the shader of my choice (ntsc-adaptive from libretro), everything seems to have a pink tint to it (left - shader off, right - shader on):

off-on

I learned that this might be a side effect of not utilizing a floating point FBO. Does SDL_gpu support this in some way? When calling GPU_CreateImage I can pick the format, but whatever SDL_gpu format I use, it all seems to be of internal format GL_RGBA/type GL_UNSIGNED_BYTE under the hood (and I'm assuming I need GL_RGBA32F/GL_FLOAT).

@grimfang4
Copy link
Owner

That is correct. SDL_gpu assumes GL_UNSIGNED_BYTE. Floating point framebuffers would probably be a good feature to expose, as lacking it limits things like HDR shaders. I can't tell if that's your actual issue here, but it is an issue.

@NTxC
Copy link
Author

NTxC commented May 5, 2022

I see, thanks. SDL_gpu doesn't seem to enjoy more than 4 bytes per pixel under the hood too, so quickly adding in GL_RGBA32F/GL_FLOAT doesn't seem like it's going to work.

Great library, by the way. Really fun to use.

@NTxC
Copy link
Author

NTxC commented Jul 11, 2023

I can confirm the issue was indeed the lack of floating point framebuffer object support in SDL_gpu. I implemented that functionality (GL_RGBA32F support) myself and it's all working now.

IM2

I might create a pull request later.

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

No branches or pull requests

2 participants