Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/src/examples/compute/particles.example.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ assetListLoader.load(() => {
fragmentWGSL: files['shader-shared.wgsl'] + files['shader-rendering.fragment.wgsl']
});

// rendering shader needs the particle storage buffer to read the particle data
material.setParameter('particles', particleStorageBuffer);

// index buffer - two triangles (6 indices) per particle using 4 vertices
const indices = new Uint32Array(numParticles * 6);
for (let i = 0; i < numParticles; ++i) {
Expand Down
3 changes: 2 additions & 1 deletion src/scene/materials/material.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { ShaderChunks } from '../shader-lib/shader-chunks.js';
* @import { UniformBufferFormat } from '../../platform/graphics/uniform-buffer-format.js';
* @import { VertexFormat } from '../../platform/graphics/vertex-format.js';
* @import { ShaderChunkMap } from '../shader-lib/shader-chunk-map.js';
* @import { StorageBuffer } from '../../platform/graphics/storage-buffer.js';
*/

// blend mode mapping to op, srcBlend and dstBlend
Expand Down Expand Up @@ -773,7 +774,7 @@ class Material {
* Sets a shader parameter on a material.
*
* @param {string} name - The name of the parameter to set.
* @param {number|number[]|Float32Array|Texture} data - The value for the specified parameter.
* @param {number|number[]|ArrayBufferView|Texture|StorageBuffer} data - The value for the specified parameter.
*/
setParameter(name, data) {

Expand Down