wgpu: add sdl3 glue

This commit is contained in:
Slashscreen
2025-02-12 14:27:16 -08:00
committed by GitHub
parent 435f77b16b
commit 02b19b115b
4 changed files with 97 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
package wgpu_sdl3_glue
import win "core:sys/windows"
import "vendor:sdl3"
import "vendor:wgpu"
GetSurface :: proc(instance: wgpu.Instance, window: ^sdl3.Window) -> wgpu.Surface {
hwnd := sdl3.GetPointerProperty(sdl3.GetWindowProperties(window), sdl3.PROP_WINDOW_WIN32_HWND_POINTER, nil)
hinstance := win.GetModuleHandleW(nil)
return wgpu.InstanceCreateSurface(
instance,
&wgpu.SurfaceDescriptor{
nextInChain = &wgpu.SurfaceDescriptorFromWindowsHWND{
chain = wgpu.ChainedStruct{
sType = .SurfaceDescriptorFromWindowsHWND,
},
hinstance = rawptr(hinstance),
hwnd = rawptr(hwnd),
},
},
)
}