@@ -45,8 +45,14 @@ import { CubeTexture } from '../../textures/CubeTexture.js';
4545import { Texture } from '../../textures/Texture.js' ;
4646import { DataArrayTexture } from '../../textures/DataArrayTexture.js' ;
4747import { Data3DTexture } from '../../textures/Data3DTexture.js' ;
48+ import { DepthTexture } from '../../textures/DepthTexture.js' ;
49+ import { LessEqualCompare } from '../../constants.js' ;
4850
4951const emptyTexture = /*@__PURE__ */ new Texture ( ) ;
52+
53+ const emptyShadowTexture = /*@__PURE__ */ new DepthTexture ( 1 , 1 ) ;
54+ emptyShadowTexture . compareFunction = LessEqualCompare ;
55+
5056const emptyArrayTexture = /*@__PURE__ */ new DataArrayTexture ( ) ;
5157const empty3dTexture = /*@__PURE__ */ new Data3DTexture ( ) ;
5258const emptyCubeTexture = /*@__PURE__ */ new CubeTexture ( ) ;
@@ -563,7 +569,9 @@ function setValueT1( gl, v, textures ) {
563569
564570 }
565571
566- textures . setTexture2D ( v || emptyTexture , unit ) ;
572+ const emptyTexture2D = ( this . type === gl . SAMPLER_2D_SHADOW ) ? emptyShadowTexture : emptyTexture ;
573+
574+ textures . setTexture2D ( v || emptyTexture2D , unit ) ;
567575
568576}
569577
@@ -947,6 +955,7 @@ class SingleUniform {
947955 this . id = id ;
948956 this . addr = addr ;
949957 this . cache = [ ] ;
958+ this . type = activeInfo . type ;
950959 this . setValue = getSingularSetter ( activeInfo . type ) ;
951960
952961 // this.path = activeInfo.name; // DEBUG
@@ -962,6 +971,7 @@ class PureArrayUniform {
962971 this . id = id ;
963972 this . addr = addr ;
964973 this . cache = [ ] ;
974+ this . type = activeInfo . type ;
965975 this . size = activeInfo . size ;
966976 this . setValue = getPureArraySetter ( activeInfo . type ) ;
967977
0 commit comments