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

sokol_app vulkan #535

Closed
pplux opened this issue Jul 6, 2021 · 7 comments
Closed

sokol_app vulkan #535

pplux opened this issue Jul 6, 2021 · 7 comments

Comments

@pplux
Copy link
Contributor

pplux commented Jul 6, 2021

sokol_app is an extraordinary library, I'm using it with my own render implementation all the time. I have plans to switch to vulkan and I was wondering if you plan to add support for vulkan (not the gfx part, just the app/context) or if you will be willing to accept PR's working towards that goal.

As said, not asking for #285 , just the sokol_app part.

@floooh
Copy link
Owner

floooh commented Jul 6, 2021

Hmm, not a fan of the idea for at least two reasons:

  • the Vulkan setup wouldn't be some isolated chunk of code, but instead needs to be implemented inside the existing platform backends which support Vulkan (Win32, Linux, Android, possibly macOS), that's a lot of "disruption" for the existing code
  • without a Vulkan backend in sokol_gfx.h, the Vulkan code in sokol_app.h would "just sit there" without tests and samples using that code

Once it makes sense to remove all OpenGL backends (for instance because of bitrot in OpenGL implementations) I'll be most likely more in favour of the idea, because this would mean ripping out some big and ugly code. Vulkan would probably be more code, but definitely not as ugly as the GL code. But that's not anytime soon I think.

There's also a big change in (very slow) progress implementing multiwindow support for sokol_app.h, so currently isn't a good time to do big PRs anyway I'm afraid.

@pplux
Copy link
Contributor Author

pplux commented Jul 7, 2021

Thanks! I will stick to glfw meanwhile :)

@pplux pplux closed this as completed Jul 7, 2021
@cshenton
Copy link

So for anyone else going down this path, I've had good results so far with just not defining a graphics API, then commenting out the bits of sokol_app.h that complained (the preprocessor errors and the corresponding function calls to undefined methods).

That so far has enabled me to rely on sokol to handle the window creation, etc., and I just used sapp_win32_get_hwnd to get the information I needed to create a VkSurface on my platform.

I might be in a minefield though. Time will tell 😆

@pplux
Copy link
Contributor Author

pplux commented May 25, 2022

I've done something similar for manual webgpu, and it also worked... so it might be worth giving a try? Maybe it could be a sokol_app with no backend and let the user deal with the specifics for vulkan/webgpu/anything else....

@floooh
Copy link
Owner

floooh commented May 27, 2022

Just some additional thoughts, in case this will ever become an "official feature":

  • a SOKOL_NO_BACKEND define (instead of SOKOL_D3D11 etc...)
  • a couple new 'custom backend' callbacks defined in sapp_desc (I think that's more robust than doing the device/context and swapchain setup in the regular frame callbacks, especially if I should continue one day with the stalled multi-window experiments):
    .backend = {
        .setup_cb = ..., // this would create the 3D device/context and the swapchain
        .discard_cb = ..., // destroy the swapchain and device/context
        .resize_cb = ..., // called when the swapchain needs resizing
        .present_cb = ..., // called when the swapchain should perform a present
        // any more?
        .user_data = ...,
    }

@mr-sihc
Copy link

mr-sihc commented May 25, 2023

how far did this go in the time?
i mean pretty much anything uses vulkan nowdays
so, this would probably be a very good thing!

how far is it/ if at all?

@floooh
Copy link
Owner

floooh commented May 25, 2023

No plans for Vulkan support anytime soon, sorry. Next is a WebGPU backend, then at some later pointer when GL is no longer relevant and Vulkan is robust enough on Android, there might be a Vulkan backend replacing the GL backend. But TBH, at that point (with GL no longer defining the minimal feature set), it probably makes more sense to start thinking about a sokol-gfx successor.

If it's just about a 3D-API agnostic sokol_app.h, currently no plans either (GLFW might be the better option).

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

4 participants