gpu: cleanup Instance import
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
7e9e617860
commit
2e445affe2
1 changed files with 3 additions and 5 deletions
|
|
@ -1,5 +1,3 @@
|
||||||
// TODO: use via gpu.Instance instead
|
|
||||||
const Instance = @import("instance.zig").Instance;
|
|
||||||
const gpu = @import("main.zig");
|
const gpu = @import("main.zig");
|
||||||
|
|
||||||
/// The gpu.Interface implementation that is used by the entire program. Only one may exist, since
|
/// The gpu.Interface implementation that is used by the entire program. Only one may exist, since
|
||||||
|
|
@ -17,7 +15,7 @@ pub const Impl = blk: {
|
||||||
|
|
||||||
/// Verifies that a gpu.Interface implementation exposes the expected function declarations.
|
/// Verifies that a gpu.Interface implementation exposes the expected function declarations.
|
||||||
pub fn Interface(comptime T: type) type {
|
pub fn Interface(comptime T: type) type {
|
||||||
assertDecl(T, "createInstance", fn (descriptor: ?*const Instance.Descriptor) callconv(.Inline) ?*Instance);
|
assertDecl(T, "createInstance", fn (descriptor: ?*const gpu.Instance.Descriptor) callconv(.Inline) ?*gpu.Instance);
|
||||||
assertDecl(T, "getProcAddress", fn (device: *gpu.Device, proc_name: [*:0]const u8) callconv(.Inline) ?gpu.Proc);
|
assertDecl(T, "getProcAddress", fn (device: *gpu.Device, proc_name: [*:0]const u8) callconv(.Inline) ?gpu.Proc);
|
||||||
assertDecl(T, "adapterCreateDevice", fn (adapter: *gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) callconv(.Inline) ?*gpu.Device);
|
assertDecl(T, "adapterCreateDevice", fn (adapter: *gpu.Adapter, descriptor: ?*const gpu.DeviceDescriptor) callconv(.Inline) ?*gpu.Device);
|
||||||
assertDecl(T, "adapterEnumerateFeatures", fn (adapter: *gpu.Adapter, features: ?[*]gpu.FeatureName) callconv(.Inline) usize);
|
assertDecl(T, "adapterEnumerateFeatures", fn (adapter: *gpu.Adapter, features: ?[*]gpu.FeatureName) callconv(.Inline) usize);
|
||||||
|
|
@ -228,7 +226,7 @@ pub fn Export(comptime T: type) type {
|
||||||
_ = Interface(T); // verify implementation is a valid interface
|
_ = Interface(T); // verify implementation is a valid interface
|
||||||
return struct {
|
return struct {
|
||||||
// WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPUInstanceDescriptor const * descriptor);
|
// WGPU_EXPORT WGPUInstance wgpuCreateInstance(WGPUInstanceDescriptor const * descriptor);
|
||||||
export fn wgpuCreateInstance(descriptor: ?*const Instance.Descriptor) ?*Instance {
|
export fn wgpuCreateInstance(descriptor: ?*const gpu.Instance.Descriptor) ?*gpu.Instance {
|
||||||
return T.createInstance(descriptor);
|
return T.createInstance(descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1221,7 +1219,7 @@ pub fn Export(comptime T: type) type {
|
||||||
|
|
||||||
/// A stub gpu.Interface in which every function is implemented by `unreachable;`
|
/// A stub gpu.Interface in which every function is implemented by `unreachable;`
|
||||||
pub const StubInterface = Interface(struct {
|
pub const StubInterface = Interface(struct {
|
||||||
pub inline fn createInstance(descriptor: ?*const Instance.Descriptor) ?*Instance {
|
pub inline fn createInstance(descriptor: ?*const gpu.Instance.Descriptor) ?*gpu.Instance {
|
||||||
_ = descriptor;
|
_ = descriptor;
|
||||||
unreachable;
|
unreachable;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue