I am trying to make use of StorageInstancedBufferAttribute to store data with the nodes system, but I receive an error with a simple example:
const normalBuffer = new StorageInstancedBufferAttribute(data.normals.length, 3);
const normalBufferNode = storage(normalBuffer, 'vec3', data.normals.length);
this._geometry.setAttribute( 'normal', normalBuffer );
this._params._material = new MeshBasicNodeMaterial();
this._params._material.side = THREE.BackSide;
this._params._material.colorNode = PS(normalBufferNode);
function PS (normalBufferNode) {
const normal = normalBufferNode.element( instanceIndex );
const update = tslFn( ( ) => {
normal.x = float(0.3);
const d = vec4().toVar();
return vec4(0.5, 0.5, 0.5, 0.5);
});
update.setLayout( {
name: 'update',
type: 'vec4',
inputs: []
});
return update();
}
Tint Errors:
Binding usage (BufferUsage::(CopySrc|CopyDst|Vertex)) of [Buffer] doesn't match expected usage (BufferUsage::Storage).
- While validating entries[1] as a Buffer.
Expected entry layout: { binding: 1, visibility: ShaderStage::Fragment, buffer: { type: BufferBindingType::Storage, hasDynamicOffset: 0, minBindingSize: 0 } }
- While validating [BindGroupDescriptor] against [BindGroupLayout]
- While calling [Device].CreateBindGroup([BindGroupDescriptor]).
Tint WGSL reader failure: :34:32 error: unresolved value 'nodeVarying0'
NodeBuffer_3737.nodeUniform0[ nodeVarying0 ].x = 0.3;
^^^^^^^^^^^^
- While validating [ShaderModuleDescriptor "fragment"]
- While calling [Device].CreateShaderModule([ShaderModuleDescriptor "fragment"]).
Note that in the examples I can only find usages of this data structure with WebGPURenderer.compute()
Is it possible to do this with WebGPURenderer.render()
?
Or does this only for for .compute()
?