@needle-tools/three 0.185.1 → 0.185.2-alpha

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.
@@ -5840,12 +5840,31 @@ function setValueV4uiArray( gl, v ) {
5840
5840
 
5841
5841
  // Array of textures (2D / 3D / Cube / 2DArray)
5842
5842
 
5843
+ const _warnedEmptySamplerArray = new Set();
5844
+
5843
5845
  function setValueT1Array( gl, v, textures ) {
5844
5846
 
5845
5847
  const cache = this.cache;
5846
5848
 
5847
5849
  const n = v.length;
5848
5850
 
5851
+ // An empty sampler array (`sampler2D x[0]`) has nothing to bind, and Chrome throws
5852
+ // "WebGL: INVALID_VALUE: uniform1iv: no array" on `gl.uniform1iv([])` — every frame.
5853
+ // Skip the upload (a genuine no-op) and warn once per uniform so the source of the
5854
+ // empty array can be tracked down. Seen with empty shadow sampler arrays (ContactShadows).
5855
+ if ( n === 0 ) {
5856
+
5857
+ if ( ! _warnedEmptySamplerArray.has( this.id ) ) {
5858
+
5859
+ _warnedEmptySamplerArray.add( this.id );
5860
+ console.warn( `THREE.WebGLUniforms: skipping empty sampler array uniform '${ this.id }' (nothing to bind).` );
5861
+
5862
+ }
5863
+
5864
+ return;
5865
+
5866
+ }
5867
+
5849
5868
  const units = allocTexUnits( textures, n );
5850
5869
 
5851
5870
  if ( ! arraysEqual( cache, units ) ) {