@@ -93,7 +93,7 @@ class Texture {
9393 * @param {string } [options.name] - The name of the texture. Defaults to null.
9494 * @param {number } [options.width] - The width of the texture in pixels. Defaults to 4.
9595 * @param {number } [options.height] - The height of the texture in pixels. Defaults to 4.
96- * @param {number } [options.slices ] - The number of depth slices in a 3D texture, the number of textures
96+ * @param {number } [options.layers ] - The number of depth layers in a 3D texture, the number of textures
9797 * in a texture array or the number of faces for a cubemap.
9898 * @param {string } [options.dimension] - The texture dimension type. Can be:
9999 * - {@link TEXTUREDIMENSION_2D}
@@ -220,7 +220,7 @@ class Texture {
220220 Debug . assert ( this . device , "Texture constructor requires a graphicsDevice to be valid" ) ;
221221 Debug . assert ( ! options . width || Number . isInteger ( options . width ) , "Texture width must be an integer number, got" , options ) ;
222222 Debug . assert ( ! options . height || Number . isInteger ( options . height ) , "Texture height must be an integer number, got" , options ) ;
223- Debug . assert ( ! options . slices || Number . isInteger ( options . slices ) , "Texture slices must be an integer number, got" , options ) ;
223+ Debug . assert ( ! options . layers || Number . isInteger ( options . layers ) , "Texture layers must be an integer number, got" , options ) ;
224224
225225 this . name = options . name ?? '' ;
226226
@@ -232,9 +232,9 @@ class Texture {
232232 this . _width = Math . floor ( options . width ?? 4 ) ;
233233 this . _height = Math . floor ( options . height ?? 4 ) ;
234234
235- this . _slices = Math . floor ( options . slices ?? ( this . _dimension === TEXTUREDIMENSION_CUBE ? 6 : 1 ) ) ;
235+ this . _layers = Math . floor ( options . layers ?? ( this . _dimension === TEXTUREDIMENSION_CUBE ? 6 : 1 ) ) ;
236236
237- Debug . assert ( ( this . _dimension === TEXTUREDIMENSION_CUBE ? this . _slices === 6 : true ) , "Texture cube map must have 6 slices " ) ;
237+ Debug . assert ( ( this . _dimension === TEXTUREDIMENSION_CUBE ? this . _layers === 6 : true ) , "Texture cube map must have 6 layers " ) ;
238238
239239 this . _format = options . format ?? PIXELFORMAT_RGBA8 ;
240240 this . _compressed = isCompressedPixelFormat ( this . _format ) ;
@@ -283,7 +283,7 @@ class Texture {
283283 if ( this . _levels ) {
284284 this . upload ( options . immediate ?? false ) ;
285285 } else {
286- this . _levels = ( this . cubemap || this . array ) ? [ Array ( this . _slices ) . fill ( null ) ] : [ null ] ;
286+ this . _levels = ( this . cubemap || this . array ) ? [ Array ( this . _layers ) . fill ( null ) ] : [ null ] ;
287287 }
288288
289289 // track the texture
@@ -331,10 +331,10 @@ class Texture {
331331 *
332332 * @param {number } width - The new width of the texture.
333333 * @param {number } height - The new height of the texture.
334- * @param {number } [slices ] - The new number of slices for the texture. Defaults to 1.
334+ * @param {number } [layers ] - The new number of layers for the texture. Defaults to 1.
335335 * @ignore
336336 */
337- resize ( width , height , slices = 1 ) {
337+ resize ( width , height , layers = 1 ) {
338338
339339 // destroy texture impl
340340 const device = this . device ;
@@ -343,7 +343,7 @@ class Texture {
343343
344344 this . _width = Math . floor ( width ) ;
345345 this . _height = Math . floor ( height ) ;
346- this . _slices = Math . floor ( slices ) ;
346+ this . _layers = Math . floor ( layers ) ;
347347
348348 // re-create the implementation
349349 this . impl = device . createTextureImpl ( this ) ;
@@ -680,21 +680,21 @@ class Texture {
680680 }
681681
682682 /**
683- * The number of depth slices in a 3D texture.
683+ * The number of depth layers in a 3D texture.
684684 *
685685 * @type {number }
686686 */
687687 get depth ( ) {
688- return this . _dimension === TEXTUREDIMENSION_3D ? this . _slices : 1 ;
688+ return this . _dimension === TEXTUREDIMENSION_3D ? this . _layers : 1 ;
689689 }
690690
691691 /**
692692 * The number of textures in a texture array or the number of faces for a cubemap.
693693 *
694694 * @type {number }
695695 */
696- get slices ( ) {
697- return this . _slices ;
696+ get layers ( ) {
697+ return this . _layers ;
698698 }
699699
700700 /**
@@ -741,7 +741,7 @@ class Texture {
741741
742742 get gpuSize ( ) {
743743 const mips = this . pot && this . _mipmaps && ! ( this . _compressed && this . _levels . length === 1 ) ;
744- return TextureUtils . calcGpuSize ( this . _width , this . _height , this . _slices , this . _format , this . volume , mips ) ;
744+ return TextureUtils . calcGpuSize ( this . _width , this . _height , this . _layers , this . _format , this . volume , mips ) ;
745745 }
746746
747747 /**
@@ -822,7 +822,7 @@ class Texture {
822822
823823 // Force a full resubmission of the texture to the GPU (used on a context restore event)
824824 dirtyAll ( ) {
825- this . _levelsUpdated = ( this . cubemap || this . array ) ? [ Array ( this . _slices ) . fill ( true ) ] : [ true ] ;
825+ this . _levelsUpdated = ( this . cubemap || this . array ) ? [ Array ( this . _layers ) . fill ( true ) ] : [ true ] ;
826826
827827 this . _needsUpload = true ;
828828 this . _needsMipmapsUpload = this . _mipmaps ;
@@ -839,8 +839,8 @@ class Texture {
839839 * to 0.
840840 * @param {number } [options.face] - If the texture is a cubemap, this is the index of the face
841841 * to lock.
842- * @param {number } [options.slice ] - If the texture is a texture array, this is the index of the
843- * slice to lock.
842+ * @param {number } [options.layer ] - If the texture is a texture array, this is the index of the
843+ * layer to lock.
844844 * @param {number } [options.mode] - The lock mode. Can be:
845845 * - {@link TEXTURELOCK_READ}
846846 * - {@link TEXTURELOCK_WRITE}
@@ -852,7 +852,7 @@ class Texture {
852852 // Initialize options to some sensible defaults
853853 options . level ??= 0 ;
854854 options . face ??= 0 ;
855- options . slice ??= 0 ;
855+ options . layer ??= 0 ;
856856 options . mode ??= TEXTURELOCK_WRITE ;
857857
858858 Debug . assert (
@@ -881,7 +881,7 @@ class Texture {
881881
882882 this . _lockedMode = options . mode ;
883883
884- const levels = this . cubemap ? this . _levels [ options . face ] : this . array ? this . _levels [ options . slice ] : this . _levels ;
884+ const levels = this . cubemap ? this . _levels [ options . face ] : this . array ? this . _levels [ options . layer ] : this . _levels ;
885885 if ( levels [ options . level ] === null ) {
886886 // allocate storage for this mip level
887887 const width = Math . max ( 1 , this . _width >> options . level ) ;
@@ -893,7 +893,7 @@ class Texture {
893893
894894 if ( this . _lockedMode === TEXTURELOCK_WRITE ) {
895895 if ( this . cubemap || this . array ) {
896- this . _levelsUpdated [ 0 ] [ options . face ?? options . slice ] = true ;
896+ this . _levelsUpdated [ 0 ] [ options . face ?? options . layer ] = true ;
897897 } else {
898898 this . _levelsUpdated [ 0 ] = true ;
899899 }
@@ -922,7 +922,7 @@ class Texture {
922922 width = source [ 0 ] . width || 0 ;
923923 height = source [ 0 ] . height || 0 ;
924924
925- for ( let i = 0 ; i < this . _slices ; i ++ ) {
925+ for ( let i = 0 ; i < this . _layers ; i ++ ) {
926926 const face = source [ i ] ;
927927 // cubemap becomes invalid if any condition is not satisfied
928928 if ( ! face || // face is missing
@@ -940,7 +940,7 @@ class Texture {
940940
941941 if ( ! invalid ) {
942942 // mark levels as updated
943- for ( let i = 0 ; i < this . _slices ; i ++ ) {
943+ for ( let i = 0 ; i < this . _layers ; i ++ ) {
944944 if ( this . _levels [ 0 ] [ i ] !== source [ i ] )
945945 this . _levelsUpdated [ 0 ] [ i ] = true ;
946946 }
@@ -970,7 +970,7 @@ class Texture {
970970
971971 // remove levels
972972 if ( this . cubemap || this . array ) {
973- for ( let i = 0 ; i < this . _slices ; i ++ ) {
973+ for ( let i = 0 ; i < this . _layers ; i ++ ) {
974974 this . _levels [ 0 ] [ i ] = null ;
975975 this . _levelsUpdated [ 0 ] [ i ] = true ;
976976 }
0 commit comments