gpu: internalize PipelineLayout types

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

View file

@ -7,7 +7,6 @@ const CommandEncoder = @import("command_encoder.zig").CommandEncoder;
const ComputePipeline = @import("compute_pipeline.zig").ComputePipeline;
const ExternalTexture = @import("external_texture.zig").ExternalTexture;
const PipelineLayout = @import("pipeline_layout.zig").PipelineLayout;
const PipelineLayoutDescriptor = @import("pipeline_layout.zig").PipelineLayoutDescriptor;
const QuerySet = @import("query_set.zig").QuerySet;
const QuerySetDescriptor = @import("query_set.zig").QuerySetDescriptor;
const RenderBundleEncoder = @import("render_bundle_encoder.zig").RenderBundleEncoder;
@ -92,7 +91,7 @@ pub const Device = opaque {
return Impl.deviceCreateExternalTexture(device, external_texture_descriptor);
}
pub inline fn createPipelineLayout(device: *Device, pipeline_layout_descriptor: *const PipelineLayoutDescriptor) *PipelineLayout {
pub inline fn createPipelineLayout(device: *Device, pipeline_layout_descriptor: *const PipelineLayout.Descriptor) *PipelineLayout {
return Impl.deviceCreatePipelineLayout(device, pipeline_layout_descriptor);
}

View file

@ -88,7 +88,7 @@ pub fn Interface(comptime T: type) type {
assertDecl(T, "deviceCreateErrorBuffer", fn (device: *gpu.Device) callconv(.Inline) *gpu.Buffer);
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.PipelineLayoutDescriptor) callconv(.Inline) *gpu.PipelineLayout);
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, "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);
@ -594,7 +594,7 @@ pub fn Export(comptime T: type) type {
}
// WGPU_EXPORT WGPUPipelineLayout wgpuDeviceCreatePipelineLayout(WGPUDevice device, WGPUPipelineLayoutDescriptor const * descriptor);
export fn wgpuDeviceCreatePipelineLayout(device: *gpu.Device, pipeline_layout_descriptor: *const gpu.PipelineLayoutDescriptor) *gpu.PipelineLayout {
export fn wgpuDeviceCreatePipelineLayout(device: *gpu.Device, pipeline_layout_descriptor: *const gpu.PipelineLayout.Descriptor) *gpu.PipelineLayout {
return T.deviceCreatePipelineLayout(device, pipeline_layout_descriptor);
}
@ -1671,7 +1671,7 @@ pub const StubInterface = Interface(struct {
unreachable;
}
pub inline fn deviceCreatePipelineLayout(device: *gpu.Device, pipeline_layout_descriptor: *const gpu.PipelineLayoutDescriptor) *gpu.PipelineLayout {
pub inline fn deviceCreatePipelineLayout(device: *gpu.Device, pipeline_layout_descriptor: *const gpu.PipelineLayout.Descriptor) *gpu.PipelineLayout {
_ = device;
_ = pipeline_layout_descriptor;
unreachable;

View file

@ -3,6 +3,14 @@ const BindGroupLayout = @import("bind_group_layout.zig").BindGroupLayout;
const Impl = @import("interface.zig").Impl;
pub const PipelineLayout = opaque {
pub const Descriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
bind_group_layout_count: u32,
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
bind_group_layouts: ?[*]const *BindGroupLayout,
};
pub inline fn setLabel(pipeline_layout: *PipelineLayout, label: [*:0]const u8) void {
Impl.pipelineLayoutSetLabel(pipeline_layout, label);
}
@ -15,11 +23,3 @@ pub const PipelineLayout = opaque {
Impl.pipelineLayoutRelease(pipeline_layout);
}
};
pub const PipelineLayoutDescriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null,
bind_group_layout_count: u32,
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
bind_group_layouts: ?[*]const *BindGroupLayout,
};