Просмотр исходного кода

WebGPURenderer: Minor improvements for shared BindingGroup. (#32998)

sunag 2 месяцев назад
Родитель
Сommit
acf55ac61a

+ 1 - 3
src/renderers/webgpu/nodes/WGSLNodeBuilder.js

@@ -1146,14 +1146,12 @@ class WGSLNodeBuilder extends NodeBuilder {
 				if ( uniformsGroup === undefined ) {
 
 					uniformsGroup = new NodeUniformsGroup( groupName, group );
+					uniformsGroup.setVisibility( GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE );
 
 					this.uniformGroups[ groupName ] = uniformsGroup;
 
 				}
 
-				// TODO: Verifier caches
-				uniformsGroup.setVisibility( GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE );
-
 				// Add to bindings for this stage if not already present
 				if ( bindings.indexOf( uniformsGroup ) === - 1 ) {
 

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

@@ -6,6 +6,7 @@ import {
 import { FloatType, IntType, UnsignedIntType, Compatibility } from '../../../constants.js';
 import { NodeAccess } from '../../../nodes/core/constants.js';
 import { isTypedArray, error } from '../../../utils.js';
+import { hashString } from '../../../nodes/core/NodeUtils.js';
 
 /**
  * Class representing a WebGPU bind group layout.
@@ -99,7 +100,7 @@ class WebGPUBindingUtils {
 		// if not, assing one
 
 		const entries = this._createLayoutEntries( bindGroup );
-		const bindGroupLayoutKey = JSON.stringify( entries );
+		const bindGroupLayoutKey = hashString( JSON.stringify( entries ) );
 
 		// try to find an existing layout in the cache
 

粤ICP备19079148号