zgpu

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

buffer.zig (1032B)


      1 const c = @import("c.zig").c;
      2 const ChainedStruct = @import("common.zig").ChainedStruct;
      3 const StringView = @import("common.zig").StringView;
      4 
      5 pub const Buffer = opaque {
      6     pub const Descriptor = extern struct {
      7         next: ?*const ChainedStruct = null,
      8         label: StringView,
      9         usage: Usage,
     10         size: u64,
     11         mapped_at_creation: bool,
     12     };
     13 
     14     const Usage = packed struct(u64) {
     15         map_read: bool = false,
     16         map_write: bool = false,
     17         copy_src: bool = false,
     18         copy_dst: bool = false,
     19         index: bool = false,
     20         vertex: bool = false,
     21         uniform: bool = false,
     22         storage: bool = false,
     23         indirect: bool = false,
     24         query_resolve: bool = false,
     25         _padding: u54 = 0,
     26     };
     27 
     28     pub fn unmap(buffer: *Buffer) void {
     29         c.wgpuBufferUnmap(@ptrCast(buffer));
     30     }
     31 
     32     // destroy
     33     // getConstMappedRange
     34     // getMapState
     35     // getMappedRange
     36     // getSize
     37     // getUsage
     38     // mapAsync
     39     // setLabel
     40     // addRef
     41     // release
     42 };