Prechádzať zdrojové kódy

WebGPURenderer: Fix isStorageInstancedBufferAttribute usage (#27737)

sunag 1 rok pred
rodič
commit
56785efe0f

+ 2 - 2
examples/jsm/renderers/webgl/WebGLBackend.js

@@ -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 );
 
@@ -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;
 

+ 1 - 1
examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js

@@ -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 );

+ 1 - 1
examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js

@@ -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 );