gpu: implement Queue methods

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-26 19:51:46 -07:00 committed by Stephen Gutekanst
parent e287b66d53
commit fa61855659

View file

@ -1,29 +1,44 @@
const CommandBuffer = @import("command_buffer.zig").CommandBuffer;
const Buffer = @import("buffer.zig").Buffer;
const TextureDataLayout = @import("texture.zig").TextureDataLayout;
const ImageCopyTexture = @import("types.zig").ImageCopyTexture;
const ChainedStruct = @import("types.zig").ChainedStruct;
const Extent3D = @import("types.zig").Extent3D;
const CopyTextureForBrowserOptions = @import("types.zig").CopyTextureForBrowserOptions;
const impl = @import("interface.zig").impl;
pub const Queue = *opaque {
// TODO
// pub inline fn queueCopyTextureForBrowser(queue: gpu.Queue, source: *const gpu.ImageCopyTexture, destination: *const gpu.ImageCopyTexture, copy_size: *const gpu.Extent3D, options: *const gpu.CopyTextureForBrowserOptions) void {
pub inline fn copyTextureForBrowser(queue: Queue, source: *const ImageCopyTexture, destination: *const ImageCopyTexture, copy_size: *const Extent3D, options: *const CopyTextureForBrowserOptions) void {
impl.queueCopyTextureForBrowser(queue, source, destination, copy_size, options);
}
// TODO
// pub inline fn queueOnSubmittedWorkDone(queue: gpu.Queue, signal_value: u64, callback: gpu.QueueWorkDoneCallback, userdata: *anyopaque) void {
pub inline fn onSubmittedWorkDone(queue: Queue, signal_value: u64, callback: QueueWorkDoneCallback, userdata: *anyopaque) void {
impl.queueOnSubmittedWorkDone(queue, signal_value, callback, userdata);
}
// TODO
// pub inline fn queueSetLabel(queue: gpu.Queue, label: [*:0]const u8) void {
pub inline fn setLabel(queue: Queue, label: [*:0]const u8) void {
impl.queueSetLabel(queue, label);
}
// TODO
// pub inline fn queueSubmit(queue: gpu.Queue, command_count: u32, commands: [*]gpu.CommandBuffer) void {
pub inline fn submit(queue: Queue, command_count: u32, commands: [*]CommandBuffer) void {
impl.queueSubmit(queue, command_count, commands);
}
// TODO
// pub inline fn queueWriteBuffer(queue: gpu.Queue, buffer: gpu.Buffer, buffer_offset: u64, data: *anyopaque, size: usize) void {
pub inline fn writeBuffer(queue: Queue, buffer: Buffer, buffer_offset: u64, data: *anyopaque, size: usize) void {
impl.queueWriteBuffer(queue, buffer, buffer_offset, data, size);
}
// TODO
// pub inline fn queueWriteTexture(queue: gpu.Queue, data: *anyopaque, data_size: usize, data_layout: *const gpu.TextureDataLayout, write_size: *const gpu.Extent3D) void {
pub inline fn writeTexture(queue: Queue, data: *anyopaque, data_size: usize, data_layout: *const TextureDataLayout, write_size: *const Extent3D) void {
impl.queueWriteTexture(queue, data, data_size, data_layout, write_size);
}
// TODO
// pub inline fn queueReference(queue: gpu.Queue) void {
pub inline fn reference(queue: Queue) void {
impl.queueReference(queue);
}
// TODO
// pub inline fn queueRelease(queue: gpu.Queue) void {
pub inline fn release(queue: Queue) void {
impl.queueRelease(queue);
}
};
pub const QueueWorkDoneCallback = fn (