@@ -104,7 +104,7 @@ class Texture {
104104 * @param {string } [options.name] - The name of the texture. Defaults to null.
105105 * @param {number } [options.width] - The width of the texture in pixels. Defaults to 4.
106106 * @param {number } [options.height] - The height of the texture in pixels. Defaults to 4.
107- * @param {number } [options.slices ] - The number of depth slices in a 3D texture, the number of textures
107+ * @param {number } [options.layers ] - The number of depth layers in a 3D texture, the number of textures
108108 * in a texture array or the number of faces for a cubemap.
109109 * @param {string } [options.dimension] - The texture dimension type. Can be:
110110 * - {@link TEXTUREDIMENSION_2D}
@@ -231,7 +231,7 @@ class Texture {
231231 Debug . assert ( this . device , "Texture constructor requires a graphicsDevice to be valid" ) ;
232232 Debug . assert ( ! options . width || Number . isInteger ( options . width ) , "Texture width must be an integer number, got" , options ) ;
233233 Debug . assert ( ! options . height || Number . isInteger ( options . height ) , "Texture height must be an integer number, got" , options ) ;
234- Debug . assert ( ! options . slices || Number . isInteger ( options . slices ) , "Texture slices must be an integer number, got" , options ) ;
234+ Debug . assert ( ! options . layers || Number . isInteger ( options . layers ) , "Texture layers must be an integer number, got" , options ) ;
235235
236236 this . name = options . name ?? '' ;
237237
@@ -243,9 +243,9 @@ class Texture {
243243 this . _width = Math . floor ( options . width ?? 4 ) ;
244244 this . _height = Math . floor ( options . height ?? 4 ) ;
245245
246- this . _slices = Math . floor ( options . slices ?? ( this . _dimension === TEXTUREDIMENSION_CUBE ? 6 : 1 ) ) ;
246+ this . _layers = Math . floor ( options . layers ?? ( this . _dimension === TEXTUREDIMENSION_CUBE ? 6 : 1 ) ) ;
247247
248- Debug . assert ( ( this . _dimension === TEXTUREDIMENSION_CUBE ? this . _slices === 6 : true ) , "Texture cube map must have 6 slices " ) ;
248+ Debug . assert ( ( this . _dimension === TEXTUREDIMENSION_CUBE ? this . _layers === 6 : true ) , "Texture cube map must have 6 layers " ) ;
249249
250250 this . _format = options . format ?? PIXELFORMAT_RGBA8 ;
251251 this . _compressed = isCompressedPixelFormat ( this . _format ) ;
@@ -294,7 +294,7 @@ class Texture {
294294 if ( this . _levels ) {
295295 this . upload ( options . immediate ?? false ) ;
296296 } else {
297- this . _levels = ( this . cubemap || this . array ) ? [ Array ( this . _slices ) . fill ( null ) ] : [ null ] ;
297+ this . _levels = ( this . cubemap || this . array ) ? [ Array ( this . _layers ) . fill ( null ) ] : [ null ] ;
298298 }
299299
300300 // track the texture
@@ -342,10 +342,10 @@ class Texture {
342342 *
343343 * @param {number } width - The new width of the texture.
344344 * @param {number } height - The new height of the texture.
345- * @param {number } [slices ] - The new number of slices for the texture. Defaults to 1.
345+ * @param {number } [layers ] - The new number of layers for the texture. Defaults to 1.
346346 * @ignore
347347 */
348- resize ( width , height , slices = 1 ) {
348+ resize ( width , height , layers = 1 ) {
349349
350350 // destroy texture impl
351351 const device = this . device ;
@@ -354,7 +354,7 @@ class Texture {
354354
355355 this . _width = Math . floor ( width ) ;
356356 this . _height = Math . floor ( height ) ;
357- this . _slices = Math . floor ( slices ) ;
357+ this . _layers = Math . floor ( layers ) ;
358358
359359 // re-create the implementation
360360 this . impl = device . createTextureImpl ( this ) ;
@@ -691,21 +691,21 @@ class Texture {
691691 }
692692
693693 /**
694- * The number of depth slices in a 3D texture.
694+ * The number of depth layers in a 3D texture.
695695 *
696696 * @type {number }
697697 */
698698 get depth ( ) {
699- return this . _dimension === TEXTUREDIMENSION_3D ? this . _slices : 1 ;
699+ return this . _dimension === TEXTUREDIMENSION_3D ? this . _layers : 1 ;
700700 }
701701
702702 /**
703703 * The number of textures in a texture array or the number of faces for a cubemap.
704704 *
705705 * @type {number }
706706 */
707- get slices ( ) {
708- return this . _slices ;
707+ get layers ( ) {
708+ return this . _layers ;
709709 }
710710
711711 /**
@@ -752,7 +752,7 @@ class Texture {
752752
753753 get gpuSize ( ) {
754754 const mips = this . pot && this . _mipmaps && ! ( this . _compressed && this . _levels . length === 1 ) ;
755- return TextureUtils . calcGpuSize ( this . _width , this . _height , this . _slices , this . _format , this . volume , mips ) ;
755+ return TextureUtils . calcGpuSize ( this . _width , this . _height , this . _layers , this . _format , this . volume , mips ) ;
756756 }
757757
758758 /**
@@ -833,7 +833,7 @@ class Texture {
833833
834834 // Force a full resubmission of the texture to the GPU (used on a context restore event)
835835 dirtyAll ( ) {
836- this . _levelsUpdated = ( this . cubemap || this . array ) ? [ Array ( this . _slices ) . fill ( true ) ] : [ true ] ;
836+ this . _levelsUpdated = ( this . cubemap || this . array ) ? [ Array ( this . _layers ) . fill ( true ) ] : [ true ] ;
837837
838838 this . _needsUpload = true ;
839839 this . _needsMipmapsUpload = this . _mipmaps ;
@@ -850,8 +850,8 @@ class Texture {
850850 * to 0.
851851 * @param {number } [options.face] - If the texture is a cubemap, this is the index of the face
852852 * to lock.
853- * @param {number } [options.slice ] - If the texture is a texture array, this is the index of the
854- * slice to lock.
853+ * @param {number } [options.layer ] - If the texture is a texture array, this is the index of the
854+ * layer to lock.
855855 * @param {number } [options.mode] - The lock mode. Can be:
856856 * - {@link TEXTURELOCK_READ}
857857 * - {@link TEXTURELOCK_WRITE}
@@ -863,7 +863,7 @@ class Texture {
863863 // Initialize options to some sensible defaults
864864 options . level ??= 0 ;
865865 options . face ??= 0 ;
866- options . slice ??= 0 ;
866+ options . layer ??= 0 ;
867867 options . mode ??= TEXTURELOCK_WRITE ;
868868
869869 Debug . assert (
@@ -892,7 +892,7 @@ class Texture {
892892
893893 this . _lockedMode = options . mode ;
894894
895- const levels = this . cubemap ? this . _levels [ options . face ] : this . array ? this . _levels [ options . slice ] : this . _levels ;
895+ const levels = this . cubemap ? this . _levels [ options . face ] : this . array ? this . _levels [ options . layer ] : this . _levels ;
896896 if ( levels [ options . level ] === null ) {
897897 // allocate storage for this mip level
898898 const width = Math . max ( 1 , this . _width >> options . level ) ;
@@ -904,7 +904,7 @@ class Texture {
904904
905905 if ( this . _lockedMode === TEXTURELOCK_WRITE ) {
906906 if ( this . cubemap || this . array ) {
907- this . _levelsUpdated [ 0 ] [ options . face ?? options . slice ] = true ;
907+ this . _levelsUpdated [ 0 ] [ options . face ?? options . layer ] = true ;
908908 } else {
909909 this . _levelsUpdated [ 0 ] = true ;
910910 }
@@ -933,7 +933,7 @@ class Texture {
933933 width = source [ 0 ] . width || 0 ;
934934 height = source [ 0 ] . height || 0 ;
935935
936- for ( let i = 0 ; i < this . _slices ; i ++ ) {
936+ for ( let i = 0 ; i < this . _layers ; i ++ ) {
937937 const face = source [ i ] ;
938938 // cubemap becomes invalid if any condition is not satisfied
939939 if ( ! face || // face is missing
@@ -951,7 +951,7 @@ class Texture {
951951
952952 if ( ! invalid ) {
953953 // mark levels as updated
954- for ( let i = 0 ; i < this . _slices ; i ++ ) {
954+ for ( let i = 0 ; i < this . _layers ; i ++ ) {
955955 if ( this . _levels [ 0 ] [ i ] !== source [ i ] )
956956 this . _levelsUpdated [ 0 ] [ i ] = true ;
957957 }
@@ -980,7 +980,7 @@ class Texture {
980980
981981 // remove levels
982982 if ( this . cubemap || this . array ) {
983- for ( let i = 0 ; i < this . _slices ; i ++ ) {
983+ for ( let i = 0 ; i < this . _layers ; i ++ ) {
984984 this . _levels [ 0 ] [ i ] = null ;
985985 this . _levelsUpdated [ 0 ] [ i ] = true ;
986986 }
0 commit comments