gpu: add InstanceDescriptor slice helper
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
c3bb1683a6
commit
cb80cfc3c2
3 changed files with 13 additions and 2 deletions
|
|
@ -167,6 +167,7 @@ And, to initialize data structures with slices in them, the following helpers ar
|
|||
|
||||
* `BindGroupLayout.Descriptor.init`
|
||||
* `BindGroup.Descriptor.init`
|
||||
* `InstanceDescriptor.init`
|
||||
|
||||
### Typed callbacks
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ pub const BindGroup = opaque {
|
|||
next_in_chain: ?*const ChainedStruct = null,
|
||||
label: ?[*:0]const u8 = null,
|
||||
layout: *BindGroupLayout,
|
||||
// TODO: slice helper
|
||||
entry_count: u32 = 0,
|
||||
entries: ?[*]const Entry = null,
|
||||
|
||||
|
|
|
|||
|
|
@ -17,9 +17,20 @@ pub const EncoderInternalUsageDescriptor = extern struct {
|
|||
/// TODO: Can be chained in gpu.Instance.Descriptor
|
||||
pub const InstanceDescriptor = extern struct {
|
||||
chain: ChainedStruct,
|
||||
// TODO: slice helper
|
||||
additional_runtime_search_paths_count: u32 = 0,
|
||||
additional_runtime_search_paths: ?[*]const u8 = null,
|
||||
|
||||
/// Provides a slightly friendlier Zig API to initialize this structure.
|
||||
pub fn init(v: struct {
|
||||
chain: ChainedStruct,
|
||||
additional_runtime_search_paths: ?[]const u8 = null,
|
||||
}) InstanceDescriptor {
|
||||
return .{
|
||||
.chain = v.chain,
|
||||
.additional_runtime_search_paths_count = if (v.additional_runtime_search_paths) |e| @intCast(u32, e.len) else 0,
|
||||
.additional_runtime_search_paths = if (v.additional_runtime_search_paths) |e| e.ptr else null,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/// TODO: Can be chained in gpu.Texture.Descriptor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue