zgpu

git clone git://git.electrosoup.com/zgpu
Log | Files | Refs | Submodules | README

queue.zig (1178B)


      1 const c = @import("c.zig").c;
      2 const Buffer = @import("buffer.zig").Buffer;
      3 const ChainedStruct = @import("common.zig").ChainedStruct;
      4 const CommandBuffer = @import("command_buffer.zig").CommandBuffer;
      5 const StringView = @import("common.zig").StringView;
      6 
      7 pub const Queue = opaque {
      8     pub const Descriptor = extern struct {
      9         next: ?*const ChainedStruct = null,
     10         label: StringView,
     11     };
     12 
     13     pub fn release(queue: *Queue) void {
     14         c.wgpuQueueRelease(@ptrCast(queue));
     15     }
     16 
     17     pub fn submit(queue: *Queue, commands: []const *CommandBuffer) void {
     18         c.wgpuQueueSubmit(
     19             @ptrCast(queue),
     20             @intCast(commands.len),
     21             @ptrCast(commands.ptr),
     22         );
     23     }
     24 
     25     pub fn writeBuffer(
     26         queue: *Queue,
     27         buffer: *Buffer,
     28         buffer_offset: u64,
     29         data: [*]const u8,
     30         size: usize,
     31     ) void {
     32         c.wgpuQueueWriteBuffer(
     33             @ptrCast(queue),
     34             @ptrCast(buffer),
     35             buffer_offset,
     36             @ptrCast(data),
     37             size,
     38         );
     39     }
     40 
     41 
     42     // onSubmittedWorkDone
     43     // setLabel
     44     // writeBuffer
     45     // writeTexture
     46     // reference
     47     // release
     48 };