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

SDL_gpu Backend #8160

Closed
wants to merge 10 commits into from
Closed

SDL_gpu Backend #8160

wants to merge 10 commits into from

Conversation

DeltaW0x
Copy link

Now that SDL3 has reached ABI stability, I've added a SDL_Gpu backend to ImGui. The only notable difference from other backends lies in the fact that SDL_Gpu doesn't allow copy passes to occur during a renderpass.
There are two solutions to this problem (that I thought of):

  • Take control of the entire RenderPass for ImGui, which could (and will) limit what the user can do with the rendered texture (like rendering to a different RenderTarget).
  • Require the user to call a new function Imgui_ImplSDLGPU_PrepareDrawData before starting a user-created RenderPass, which uploads all the vertex/index buffer data.

I chose the second option because I thought it was the more useful one, but the code can be rewritten easily to support the former if deemed necessary. I've included shaders for SPIRV, DXCB and METALLIB for MacOS, I'll be able to compile the remaining ones for iOS and tvOS as soon as I'm able to install the SDKs for those

@ocornut
Copy link
Owner

ocornut commented Nov 18, 2024

Thank you for the PR.

Some feedback:

  • rename to imgui_impl_sdlgpu3 for consistency with existing backends.
  • add a "example_sdl3_sdlgpu" demo application.
  • use a diff tool to ensure that both the backend and example app mimic other backends as much as possible (comments, formatting, etc).
  • use early out in Imgui_ImplSDLGPU_PrepareDrawData().
  • in the shaders file provide instructions (e.g. exact command-line) to regenerate binaries from sources.

Thanks!

@DeltaW0x
Copy link
Author

DeltaW0x commented Nov 18, 2024

I think I've added everything? I wrote a vcproj example and added it to the solution (hopefully without having screw up anything), added comments and tried to fix the formatting everywhere I could. I tried writing a makefile but I'm really bad at those

DeltaW0x and others added 2 commits November 19, 2024 00:58
Update main.cpp for example
…nto SDL_GPU"

This reverts commit 65abcf5, reversing
changes made to d4dc7aa.
@DeltaW0x
Copy link
Author

DeltaW0x commented Nov 19, 2024

I made an absolute mess with the commits and I don't think I can fix anything, I'm just gonna close this pull request and make a new one without causing problems this time if it's ok. Sorry, I'm not very familiar with git

@DeltaW0x DeltaW0x closed this Nov 19, 2024
@DeltaW0x DeltaW0x deleted the SDL_GPU branch November 19, 2024 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants