Skip to content

Commit acf55ac

Browse files
authored
WebGPURenderer: Minor improvements for shared BindingGroup. (mrdoob#32998)
1 parent f579efc commit acf55ac

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/renderers/webgpu/nodes/WGSLNodeBuilder.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,14 +1146,12 @@ class WGSLNodeBuilder extends NodeBuilder {
11461146
if ( uniformsGroup === undefined ) {
11471147

11481148
uniformsGroup = new NodeUniformsGroup( groupName, group );
1149+
uniformsGroup.setVisibility( GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE );
11491150

11501151
this.uniformGroups[ groupName ] = uniformsGroup;
11511152

11521153
}
11531154

1154-
// TODO: Verifier caches
1155-
uniformsGroup.setVisibility( GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE );
1156-
11571155
// Add to bindings for this stage if not already present
11581156
if ( bindings.indexOf( uniformsGroup ) === - 1 ) {
11591157

src/renderers/webgpu/utils/WebGPUBindingUtils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
import { FloatType, IntType, UnsignedIntType, Compatibility } from '../../../constants.js';
77
import { NodeAccess } from '../../../nodes/core/constants.js';
88
import { isTypedArray, error } from '../../../utils.js';
9+
import { hashString } from '../../../nodes/core/NodeUtils.js';
910

1011
/**
1112
* Class representing a WebGPU bind group layout.
@@ -99,7 +100,7 @@ class WebGPUBindingUtils {
99100
// if not, assing one
100101

101102
const entries = this._createLayoutEntries( bindGroup );
102-
const bindGroupLayoutKey = JSON.stringify( entries );
103+
const bindGroupLayoutKey = hashString( JSON.stringify( entries ) );
103104

104105
// try to find an existing layout in the cache
105106

0 commit comments

Comments
 (0)