gpu: rename native -> NativeInstance

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-06 19:50:47 -07:00 committed by Stephen Gutekanst
parent 5656d3252a
commit 9888d8fe36
2 changed files with 20 additions and 7 deletions

View file

@ -2,12 +2,18 @@
const c = @import("c.zig").c;
const Interface = @import("Interface.zig");
/// Returns a native webgpu.h implementation of the gpu.Interface, wrapping the given WGPUInstance.
pub fn native(instance: c.WGPUInstance) Interface {
// TODO: implement Interface
_ = instance;
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");
// TODO: implement Interface
// TODO: implement Device interface
// TODO: implement Adapter interface:
@ -18,3 +24,8 @@ pub fn native(instance: c.WGPUInstance) Interface {
// WGPU_EXPORT bool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits * limits);
// 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 };
}

View file

@ -17,7 +17,7 @@
//!
const std = @import("std");
const Interface = @import("Interface.zig");
const native = @import("native.zig").native;
const NativeInstance = @import("NativeInstance.zig");
const Adapter = @import("Adapter.zig");
const Device = @import("Device.zig");
@ -26,10 +26,12 @@ const FeatureName = @import("feature_name.zig").FeatureName;
const SupportedLimits = @import("supported_limits.zig").SupportedLimits;
test "syntax" {
_ = Interface;
_ = NativeInstance;
_ = Adapter;
_ = Device;
_ = Interface;
_ = native;
_ = FeatureName;
_ = SupportedLimits;
}