Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGPURenderer: Fix isStorageInstancedBufferAttribute usage #27737

Merged
merged 1 commit into from
Feb 12, 2024
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
4 changes: 2 additions & 2 deletions examples/jsm/renderers/webgl/WebGLBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ class WebGLBackend extends Backend {
gl.bindTransformFeedback( gl.TRANSFORM_FEEDBACK, transformFeedbackGPU );
gl.beginTransformFeedback( gl.POINTS );

if ( attributes[ 0 ].isInstancedBufferAttribute ) {
if ( attributes[ 0 ].isStorageInstancedBufferAttribute ) {

gl.drawArraysInstanced( gl.POINTS, 0, 1, computeNode.count );

Expand Down Expand Up @@ -1240,7 +1240,7 @@ class WebGLBackend extends Backend {
gl.bindBuffer( gl.ARRAY_BUFFER, attributeData.bufferGPU );
gl.enableVertexAttribArray( i );

if ( attribute.isStorageBufferAttribute ) staticVao = false;
if ( attribute.isStorageBufferAttribute || attribute.isStorageInstancedBufferAttribute ) staticVao = false;

let stride, offset;

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class WebGLAttributeUtils {
id: _id ++
};

if ( attribute.isStorageBufferAttribute ) {
if ( attribute.isStorageBufferAttribute || attribute.isStorageInstancedBufferAttribute ) {

// create buffer for tranform feedback use
const bufferGPUDual = this._createBuffer( gl, bufferType, array, usage );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class WebGPUAttributeUtils {

let array = bufferAttribute.array;

if ( bufferAttribute.isStorageBufferAttribute && bufferAttribute.itemSize === 3 ) {
if ( ( bufferAttribute.isStorageBufferAttribute || bufferAttribute.isStorageInstancedBufferAttribute ) && bufferAttribute.itemSize === 3 ) {

bufferAttribute.itemSize = 4;
array = new array.constructor( bufferAttribute.count * 4 );
Expand Down