-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsurface_linux.odin
More file actions
36 lines (31 loc) · 972 Bytes
/
Copy pathsurface_linux.odin
File metadata and controls
36 lines (31 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#+build linux
package application
// Core
import "vendor:glfw"
// Local packages
import "../gpu"
_window_get_gpu_surface :: proc(
window: Window,
instance: gpu.Instance,
loc := #caller_location,
) -> gpu.Surface {
impl := _window_get_impl(window, loc)
descriptor: gpu.Surface_Descriptor
switch glfw.GetPlatform() {
case glfw.PLATFORM_WAYLAND:
descriptor.label = "Wayland Surface"
descriptor.target = gpu.Surface_Source_Wayland_Surface {
display = glfw.GetWaylandDisplay(),
surface = glfw.GetWaylandWindow(impl.handle),
}
case glfw.PLATFORM_X11:
descriptor.label = "Xlib Window"
descriptor.target = gpu.Surface_Source_Xlib_Window {
display = glfw.GetX11Display(),
window = u64(glfw.GetX11Window(impl.handle)),
}
case:
panic("Unsupported platform", loc)
}
return gpu.instance_create_surface(instance, descriptor, loc)
}