@@ -102,7 +102,7 @@ class Texture {
102102 * @param {string } [options.name] - The name of the texture. Defaults to null.
103103 * @param {number } [options.width] - The width of the texture in pixels. Defaults to 4.
104104 * @param {number } [options.height] - The height of the texture in pixels. Defaults to 4.
105- * @param {number } [options.slices ] - The number of depth slices in a 3D texture, the number of textures
105+ * @param {number } [options.layers ] - The number of depth layers in a 3D texture, the number of textures
106106 * in a texture array or the number of faces for a cubemap.
107107 * @param {string } [options.dimension] - The texture dimension type. Can be:
108108 * - {@link TEXTUREDIMENSION_2D}
@@ -229,7 +229,7 @@ class Texture {
229229 Debug . assert ( this . device , "Texture constructor requires a graphicsDevice to be valid" ) ;
230230 Debug . assert ( ! options . width || Number . isInteger ( options . width ) , "Texture width must be an integer number, got" , options ) ;
231231 Debug . assert ( ! options . height || Number . isInteger ( options . height ) , "Texture height must be an integer number, got" , options ) ;
232- Debug . assert ( ! options . slices || Number . isInteger ( options . slices ) , "Texture slices must be an integer number, got" , options ) ;
232+ Debug . assert ( ! options . layers || Number . isInteger ( options . layers ) , "Texture layers must be an integer number, got" , options ) ;
233233
234234 this . name = options . name ?? '' ;
235235
@@ -241,9 +241,9 @@ class Texture {
241241 this . _width = Math . floor ( options . width ?? 4 ) ;
242242 this . _height = Math . floor ( options . height ?? 4 ) ;
243243
244- this . _slices = Math . floor ( options . slices ?? ( this . _dimension === TEXTUREDIMENSION_CUBE ? 6 : 1 ) ) ;
244+ this . _layers = Math . floor ( options . layers ?? ( this . _dimension === TEXTUREDIMENSION_CUBE ? 6 : 1 ) ) ;
245245
246- Debug . assert ( ( this . _dimension === TEXTUREDIMENSION_CUBE ? this . _slices === 6 : true ) , "Texture cube map must have 6 slices " ) ;
246+ Debug . assert ( ( this . _dimension === TEXTUREDIMENSION_CUBE ? this . _layers === 6 : true ) , "Texture cube map must have 6 layers " ) ;
247247
248248 this . _format = options . format ?? PIXELFORMAT_RGBA8 ;
249249 this . _compressed = isCompressedPixelFormat ( this . _format ) ;
@@ -292,7 +292,7 @@ class Texture {
292292 if ( this . _levels ) {
293293 this . upload ( options . immediate ?? false ) ;
294294 } else {
295- this . _levels = ( this . cubemap || this . array ) ? [ Array ( this . _slices ) . fill ( null ) ] : [ null ] ;
295+ this . _levels = ( this . cubemap || this . array ) ? [ Array ( this . _layers ) . fill ( null ) ] : [ null ] ;
296296 }
297297
298298 // track the texture
@@ -340,10 +340,10 @@ class Texture {
340340 *
341341 * @param {number } width - The new width of the texture.
342342 * @param {number } height - The new height of the texture.
343- * @param {number } [slices ] - The new number of slices for the texture. Defaults to 1.
343+ * @param {number } [layers ] - The new number of layers for the texture. Defaults to 1.
344344 * @ignore
345345 */
346- resize ( width , height , slices = 1 ) {
346+ resize ( width , height , layers = 1 ) {
347347
348348 // destroy texture impl
349349 const device = this . device ;
@@ -352,7 +352,7 @@ class Texture {
352352
353353 this . _width = Math . floor ( width ) ;
354354 this . _height = Math . floor ( height ) ;
355- this . _slices = Math . floor ( slices ) ;
355+ this . _layers = Math . floor ( layers ) ;
356356
357357 // re-create the implementation
358358 this . impl = device . createTextureImpl ( this ) ;
@@ -689,21 +689,21 @@ class Texture {
689689 }
690690
691691 /**
692- * The number of depth slices in a 3D texture.
692+ * The number of depth layers in a 3D texture.
693693 *
694694 * @type {number }
695695 */
696696 get depth ( ) {
697- return this . _dimension === TEXTUREDIMENSION_3D ? this . _slices : 1 ;
697+ return this . _dimension === TEXTUREDIMENSION_3D ? this . _layers : 1 ;
698698 }
699699
700700 /**
701701 * The number of textures in a texture array or the number of faces for a cubemap.
702702 *
703703 * @type {number }
704704 */
705- get slices ( ) {
706- return this . _slices ;
705+ get layers ( ) {
706+ return this . _layers ;
707707 }
708708
709709 /**
@@ -750,7 +750,7 @@ class Texture {
750750
751751 get gpuSize ( ) {
752752 const mips = this . pot && this . _mipmaps && ! ( this . _compressed && this . _levels . length === 1 ) ;
753- return TextureUtils . calcGpuSize ( this . _width , this . _height , this . _slices , this . _format , this . volume , mips ) ;
753+ return TextureUtils . calcGpuSize ( this . _width , this . _height , this . _layers , this . _format , this . volume , mips ) ;
754754 }
755755
756756 /**
@@ -834,7 +834,7 @@ class Texture {
834834
835835 // Force a full resubmission of the texture to the GPU (used on a context restore event)
836836 dirtyAll ( ) {
837- this . _levelsUpdated = ( this . cubemap || this . array ) ? [ Array ( this . _slices ) . fill ( true ) ] : [ true ] ;
837+ this . _levelsUpdated = ( this . cubemap || this . array ) ? [ Array ( this . _layers ) . fill ( true ) ] : [ true ] ;
838838
839839 this . _needsUpload = true ;
840840 this . _needsMipmapsUpload = this . _mipmaps ;
@@ -851,8 +851,8 @@ class Texture {
851851 * to 0.
852852 * @param {number } [options.face] - If the texture is a cubemap, this is the index of the face
853853 * to lock.
854- * @param {number } [options.slice ] - If the texture is a texture array, this is the index of the
855- * slice to lock.
854+ * @param {number } [options.layer ] - If the texture is a texture array, this is the index of the
855+ * layer to lock.
856856 * @param {number } [options.mode] - The lock mode. Can be:
857857 * - {@link TEXTURELOCK_READ}
858858 * - {@link TEXTURELOCK_WRITE}
@@ -864,7 +864,7 @@ class Texture {
864864 // Initialize options to some sensible defaults
865865 options . level ??= 0 ;
866866 options . face ??= 0 ;
867- options . slice ??= 0 ;
867+ options . layer ??= 0 ;
868868 options . mode ??= TEXTURELOCK_WRITE ;
869869
870870 Debug . assert (
@@ -893,7 +893,7 @@ class Texture {
893893
894894 this . _lockedMode = options . mode ;
895895
896- const levels = this . cubemap ? this . _levels [ options . face ] : this . array ? this . _levels [ options . slice ] : this . _levels ;
896+ const levels = this . cubemap ? this . _levels [ options . face ] : this . array ? this . _levels [ options . layer ] : this . _levels ;
897897 if ( levels [ options . level ] === null ) {
898898 // allocate storage for this mip level
899899 const width = Math . max ( 1 , this . _width >> options . level ) ;
@@ -905,7 +905,7 @@ class Texture {
905905
906906 if ( this . _lockedMode === TEXTURELOCK_WRITE ) {
907907 if ( this . cubemap || this . array ) {
908- this . _levelsUpdated [ 0 ] [ options . face ?? options . slice ] = true ;
908+ this . _levelsUpdated [ 0 ] [ options . face ?? options . layer ] = true ;
909909 } else {
910910 this . _levelsUpdated [ 0 ] = true ;
911911 }
@@ -934,7 +934,7 @@ class Texture {
934934 width = source [ 0 ] . width || 0 ;
935935 height = source [ 0 ] . height || 0 ;
936936
937- for ( let i = 0 ; i < this . _slices ; i ++ ) {
937+ for ( let i = 0 ; i < this . _layers ; i ++ ) {
938938 const face = source [ i ] ;
939939 // cubemap becomes invalid if any condition is not satisfied
940940 if ( ! face || // face is missing
@@ -952,7 +952,7 @@ class Texture {
952952
953953 if ( ! invalid ) {
954954 // mark levels as updated
955- for ( let i = 0 ; i < this . _slices ; i ++ ) {
955+ for ( let i = 0 ; i < this . _layers ; i ++ ) {
956956 if ( this . _levels [ 0 ] [ i ] !== source [ i ] )
957957 this . _levelsUpdated [ 0 ] [ i ] = true ;
958958 }
@@ -981,7 +981,7 @@ class Texture {
981981
982982 // remove levels
983983 if ( this . cubemap || this . array ) {
984- for ( let i = 0 ; i < this . _slices ; i ++ ) {
984+ for ( let i = 0 ; i < this . _layers ; i ++ ) {
985985 this . _levels [ 0 ] [ i ] = null ;
986986 this . _levelsUpdated [ 0 ] [ i ] = true ;
987987 }
0 commit comments