فهرست منبع

NodeUniformBuffer: Fix `byteLength` to follow overridden `buffer` getter (#33469)

Renaud Rohlinger 1 ماه پیش
والد
کامیت
b55cee6e9e

+ 1 - 1
src/extras/PMREMGenerator.js

@@ -159,7 +159,7 @@ class PMREMGenerator {
 	/**
 	 * Generates a PMREM from an cubemap texture, which can be either LDR
 	 * or HDR. The ideal input cube size is 256 x 256, as this matches best
-	 * with the 256 x 256 cubemap output. The minimum supported input cube 
+	 * with the 256 x 256 cubemap output. The minimum supported input cube
 	 * size is 16 x 16 per face.
 	 *
 	 * @param {Texture} cubemap - The cubemap texture to be converted.

+ 1 - 1
src/renderers/common/extras/PMREMGenerator.js

@@ -267,7 +267,7 @@ class PMREMGenerator {
 	/**
 	 * Generates a PMREM from an cubemap texture, which can be either LDR
 	 * or HDR. The ideal input cube size is 256 x 256, as this matches best
-	 * with the 256 x 256 cubemap output. The minimum supported input cube 
+	 * with the 256 x 256 cubemap output. The minimum supported input cube
 	 * size is 16 x 16 per face.
 	 *
 	 * @param {Texture} cubemap - The cubemap texture to be converted.

+ 13 - 0
src/renderers/common/nodes/NodeUniformBuffer.js

@@ -1,4 +1,5 @@
 import UniformBuffer from '../UniformBuffer.js';
+import { getFloatLength } from '../BufferUtils.js';
 
 let _id = 0;
 
@@ -89,6 +90,18 @@ class NodeUniformBuffer extends UniformBuffer {
 
 	}
 
+	/**
+	 * The buffer's byte length.
+	 *
+	 * @type {number}
+	 * @readonly
+	 */
+	get byteLength() {
+
+		return getFloatLength( this.buffer.byteLength );
+
+	}
+
 	/**
 	 * The uniform buffer.
 	 *

+ 0 - 2
src/renderers/webgpu/utils/WebGPUBindingUtils.js

@@ -190,8 +190,6 @@ class WebGPUBindingUtils {
 		const array = binding.buffer; // cpu
 		const buffer = backend.get( binding ).buffer; // gpu
 
-		if ( buffer === undefined ) return; // see #33461
-
 		const updateRanges = binding.updateRanges;
 
 		if ( updateRanges.length === 0 ) {

粤ICP备19079148号