vendor:vulkan Use vendor:x11/xlib types when available

This commit is contained in:
fleandro
2024-12-31 02:44:42 +00:00
parent 0d0a202a78
commit 98967aad74
2 changed files with 30 additions and 6 deletions
+15 -3
View File
@@ -58,7 +58,6 @@ OPAQUE_STRUCTS = """
wl_surface :: struct {} // Opaque struct defined by Wayland wl_surface :: struct {} // Opaque struct defined by Wayland
wl_display :: struct {} // Opaque struct defined by Wayland wl_display :: struct {} // Opaque struct defined by Wayland
xcb_connection_t :: struct {} // Opaque struct defined by xcb xcb_connection_t :: struct {} // Opaque struct defined by xcb
XlibDisplay :: struct {} // Opaque struct defined by Xlib
IOSurfaceRef :: struct {} // Opaque struct defined by Apples CoreGraphics framework IOSurfaceRef :: struct {} // Opaque struct defined by Apples CoreGraphics framework
""" """
@@ -901,6 +900,10 @@ import "core:c"
import win32 "core:sys/windows" import win32 "core:sys/windows"
_ :: win32 _ :: win32
import "vendor:x11/xlib"
_ :: xlib
when ODIN_OS == .Windows { when ODIN_OS == .Windows {
\tHINSTANCE :: win32.HINSTANCE \tHINSTANCE :: win32.HINSTANCE
\tHWND :: win32.HWND \tHWND :: win32.HWND
@@ -926,10 +929,19 @@ when ODIN_OS == .Windows {
\t} \t}
} }
// We want to use `vendor:x11/xlib` types so we need to match their build constraints.
when ODIN_OS == .Linux || ODIN_OS == .FreeBSD || ODIN_OS == .OpenBSD {
\tXlibDisplay :: xlib.Display
\tXlibWindow :: xlib.Window
\tXlibVisualID :: xlib.VisualID
} else {
\tXlibDisplay :: struct {} // Opaque struct defined by Xlib
\tXlibWindow :: c.ulong
\tXlibVisualID :: c.ulong
}
xcb_visualid_t :: u32 xcb_visualid_t :: u32
xcb_window_t :: u32 xcb_window_t :: u32
XlibWindow :: uint
XlibVisualID :: uint
CAMetalLayer :: struct {} CAMetalLayer :: struct {}
MTLBuffer_id :: rawptr MTLBuffer_id :: rawptr
+15 -3
View File
@@ -7,6 +7,10 @@ import "core:c"
import win32 "core:sys/windows" import win32 "core:sys/windows"
_ :: win32 _ :: win32
import "vendor:x11/xlib"
_ :: xlib
when ODIN_OS == .Windows { when ODIN_OS == .Windows {
HINSTANCE :: win32.HINSTANCE HINSTANCE :: win32.HINSTANCE
HWND :: win32.HWND HWND :: win32.HWND
@@ -32,10 +36,19 @@ when ODIN_OS == .Windows {
} }
} }
// We want to use `vendor:x11/xlib` types so we need to match their build constraints.
when ODIN_OS == .Linux || ODIN_OS == .FreeBSD || ODIN_OS == .OpenBSD {
XlibDisplay :: xlib.Display
XlibWindow :: xlib.Window
XlibVisualID :: xlib.VisualID
} else {
XlibDisplay :: struct {} // Opaque struct defined by Xlib
XlibWindow :: c.ulong
XlibVisualID :: c.ulong
}
xcb_visualid_t :: u32 xcb_visualid_t :: u32
xcb_window_t :: u32 xcb_window_t :: u32
XlibWindow :: uint
XlibVisualID :: uint
CAMetalLayer :: struct {} CAMetalLayer :: struct {}
MTLBuffer_id :: rawptr MTLBuffer_id :: rawptr
@@ -9776,7 +9789,6 @@ VideoEncodeH265ReferenceInfo :: struct {
wl_surface :: struct {} // Opaque struct defined by Wayland wl_surface :: struct {} // Opaque struct defined by Wayland
wl_display :: struct {} // Opaque struct defined by Wayland wl_display :: struct {} // Opaque struct defined by Wayland
xcb_connection_t :: struct {} // Opaque struct defined by xcb xcb_connection_t :: struct {} // Opaque struct defined by xcb
XlibDisplay :: struct {} // Opaque struct defined by Xlib
IOSurfaceRef :: struct {} // Opaque struct defined by Apples CoreGraphics framework IOSurfaceRef :: struct {} // Opaque struct defined by Apples CoreGraphics framework
// Aliases // Aliases
PhysicalDeviceVariablePointerFeatures :: PhysicalDeviceVariablePointersFeatures PhysicalDeviceVariablePointerFeatures :: PhysicalDeviceVariablePointersFeatures