Skip to content

Commit 832291b

Browse files
committed
Updated builds.
1 parent 77cc698 commit 832291b

File tree

8 files changed

+255
-55
lines changed

8 files changed

+255
-55
lines changed

build/three.cjs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9055,7 +9055,16 @@ class RenderTarget extends EventDispatcher {
90559055
this.textures[ i ].image.width = width;
90569056
this.textures[ i ].image.height = height;
90579057
this.textures[ i ].image.depth = depth;
9058-
this.textures[ i ].isArrayTexture = this.textures[ i ].image.depth > 1;
9058+
9059+
if ( this.textures[ i ].isData3DTexture !== true ) { // Fix for #31693
9060+
9061+
// TODO: Reconsider setting isArrayTexture flag here and in the ctor of Texture.
9062+
// Maybe a method `isArrayTexture()` or just a getter could replace a flag since
9063+
// both are evaluated on each call?
9064+
9065+
this.textures[ i ].isArrayTexture = this.textures[ i ].image.depth > 1;
9066+
9067+
}
90599068

90609069
}
90619070

@@ -75166,6 +75175,13 @@ class WebGLRenderer {
7516675175

7516775176
if ( typeof self !== 'undefined' ) animation.setContext( self );
7516875177

75178+
/**
75179+
* Applications are advised to always define the animation loop
75180+
* with this method and not manually with `requestAnimationFrame()`
75181+
* for best compatibility.
75182+
*
75183+
* @param {?onAnimationCallback} callback - The application's animation loop.
75184+
*/
7516975185
this.setAnimationLoop = function ( callback ) {
7517075186

7517175187
onAnimationFrameCallback = callback;

build/three.core.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9053,7 +9053,16 @@ class RenderTarget extends EventDispatcher {
90539053
this.textures[ i ].image.width = width;
90549054
this.textures[ i ].image.height = height;
90559055
this.textures[ i ].image.depth = depth;
9056-
this.textures[ i ].isArrayTexture = this.textures[ i ].image.depth > 1;
9056+
9057+
if ( this.textures[ i ].isData3DTexture !== true ) { // Fix for #31693
9058+
9059+
// TODO: Reconsider setting isArrayTexture flag here and in the ctor of Texture.
9060+
// Maybe a method `isArrayTexture()` or just a getter could replace a flag since
9061+
// both are evaluated on each call?
9062+
9063+
this.textures[ i ].isArrayTexture = this.textures[ i ].image.depth > 1;
9064+
9065+
}
90579066

90589067
}
90599068

build/three.core.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/three.module.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16336,6 +16336,13 @@ class WebGLRenderer {
1633616336

1633716337
if ( typeof self !== 'undefined' ) animation.setContext( self );
1633816338

16339+
/**
16340+
* Applications are advised to always define the animation loop
16341+
* with this method and not manually with `requestAnimationFrame()`
16342+
* for best compatibility.
16343+
*
16344+
* @param {?onAnimationCallback} callback - The application's animation loop.
16345+
*/
1633916346
this.setAnimationLoop = function ( callback ) {
1634016347

1634116348
onAnimationFrameCallback = callback;

build/three.webgpu.js

Lines changed: 109 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29942,6 +29942,24 @@ class Bindings extends DataMap {
2994229942

2994329943
}
2994429944

29945+
/**
29946+
* Deletes the bindings for the given compute node.
29947+
*
29948+
* @param {Node} computeNode - The compute node.
29949+
*/
29950+
deleteForCompute( computeNode ) {
29951+
29952+
const bindings = this.nodes.getForCompute( computeNode ).bindings;
29953+
29954+
for ( const bindGroup of bindings ) {
29955+
29956+
this.delete( bindGroup );
29957+
29958+
}
29959+
29960+
}
29961+
29962+
2994529963
/**
2994629964
* Updates the given array of bindings.
2994729965
*
@@ -31337,7 +31355,7 @@ class Textures extends DataMap {
3133731355
target.height = image.videoHeight || 1;
3133831356
target.depth = 1;
3133931357

31340-
} else if ( image instanceof VideoFrame ) {
31358+
} else if ( ( typeof VideoFrame !== 'undefined' ) && ( image instanceof VideoFrame ) ) {
3134131359

3134231360
target.width = image.displayWidth || 1;
3134331361
target.height = image.displayHeight || 1;
@@ -31421,8 +31439,15 @@ class Textures extends DataMap {
3142131439

3142231440
if ( this.has( texture ) === true ) {
3142331441

31442+
// if a texture is not ready for use, it falls back to a default texture so it's possible
31443+
// to use it for rendering. If a texture in this state is disposed, it's important to
31444+
// not destroy/delete the underlying GPU texture object since it is cached and shared with
31445+
// other textures.
31446+
31447+
const isDefaultTexture = this.get( texture ).isDefaultTexture;
31448+
3142431449
this.backend.destroySampler( texture );
31425-
this.backend.destroyTexture( texture );
31450+
this.backend.destroyTexture( texture, isDefaultTexture );
3142631451

3142731452
this.delete( texture );
3142831453

@@ -31542,6 +31567,36 @@ class ParameterNode extends PropertyNode {
3154231567

3154331568
}
3154431569

31570+
/**
31571+
* Gets the type of a member variable in the parameter node.
31572+
*
31573+
* @param {NodeBuilder} builder - The node builder.
31574+
* @param {string} name - The name of the member variable.
31575+
* @returns {string}
31576+
*/
31577+
getMemberType( builder, name ) {
31578+
31579+
const type = this.getNodeType( builder );
31580+
const struct = builder.getStructTypeNode( type );
31581+
31582+
let memberType;
31583+
31584+
if ( struct !== null ) {
31585+
31586+
memberType = struct.getMemberType( builder, name );
31587+
31588+
} else {
31589+
31590+
error( `TSL: Member "${ name }" not found in struct "${ type }".` );
31591+
31592+
memberType = 'float';
31593+
31594+
}
31595+
31596+
return memberType;
31597+
31598+
}
31599+
3154531600
getHash() {
3154631601

3154731602
return this.uuid;
@@ -33365,6 +33420,7 @@ class ReflectorNode extends TextureNode {
3336533420
newNode.depthNode = this.depthNode;
3336633421
newNode.compareNode = this.compareNode;
3336733422
newNode.gradNode = this.gradNode;
33423+
newNode.offsetNode = this.offsetNode;
3336833424
newNode._reflectorBaseNode = this._reflectorBaseNode;
3336933425

3337033426
return newNode;
@@ -35815,6 +35871,7 @@ class PassMultipleTextureNode extends PassTextureNode {
3581535871
newNode.depthNode = this.depthNode;
3581635872
newNode.compareNode = this.compareNode;
3581735873
newNode.gradNode = this.gradNode;
35874+
newNode.offsetNode = this.offsetNode;
3581835875

3581935876
return newNode;
3582035877

@@ -53457,6 +53514,9 @@ function onSessionEnd() {
5345753514

5345853515
this._session = null;
5345953516
this._xrRenderTarget = null;
53517+
this._glBinding = null;
53518+
this._glBaseLayer = null;
53519+
this._glProjLayer = null;
5346053520

5346153521
// switch layers back to emulated
5346253522
if ( this._sessionUsesLayers === true ) {
@@ -55328,7 +55388,7 @@ class Renderer {
5532855388
* for best compatibility.
5532955389
*
5533055390
* @async
55331-
* @param {?Function} callback - The application's animation loop.
55391+
* @param {?onAnimationCallback} callback - The application's animation loop.
5533255392
* @return {Promise} A Promise that resolves when the set has been executed.
5533355393
*/
5533455394
async setAnimationLoop( callback ) {
@@ -56100,7 +56160,7 @@ class Renderer {
5610056160
computeNode.removeEventListener( 'dispose', dispose );
5610156161

5610256162
pipelines.delete( computeNode );
56103-
bindings.delete( computeNode );
56163+
bindings.deleteForCompute( computeNode );
5610456164
nodes.delete( computeNode );
5610556165

5610656166
};
@@ -57615,8 +57675,24 @@ class Sampler extends Binding {
5761557675
/**
5761657676
* The texture the sampler is referring to.
5761757677
*
57678+
* @private
5761857679
* @type {?Texture}
5761957680
*/
57681+
this._texture = null;
57682+
57683+
/**
57684+
* An event listener which is added to {@link texture}'s dispose event.
57685+
*
57686+
* @private
57687+
* @type {Function}
57688+
*/
57689+
this._onTextureDispose = () => {
57690+
57691+
this.texture = null;
57692+
57693+
};
57694+
57695+
// Assignment to the texture via a setter must occur after "_onTextureDispose" is initialized.
5762057696
this.texture = texture;
5762157697

5762257698
/**
@@ -57654,17 +57730,9 @@ class Sampler extends Binding {
5765457730

5765557731
if ( this._texture === value ) return;
5765657732

57657-
const onDispose = () => {
57658-
57659-
this._texture = null;
57660-
this.generation = null;
57661-
this.version = 0;
57662-
57663-
};
57664-
5766557733
if ( this._texture ) {
5766657734

57667-
this._texture.removeEventListener( 'dispose', onDispose );
57735+
this._texture.removeEventListener( 'dispose', this._onTextureDispose );
5766857736

5766957737
}
5767057738

@@ -57675,7 +57743,7 @@ class Sampler extends Binding {
5767557743

5767657744
if ( this._texture ) {
5767757745

57678-
this._texture.addEventListener( 'dispose', onDispose );
57746+
this._texture.addEventListener( 'dispose', this._onTextureDispose );
5767957747

5768057748
}
5768157749

@@ -57722,6 +57790,13 @@ class Sampler extends Binding {
5772257790
// TODO: Find better solution, see #31747
5772357791

5772457792
clonedSampler._texture = null;
57793+
57794+
clonedSampler._onTextureDispose = () => {
57795+
57796+
clonedSampler.texture = null;
57797+
57798+
};
57799+
5772557800
clonedSampler.texture = this.texture;
5772657801

5772757802
return clonedSampler;
@@ -59745,8 +59820,9 @@ class Backend {
5974559820
*
5974659821
* @abstract
5974759822
* @param {Texture} texture - The texture.
59823+
* @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not.
5974859824
*/
59749-
destroyTexture( /*texture*/ ) { }
59825+
destroyTexture( /*texture, isDefaultTexture*/ ) { }
5975059826

5975159827
/**
5975259828
* Returns texture data as a typed array.
@@ -62268,8 +62344,7 @@ class WebGLTextureUtils {
6226862344

6226962345
backend.set( texture, {
6227062346
textureGPU,
62271-
glTextureType,
62272-
isDefault: true
62347+
glTextureType
6227362348
} );
6227462349

6227562350
}
@@ -62600,14 +62675,20 @@ class WebGLTextureUtils {
6260062675
* Destroys the GPU data for the given texture object.
6260162676
*
6260262677
* @param {Texture} texture - The texture.
62678+
* @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not.
6260362679
*/
62604-
destroyTexture( texture ) {
62680+
destroyTexture( texture, isDefaultTexture = false ) {
6260562681

6260662682
const { gl, backend } = this;
6260762683
const { textureGPU, renderTarget } = backend.get( texture );
6260862684

6260962685
this.deallocateRenderBuffers( renderTarget );
62610-
gl.deleteTexture( textureGPU );
62686+
62687+
if ( isDefaultTexture === false ) {
62688+
62689+
gl.deleteTexture( textureGPU );
62690+
62691+
}
6261162692

6261262693
backend.delete( texture );
6261362694

@@ -65205,10 +65286,11 @@ class WebGLBackend extends Backend {
6520565286
* Destroys the GPU data for the given texture object.
6520665287
*
6520765288
* @param {Texture} texture - The texture.
65289+
* @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not.
6520865290
*/
65209-
destroyTexture( texture ) {
65291+
destroyTexture( texture, isDefaultTexture = false ) {
6521065292

65211-
this.textureUtils.destroyTexture( texture );
65293+
this.textureUtils.destroyTexture( texture, isDefaultTexture );
6521265294

6521365295
}
6521465296

@@ -67671,13 +67753,14 @@ class WebGPUTextureUtils {
6767167753
* Destroys the GPU data for the given texture object.
6767267754
*
6767367755
* @param {Texture} texture - The texture.
67756+
* @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not.
6767467757
*/
67675-
destroyTexture( texture ) {
67758+
destroyTexture( texture, isDefaultTexture = false ) {
6767667759

6767767760
const backend = this.backend;
6767867761
const textureData = backend.get( texture );
6767967762

67680-
if ( textureData.texture !== undefined ) textureData.texture.destroy();
67763+
if ( textureData.texture !== undefined && isDefaultTexture === false ) textureData.texture.destroy();
6768167764

6768267765
if ( textureData.msaaTexture !== undefined ) textureData.msaaTexture.destroy();
6768367766

@@ -75388,10 +75471,11 @@ class WebGPUBackend extends Backend {
7538875471
* Destroys the GPU data for the given texture object.
7538975472
*
7539075473
* @param {Texture} texture - The texture.
75474+
* @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not.
7539175475
*/
75392-
destroyTexture( texture ) {
75476+
destroyTexture( texture, isDefaultTexture = false ) {
7539375477

75394-
this.textureUtils.destroyTexture( texture );
75478+
this.textureUtils.destroyTexture( texture, isDefaultTexture );
7539575479

7539675480
}
7539775481

build/three.webgpu.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)