gpu: internalize Surface types
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
23fb836ce8
commit
9d367c3957
3 changed files with 52 additions and 53 deletions
|
|
@ -1,7 +1,6 @@
|
|||
const ChainedStruct = @import("types.zig").ChainedStruct;
|
||||
const RequestAdapterStatus = @import("types.zig").RequestAdapterStatus;
|
||||
const Surface = @import("surface.zig").Surface;
|
||||
const SurfaceDescriptor = @import("surface.zig").SurfaceDescriptor;
|
||||
const Adapter = @import("adapter.zig").Adapter;
|
||||
const RequestAdapterOptions = @import("main.zig").RequestAdapterOptions;
|
||||
const RequestAdapterCallback = @import("callbacks.zig").RequestAdapterCallback;
|
||||
|
|
@ -12,7 +11,7 @@ pub const Instance = opaque {
|
|||
next_in_chain: ?*const ChainedStruct = null,
|
||||
};
|
||||
|
||||
pub inline fn createSurface(instance: *Instance, descriptor: *const SurfaceDescriptor) *Surface {
|
||||
pub inline fn createSurface(instance: *Instance, descriptor: *const Surface.Descriptor) *Surface {
|
||||
return Impl.instanceCreateSurface(instance, descriptor);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ pub fn Interface(comptime T: type) type {
|
|||
assertDecl(T, "externalTextureSetLabel", fn (external_texture: *gpu.ExternalTexture, label: [*:0]const u8) callconv(.Inline) void);
|
||||
assertDecl(T, "externalTextureReference", fn (external_texture: *gpu.ExternalTexture) callconv(.Inline) void);
|
||||
assertDecl(T, "externalTextureRelease", fn (external_texture: *gpu.ExternalTexture) callconv(.Inline) void);
|
||||
assertDecl(T, "instanceCreateSurface", fn (instance: *gpu.Instance, descriptor: *const gpu.SurfaceDescriptor) callconv(.Inline) *gpu.Surface);
|
||||
assertDecl(T, "instanceCreateSurface", fn (instance: *gpu.Instance, descriptor: *const gpu.Surface.Descriptor) callconv(.Inline) *gpu.Surface);
|
||||
assertDecl(T, "instanceRequestAdapter", fn (instance: *gpu.Instance, options: *const gpu.RequestAdapterOptions, callback: gpu.RequestAdapterCallback, userdata: *anyopaque) callconv(.Inline) void);
|
||||
assertDecl(T, "instanceReference", fn (instance: *gpu.Instance) callconv(.Inline) void);
|
||||
assertDecl(T, "instanceRelease", fn (instance: *gpu.Instance) callconv(.Inline) void);
|
||||
|
|
@ -739,7 +739,7 @@ pub fn Export(comptime T: type) type {
|
|||
}
|
||||
|
||||
// WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor);
|
||||
export fn wgpuInstanceCreateSurface(instance: *gpu.Instance, descriptor: *const gpu.SurfaceDescriptor) *gpu.Surface {
|
||||
export fn wgpuInstanceCreateSurface(instance: *gpu.Instance, descriptor: *const gpu.Surface.Descriptor) *gpu.Surface {
|
||||
return T.instanceCreateSurface(instance, descriptor);
|
||||
}
|
||||
|
||||
|
|
@ -1844,7 +1844,7 @@ pub const StubInterface = Interface(struct {
|
|||
unreachable;
|
||||
}
|
||||
|
||||
pub inline fn instanceCreateSurface(instance: *gpu.Instance, descriptor: *const gpu.SurfaceDescriptor) *gpu.Surface {
|
||||
pub inline fn instanceCreateSurface(instance: *gpu.Instance, descriptor: *const gpu.Surface.Descriptor) *gpu.Surface {
|
||||
_ = instance;
|
||||
_ = descriptor;
|
||||
unreachable;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,54 @@ const ChainedStruct = @import("types.zig").ChainedStruct;
|
|||
const Impl = @import("interface.zig").Impl;
|
||||
|
||||
pub const Surface = opaque {
|
||||
pub const Descriptor = extern struct {
|
||||
next_in_chain: ?*const ChainedStruct = null,
|
||||
label: ?[*:0]const u8 = null,
|
||||
};
|
||||
|
||||
pub const DescriptorFromAndroidNativeWindow = extern struct {
|
||||
chain: ChainedStruct,
|
||||
window: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromCanvasHTMLSelector = extern struct {
|
||||
chain: ChainedStruct,
|
||||
selector: [*:0]const u8,
|
||||
};
|
||||
|
||||
pub const DescriptorFromMetalLayer = extern struct {
|
||||
chain: ChainedStruct,
|
||||
layer: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromWaylandSurface = extern struct {
|
||||
chain: ChainedStruct,
|
||||
display: *anyopaque,
|
||||
surface: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromWindowsCoreWindow = extern struct {
|
||||
chain: ChainedStruct,
|
||||
core_window: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromWindowsHWND = extern struct {
|
||||
chain: ChainedStruct,
|
||||
hinstance: *anyopaque,
|
||||
hwnd: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromWindowsSwapChainPanel = extern struct {
|
||||
chain: ChainedStruct,
|
||||
swap_chain_panel: *anyopaque,
|
||||
};
|
||||
|
||||
pub const DescriptorFromXlibWindow = extern struct {
|
||||
chain: ChainedStruct,
|
||||
display: *anyopaque,
|
||||
window: u32,
|
||||
};
|
||||
|
||||
pub inline fn reference(surface: *Surface) void {
|
||||
Impl.surfaceReference(surface);
|
||||
}
|
||||
|
|
@ -10,51 +58,3 @@ pub const Surface = opaque {
|
|||
Impl.surfaceRelease(surface);
|
||||
}
|
||||
};
|
||||
|
||||
pub const SurfaceDescriptor = extern struct {
|
||||
next_in_chain: ?*const ChainedStruct = null,
|
||||
label: ?[*:0]const u8 = null,
|
||||
};
|
||||
|
||||
pub const SurfaceDescriptorFromAndroidNativeWindow = extern struct {
|
||||
chain: ChainedStruct,
|
||||
window: *anyopaque,
|
||||
};
|
||||
|
||||
pub const SurfaceDescriptorFromCanvasHTMLSelector = extern struct {
|
||||
chain: ChainedStruct,
|
||||
selector: [*:0]const u8,
|
||||
};
|
||||
|
||||
pub const SurfaceDescriptorFromMetalLayer = extern struct {
|
||||
chain: ChainedStruct,
|
||||
layer: *anyopaque,
|
||||
};
|
||||
|
||||
pub const SurfaceDescriptorFromWaylandSurface = extern struct {
|
||||
chain: ChainedStruct,
|
||||
display: *anyopaque,
|
||||
surface: *anyopaque,
|
||||
};
|
||||
|
||||
pub const SurfaceDescriptorFromWindowsCoreWindow = extern struct {
|
||||
chain: ChainedStruct,
|
||||
core_window: *anyopaque,
|
||||
};
|
||||
|
||||
pub const SurfaceDescriptorFromWindowsHWND = extern struct {
|
||||
chain: ChainedStruct,
|
||||
hinstance: *anyopaque,
|
||||
hwnd: *anyopaque,
|
||||
};
|
||||
|
||||
pub const SurfaceDescriptorFromWindowsSwapChainPanel = extern struct {
|
||||
chain: ChainedStruct,
|
||||
swap_chain_panel: *anyopaque,
|
||||
};
|
||||
|
||||
pub const SurfaceDescriptorFromXlibWindow = extern struct {
|
||||
chain: ChainedStruct,
|
||||
display: *anyopaque,
|
||||
window: u32,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue