@gnsx/three 0.185.9 → 0.185.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +759 -2
- package/build/three.core.js +759 -2
- package/build/three.core.min.js +1 -1
- package/build/three.webgpu.js +138 -9
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +138 -9
- package/build/three.webgpu.nodes.min.js +1 -1
- package/package.json +1 -1
- package/src/profiler/ProfilerService.js +761 -2
- package/src/renderers/common/Backend.js +60 -0
- package/src/renderers/common/RenderContext.js +10 -0
- package/src/renderers/common/Renderer.js +5 -1
- package/src/renderers/common/TimestampQueryPool.js +23 -0
- package/src/renderers/webgl-fallback/WebGLBackend.js +14 -3
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +8 -4
- package/src/renderers/webgpu/WebGPUBackend.js +13 -2
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +6 -0
|
@@ -33990,6 +33990,16 @@ class RenderContext {
|
|
|
33990
33990
|
*/
|
|
33991
33991
|
this.camera = null;
|
|
33992
33992
|
|
|
33993
|
+
// WITH_GENESYS
|
|
33994
|
+
/**
|
|
33995
|
+
* An optional label used to identify this render pass in GPU profiler output.
|
|
33996
|
+
*
|
|
33997
|
+
* @type {?string}
|
|
33998
|
+
* @default null
|
|
33999
|
+
*/
|
|
34000
|
+
this.gpuProfilerLabel = null;
|
|
34001
|
+
// !WITH_GENESYS
|
|
34002
|
+
|
|
33993
34003
|
/**
|
|
33994
34004
|
* This flag can be used for type testing.
|
|
33995
34005
|
*
|
|
@@ -61592,6 +61602,10 @@ class Renderer {
|
|
|
61592
61602
|
|
|
61593
61603
|
const renderContext = this._renderContexts.get( renderTarget, this._mrt, this._callDepth );
|
|
61594
61604
|
|
|
61605
|
+
// WITH_GENESYS
|
|
61606
|
+
renderContext.gpuProfilerLabel = scene.isQuadMesh === true && scene.name !== '' ? scene.name : null;
|
|
61607
|
+
// !WITH_GENESYS
|
|
61608
|
+
|
|
61595
61609
|
this._currentRenderContext = renderContext;
|
|
61596
61610
|
this._currentRenderObjectFunction = this._renderObjectFunction || this.renderObject;
|
|
61597
61611
|
this._handleObjectFunction = this._renderObjectDirect;
|
|
@@ -67058,6 +67072,15 @@ class Backend {
|
|
|
67058
67072
|
[ TimestampQuery.COMPUTE ]: null
|
|
67059
67073
|
};
|
|
67060
67074
|
|
|
67075
|
+
// WITH_GENESYS
|
|
67076
|
+
/**
|
|
67077
|
+
* Listeners notified after a timestamp query is successfully allocated.
|
|
67078
|
+
*
|
|
67079
|
+
* @type {Set<function(string, string, ?string): void>}
|
|
67080
|
+
*/
|
|
67081
|
+
this.timestampQueryListeners = new Set();
|
|
67082
|
+
// !WITH_GENESYS
|
|
67083
|
+
|
|
67061
67084
|
/**
|
|
67062
67085
|
* Whether to track timestamps with a Timestamp Query API or not.
|
|
67063
67086
|
*
|
|
@@ -67496,6 +67519,41 @@ class Backend {
|
|
|
67496
67519
|
|
|
67497
67520
|
}
|
|
67498
67521
|
|
|
67522
|
+
// WITH_GENESYS
|
|
67523
|
+
/**
|
|
67524
|
+
* @param {function(string, string, ?string): void} listener
|
|
67525
|
+
*/
|
|
67526
|
+
addTimestampQueryListener( listener ) {
|
|
67527
|
+
|
|
67528
|
+
this.timestampQueryListeners.add( listener );
|
|
67529
|
+
|
|
67530
|
+
}
|
|
67531
|
+
|
|
67532
|
+
/**
|
|
67533
|
+
* @param {function(string, string, ?string): void} listener
|
|
67534
|
+
*/
|
|
67535
|
+
removeTimestampQueryListener( listener ) {
|
|
67536
|
+
|
|
67537
|
+
this.timestampQueryListeners.delete( listener );
|
|
67538
|
+
|
|
67539
|
+
}
|
|
67540
|
+
|
|
67541
|
+
/**
|
|
67542
|
+
* @param {string} type
|
|
67543
|
+
* @param {string} uid
|
|
67544
|
+
* @param {?string} [label=null]
|
|
67545
|
+
*/
|
|
67546
|
+
notifyTimestampQuery( type, uid, label = null ) {
|
|
67547
|
+
|
|
67548
|
+
for ( const listener of this.timestampQueryListeners ) {
|
|
67549
|
+
|
|
67550
|
+
listener( type, uid, label );
|
|
67551
|
+
|
|
67552
|
+
}
|
|
67553
|
+
|
|
67554
|
+
}
|
|
67555
|
+
// !WITH_GENESYS
|
|
67556
|
+
|
|
67499
67557
|
/**
|
|
67500
67558
|
* Returns all timestamp frames for the given type.
|
|
67501
67559
|
*
|
|
@@ -67539,6 +67597,22 @@ class Backend {
|
|
|
67539
67597
|
|
|
67540
67598
|
}
|
|
67541
67599
|
|
|
67600
|
+
// WITH_GENESYS
|
|
67601
|
+
/**
|
|
67602
|
+
* Returns the raw GPU timestamp range for the given uid when supported.
|
|
67603
|
+
*
|
|
67604
|
+
* @param {string} uid - The unique identifier.
|
|
67605
|
+
* @return {?{start: bigint, end: bigint}} The raw timestamp range.
|
|
67606
|
+
*/
|
|
67607
|
+
getTimestampRange( uid ) {
|
|
67608
|
+
|
|
67609
|
+
const queryPool = this._getQueryPool( uid );
|
|
67610
|
+
|
|
67611
|
+
return queryPool.getTimestampRange( uid );
|
|
67612
|
+
|
|
67613
|
+
}
|
|
67614
|
+
// !WITH_GENESYS
|
|
67615
|
+
|
|
67542
67616
|
/**
|
|
67543
67617
|
* Whether the backend supports query timestamps or not.
|
|
67544
67618
|
*
|
|
@@ -71534,6 +71608,15 @@ class TimestampQueryPool {
|
|
|
71534
71608
|
*/
|
|
71535
71609
|
this.timestamps = new Map();
|
|
71536
71610
|
|
|
71611
|
+
// WITH_GENESYS
|
|
71612
|
+
/**
|
|
71613
|
+
* Stores raw GPU timestamp ranges for each render context when supported.
|
|
71614
|
+
*
|
|
71615
|
+
* @type {Map<string, {start: bigint, end: bigint}>}
|
|
71616
|
+
*/
|
|
71617
|
+
this.timestampRanges = new Map();
|
|
71618
|
+
// !WITH_GENESYS
|
|
71619
|
+
|
|
71537
71620
|
}
|
|
71538
71621
|
|
|
71539
71622
|
/**
|
|
@@ -71569,6 +71652,20 @@ class TimestampQueryPool {
|
|
|
71569
71652
|
|
|
71570
71653
|
}
|
|
71571
71654
|
|
|
71655
|
+
// WITH_GENESYS
|
|
71656
|
+
/**
|
|
71657
|
+
* Returns the raw GPU timestamp range for a render context.
|
|
71658
|
+
*
|
|
71659
|
+
* @param {string} uid - A unique identifier for the render context.
|
|
71660
|
+
* @return {?{start: bigint, end: bigint}} The raw timestamp range, or null when unsupported.
|
|
71661
|
+
*/
|
|
71662
|
+
getTimestampRange( uid ) {
|
|
71663
|
+
|
|
71664
|
+
return this.timestampRanges.get( uid ) ?? null;
|
|
71665
|
+
|
|
71666
|
+
}
|
|
71667
|
+
// !WITH_GENESYS
|
|
71668
|
+
|
|
71572
71669
|
/**
|
|
71573
71670
|
* Returns whether a timestamp is available for a given render context.
|
|
71574
71671
|
*
|
|
@@ -71689,33 +71786,34 @@ class WebGLTimestampQueryPool extends TimestampQueryPool {
|
|
|
71689
71786
|
* Begins a timestamp query for the specified render context.
|
|
71690
71787
|
*
|
|
71691
71788
|
* @param {string} uid - A unique identifier for the render context.
|
|
71789
|
+
* @return {boolean} Whether the query was started.
|
|
71692
71790
|
*/
|
|
71693
71791
|
beginQuery( uid ) {
|
|
71694
71792
|
|
|
71695
71793
|
if ( ! this.trackTimestamp || this.isDisposed ) {
|
|
71696
71794
|
|
|
71697
|
-
return;
|
|
71795
|
+
return false;
|
|
71698
71796
|
|
|
71699
71797
|
}
|
|
71700
71798
|
|
|
71701
71799
|
const baseOffset = this.queryOffsets.get( uid );
|
|
71702
71800
|
if ( baseOffset == null ) {
|
|
71703
71801
|
|
|
71704
|
-
return;
|
|
71802
|
+
return false;
|
|
71705
71803
|
|
|
71706
71804
|
}
|
|
71707
71805
|
|
|
71708
71806
|
// Don't start a new query if there's an active one
|
|
71709
71807
|
if ( this.activeQuery !== null ) {
|
|
71710
71808
|
|
|
71711
|
-
return;
|
|
71809
|
+
return false;
|
|
71712
71810
|
|
|
71713
71811
|
}
|
|
71714
71812
|
|
|
71715
71813
|
const query = this.queries[ baseOffset ];
|
|
71716
71814
|
if ( ! query ) {
|
|
71717
71815
|
|
|
71718
|
-
return;
|
|
71816
|
+
return false;
|
|
71719
71817
|
|
|
71720
71818
|
}
|
|
71721
71819
|
|
|
@@ -71727,6 +71825,7 @@ class WebGLTimestampQueryPool extends TimestampQueryPool {
|
|
|
71727
71825
|
this.gl.beginQuery( this.ext.TIME_ELAPSED_EXT, query );
|
|
71728
71826
|
this.activeQuery = baseOffset;
|
|
71729
71827
|
this.queryStates.set( baseOffset, 'started' );
|
|
71828
|
+
return true;
|
|
71730
71829
|
|
|
71731
71830
|
}
|
|
71732
71831
|
|
|
@@ -71738,6 +71837,8 @@ class WebGLTimestampQueryPool extends TimestampQueryPool {
|
|
|
71738
71837
|
|
|
71739
71838
|
}
|
|
71740
71839
|
|
|
71840
|
+
return false;
|
|
71841
|
+
|
|
71741
71842
|
}
|
|
71742
71843
|
|
|
71743
71844
|
/**
|
|
@@ -72393,7 +72494,11 @@ class WebGLBackend extends Backend {
|
|
|
72393
72494
|
* @param {string} type - The type of the timestamp query.
|
|
72394
72495
|
* @param {string} uid - A unique identifier for the timestamp query.
|
|
72395
72496
|
*/
|
|
72396
|
-
|
|
72497
|
+
// WITH_GENESYS
|
|
72498
|
+
initTimestampQuery( type, uid, label = null ) {
|
|
72499
|
+
|
|
72500
|
+
// !WITH_GENESYS
|
|
72501
|
+
// initTimestampQuery( type, uid ) {
|
|
72397
72502
|
|
|
72398
72503
|
if ( ! this.disjoint || ! this.trackTimestamp ) return;
|
|
72399
72504
|
|
|
@@ -72410,7 +72515,11 @@ class WebGLBackend extends Backend {
|
|
|
72410
72515
|
|
|
72411
72516
|
if ( baseOffset !== null ) {
|
|
72412
72517
|
|
|
72413
|
-
timestampQueryPool.beginQuery( uid );
|
|
72518
|
+
const started = timestampQueryPool.beginQuery( uid );
|
|
72519
|
+
|
|
72520
|
+
// WITH_GENESYS
|
|
72521
|
+
if ( started ) this.notifyTimestampQuery( type, uid, label );
|
|
72522
|
+
// !WITH_GENESYS
|
|
72414
72523
|
|
|
72415
72524
|
}
|
|
72416
72525
|
|
|
@@ -72483,7 +72592,10 @@ class WebGLBackend extends Backend {
|
|
|
72483
72592
|
|
|
72484
72593
|
//
|
|
72485
72594
|
|
|
72486
|
-
|
|
72595
|
+
// WITH_GENESYS
|
|
72596
|
+
this.initTimestampQuery( TimestampQuery.RENDER, this.getTimestampUID( renderContext ), renderContext.gpuProfilerLabel );
|
|
72597
|
+
// !WITH_GENESYS
|
|
72598
|
+
// this.initTimestampQuery( TimestampQuery.RENDER, this.getTimestampUID( renderContext ) );
|
|
72487
72599
|
|
|
72488
72600
|
renderContextData.previousContext = this._currentContext;
|
|
72489
72601
|
this._currentContext = renderContext;
|
|
@@ -84366,6 +84478,9 @@ class WebGPUTimestampQueryPool extends TimestampQueryPool {
|
|
|
84366
84478
|
const duration = Number( endTime - startTime ) / 1e6;
|
|
84367
84479
|
|
|
84368
84480
|
this.timestamps.set( uid, duration );
|
|
84481
|
+
// WITH_GENESYS
|
|
84482
|
+
this.timestampRanges.set( uid, { start: startTime, end: endTime } );
|
|
84483
|
+
// !WITH_GENESYS
|
|
84369
84484
|
|
|
84370
84485
|
framesDuration[ frame ] += duration;
|
|
84371
84486
|
|
|
@@ -84464,6 +84579,9 @@ class WebGPUTimestampQueryPool extends TimestampQueryPool {
|
|
|
84464
84579
|
}
|
|
84465
84580
|
|
|
84466
84581
|
this.queryOffsets.clear();
|
|
84582
|
+
// WITH_GENESYS
|
|
84583
|
+
this.timestampRanges.clear();
|
|
84584
|
+
// !WITH_GENESYS
|
|
84467
84585
|
this.pendingResolve = null;
|
|
84468
84586
|
|
|
84469
84587
|
}
|
|
@@ -85463,7 +85581,10 @@ class WebGPUBackend extends Backend {
|
|
|
85463
85581
|
|
|
85464
85582
|
}
|
|
85465
85583
|
|
|
85466
|
-
|
|
85584
|
+
// WITH_GENESYS
|
|
85585
|
+
this.initTimestampQuery( TimestampQuery.RENDER, this.getTimestampUID( renderContext ), descriptor, renderContext.gpuProfilerLabel );
|
|
85586
|
+
// !WITH_GENESYS
|
|
85587
|
+
// this.initTimestampQuery( TimestampQuery.RENDER, this.getTimestampUID( renderContext ), descriptor );
|
|
85467
85588
|
|
|
85468
85589
|
descriptor.occlusionQuerySet = occlusionQuerySet;
|
|
85469
85590
|
|
|
@@ -86879,7 +87000,11 @@ class WebGPUBackend extends Backend {
|
|
|
86879
87000
|
* @param {number} uid - Unique id for the context (e.g. render context id).
|
|
86880
87001
|
* @param {Object} descriptor - The query descriptor.
|
|
86881
87002
|
*/
|
|
86882
|
-
|
|
87003
|
+
// WITH_GENESYS
|
|
87004
|
+
initTimestampQuery( type, uid, descriptor, label = null ) {
|
|
87005
|
+
|
|
87006
|
+
// !WITH_GENESYS
|
|
87007
|
+
// initTimestampQuery( type, uid, descriptor ) {
|
|
86883
87008
|
|
|
86884
87009
|
if ( ! this.trackTimestamp ) return;
|
|
86885
87010
|
|
|
@@ -86905,6 +87030,10 @@ class WebGPUBackend extends Backend {
|
|
|
86905
87030
|
|
|
86906
87031
|
descriptor.timestampWrites = _renderPassTimestampWrites;
|
|
86907
87032
|
|
|
87033
|
+
// WITH_GENESYS
|
|
87034
|
+
this.notifyTimestampQuery( type, uid, label );
|
|
87035
|
+
// !WITH_GENESYS
|
|
87036
|
+
|
|
86908
87037
|
}
|
|
86909
87038
|
|
|
86910
87039
|
|