gpu: convert *opaque -> opaque for BindGroupLayout

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-29 18:55:31 -07:00 committed by Stephen Gutekanst
parent 44377e2e27
commit 2ba4b9ff95
7 changed files with 27 additions and 27 deletions

View file

@ -32,7 +32,7 @@ pub const BindGroupEntry = extern struct {
pub const BindGroupDescriptor = extern struct { pub const BindGroupDescriptor = extern struct {
next_in_chain: ?*const ChainedStruct = null, next_in_chain: ?*const ChainedStruct = null,
label: ?[*:0]const u8 = null, label: ?[*:0]const u8 = null,
layout: BindGroupLayout, layout: *BindGroupLayout,
entry_count: u32, entry_count: u32,
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is. // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
entries: ?[*]const BindGroupEntry, entries: ?[*]const BindGroupEntry,

View file

@ -9,16 +9,16 @@ const TextureBindingLayout = @import("texture.zig").TextureBindingLayout;
const StorageTextureBindingLayout = @import("types.zig").StorageTextureBindingLayout; const StorageTextureBindingLayout = @import("types.zig").StorageTextureBindingLayout;
const Impl = @import("interface.zig").Impl; const Impl = @import("interface.zig").Impl;
pub const BindGroupLayout = *opaque { pub const BindGroupLayout = opaque {
pub inline fn setLabel(bind_group_layout: BindGroupLayout, label: [*:0]const u8) void { pub inline fn setLabel(bind_group_layout: *BindGroupLayout, label: [*:0]const u8) void {
Impl.bindGroupLayoutSetLabel(bind_group_layout, label); Impl.bindGroupLayoutSetLabel(bind_group_layout, label);
} }
pub inline fn reference(bind_group_layout: BindGroupLayout) void { pub inline fn reference(bind_group_layout: *BindGroupLayout) void {
Impl.bindGroupLayoutReference(bind_group_layout); Impl.bindGroupLayoutReference(bind_group_layout);
} }
pub inline fn release(bind_group_layout: BindGroupLayout) void { pub inline fn release(bind_group_layout: *BindGroupLayout) void {
Impl.bindGroupLayoutRelease(bind_group_layout); Impl.bindGroupLayoutRelease(bind_group_layout);
} }
}; };

View file

@ -5,7 +5,7 @@ const BindGroupLayout = @import("bind_group_layout.zig").BindGroupLayout;
const Impl = @import("interface.zig").Impl; const Impl = @import("interface.zig").Impl;
pub const ComputePipeline = *opaque { pub const ComputePipeline = *opaque {
pub inline fn getBindGroupLayout(compute_pipeline: ComputePipeline, group_index: u32) BindGroupLayout { pub inline fn getBindGroupLayout(compute_pipeline: ComputePipeline, group_index: u32) *BindGroupLayout {
return Impl.computePipelineGetBindGroupLayout(compute_pipeline, group_index); return Impl.computePipelineGetBindGroupLayout(compute_pipeline, group_index);
} }

View file

@ -46,7 +46,7 @@ pub const Device = *opaque {
return Impl.deviceCreateBindGroup(device, descriptor); return Impl.deviceCreateBindGroup(device, descriptor);
} }
pub inline fn createBindGroupLayout(device: Device, descriptor: *const BindGroupLayoutDescriptor) BindGroupLayout { pub inline fn createBindGroupLayout(device: Device, descriptor: *const BindGroupLayoutDescriptor) *BindGroupLayout {
return Impl.deviceCreateBindGroupLayout(device, descriptor); return Impl.deviceCreateBindGroupLayout(device, descriptor);
} }

View file

@ -30,9 +30,9 @@ pub fn Interface(comptime T: type) type {
assertDecl(T, "bindGroupSetLabel", fn (bind_group: gpu.BindGroup, label: [*:0]const u8) callconv(.Inline) void); assertDecl(T, "bindGroupSetLabel", fn (bind_group: gpu.BindGroup, label: [*:0]const u8) callconv(.Inline) void);
assertDecl(T, "bindGroupReference", fn (bind_group: gpu.BindGroup) callconv(.Inline) void); assertDecl(T, "bindGroupReference", fn (bind_group: gpu.BindGroup) callconv(.Inline) void);
assertDecl(T, "bindGroupRelease", fn (bind_group: gpu.BindGroup) callconv(.Inline) void); assertDecl(T, "bindGroupRelease", fn (bind_group: gpu.BindGroup) callconv(.Inline) void);
assertDecl(T, "bindGroupLayoutSetLabel", fn (bind_group_layout: gpu.BindGroupLayout, label: [*:0]const u8) callconv(.Inline) void); assertDecl(T, "bindGroupLayoutSetLabel", fn (bind_group_layout: *gpu.BindGroupLayout, label: [*:0]const u8) callconv(.Inline) void);
assertDecl(T, "bindGroupLayoutReference", fn (bind_group_layout: gpu.BindGroupLayout) callconv(.Inline) void); assertDecl(T, "bindGroupLayoutReference", fn (bind_group_layout: *gpu.BindGroupLayout) callconv(.Inline) void);
assertDecl(T, "bindGroupLayoutRelease", fn (bind_group_layout: gpu.BindGroupLayout) callconv(.Inline) void); assertDecl(T, "bindGroupLayoutRelease", fn (bind_group_layout: *gpu.BindGroupLayout) callconv(.Inline) void);
assertDecl(T, "bufferDestroy", fn (buffer: gpu.Buffer) callconv(.Inline) void); assertDecl(T, "bufferDestroy", fn (buffer: gpu.Buffer) callconv(.Inline) void);
assertDecl(T, "bufferGetConstMappedRange", fn (buffer: gpu.Buffer, offset: usize, size: usize) callconv(.Inline) ?*const anyopaque); assertDecl(T, "bufferGetConstMappedRange", fn (buffer: gpu.Buffer, offset: usize, size: usize) callconv(.Inline) ?*const anyopaque);
assertDecl(T, "bufferGetMappedRange", fn (buffer: gpu.Buffer, offset: usize, size: usize) callconv(.Inline) ?*anyopaque); assertDecl(T, "bufferGetMappedRange", fn (buffer: gpu.Buffer, offset: usize, size: usize) callconv(.Inline) ?*anyopaque);
@ -77,12 +77,12 @@ pub fn Interface(comptime T: type) type {
assertDecl(T, "computePassEncoderWriteTimestamp", fn (compute_pass_encoder: gpu.ComputePassEncoder, pipeline: gpu.ComputePipeline) callconv(.Inline) void); assertDecl(T, "computePassEncoderWriteTimestamp", fn (compute_pass_encoder: gpu.ComputePassEncoder, pipeline: gpu.ComputePipeline) callconv(.Inline) void);
assertDecl(T, "computePassEncoderReference", fn (compute_pass_encoder: gpu.ComputePassEncoder) callconv(.Inline) void); assertDecl(T, "computePassEncoderReference", fn (compute_pass_encoder: gpu.ComputePassEncoder) callconv(.Inline) void);
assertDecl(T, "computePassEncoderRelease", fn (compute_pass_encoder: gpu.ComputePassEncoder) callconv(.Inline) void); assertDecl(T, "computePassEncoderRelease", fn (compute_pass_encoder: gpu.ComputePassEncoder) callconv(.Inline) void);
assertDecl(T, "computePipelineGetBindGroupLayout", fn (compute_pipeline: gpu.ComputePipeline, group_index: u32) callconv(.Inline) gpu.BindGroupLayout); assertDecl(T, "computePipelineGetBindGroupLayout", fn (compute_pipeline: gpu.ComputePipeline, group_index: u32) callconv(.Inline) *gpu.BindGroupLayout);
assertDecl(T, "computePipelineSetLabel", fn (compute_pipeline: gpu.ComputePipeline, label: [*:0]const u8) callconv(.Inline) void); assertDecl(T, "computePipelineSetLabel", fn (compute_pipeline: gpu.ComputePipeline, label: [*:0]const u8) callconv(.Inline) void);
assertDecl(T, "computePipelineReference", fn (compute_pipeline: gpu.ComputePipeline) callconv(.Inline) void); assertDecl(T, "computePipelineReference", fn (compute_pipeline: gpu.ComputePipeline) callconv(.Inline) void);
assertDecl(T, "computePipelineRelease", fn (compute_pipeline: gpu.ComputePipeline) callconv(.Inline) void); assertDecl(T, "computePipelineRelease", fn (compute_pipeline: gpu.ComputePipeline) callconv(.Inline) void);
assertDecl(T, "deviceCreateBindGroup", fn (device: gpu.Device, descriptor: *const gpu.BindGroupDescriptor) callconv(.Inline) gpu.BindGroup); assertDecl(T, "deviceCreateBindGroup", fn (device: gpu.Device, descriptor: *const gpu.BindGroupDescriptor) callconv(.Inline) gpu.BindGroup);
assertDecl(T, "deviceCreateBindGroupLayout", fn (device: gpu.Device, descriptor: *const gpu.BindGroupLayoutDescriptor) callconv(.Inline) gpu.BindGroupLayout); assertDecl(T, "deviceCreateBindGroupLayout", fn (device: gpu.Device, descriptor: *const gpu.BindGroupLayoutDescriptor) callconv(.Inline) *gpu.BindGroupLayout);
assertDecl(T, "deviceCreateBuffer", fn (device: gpu.Device, descriptor: *const gpu.BufferDescriptor) callconv(.Inline) gpu.Buffer); assertDecl(T, "deviceCreateBuffer", fn (device: gpu.Device, descriptor: *const gpu.BufferDescriptor) callconv(.Inline) gpu.Buffer);
assertDecl(T, "deviceCreateCommandEncoder", fn (device: gpu.Device, descriptor: ?*const gpu.CommandEncoderDescriptor) callconv(.Inline) gpu.CommandEncoder); assertDecl(T, "deviceCreateCommandEncoder", fn (device: gpu.Device, descriptor: ?*const gpu.CommandEncoderDescriptor) callconv(.Inline) gpu.CommandEncoder);
assertDecl(T, "deviceCreateComputePipeline", fn (device: gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor) callconv(.Inline) gpu.ComputePipeline); assertDecl(T, "deviceCreateComputePipeline", fn (device: gpu.Device, descriptor: *const gpu.ComputePipelineDescriptor) callconv(.Inline) gpu.ComputePipeline);
@ -180,7 +180,7 @@ pub fn Interface(comptime T: type) type {
assertDecl(T, "renderPassEncoderWriteTimestamp", fn (render_pass_encoder: gpu.RenderPassEncoder, query_set: gpu.QuerySet, query_index: u32) callconv(.Inline) void); assertDecl(T, "renderPassEncoderWriteTimestamp", fn (render_pass_encoder: gpu.RenderPassEncoder, query_set: gpu.QuerySet, query_index: u32) callconv(.Inline) void);
assertDecl(T, "renderPassEncoderReference", fn (render_pass_encoder: gpu.RenderPassEncoder) callconv(.Inline) void); assertDecl(T, "renderPassEncoderReference", fn (render_pass_encoder: gpu.RenderPassEncoder) callconv(.Inline) void);
assertDecl(T, "renderPassEncoderRelease", fn (render_pass_encoder: gpu.RenderPassEncoder) callconv(.Inline) void); assertDecl(T, "renderPassEncoderRelease", fn (render_pass_encoder: gpu.RenderPassEncoder) callconv(.Inline) void);
assertDecl(T, "renderPipelineGetBindGroupLayout", fn (render_pipeline: gpu.RenderPipeline, group_index: u32) callconv(.Inline) gpu.BindGroupLayout); assertDecl(T, "renderPipelineGetBindGroupLayout", fn (render_pipeline: gpu.RenderPipeline, group_index: u32) callconv(.Inline) *gpu.BindGroupLayout);
assertDecl(T, "renderPipelineSetLabel", fn (render_pipeline: gpu.RenderPipeline, label: [*:0]const u8) callconv(.Inline) void); assertDecl(T, "renderPipelineSetLabel", fn (render_pipeline: gpu.RenderPipeline, label: [*:0]const u8) callconv(.Inline) void);
assertDecl(T, "renderPipelineReference", fn (render_pipeline: gpu.RenderPipeline) callconv(.Inline) void); assertDecl(T, "renderPipelineReference", fn (render_pipeline: gpu.RenderPipeline) callconv(.Inline) void);
assertDecl(T, "renderPipelineRelease", fn (render_pipeline: gpu.RenderPipeline) callconv(.Inline) void); assertDecl(T, "renderPipelineRelease", fn (render_pipeline: gpu.RenderPipeline) callconv(.Inline) void);
@ -294,17 +294,17 @@ pub fn Export(comptime T: type) type {
} }
// WGPU_EXPORT void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, char const * label); // WGPU_EXPORT void wgpuBindGroupLayoutSetLabel(WGPUBindGroupLayout bindGroupLayout, char const * label);
export fn wgpuBindGroupLayoutSetLabel(bind_group_layout: gpu.BindGroupLayout, label: [*:0]const u8) void { export fn wgpuBindGroupLayoutSetLabel(bind_group_layout: *gpu.BindGroupLayout, label: [*:0]const u8) void {
T.bindGroupLayoutSetLabel(bind_group_layout, label); T.bindGroupLayoutSetLabel(bind_group_layout, label);
} }
// WGPU_EXPORT void wgpuBindGroupLayoutReference(WGPUBindGroupLayout bindGroupLayout); // WGPU_EXPORT void wgpuBindGroupLayoutReference(WGPUBindGroupLayout bindGroupLayout);
export fn wgpuBindGroupLayoutReference(bind_group_layout: gpu.BindGroupLayout) void { export fn wgpuBindGroupLayoutReference(bind_group_layout: *gpu.BindGroupLayout) void {
T.bindGroupLayoutReference(bind_group_layout); T.bindGroupLayoutReference(bind_group_layout);
} }
// WGPU_EXPORT void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout); // WGPU_EXPORT void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout);
export fn wgpuBindGroupLayoutRelease(bind_group_layout: gpu.BindGroupLayout) void { export fn wgpuBindGroupLayoutRelease(bind_group_layout: *gpu.BindGroupLayout) void {
T.bindGroupLayoutRelease(bind_group_layout); T.bindGroupLayoutRelease(bind_group_layout);
} }
@ -531,7 +531,7 @@ pub fn Export(comptime T: type) type {
} }
// WGPU_EXPORT WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex); // WGPU_EXPORT WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex);
export fn wgpuComputePipelineGetBindGroupLayout(compute_pipeline: gpu.ComputePipeline, group_index: u32) gpu.BindGroupLayout { export fn wgpuComputePipelineGetBindGroupLayout(compute_pipeline: gpu.ComputePipeline, group_index: u32) *gpu.BindGroupLayout {
return T.computePipelineGetBindGroupLayout(compute_pipeline, group_index); return T.computePipelineGetBindGroupLayout(compute_pipeline, group_index);
} }
@ -556,7 +556,7 @@ pub fn Export(comptime T: type) type {
} }
// WGPU_EXPORT WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor); // WGPU_EXPORT WGPUBindGroupLayout wgpuDeviceCreateBindGroupLayout(WGPUDevice device, WGPUBindGroupLayoutDescriptor const * descriptor);
export fn wgpuDeviceCreateBindGroupLayout(device: gpu.Device, descriptor: *const gpu.BindGroupLayoutDescriptor) gpu.BindGroupLayout { export fn wgpuDeviceCreateBindGroupLayout(device: gpu.Device, descriptor: *const gpu.BindGroupLayoutDescriptor) *gpu.BindGroupLayout {
return T.deviceCreateBindGroupLayout(device, descriptor); return T.deviceCreateBindGroupLayout(device, descriptor);
} }
@ -1046,7 +1046,7 @@ pub fn Export(comptime T: type) type {
} }
// WGPU_EXPORT WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex); // WGPU_EXPORT WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex);
export fn wgpuRenderPipelineGetBindGroupLayout(render_pipeline: gpu.RenderPipeline, group_index: u32) gpu.BindGroupLayout { export fn wgpuRenderPipelineGetBindGroupLayout(render_pipeline: gpu.RenderPipeline, group_index: u32) *gpu.BindGroupLayout {
return T.renderPipelineGetBindGroupLayout(render_pipeline, group_index); return T.renderPipelineGetBindGroupLayout(render_pipeline, group_index);
} }
@ -1296,18 +1296,18 @@ pub const StubInterface = Interface(struct {
unreachable; unreachable;
} }
pub inline fn bindGroupLayoutSetLabel(bind_group_layout: gpu.BindGroupLayout, label: [*:0]const u8) void { pub inline fn bindGroupLayoutSetLabel(bind_group_layout: *gpu.BindGroupLayout, label: [*:0]const u8) void {
_ = bind_group_layout; _ = bind_group_layout;
_ = label; _ = label;
unreachable; unreachable;
} }
pub inline fn bindGroupLayoutReference(bind_group_layout: gpu.BindGroupLayout) void { pub inline fn bindGroupLayoutReference(bind_group_layout: *gpu.BindGroupLayout) void {
_ = bind_group_layout; _ = bind_group_layout;
unreachable; unreachable;
} }
pub inline fn bindGroupLayoutRelease(bind_group_layout: gpu.BindGroupLayout) void { pub inline fn bindGroupLayoutRelease(bind_group_layout: *gpu.BindGroupLayout) void {
_ = bind_group_layout; _ = bind_group_layout;
unreachable; unreachable;
} }
@ -1597,7 +1597,7 @@ pub const StubInterface = Interface(struct {
unreachable; unreachable;
} }
pub inline fn computePipelineGetBindGroupLayout(compute_pipeline: gpu.ComputePipeline, group_index: u32) gpu.BindGroupLayout { pub inline fn computePipelineGetBindGroupLayout(compute_pipeline: gpu.ComputePipeline, group_index: u32) *gpu.BindGroupLayout {
_ = compute_pipeline; _ = compute_pipeline;
_ = group_index; _ = group_index;
unreachable; unreachable;
@ -1625,7 +1625,7 @@ pub const StubInterface = Interface(struct {
unreachable; unreachable;
} }
pub inline fn deviceCreateBindGroupLayout(device: gpu.Device, descriptor: *const gpu.BindGroupLayoutDescriptor) gpu.BindGroupLayout { pub inline fn deviceCreateBindGroupLayout(device: gpu.Device, descriptor: *const gpu.BindGroupLayoutDescriptor) *gpu.BindGroupLayout {
_ = device; _ = device;
_ = descriptor; _ = descriptor;
unreachable; unreachable;
@ -2251,7 +2251,7 @@ pub const StubInterface = Interface(struct {
unreachable; unreachable;
} }
pub inline fn renderPipelineGetBindGroupLayout(render_pipeline: gpu.RenderPipeline, group_index: u32) gpu.BindGroupLayout { pub inline fn renderPipelineGetBindGroupLayout(render_pipeline: gpu.RenderPipeline, group_index: u32) *gpu.BindGroupLayout {
_ = render_pipeline; _ = render_pipeline;
_ = group_index; _ = group_index;
unreachable; unreachable;

View file

@ -21,5 +21,5 @@ pub const PipelineLayoutDescriptor = extern struct {
label: ?[*:0]const u8 = null, label: ?[*:0]const u8 = null,
bind_group_layout_count: u32, bind_group_layout_count: u32,
// TODO: file a bug on Dawn, this is not marked as nullable but in fact is. // TODO: file a bug on Dawn, this is not marked as nullable but in fact is.
bind_group_layouts: ?[*]const BindGroupLayout, bind_group_layouts: ?[*]const *BindGroupLayout,
}; };

View file

@ -9,7 +9,7 @@ const BindGroupLayout = @import("bind_group_layout.zig").BindGroupLayout;
const Impl = @import("interface.zig").Impl; const Impl = @import("interface.zig").Impl;
pub const RenderPipeline = *opaque { pub const RenderPipeline = *opaque {
pub inline fn getBindGroupLayout(render_pipeline: RenderPipeline, group_index: u32) BindGroupLayout { pub inline fn getBindGroupLayout(render_pipeline: RenderPipeline, group_index: u32) *BindGroupLayout {
return Impl.renderPipelineGetBindGroupLayout(render_pipeline, group_index); return Impl.renderPipelineGetBindGroupLayout(render_pipeline, group_index);
} }