Storage()

new Storage()

Storage is a container for storage buffer related data and actions.

Source:
Storage.js, line 3

Members

buffer

For internal use mostly. The actual GPUBuffer with the data.

Source:
Storage.js, line 141

bufferRead

Buffer for reading back For internal use mostly. The actual GPUBufferRead with the data.

Source:
Storage.js, line 154

clear

Clear the Storage buffer to its defaults. Is set to false after the buffer is cleared.

Source:
Storage.js, line 228

clearData

Data to be used after a setClear is called.

Source:
Storage.js, line 302

mapped

Source:
Storage.js, line 88

name

The name that the Storage will have on the WGSL side.

Source:
Storage.js, line 73
Example
myStorage.name = 'myStorageName';

// wgsl
myStorageName = 13.1;
js

readable

If data is read back in JS from WGSL, then set to true.

Source:
Storage.js, line 129

shaderStage

Tells WebGPU to which shader it can only be used.

Source:
Storage.js, line 116

stream

updated is set to true in data updates, but this is not true in something like audio, where the data streams and needs to be updated constantly, so if the storage map needs to be updated constantly then stream needs to be set to true.

Source:
Storage.js, line 185

type

Source:
Storage.js, line 102
Example
myStorage.type = 'u32'

updated

Mostly internal. Set to true if a value has been updated.

Source:
Storage.js, line 197

value

Source:
Storage.js, line 209

Methods

setClear(offset, size)

Clear buffer with offset and size. To clear only a section of the buffer. clear is set to true and reset after the buffer is cleared.

Parameters:
Name Type Description
offset Number

start index

size Number

length to clear

Source:
Storage.js, line 292

setReadable(value)Storage

if this is going to be used to read data back set to true

Parameters:
Name Type Description
value bool
Source:
Storage.js, line 256
Returns:
Type:
Storage

setShaderStage(value)Storage

Tells WebGPU to which shader it can only be used.

Parameters:
Name Type Description
value GPUShaderStage
Source:
Storage.js, line 267
Returns:
Type:
Storage

setType(value)Storage

Parameters:
Name Type Description
value String

WGSL data type of the Storage.

Source:
Storage.js, line 279
Returns:
Type:
Storage
Example
myStorage.setType('u32');

setValue(value)Storage

Parameters:
Name Type Description
value
  • Number
  • Number[]

data to send to the shader

Source:
Storage.js, line 238
Returns:
Type:
Storage

Storage(config)

new Storage(config)

Parameters:
Name Type Description
config Object
Source:
Storage.js, line 28

Members

buffer

For internal use mostly. The actual GPUBuffer with the data.

Source:
Storage.js, line 141

bufferRead

Buffer for reading back For internal use mostly. The actual GPUBufferRead with the data.

Source:
Storage.js, line 154

clear

Clear the Storage buffer to its defaults. Is set to false after the buffer is cleared.

Source:
Storage.js, line 228

clearData

Data to be used after a setClear is called.

Source:
Storage.js, line 302

mapped

Source:
Storage.js, line 88

name

The name that the Storage will have on the WGSL side.

Source:
Storage.js, line 73
Example
myStorage.name = 'myStorageName';

// wgsl
myStorageName = 13.1;
js

readable

If data is read back in JS from WGSL, then set to true.

Source:
Storage.js, line 129

shaderStage

Tells WebGPU to which shader it can only be used.

Source:
Storage.js, line 116

stream

updated is set to true in data updates, but this is not true in something like audio, where the data streams and needs to be updated constantly, so if the storage map needs to be updated constantly then stream needs to be set to true.

Source:
Storage.js, line 185

type

Source:
Storage.js, line 102
Example
myStorage.type = 'u32'

updated

Mostly internal. Set to true if a value has been updated.

Source:
Storage.js, line 197

value

Source:
Storage.js, line 209

Methods

setClear(offset, size)

Clear buffer with offset and size. To clear only a section of the buffer. clear is set to true and reset after the buffer is cleared.

Parameters:
Name Type Description
offset Number

start index

size Number

length to clear

Source:
Storage.js, line 292

setReadable(value)Storage

if this is going to be used to read data back set to true

Parameters:
Name Type Description
value bool
Source:
Storage.js, line 256
Returns:
Type:
Storage

setShaderStage(value)Storage

Tells WebGPU to which shader it can only be used.

Parameters:
Name Type Description
value GPUShaderStage
Source:
Storage.js, line 267
Returns:
Type:
Storage

setType(value)Storage

Parameters:
Name Type Description
value String

WGSL data type of the Storage.

Source:
Storage.js, line 279
Returns:
Type:
Storage
Example
myStorage.setType('u32');

setValue(value)Storage

Parameters:
Name Type Description
value
  • Number
  • Number[]

data to send to the shader

Source:
Storage.js, line 238
Returns:
Type:
Storage

MIT

Documentation generated by JSDoc 4.0.5 using Docolatte theme on