gpu: add QuerySet.Descriptor.init slice helper
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
aaa194c5eb
commit
c82f640296
2 changed files with 19 additions and 1 deletions
|
|
@ -171,6 +171,7 @@ And, to initialize data structures with slices in them, the following helpers ar
|
||||||
* `TogglesDeviceDescriptor.init`
|
* `TogglesDeviceDescriptor.init`
|
||||||
* `Device.Descriptor.init`
|
* `Device.Descriptor.init`
|
||||||
* `PipelineLayout.Descriptor.init`
|
* `PipelineLayout.Descriptor.init`
|
||||||
|
* `QuerySet.Descriptor.init`
|
||||||
|
|
||||||
### Typed callbacks
|
### Typed callbacks
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,26 @@ pub const QuerySet = opaque {
|
||||||
label: ?[*:0]const u8 = null,
|
label: ?[*:0]const u8 = null,
|
||||||
type: QueryType,
|
type: QueryType,
|
||||||
count: u32,
|
count: u32,
|
||||||
// TODO: slice helper
|
|
||||||
pipeline_statistics: ?[*]const PipelineStatisticName = null,
|
pipeline_statistics: ?[*]const PipelineStatisticName = null,
|
||||||
pipeline_statistics_count: u32 = 0,
|
pipeline_statistics_count: u32 = 0,
|
||||||
|
|
||||||
|
/// Provides a slightly friendlier Zig API to initialize this structure.
|
||||||
|
pub inline fn init(v: struct {
|
||||||
|
next_in_chain: ?*const ChainedStruct = null,
|
||||||
|
label: ?[*:0]const u8 = null,
|
||||||
|
type: QueryType,
|
||||||
|
count: u32,
|
||||||
|
pipeline_statistics: ?[]const PipelineStatisticName = null,
|
||||||
|
}) Descriptor {
|
||||||
|
return .{
|
||||||
|
.next_in_chain = v.next_in_chain,
|
||||||
|
.label = v.label,
|
||||||
|
.type = v.type,
|
||||||
|
.count = v.count,
|
||||||
|
.pipeline_statistics_count = if (v.pipeline_statistics) |e| @intCast(u32, e.len) else 0,
|
||||||
|
.pipeline_statistics = if (v.pipeline_statistics) |e| e.ptr else null,
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub inline fn destroy(query_set: *QuerySet) void {
|
pub inline fn destroy(query_set: *QuerySet) void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue