gpu: make Surface.Descriptor.next_in_chain type-safe
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
8a0d47b94b
commit
ce8e062249
2 changed files with 65 additions and 16 deletions
|
|
@ -2,50 +2,62 @@ const ChainedStruct = @import("types.zig").ChainedStruct;
|
|||
const Impl = @import("interface.zig").Impl;
|
||||
|
||||
pub const Surface = opaque {
|
||||
pub const Extension = extern union {
|
||||
generic: ?*const ChainedStruct,
|
||||
from_android_native_window: *const DescriptorFromAndroidNativeWindow,
|
||||
from_canvas_html_selector: *const DescriptorFromCanvasHTMLSelector,
|
||||
from_metal_layer: *const DescriptorFromMetalLayer,
|
||||
from_wayland_surface: *const DescriptorFromWaylandSurface,
|
||||
from_windows_core_window: *const DescriptorFromWindowsCoreWindow,
|
||||
from_windows_hwnd: *const DescriptorFromWindowsHWND,
|
||||
from_windows_swap_chain_panel: *const DescriptorFromWindowsSwapChainPanel,
|
||||
from_xlib_window: *const DescriptorFromXlibWindow,
|
||||
};
|
||||
|
||||
pub const Descriptor = extern struct {
|
||||
next_in_chain: ?*const ChainedStruct = null,
|
||||
next_in_chain: Extension = .{ .generic = null },
|
||||
label: ?[*:0]const u8 = null,
|
||||
};
|
||||
|
||||
pub const DescriptorFromAndroidNativeWindow = extern struct {
|
||||
chain: ChainedStruct,
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .surface_descriptor_from_android_native_window },
|
||||
window: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromCanvasHTMLSelector = extern struct {
|
||||
chain: ChainedStruct,
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .surface_descriptor_from_canvas_html_selector },
|
||||
selector: [*:0]const u8,
|
||||
};
|
||||
|
||||
pub const DescriptorFromMetalLayer = extern struct {
|
||||
chain: ChainedStruct,
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .surface_descriptor_from_metal_layer },
|
||||
layer: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromWaylandSurface = extern struct {
|
||||
chain: ChainedStruct,
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .surface_descriptor_from_wayland_surface },
|
||||
display: *anyopaque,
|
||||
surface: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromWindowsCoreWindow = extern struct {
|
||||
chain: ChainedStruct,
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .surface_descriptor_from_windows_core_window },
|
||||
core_window: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromWindowsHWND = extern struct {
|
||||
chain: ChainedStruct,
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .surface_descriptor_from_windows_hwnd },
|
||||
hinstance: *anyopaque,
|
||||
hwnd: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromWindowsSwapChainPanel = extern struct {
|
||||
chain: ChainedStruct,
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .surface_descriptor_from_windows_swap_chain_panel },
|
||||
swap_chain_panel: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromXlibWindow = extern struct {
|
||||
chain: ChainedStruct,
|
||||
chain: ChainedStruct = .{ .next = null, .s_type = .surface_descriptor_from_xlib_window },
|
||||
display: *anyopaque,
|
||||
window: u32,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue