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

Vulkan backend #191

Open
alichraghi opened this issue Feb 28, 2025 · 7 comments
Open

Vulkan backend #191

alichraghi opened this issue Feb 28, 2025 · 7 comments

Comments

@alichraghi
Copy link
Collaborator

I'm eager to contribute it

@david-vanderson
Copy link
Owner

Awesome!

The first thing we need is a demo app (not using dvui) that renders a triangle and a textured triangle. Do you have that kind of thing?

I tried to get https://github.com/ezzieyguywuf/zcad running but ran into build errors.

@alichraghi
Copy link
Collaborator Author

Yeah i can extract some stuff from my own game or copy vulkan-zig-demo.

@Deins
Copy link
Collaborator

Deins commented Feb 28, 2025

I was messing around with this couple months ago around Christmas with this. I got quite far with zig 13 and version back then. Overall was working without support of render-textures. Somewhat got stuck there, otherwise was fully functional.

Image

IMHO, the somewhat painful part was figuring out what backend to use for window creation and input as vulkan doesn't handle it.
I somewhat ugly hacked it to piggy back on sdl3 while overriding any rendering callbacks, might be better solution possible.

Otherwise in nearest time I doubt I will have time to work on it. So feel free to attempt to updaet it or borrow anything if you want. Or write it yourself.

My attempt:
https://github.com/Deins/s3-vk/blob/master/src/dvui_vulkan_renderer.zig
With local dvui dependancy at path ./deps/. I think I tested it on linux, but maybe its windows only for now.
https://github.com/Deins/dvui/tree/vulkan
Cheers.

@david-vanderson
Copy link
Owner

Amazing thank you! It looks like sdl has vulkan support, so that would be one option (adding that to the sdl backend). Or could write a new glfw backend for it.

@alichraghi Can you give more details of what you want to do with it? Do you have a vulkan app already and want to add dvui on top of it? Or are you starting from scratch and want to do low-level vulkan stuff on part of the screen with dvui widgets alongside?

@Deins
Copy link
Collaborator

Deins commented Feb 28, 2025

In regards to sdl3 specifically: I didn't figure out a way to interop sdl3 / sdl3-gpu rendering with native vulkan rendering as far as I tried.
You can use sdl3 with its vulkan backed that works fine including stock dvui sdl3 backend.
But if you want to do your own vulkan rendering stuff AND still render something with sdl/sdl-gpu as far as I tried I didn't have any luck.

But for other platforms - yes vulkan "rendering" backend could be itself useful as rendering code would itself be more cross platform. Only it needs something on each platform to handle creating window and platform specific input - that can be done natively on each platform or use libs such as sdl or glfw.

@david-vanderson
Copy link
Owner

@Deins Thanks so much for the information!

@alichraghi
Copy link
Collaborator Author

Do you have a vulkan app already and want to add dvui on top of it

Yes. i need to write a GLFW backend as well. then we can create an example using only dvui+vulkan-zig+(glfw/sdl)

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