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

Fragment shader should be optional in SDL_gpu graphics pipeline #12311

Open
zopsicle opened this issue Feb 17, 2025 · 5 comments
Open

Fragment shader should be optional in SDL_gpu graphics pipeline #12311

zopsicle opened this issue Feb 17, 2025 · 5 comments

Comments

@zopsicle
Copy link

When you want to render only depth, there’s no need for a fragment shader. Direct3D 12, Metal, and Vulkan all support omitting the fragment shader in a graphics pipeline. But SDL_gpu artificially requires one, requiring the programmer to compile and supply no-op fragment shaders.

@zopsicle zopsicle changed the title Fragment shader should be optional Fragment shader should be optional in SDL_gpu graphics pipeline Feb 17, 2025
@flibitijibibo
Copy link
Collaborator

Will have to check but PS4/5 may require a fragment shader at all times, someone should be able to confirm sooner rather than later. Other than that it'd be good to have this in SDL_gpu_examples first so we can verify the fix everywhere. At the moment the GPU team is focused on PS5 but we can review patches for this if it turns out it's portable to allow null fragment shaders.

@icculus
Copy link
Collaborator

icculus commented Feb 17, 2025

It (probably) wouldn't be unreasonable to have the GPU API use a dummy fragment shader on those platforms, compiled down to a const static array inside SDL.

@flibitijibibo
Copy link
Collaborator

It (probably) wouldn't be unreasonable to have the GPU API use a dummy fragment shader on those platforms, compiled down to a const static array inside SDL.

The funny thing is PS is the one place where that may not be true; shader linkage is a lot more strict so it may be a situation where the shader itself is empty but still has inputs that match the vertex shader output, even though they're entirely unused... hoping to have a definitive answer on it soon.

@flibitijibibo
Copy link
Collaborator

Got confirmation that this is possible on PS5, so PRs welcome for this feature!

@zopsicle
Copy link
Author

zopsicle commented Feb 18, 2025

Amazing 🎉 I’ll see if I can get it to work for the PC APIs.

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

3 participants