gpu: internalize QuerySet types

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-29 23:51:13 -07:00 committed by Stephen Gutekanst
parent 1a57ae1c4d
commit f4a6e08357
3 changed files with 14 additions and 15 deletions

View file

@ -8,7 +8,6 @@ const ComputePipeline = @import("compute_pipeline.zig").ComputePipeline;
const ExternalTexture = @import("external_texture.zig").ExternalTexture;
const PipelineLayout = @import("pipeline_layout.zig").PipelineLayout;
const QuerySet = @import("query_set.zig").QuerySet;
const QuerySetDescriptor = @import("query_set.zig").QuerySetDescriptor;
const RenderBundleEncoder = @import("render_bundle_encoder.zig").RenderBundleEncoder;
const RenderBundleEncoderDescriptor = @import("render_bundle_encoder.zig").RenderBundleEncoderDescriptor;
const RenderPipeline = @import("render_pipeline.zig").RenderPipeline;
@ -95,7 +94,7 @@ pub const Device = opaque {
return Impl.deviceCreatePipelineLayout(device, pipeline_layout_descriptor);
}
pub inline fn createQuerySet(device: *Device, descriptor: *const QuerySetDescriptor) *QuerySet {
pub inline fn createQuerySet(device: *Device, descriptor: *const QuerySet.Descriptor) *QuerySet {
return Impl.deviceCreateQuerySet(device, descriptor);
}

View file

@ -89,7 +89,7 @@ pub fn Interface(comptime T: type) type {
assertDecl(T, "deviceCreateErrorExternalTexture", fn (device: *gpu.Device) callconv(.Inline) *gpu.ExternalTexture);
assertDecl(T, "deviceCreateExternalTexture", fn (device: *gpu.Device, external_texture_descriptor: *const gpu.ExternalTexture.Descriptor) callconv(.Inline) *gpu.ExternalTexture);
assertDecl(T, "deviceCreatePipelineLayout", fn (device: *gpu.Device, pipeline_layout_descriptor: *const gpu.PipelineLayout.Descriptor) callconv(.Inline) *gpu.PipelineLayout);
assertDecl(T, "deviceCreateQuerySet", fn (device: *gpu.Device, descriptor: *const gpu.QuerySetDescriptor) callconv(.Inline) *gpu.QuerySet);
assertDecl(T, "deviceCreateQuerySet", fn (device: *gpu.Device, descriptor: *const gpu.QuerySet.Descriptor) callconv(.Inline) *gpu.QuerySet);
assertDecl(T, "deviceCreateRenderBundleEncoder", fn (device: *gpu.Device, descriptor: *const gpu.RenderBundleEncoderDescriptor) callconv(.Inline) *gpu.RenderBundleEncoder);
assertDecl(T, "deviceCreateRenderPipeline", fn (device: *gpu.Device, descriptor: *const gpu.RenderPipelineDescriptor) callconv(.Inline) *gpu.RenderPipeline);
assertDecl(T, "deviceCreateRenderPipelineAsync", fn (device: *gpu.Device, descriptor: *const gpu.RenderPipelineDescriptor, callback: gpu.CreateRenderPipelineAsyncCallback, userdata: *anyopaque) callconv(.Inline) void);
@ -599,7 +599,7 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPUQuerySet wgpuDeviceCreateQuerySet(WGPUDevice device, WGPUQuerySetDescriptor const * descriptor);
export fn wgpuDeviceCreateQuerySet(device: *gpu.Device, descriptor: *const gpu.QuerySetDescriptor) *gpu.QuerySet {
export fn wgpuDeviceCreateQuerySet(device: *gpu.Device, descriptor: *const gpu.QuerySet.Descriptor) *gpu.QuerySet {
return T.deviceCreateQuerySet(device, descriptor);
}
@ -1677,7 +1677,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn deviceCreateQuerySet(device: *gpu.Device, descriptor: *const gpu.QuerySetDescriptor) *gpu.QuerySet {
pub inline fn deviceCreateQuerySet(device: *gpu.Device, descriptor: *const gpu.QuerySet.Descriptor) *gpu.QuerySet {
_ = device;
_ = descriptor;
unreachable;

View file

@ -4,6 +4,16 @@ const QueryType = @import("types.zig").QueryType;
const Impl = @import("interface.zig").Impl;
pub const QuerySet = opaque {
pub const Descriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
type: QueryType,
count: u32,
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
pipeline_statistics: ?[*]const PipelineStatisticName = null,
pipeline_statistics_count: u32 = 0,
};
pub inline fn destroy(query_set: *QuerySet) void {
Impl.querySetDestroy(query_set);
}
@ -28,13 +38,3 @@ pub const QuerySet = opaque {
Impl.querySetRelease(query_set);
}
};
pub const QuerySetDescriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
type: QueryType,
count: u32,
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
pipeline_statistics: ?[*]const PipelineStatisticName = null,
pipeline_statistics_count: u32 = 0,
};