gpu: prepare to implement Surface
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
9888d8fe36
commit
64e023c992
4 changed files with 74 additions and 8 deletions
|
|
@ -1,18 +1,29 @@
|
|||
//! A native webgpu.h implementation of the gpu.Interface
|
||||
const c = @import("c.zig").c;
|
||||
const Interface = @import("Interface.zig");
|
||||
const Surface = @import("Surface.zig");
|
||||
|
||||
const NativeInstance = @This();
|
||||
|
||||
/// The WGPUInstance that is wrapped by this native instance.
|
||||
instance: c.WGPUInstance,
|
||||
|
||||
/// Returns the gpu.Interface for interacting with this native instance.
|
||||
pub fn interface(native: NativeInstance) Interface {
|
||||
_ = native;
|
||||
@panic("not implemented");
|
||||
vtable: Interface.VTable,
|
||||
|
||||
/// Wraps a native WGPUInstance to provide an implementation of the gpu.Interface.
|
||||
pub fn wrap(instance: c.WGPUInstance) NativeInstance {
|
||||
return .{ .instance = instance };
|
||||
}
|
||||
|
||||
/// Returns the gpu.Interface for interacting with this native instance.
|
||||
pub fn interface(native: *const NativeInstance) Interface {
|
||||
return .{
|
||||
.ptr = native,
|
||||
.vtable = native.vtable,
|
||||
};
|
||||
// TODO: implement Interface
|
||||
// WGPU_EXPORT void wgpuInstanceReference(WGPUInstance instance);
|
||||
// WGPU_EXPORT void wgpuInstanceRelease(WGPUInstance instance);
|
||||
|
||||
// TODO: implement Device interface
|
||||
|
||||
|
|
@ -25,7 +36,9 @@ pub fn interface(native: NativeInstance) Interface {
|
|||
// WGPU_EXPORT void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties * properties);
|
||||
}
|
||||
|
||||
/// Wraps a native WGPUInstance to provide an implementation of the gpu.Interface.
|
||||
pub fn wrap(instance: c.WGPUInstance) NativeInstance {
|
||||
return .{ .instance = instance };
|
||||
pub fn createSurface(native: *const NativeInstance, descriptor: *const Surface.Descriptor) Surface {
|
||||
_ = native;
|
||||
_ = descriptor;
|
||||
// TODO:
|
||||
// WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue