gpu: add type-safety for chaining dawn.InstanceDescriptor

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-08-16 20:49:59 -07:00
parent 8462427524
commit 801d772752
2 changed files with 7 additions and 2 deletions

View file

@ -13,7 +13,6 @@ pub const EncoderInternalUsageDescriptor = extern struct {
use_internal_usages: bool = false,
};
/// TODO: Can be chained in gpu.Instance.Descriptor
pub const InstanceDescriptor = extern struct {
chain: ChainedStruct = .{ .next = null, .s_type = .dawn_instance_descriptor },
additional_runtime_search_paths_count: u32 = 0,

View file

@ -5,10 +5,16 @@ const Adapter = @import("adapter.zig").Adapter;
const RequestAdapterOptions = @import("types.zig").RequestAdapterOptions;
const RequestAdapterCallback = @import("callbacks.zig").RequestAdapterCallback;
const Impl = @import("interface.zig").Impl;
const dawn = @import("dawn.zig");
pub const Instance = opaque {
pub const Descriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
pub const NextInChain = extern union {
generic: ?*const ChainedStruct,
dawn_instance_descriptor: *const dawn.InstanceDescriptor,
};
next_in_chain: NextInChain = .{ .generic = null },
};
pub inline fn createSurface(instance: *Instance, descriptor: *const Surface.Descriptor) *Surface {