WebGPU Headers: WGPUBuffer methods
Functions whose first argument has type WGPUBuffer. More...
Functions | |
| void | wgpuBufferDestroy (WGPUBuffer buffer) |
| void const * | wgpuBufferGetConstMappedRange (WGPUBuffer buffer, size_t offset, size_t size) |
| void * | wgpuBufferGetMappedRange (WGPUBuffer buffer, size_t offset, size_t size) |
| WGPUBufferMapState | wgpuBufferGetMapState (WGPUBuffer buffer) |
| uint64_t | wgpuBufferGetSize (WGPUBuffer buffer) |
| WGPUBufferUsage | wgpuBufferGetUsage (WGPUBuffer buffer) |
| WGPUFuture | wgpuBufferMapAsync (WGPUBuffer buffer, WGPUMapMode mode, size_t offset, size_t size, WGPUBufferMapCallbackInfo callbackInfo) |
| WGPUStatus | wgpuBufferReadMappedRange (WGPUBuffer buffer, size_t offset, void *data, size_t size) |
| void | wgpuBufferSetLabel (WGPUBuffer buffer, WGPUStringView label) |
| void | wgpuBufferUnmap (WGPUBuffer buffer) |
| WGPUStatus | wgpuBufferWriteMappedRange (WGPUBuffer buffer, size_t offset, void const *data, size_t size) |
| void | wgpuBufferAddRef (WGPUBuffer buffer) |
| void | wgpuBufferRelease (WGPUBuffer buffer) |
Functions whose first argument has type WGPUBuffer.
◆ wgpuBufferDestroy()
◆ wgpuBufferGetConstMappedRange()
| void const * wgpuBufferGetConstMappedRange | ( | WGPUBuffer | buffer, |
| size_t | offset, | ||
| size_t | size ) |
Returns a const pointer to beginning of the mapped range. It must not be written; writing to this range causes undefined behavior. See Mapped Range Behavior for error conditions and guarantees. This function is safe to call inside spontaneous callbacks (see Callback Reentrancy).
In Wasm, if memcpying from this range, prefer using wgpuBufferReadMappedRange instead for better performance.
- Parameters
-
offset Byte offset relative to the beginning of the buffer. size Byte size of the range to get. If this is WGPU_WHOLE_MAP_SIZE, it defaults to buffer.size - offset. The returned pointer is valid for exactly this many bytes.
◆ wgpuBufferGetMappedRange()
| void * wgpuBufferGetMappedRange | ( | WGPUBuffer | buffer, |
| size_t | offset, | ||
| size_t | size ) |
Returns a mutable pointer to beginning of the mapped range. See Mapped Range Behavior for error conditions and guarantees. This function is safe to call inside spontaneous callbacks (see Callback Reentrancy).
In Wasm, if memcpying into this range, prefer using wgpuBufferWriteMappedRange instead for better performance.
- Parameters
-
offset Byte offset relative to the beginning of the buffer. size Byte size of the range to get. If this is WGPU_WHOLE_MAP_SIZE, it defaults to buffer.size - offset. The returned pointer is valid for exactly this many bytes.
◆ wgpuBufferGetMapState()
◆ wgpuBufferGetSize()
◆ wgpuBufferGetUsage()
◆ wgpuBufferMapAsync()
- Parameters
-
mode The mapping mode (read or write). offset Byte offset relative to beginning of the buffer. size Byte size of the region to map. If this is WGPU_WHOLE_MAP_SIZE, it defaults to buffer.size - offset.
◆ wgpuBufferReadMappedRange()
Copies a range of data from the buffer mapping into the provided destination pointer. See Mapped Range Behavior for error conditions and guarantees. This function is safe to call inside spontaneous callbacks (see Callback Reentrancy).
In Wasm, this is more efficient than copying from a mapped range into a malloc'd range.
- Parameters
-
offset Byte offset relative to the beginning of the buffer. data Destination, to read buffer data into. size Number of bytes of data to read from the buffer. (Note WGPU_WHOLE_MAP_SIZE is not accepted here.)
- Returns
- WGPUStatus_Error if the copy did not occur.
◆ wgpuBufferSetLabel()
◆ wgpuBufferUnmap()
◆ wgpuBufferWriteMappedRange()
| WGPUStatus wgpuBufferWriteMappedRange | ( | WGPUBuffer | buffer, |
| size_t | offset, | ||
| void const * | data, | ||
| size_t | size ) |
Copies a range of data from the provided source pointer into the buffer mapping. See Mapped Range Behavior for error conditions and guarantees. This function is safe to call inside spontaneous callbacks (see Callback Reentrancy).
In Wasm, this is more efficient than copying from a malloc'd range into a mapped range.
- Parameters
-
offset Byte offset relative to the beginning of the buffer. data Source, to write buffer data from. size Number of bytes of data to write to the buffer. (Note WGPU_WHOLE_MAP_SIZE is not accepted here.)
- Returns
- WGPUStatus_Error if the copy did not occur.