WebGPU Headers
The WebGPU C API
 
All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules Pages
Loading...
Searching...
No Matches
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)
 
WGPUBufferMapState wgpuBufferGetMapState (WGPUBuffer buffer)
 
void * wgpuBufferGetMappedRange (WGPUBuffer buffer, size_t offset, size_t size)
 
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)
 

Detailed Description

Functions whose first argument has type WGPUBuffer.

Function Documentation

◆ wgpuBufferDestroy()

void wgpuBufferDestroy ( WGPUBuffer buffer)

◆ 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
offsetByte offset relative to the beginning of the buffer.
sizeByte 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()

WGPUBufferMapState wgpuBufferGetMapState ( WGPUBuffer buffer)

◆ 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
offsetByte offset relative to the beginning of the buffer.
sizeByte 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.

◆ wgpuBufferGetSize()

uint64_t wgpuBufferGetSize ( WGPUBuffer buffer)

◆ wgpuBufferGetUsage()

WGPUBufferUsage wgpuBufferGetUsage ( WGPUBuffer buffer)

◆ wgpuBufferMapAsync()

WGPUFuture wgpuBufferMapAsync ( WGPUBuffer buffer,
WGPUMapMode mode,
size_t offset,
size_t size,
WGPUBufferMapCallbackInfo callbackInfo )
Parameters
offsetByte offset relative to beginning of the buffer.
sizeByte size of the region to map. If this is WGPU_WHOLE_MAP_SIZE, it defaults to buffer.size - offset.

◆ wgpuBufferReadMappedRange()

WGPUStatus wgpuBufferReadMappedRange ( WGPUBuffer buffer,
size_t offset,
void * data,
size_t size )

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
offsetByte offset relative to the beginning of the buffer.
dataDestination, to read buffer data into.
sizeNumber 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()

void wgpuBufferSetLabel ( WGPUBuffer buffer,
WGPUStringView label )

◆ wgpuBufferUnmap()

void wgpuBufferUnmap ( WGPUBuffer buffer)

◆ 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
offsetByte offset relative to the beginning of the buffer.
dataSource, to write buffer data from.
sizeNumber 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.

◆ wgpuBufferAddRef()

void wgpuBufferAddRef ( WGPUBuffer buffer)

◆ wgpuBufferRelease()

void wgpuBufferRelease ( WGPUBuffer buffer)