|
|
@@ -56075,7 +56075,7 @@ class ReflectorBaseNode extends Node {
|
|
|
// Replacing the third row of the projection matrix
|
|
|
projectionMatrix.elements[ 2 ] = clipPlane.x;
|
|
|
projectionMatrix.elements[ 6 ] = clipPlane.y;
|
|
|
- projectionMatrix.elements[ 10 ] = clipPlane.z - clipBias;
|
|
|
+ projectionMatrix.elements[ 10 ] = ( renderer.coordinateSystem === WebGPUCoordinateSystem ) ? ( clipPlane.z - clipBias ) : ( clipPlane.z + 1.0 - clipBias );
|
|
|
projectionMatrix.elements[ 14 ] = clipPlane.w;
|
|
|
|
|
|
//
|
|
|
@@ -69708,6 +69708,8 @@ class WebGLBackend extends Backend {
|
|
|
this.disjoint = this.extensions.get( 'EXT_disjoint_timer_query_webgl2' );
|
|
|
this.parallel = this.extensions.get( 'KHR_parallel_shader_compile' );
|
|
|
|
|
|
+ this._knownBindings = new WeakSet();
|
|
|
+
|
|
|
this._currentContext = null;
|
|
|
|
|
|
}
|
|
|
@@ -70770,33 +70772,45 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
createBindings( bindGroup, bindings ) {
|
|
|
|
|
|
- this.updateBindings( bindGroup, bindings );
|
|
|
+ if ( this._knownBindings.has( bindings ) === false ) {
|
|
|
|
|
|
- }
|
|
|
+ this._knownBindings.add( bindings );
|
|
|
|
|
|
- updateBindings( bindGroup, bindings ) {
|
|
|
+ let uniformBuffers = 0;
|
|
|
+ let textures = 0;
|
|
|
|
|
|
- if ( ! bindGroup ) return;
|
|
|
+ for ( const bindGroup of bindings ) {
|
|
|
|
|
|
- const { gl } = this;
|
|
|
+ this.set( bindGroup, {
|
|
|
+ textures: textures,
|
|
|
+ uniformBuffers: uniformBuffers
|
|
|
+ } );
|
|
|
|
|
|
- const bindingsData = this.get( bindings );
|
|
|
- const bindGroupData = this.get( bindGroup );
|
|
|
+ for ( const binding of bindGroup.bindings ) {
|
|
|
|
|
|
- if ( bindingsData.textureIndex === undefined ) bindingsData.textureIndex = 0;
|
|
|
+ if ( binding.isUniformBuffer ) uniformBuffers ++;
|
|
|
+ if ( binding.isSampledTexture ) textures ++;
|
|
|
|
|
|
- if ( bindGroupData.textureIndex === undefined ) {
|
|
|
+ }
|
|
|
|
|
|
- bindGroupData.textureIndex = bindingsData.textureIndex;
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
+ }
|
|
|
|
|
|
- // reset textureIndex to match previous mappimgs when rebuilt
|
|
|
- bindingsData.textureIndex = bindGroupData.textureIndex;
|
|
|
+ this.updateBindings( bindGroup, bindings );
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- let i = 0;
|
|
|
+ updateBindings( bindGroup /*, bindings*/ ) {
|
|
|
+
|
|
|
+ if ( bindGroup === null ) return;
|
|
|
+
|
|
|
+ const { gl } = this;
|
|
|
+
|
|
|
+ const bindGroupData = this.get( bindGroup );
|
|
|
+
|
|
|
+ let i = bindGroupData.uniformBuffers;
|
|
|
+ let t = bindGroupData.textures;
|
|
|
|
|
|
for ( const binding of bindGroup.bindings ) {
|
|
|
|
|
|
@@ -70809,7 +70823,7 @@ class WebGLBackend extends Backend {
|
|
|
gl.bufferData( gl.UNIFORM_BUFFER, data, gl.DYNAMIC_DRAW );
|
|
|
|
|
|
this.set( binding, {
|
|
|
- index: bindGroup.index * 2 + i ++,
|
|
|
+ index: i ++,
|
|
|
bufferGPU
|
|
|
} );
|
|
|
|
|
|
@@ -70818,7 +70832,7 @@ class WebGLBackend extends Backend {
|
|
|
const { textureGPU, glTextureType } = this.get( binding.texture );
|
|
|
|
|
|
this.set( binding, {
|
|
|
- index: bindingsData.textureIndex ++,
|
|
|
+ index: t ++,
|
|
|
textureGPU,
|
|
|
glTextureType
|
|
|
} );
|