@@ -1347,8 +1347,8 @@ pub const Buffer = *opaque {
1347
1347
}
1348
1348
extern fn wgpuBufferGetConstMappedRange (buffer : Buffer , offset : usize , size : usize ) ? * const anyopaque ;
1349
1349
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).
1352
1352
pub fn getMappedRange (buffer : Buffer , comptime T : type , offset : usize , len : usize ) ? []T {
1353
1353
if (len == 0 ) return null ;
1354
1354
const ptr = wgpuBufferGetMappedRange (buffer , offset , @sizeOf (T ) * len );
@@ -1357,9 +1357,23 @@ pub const Buffer = *opaque {
1357
1357
}
1358
1358
extern fn wgpuBufferGetMappedRange (buffer : Buffer , offset : usize , size : usize ) ? * anyopaque ;
1359
1359
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).
1363
1377
pub fn mapAsync (
1364
1378
buffer : Buffer ,
1365
1379
mode : MapMode ,
0 commit comments