Sets the contents of the TypedArrays based on the data passed in Note: The data may be sparse
example:
const code = `struct HSL { hue: f32, sat: f32, lum: f32,};struct MyStorage { colors: array<HSL, 4>, brightness: f32, kernel: array<f32, 9>,};@group(0) @binding(0) var<storage> myStorage: MyStorage;`;const defs = makeShaderDataDefinitions(code);const myUniformValues = makeStructuredView(defs.storages.myStorage);myUniformValues.set({ colors: [ , , { hue: 0.5, sat: 1.0, lum: 0.5 }, // only set the 3rd color ], brightness: 0.8, kernel: [ 1, 0, -1, 2, 0, -2, 1, 0, -1, ],}); Copy
const code = `struct HSL { hue: f32, sat: f32, lum: f32,};struct MyStorage { colors: array<HSL, 4>, brightness: f32, kernel: array<f32, 9>,};@group(0) @binding(0) var<storage> myStorage: MyStorage;`;const defs = makeShaderDataDefinitions(code);const myUniformValues = makeStructuredView(defs.storages.myStorage);myUniformValues.set({ colors: [ , , { hue: 0.5, sat: 1.0, lum: 0.5 }, // only set the 3rd color ], brightness: 0.8, kernel: [ 1, 0, -1, 2, 0, -2, 1, 0, -1, ],});
Generated using TypeDoc
Sets the contents of the TypedArrays based on the data passed in Note: The data may be sparse
example: