@gnsx/three 0.185.10 → 0.185.11

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.
@@ -61603,8 +61603,23 @@ class Renderer {
61603
61603
  const renderContext = this._renderContexts.get( renderTarget, this._mrt, this._callDepth );
61604
61604
 
61605
61605
  // WITH_GENESYS
61606
- renderContext.gpuProfilerLabel = scene.isQuadMesh === true && scene.name !== '' ? scene.name : null;
61606
+ // Prefer an explicit scene/pass name; otherwise fall back to the render
61607
+ // target texture name so depth/shadow/RTT work is not an invisible hole.
61608
+ let gpuProfilerLabel = scene.name !== '' ? scene.name : null;
61609
+ if ( gpuProfilerLabel === null && renderTarget !== null ) {
61610
+
61611
+ const textureName = renderTarget.texture?.name;
61612
+ if ( textureName !== undefined && textureName !== null && textureName !== '' ) {
61613
+
61614
+ gpuProfilerLabel = textureName;
61615
+
61616
+ }
61617
+
61618
+ }
61619
+
61620
+ renderContext.gpuProfilerLabel = gpuProfilerLabel;
61607
61621
  // !WITH_GENESYS
61622
+ // renderContext.gpuProfilerLabel = scene.name !== '' ? scene.name : null;
61608
61623
 
61609
61624
  this._currentRenderContext = renderContext;
61610
61625
  this._currentRenderObjectFunction = this._renderObjectFunction || this.renderObject;
@@ -62605,7 +62620,7 @@ class Renderer {
62605
62620
 
62606
62621
  // WITH_GENESYS
62607
62622
  // Drop the strong reference to the active `RenderContext` so module-level
62608
- // `WeakMap<RenderContext, �?>` caches can release entries once
62623
+ // `WeakMap<RenderContext, ...>` caches can release entries once
62609
62624
  // `_renderContexts.dispose()` has cleared its dictionary.
62610
62625
  this._currentRenderContext = null;
62611
62626
  // !WITH_GENESYS
@@ -84338,7 +84353,20 @@ class WebGPUTimestampQueryPool extends TimestampQueryPool {
84338
84353
  const baseOffset = this.currentQueryIndex;
84339
84354
  this.currentQueryIndex += 2;
84340
84355
 
84341
- this.queryOffsets.set( uid, baseOffset );
84356
+ // WITH_GENESYS
84357
+ // One logical uid can own multiple GPU passes (nested interrupt /
84358
+ // copyFramebuffer restart). Keep every offset; resolve sums them.
84359
+ let offsets = this.queryOffsets.get( uid );
84360
+ if ( offsets === undefined ) {
84361
+
84362
+ offsets = [];
84363
+ this.queryOffsets.set( uid, offsets );
84364
+
84365
+ }
84366
+
84367
+ offsets.push( baseOffset );
84368
+ // !WITH_GENESYS
84369
+ // this.queryOffsets.set( uid, baseOffset );
84342
84370
 
84343
84371
  return baseOffset;
84344
84372
 
@@ -84460,7 +84488,7 @@ class WebGPUTimestampQueryPool extends TimestampQueryPool {
84460
84488
 
84461
84489
  const frames = [];
84462
84490
 
84463
- for ( const [ uid, baseOffset ] of currentOffsets ) {
84491
+ for ( const [ uid, offsetOrOffsets ] of currentOffsets ) {
84464
84492
 
84465
84493
  const match = uid.match( /^(.*):f(\d+)$/ );
84466
84494
  const frame = parseInt( match[ 2 ] );
@@ -84473,14 +84501,34 @@ class WebGPUTimestampQueryPool extends TimestampQueryPool {
84473
84501
 
84474
84502
  if ( framesDuration[ frame ] === undefined ) framesDuration[ frame ] = 0;
84475
84503
 
84476
- const startTime = times[ baseOffset ];
84477
- const endTime = times[ baseOffset + 1 ];
84478
- const duration = Number( endTime - startTime ) / 1e6;
84504
+ // WITH_GENESYS
84505
+ const offsets = Array.isArray( offsetOrOffsets ) ? offsetOrOffsets : [ offsetOrOffsets ];
84506
+ let duration = 0;
84507
+ let rangeStart = null;
84508
+ let rangeEnd = null;
84509
+
84510
+ for ( const baseOffset of offsets ) {
84511
+
84512
+ const startTime = times[ baseOffset ];
84513
+ const endTime = times[ baseOffset + 1 ];
84514
+ duration += Number( endTime - startTime ) / 1e6;
84515
+
84516
+ if ( rangeStart === null || startTime < rangeStart ) rangeStart = startTime;
84517
+ if ( rangeEnd === null || endTime > rangeEnd ) rangeEnd = endTime;
84518
+
84519
+ }
84479
84520
 
84480
84521
  this.timestamps.set( uid, duration );
84481
- // WITH_GENESYS
84482
- this.timestampRanges.set( uid, { start: startTime, end: endTime } );
84522
+ if ( rangeStart !== null && rangeEnd !== null ) {
84523
+
84524
+ this.timestampRanges.set( uid, { start: rangeStart, end: rangeEnd } );
84525
+
84526
+ }
84483
84527
  // !WITH_GENESYS
84528
+ // const startTime = times[ baseOffset ];
84529
+ // const endTime = times[ baseOffset + 1 ];
84530
+ // const duration = Number( endTime - startTime ) / 1e6;
84531
+ // this.timestamps.set( uid, duration );
84484
84532
 
84485
84533
  framesDuration[ frame ] += duration;
84486
84534
 
@@ -84723,54 +84771,6 @@ class GPURenderPassDepthStencilAttachment {
84723
84771
 
84724
84772
  }
84725
84773
 
84726
- /**
84727
- * Reusable descriptor for `GPURenderPassTimestampWrites`, the
84728
- * `timestampWrites` field of `GPURenderPassDescriptor`. The same shape is
84729
- * also accepted as `GPUComputePassTimestampWrites`.
84730
- *
84731
- * @private
84732
- */
84733
- class GPURenderPassTimestampWrites {
84734
-
84735
- constructor() {
84736
-
84737
- /**
84738
- * The query set the timestamps are written to.
84739
- *
84740
- * @type {?GPUQuerySet}
84741
- * @default null
84742
- */
84743
- this.querySet = null;
84744
-
84745
- /**
84746
- * The index in the query set the beginning timestamp is written to.
84747
- *
84748
- * @type {number|undefined}
84749
- */
84750
- this.beginningOfPassWriteIndex = undefined;
84751
-
84752
- /**
84753
- * The index in the query set the ending timestamp is written to.
84754
- *
84755
- * @type {number|undefined}
84756
- */
84757
- this.endOfPassWriteIndex = undefined;
84758
-
84759
- }
84760
-
84761
- /**
84762
- * Resets the descriptor to its default state.
84763
- */
84764
- reset() {
84765
-
84766
- this.querySet = null;
84767
- this.beginningOfPassWriteIndex = undefined;
84768
- this.endOfPassWriteIndex = undefined;
84769
-
84770
- }
84771
-
84772
- }
84773
-
84774
84774
  // debugger tools
84775
84775
  // import 'https://greggman.github.io/webgpu-avoid-redundant-state-setting/webgpu-check-redundant-state-setting.js';
84776
84776
 
@@ -84781,7 +84781,7 @@ const _commandEncoderDescriptor = new GPUCommandEncoderDescriptor();
84781
84781
  const _computePassDescriptor = new GPUComputePassDescriptor();
84782
84782
  const _querySetDescriptor = new GPUQuerySetDescriptor();
84783
84783
  const _shaderModuleDescriptor = new GPUShaderModuleDescriptor();
84784
- const _renderPassTimestampWrites = new GPURenderPassTimestampWrites();
84784
+ // const _renderPassTimestampWrites = new GPURenderPassTimestampWrites();
84785
84785
  const _texelCopyTextureInfoSrc = new GPUTexelCopyTextureInfo();
84786
84786
  const _texelCopyTextureInfoDst = new GPUTexelCopyTextureInfo();
84787
84787
  const _viewDescriptor = new GPUTextureViewDescriptor();
@@ -87024,15 +87024,22 @@ class WebGPUBackend extends Backend {
87024
87024
  if ( baseOffset === null || timestampQueryPool.querySet === null ) return;
87025
87025
  // !WITH_GENESYS
87026
87026
 
87027
- _renderPassTimestampWrites.querySet = timestampQueryPool.querySet;
87028
- _renderPassTimestampWrites.beginningOfPassWriteIndex = baseOffset;
87029
- _renderPassTimestampWrites.endOfPassWriteIndex = baseOffset + 1;
87030
-
87031
- descriptor.timestampWrites = _renderPassTimestampWrites;
87032
-
87033
87027
  // WITH_GENESYS
87028
+ // Per-pass object: a shared descriptor is mutated by nested beginRender /
87029
+ // copyFramebuffer restarts and can make unrelated passes write the same
87030
+ // query indices (shadow maps collapsing to ~1µs is the common symptom).
87031
+ descriptor.timestampWrites = {
87032
+ querySet: timestampQueryPool.querySet,
87033
+ beginningOfPassWriteIndex: baseOffset,
87034
+ endOfPassWriteIndex: baseOffset + 1,
87035
+ };
87036
+
87034
87037
  this.notifyTimestampQuery( type, uid, label );
87035
87038
  // !WITH_GENESYS
87039
+ // _renderPassTimestampWrites.querySet = timestampQueryPool.querySet;
87040
+ // _renderPassTimestampWrites.beginningOfPassWriteIndex = baseOffset;
87041
+ // _renderPassTimestampWrites.endOfPassWriteIndex = baseOffset + 1;
87042
+ // descriptor.timestampWrites = _renderPassTimestampWrites;
87036
87043
 
87037
87044
  }
87038
87045
 
@@ -87593,6 +87600,17 @@ class WebGPUBackend extends Backend {
87593
87600
  if ( renderContext.depth ) descriptor.depthStencilAttachment.depthLoadOp = GPULoadOp.Load;
87594
87601
  if ( renderContext.stencil ) descriptor.depthStencilAttachment.stencilLoadOp = GPULoadOp.Load;
87595
87602
 
87603
+ // WITH_GENESYS
87604
+ // Restarted passes need fresh timestamp slots; reusing the previous
87605
+ // timestampWrites overwrites the first segment's query results.
87606
+ this.initTimestampQuery(
87607
+ TimestampQuery.RENDER,
87608
+ this.getTimestampUID( renderContext ),
87609
+ descriptor,
87610
+ renderContext.gpuProfilerLabel
87611
+ );
87612
+ // !WITH_GENESYS
87613
+
87596
87614
  renderContextData.currentPass = encoder.beginRenderPass( descriptor );
87597
87615
  renderContextData.currentSets = { attributes: {}, bindingGroups: [], pipeline: null, index: null };
87598
87616