@@ -1347,8 +1347,8 @@ pub const Buffer = *opaque {
13471347 }
13481348 extern fn wgpuBufferGetConstMappedRange (buffer : Buffer , offset : usize , size : usize ) ? * const anyopaque ;
13491349
1350- // `offset` has to be a multiple of 8 (otherwise `null` will be returned).
1351- // `@sizeOf(T) * len` has to be a multiple of 4 (otherwise `null` will be returned).
1350+ // `offset` - in bytes, has to be a multiple of 8 (otherwise `null` will be returned).
1351+ // `len` - length of slice to return, in elements of type T, ` @sizeOf(T) * len` has to be a multiple of 4 (otherwise `null` will be returned).
13521352 pub fn getMappedRange (buffer : Buffer , comptime T : type , offset : usize , len : usize ) ? []T {
13531353 if (len == 0 ) return null ;
13541354 const ptr = wgpuBufferGetMappedRange (buffer , offset , @sizeOf (T ) * len );
@@ -1357,9 +1357,23 @@ pub const Buffer = *opaque {
13571357 }
13581358 extern fn wgpuBufferGetMappedRange (buffer : Buffer , offset : usize , size : usize ) ? * anyopaque ;
13591359
1360- // `offset` has to be a multiple of 8 (Dawn's validation layer will warn).
1361- // `size` has to be a multiple of 4 (Dawn's validation layer will warn).
1362- // `size == 0` will map entire range (from 'offset' to the end of the buffer).
1360+ pub fn getMapState (buffer : Buffer ) BufferMapState {
1361+ return wgpuBufferGetMapState (buffer );
1362+ }
1363+ extern fn wgpuBufferGetMapState (buffer : Buffer ) BufferMapState ;
1364+
1365+ pub fn getSize (buffer : Buffer ) usize {
1366+ return @intCast (wgpuBufferGetSize (buffer ));
1367+ }
1368+ extern fn wgpuBufferGetSize (buffer : Buffer ) u64 ;
1369+
1370+ pub fn getUsage (buffer : Buffer ) BufferUsage {
1371+ return wgpuBufferGetUsage (buffer );
1372+ }
1373+ extern fn wgpuBufferGetUsage (buffer : Buffer ) BufferUsage ;
1374+
1375+ // `offset` - in bytes, has to be a multiple of 8 (Dawn's validation layer will warn).
1376+ // `size` - size of buffer to map in bytes, has to be a multiple of 4 (Dawn's validation layer will warn).
13631377 pub fn mapAsync (
13641378 buffer : Buffer ,
13651379 mode : MapMode ,
0 commit comments