gpu: convert *opaque -> opaque for CommandBuffer

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-29 22:28:18 -07:00 committed by Stephen Gutekanst
parent 1714f43e1f
commit e15cb4009a
4 changed files with 11 additions and 11 deletions

View file

@ -1,16 +1,16 @@
const ChainedStruct = @import("types.zig").ChainedStruct; const ChainedStruct = @import("types.zig").ChainedStruct;
const Impl = @import("interface.zig").Impl; const Impl = @import("interface.zig").Impl;
pub const CommandBuffer = *opaque { pub const CommandBuffer = opaque {
pub inline fn setLabel(command_buffer: CommandBuffer, label: [*:0]const u8) void { pub inline fn setLabel(command_buffer: *CommandBuffer, label: [*:0]const u8) void {
Impl.commandBufferSetLabel(command_buffer, label); Impl.commandBufferSetLabel(command_buffer, label);
} }
pub inline fn reference(command_buffer: CommandBuffer) void { pub inline fn reference(command_buffer: *CommandBuffer) void {
Impl.commandBufferReference(command_buffer); Impl.commandBufferReference(command_buffer);
} }
pub inline fn release(command_buffer: CommandBuffer) void { pub inline fn release(command_buffer: *CommandBuffer) void {
Impl.commandBufferRelease(command_buffer); Impl.commandBufferRelease(command_buffer);
} }
}; };

View file

@ -49,7 +49,7 @@ pub const CommandEncoder = *opaque {
Impl.commandEncoderCopyTextureToTextureInternal(command_encoder, source, destination, copy_size); Impl.commandEncoderCopyTextureToTextureInternal(command_encoder, source, destination, copy_size);
} }
pub inline fn finish(command_encoder: CommandEncoder, descriptor: ?*const CommandBufferDescriptor) CommandBuffer { pub inline fn finish(command_encoder: CommandEncoder, descriptor: ?*const CommandBufferDescriptor) *CommandBuffer {
return Impl.commandEncoderFinish(command_encoder, descriptor); return Impl.commandEncoderFinish(command_encoder, descriptor);
} }

View file

@ -135,7 +135,7 @@ pub fn Interface(comptime T: type) type {
assertDecl(T, "queueCopyTextureForBrowser", fn (queue: *gpu.Queue, source: *const gpu.ImageCopyTexture, destination: *const gpu.ImageCopyTexture, copy_size: *const gpu.Extent3D, options: *const gpu.CopyTextureForBrowserOptions) callconv(.Inline) void); assertDecl(T, "queueCopyTextureForBrowser", fn (queue: *gpu.Queue, source: *const gpu.ImageCopyTexture, destination: *const gpu.ImageCopyTexture, copy_size: *const gpu.Extent3D, options: *const gpu.CopyTextureForBrowserOptions) callconv(.Inline) void);
assertDecl(T, "queueOnSubmittedWorkDone", fn (queue: *gpu.Queue, signal_value: u64, callback: gpu.QueueWorkDoneCallback, userdata: *anyopaque) callconv(.Inline) void); assertDecl(T, "queueOnSubmittedWorkDone", fn (queue: *gpu.Queue, signal_value: u64, callback: gpu.QueueWorkDoneCallback, userdata: *anyopaque) callconv(.Inline) void);
assertDecl(T, "queueSetLabel", fn (queue: *gpu.Queue, label: [*:0]const u8) callconv(.Inline) void); assertDecl(T, "queueSetLabel", fn (queue: *gpu.Queue, label: [*:0]const u8) callconv(.Inline) void);
assertDecl(T, "queueSubmit", fn (queue: *gpu.Queue, command_count: u32, commands: [*]gpu.CommandBuffer) callconv(.Inline) void); assertDecl(T, "queueSubmit", fn (queue: *gpu.Queue, command_count: u32, commands: [*]*gpu.CommandBuffer) callconv(.Inline) void);
assertDecl(T, "queueWriteBuffer", fn (queue: *gpu.Queue, buffer: *gpu.Buffer, buffer_offset: u64, data: *anyopaque, size: usize) callconv(.Inline) void); assertDecl(T, "queueWriteBuffer", fn (queue: *gpu.Queue, buffer: *gpu.Buffer, buffer_offset: u64, data: *anyopaque, size: usize) callconv(.Inline) void);
assertDecl(T, "queueWriteTexture", fn (queue: *gpu.Queue, data: *anyopaque, data_size: usize, data_layout: *const gpu.TextureDataLayout, write_size: *const gpu.Extent3D) callconv(.Inline) void); assertDecl(T, "queueWriteTexture", fn (queue: *gpu.Queue, data: *anyopaque, data_size: usize, data_layout: *const gpu.TextureDataLayout, write_size: *const gpu.Extent3D) callconv(.Inline) void);
assertDecl(T, "queueReference", fn (queue: *gpu.Queue) callconv(.Inline) void); assertDecl(T, "queueReference", fn (queue: *gpu.Queue) callconv(.Inline) void);
@ -416,7 +416,7 @@ pub fn Export(comptime T: type) type {
} }
// WGPU_EXPORT WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, WGPUCommandBufferDescriptor const * descriptor /* nullable */); // WGPU_EXPORT WGPUCommandBuffer wgpuCommandEncoderFinish(WGPUCommandEncoder commandEncoder, WGPUCommandBufferDescriptor const * descriptor /* nullable */);
export fn wgpuCommandEncoderFinish(command_encoder: *gpu.CommandEncoder, descriptor: ?*const gpu.CommandBufferDescriptor) gpu.CommandBuffer { export fn wgpuCommandEncoderFinish(command_encoder: *gpu.CommandEncoder, descriptor: ?*const gpu.CommandBufferDescriptor) *gpu.CommandBuffer {
return T.commandEncoderFinish(command_encoder, descriptor); return T.commandEncoderFinish(command_encoder, descriptor);
} }
@ -821,7 +821,7 @@ pub fn Export(comptime T: type) type {
} }
// WGPU_EXPORT void wgpuQueueSubmit(WGPUQueue queue, uint32_t commandCount, WGPUCommandBuffer const * commands); // WGPU_EXPORT void wgpuQueueSubmit(WGPUQueue queue, uint32_t commandCount, WGPUCommandBuffer const * commands);
export fn wgpuQueueSubmit(queue: *gpu.Queue, command_count: u32, commands: [*]gpu.CommandBuffer) void { export fn wgpuQueueSubmit(queue: *gpu.Queue, command_count: u32, commands: [*]*gpu.CommandBuffer) void {
T.queueSubmit(queue, command_count, commands); T.queueSubmit(queue, command_count, commands);
} }
@ -1452,7 +1452,7 @@ pub const StubInterface = Interface(struct {
unreachable; unreachable;
} }
pub inline fn commandEncoderFinish(command_encoder: *gpu.CommandEncoder, descriptor: ?*const gpu.CommandBufferDescriptor) gpu.CommandBuffer { pub inline fn commandEncoderFinish(command_encoder: *gpu.CommandEncoder, descriptor: ?*const gpu.CommandBufferDescriptor) *gpu.CommandBuffer {
_ = command_encoder; _ = command_encoder;
_ = descriptor; _ = descriptor;
unreachable; unreachable;
@ -1940,7 +1940,7 @@ pub const StubInterface = Interface(struct {
unreachable; unreachable;
} }
pub inline fn queueSubmit(queue: *gpu.Queue, command_count: u32, commands: [*]gpu.CommandBuffer) void { pub inline fn queueSubmit(queue: *gpu.Queue, command_count: u32, commands: [*]*gpu.CommandBuffer) void {
_ = queue; _ = queue;
_ = command_count; _ = command_count;
_ = commands; _ = commands;

View file

@ -20,7 +20,7 @@ pub const Queue = *opaque {
Impl.queueSetLabel(queue, label); Impl.queueSetLabel(queue, label);
} }
pub inline fn submit(queue: Queue, command_count: u32, commands: [*]CommandBuffer) void { pub inline fn submit(queue: Queue, command_count: u32, commands: [*]*CommandBuffer) void {
Impl.queueSubmit(queue, command_count, commands); Impl.queueSubmit(queue, command_count, commands);
} }