fixed many oversights

This commit is contained in:
Slashscreen
2025-02-12 15:06:22 -08:00
parent 02b19b115b
commit 2f82d4e325
3 changed files with 56 additions and 46 deletions
+8 -13
View File
@@ -1,22 +1,17 @@
package wgpu_sdl3_glue
import "vendor:sdl3"
import "vendor:wgpu"
import CA "vendor:darwin/QuartzCore"
import NS "core:sys/darwin/Foundation"
import "vendor:sdl3"
import "vendor:wgpu"
GetSurface :: proc(instance: wgpu.Instance, window: ^sdl3.Window) -> wgpu.Surface {
ns_window := cast(^NS.Window)sdl3.GetPointerProperty(sdl3.GetWindowProperties(window), sdl3.PROP_WINDOW_COCOA_WINDOW_POINTER, nil)
metal_layer := CA.MetalLayer_layer()
ns_window->contentView()->setLayer(metal_layer)
view := sdl3.Metal_CreateView(window)
metal_layer := sdl3.Metal_GetLayer(view)
return wgpu.InstanceCreateSurface(
instance,
&wgpu.SurfaceDescriptor{
nextInChain = &wgpu.SurfaceDescriptorFromMetalLayer{
chain = wgpu.ChainedStruct{
sType = .SurfaceDescriptorFromMetalLayer,
},
layer = rawptr(metal_layer),
&wgpu.SurfaceDescriptor {
nextInChain = &wgpu.SurfaceDescriptorFromMetalLayer {
chain = wgpu.ChainedStruct{sType = .SurfaceDescriptorFromMetalLayer},
layer = metal_layer,
},
},
)