mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
wgpu: update to v24.0.0
This commit is contained in:
Vendored
+6
-6
@@ -1,6 +1,6 @@
|
||||
#+build !linux
|
||||
#+build !windows
|
||||
#+build !darwin
|
||||
package wgpu_sdl3_glue
|
||||
|
||||
#panic("package wgpu/sdl3glue is not supported on the current target")
|
||||
#+build !linux
|
||||
#+build !windows
|
||||
#+build !darwin
|
||||
package wgpu_sdl3_glue
|
||||
|
||||
#panic("package wgpu/sdl3glue is not supported on the current target")
|
||||
|
||||
+21
-18
@@ -1,18 +1,21 @@
|
||||
package wgpu_sdl3_glue
|
||||
|
||||
import "vendor:sdl3"
|
||||
import "vendor:wgpu"
|
||||
|
||||
GetSurface :: proc(instance: wgpu.Instance, window: ^sdl3.Window) -> wgpu.Surface {
|
||||
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 = metal_layer,
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
package wgpu_sdl3_glue
|
||||
|
||||
import "vendor:sdl3"
|
||||
import "vendor:wgpu"
|
||||
|
||||
GetSurface :: proc(instance: wgpu.Instance, window: ^sdl3.Window) -> wgpu.Surface {
|
||||
view := sdl3.Metal_CreateView(window)
|
||||
layer := sdl3.Metal_GetLayer(view)
|
||||
|
||||
return wgpu.InstanceCreateSurface(
|
||||
instance,
|
||||
&wgpu.SurfaceDescriptor{
|
||||
nextInChain = &wgpu.SurfaceSourceMetalLayer{
|
||||
chain = wgpu.ChainedStruct{
|
||||
sType = .SurfaceSourceMetalLayer,
|
||||
},
|
||||
layer = layer,
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Vendored
+37
-54
@@ -1,54 +1,37 @@
|
||||
package wgpu_sdl3_glue
|
||||
|
||||
import "vendor:sdl3"
|
||||
import "vendor:wgpu"
|
||||
|
||||
|
||||
GetSurface :: proc(instance: wgpu.Instance, window: ^sdl3.Window) -> wgpu.Surface {
|
||||
switch sdl3.GetCurrentVideoDriver() {
|
||||
case "x11":
|
||||
display := sdl3.GetPointerProperty(
|
||||
sdl3.GetWindowProperties(window),
|
||||
sdl3.PROP_WINDOW_X11_DISPLAY_POINTER,
|
||||
nil,
|
||||
)
|
||||
x_window := sdl3.GetNumberProperty(
|
||||
sdl3.GetWindowProperties(window),
|
||||
sdl3.PROP_WINDOW_X11_WINDOW_NUMBER,
|
||||
0,
|
||||
)
|
||||
return wgpu.InstanceCreateSurface(
|
||||
instance,
|
||||
&wgpu.SurfaceDescriptor {
|
||||
nextInChain = &wgpu.SurfaceDescriptorFromXlibWindow {
|
||||
chain = {sType = .SurfaceDescriptorFromXlibWindow},
|
||||
display = display,
|
||||
window = u64(x_window),
|
||||
},
|
||||
},
|
||||
)
|
||||
case "wayland":
|
||||
display := sdl3.GetPointerProperty(
|
||||
sdl3.GetWindowProperties(window),
|
||||
sdl3.PROP_WINDOW_WAYLAND_DISPLAY_POINTER,
|
||||
nil,
|
||||
)
|
||||
w_surface := sdl3.GetPointerProperty(
|
||||
sdl3.GetWindowProperties(window),
|
||||
sdl3.PROP_WINDOW_WAYLAND_SURFACE_POINTER,
|
||||
nil,
|
||||
)
|
||||
return wgpu.InstanceCreateSurface(
|
||||
instance,
|
||||
&wgpu.SurfaceDescriptor {
|
||||
nextInChain = &wgpu.SurfaceDescriptorFromWaylandSurface {
|
||||
chain = {sType = .SurfaceDescriptorFromWaylandSurface},
|
||||
display = display,
|
||||
surface = w_surface,
|
||||
},
|
||||
},
|
||||
)
|
||||
case:
|
||||
panic("wgpu sdl3 glue: unsupported platform, expected Wayland or X11")
|
||||
}
|
||||
}
|
||||
package wgpu_sdl3_glue
|
||||
|
||||
import "vendor:sdl3"
|
||||
import "vendor:wgpu"
|
||||
|
||||
GetSurface :: proc(instance: wgpu.Instance, window: ^sdl3.Window) -> wgpu.Surface {
|
||||
switch sdl3.GetCurrentVideoDriver() {
|
||||
case "wayland":
|
||||
return wgpu.InstanceCreateSurface(
|
||||
instance,
|
||||
&wgpu.SurfaceDescriptor{
|
||||
nextInChain = &wgpu.SurfaceSourceWaylandSurface{
|
||||
chain = {
|
||||
sType = .SurfaceSourceWaylandSurface,
|
||||
},
|
||||
display = sdl3.GetPointerProperty(sdl3.GetWindowProperties(window), sdl3.PROP_WINDOW_WAYLAND_DISPLAY_POINTER, nil),
|
||||
surface = sdl3.GetPointerProperty(sdl3.GetWindowProperties(window), sdl3.PROP_WINDOW_WAYLAND_SURFACE_POINTER, nil),
|
||||
},
|
||||
},
|
||||
)
|
||||
case "x11":
|
||||
return wgpu.InstanceCreateSurface(
|
||||
instance,
|
||||
&wgpu.SurfaceDescriptor{
|
||||
nextInChain = &wgpu.SurfaceSourceXlibWindow{
|
||||
chain = {
|
||||
sType = .SurfaceSourceXlibWindow,
|
||||
},
|
||||
display = sdl3.GetPointerProperty(sdl3.GetWindowProperties(window), sdl3.PROP_WINDOW_X11_DISPLAY_POINTER, nil),
|
||||
window = cast(u64)sdl3.GetNumberProperty(sdl3.GetWindowProperties(window), sdl3.PROP_WINDOW_X11_WINDOW_NUMBER, 0),
|
||||
},
|
||||
},
|
||||
)
|
||||
case:
|
||||
panic("wgpu sdl3 glue: unsupported video driver, expected Wayland or X11")
|
||||
}
|
||||
}
|
||||
|
||||
+19
-29
@@ -1,29 +1,19 @@
|
||||
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 := sdl3.GetPointerProperty(
|
||||
sdl3.GetWindowProperties(window),
|
||||
sdl3.PROP_WINDOW_WIN32_INSTANCE_POINTER,
|
||||
nil,
|
||||
)
|
||||
return wgpu.InstanceCreateSurface(
|
||||
instance,
|
||||
&wgpu.SurfaceDescriptor {
|
||||
nextInChain = &wgpu.SurfaceDescriptorFromWindowsHWND {
|
||||
chain = wgpu.ChainedStruct{sType = .SurfaceDescriptorFromWindowsHWND},
|
||||
hinstance = hinstance,
|
||||
hwnd = hwnd,
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
package wgpu_sdl3_glue
|
||||
|
||||
import "vendor:sdl3"
|
||||
import "vendor:wgpu"
|
||||
|
||||
GetSurface :: proc(instance: wgpu.Instance, window: ^sdl3.Window) -> wgpu.Surface {
|
||||
return wgpu.InstanceCreateSurface(
|
||||
instance,
|
||||
&wgpu.SurfaceDescriptor{
|
||||
nextInChain = &wgpu.SurfaceSourceWindowsHWND{
|
||||
chain = wgpu.ChainedStruct{
|
||||
sType = .SurfaceSourceWindowsHWND,
|
||||
},
|
||||
hinstance = sdl3.GetPointerProperty(sdl3.GetWindowProperties(window), sdl3.PROP_WINDOW_WIN32_INSTANCE_POINTER, nil),
|
||||
hwnd = sdl3.GetPointerProperty(sdl3.GetWindowProperties(window), sdl3.PROP_WINDOW_WIN32_HWND_POINTER, nil),
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user