Dawn native with WinAPI example: swap chain creation process.

Skip to first unread message

Jean-Colas Prunier

Dec 20, 2022, 9:28:34 AM12/20/22
to Dawn Graphics
Hi everyone,

To start with, thanks a lot to the great team behind Dawn. 

I have been struggling building an app on Widows + Vulkan without using GLFW (directly using WinAPI). My main issue is the whole process around the creation of the swap chain. I have struggling to understand how to use `dawn::native::vulkan::CreateNativeSwapChainImpl` and then later `wgpuDeviceCreateSwapChain`.

Would anybody have an example he/she could share? Many thanks.

Alternative question: is anybody "maintaining" documentation somewhere with respect to how Dawn is intended to be used (with examples, etc.)? I would be happy to contribute to that effort if someone is already leading that project. When you look for Dawn you land on the Google project page. I am super happy about the work put into that project (and very appreciative of it) but I could find any docs. So happy to aggregate info if this is of interest).

Corentin Wallez

Dec 20, 2022, 9:34:29 AM12/20/22
to Jean-Colas Prunier, Dawn Graphics
Hey Jean-Colas,

The swapchain APIs are a bit confusing because Dawn is in the middle of transitioning between two models, one with the NativeSwapChainImpl (deprecated and all around bad) and one with wgpu::Surface. What you should do is create a wgpu::Surface from an HWINDOW (like done here) then device.CreateSwapchain(surface, descriptorWithImplementationSetTo0). ManualSwapChainTests is a fairly complicated example that should work well. I'm not sure however if GLFW sets any specific options on the HWINDOW. Hopefully this helps!

We'd love to maintain a documentation on how to use Dawn's webgpu.h but at the moment all our efforts are aimed towards releasing a WebGPU v1, which should happen early next year. After that we'll want to finish any polish on webgpu.h and have better documentation for it. We know that right now there's a lot of guesswork involved, sorry about that!



You received this message because you are subscribed to the Google Groups "Dawn Graphics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dawn-graphic...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dawn-graphics/e7c09c94-5445-4dc0-9b35-e4a5096e1cb5n%40googlegroups.com.

Jean-Colas Prunier

Dec 20, 2022, 10:42:23 AM12/20/22
to Dawn Graphics
Hi Corentin,

Thanks for the swift reply and many thanks for the pointers and the info. Very valuable. I have had the "old way" version working. I will try the one you suggest.

No worries about the lack of doc. It's great to know you have the priority of releasing a v1 first. My proposition still stands though). I have been doing a lot of tech writing in the past (being the founder of scratchapixel.com) and will be happy to support your team in this work if necessary.

Looking forward to more of your work next year then. It's really a great project.
Reply all
Reply to author
0 new messages