@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -48,68 +51,73 @@ ImageInfo::ImageInfo(const TICEntry& config) noexcept {
config . texture_type ! = TextureType : : Texture2DNoMipmap ) {
ASSERT ( ! config . IsPitchLinear ( ) ) ;
}
switch ( config . texture_type ) {
case TextureType : : Texture1D :
ASSERT ( config . BaseLayer ( ) = = 0 ) ;
type = ImageType : : e1D ;
size . width = config . Width ( ) ;
resources . layers = 1 ;
break ;
case TextureType : : Texture1DArray :
UNIMPLEMENTED_IF ( config . BaseLayer ( ) ! = 0 ) ;
type = ImageType : : e1D ;
size . width = config . Width ( ) ;
resources . layers = config . Depth ( ) ;
break ;
case TextureType : : Texture2D :
case TextureType : : Texture2DNoMipmap :
ASSERT ( config . Depth ( ) = = 1 ) ;
type = config . IsPitchLinear ( ) ? ImageType : : Linear : ImageType : : e2D ;
rescaleable = ! config . IsPitchLinear ( ) ;
size . width = config . Width ( ) ;
size . height = config . Height ( ) ;
resources . layers = config . BaseLayer ( ) + 1 ;
break ;
case TextureType : : Texture2DArray :
type = ImageType : : e2D ;
rescaleable = true ;
size . width = config . Width ( ) ;
size . height = config . Height ( ) ;
resources . layers = config . BaseLayer ( ) + config . Depth ( ) ;
break ;
case TextureType : : TextureCubemap :
ASSERT ( config . Depth ( ) = = 1 ) ;
type = ImageType : : e2D ;
size . width = config . Width ( ) ;
size . height = config . Height ( ) ;
resources . layers = config . BaseLayer ( ) + 6 ;
break ;
case TextureType : : TextureCubeArray :
UNIMPLEMENTED_IF ( config . load_store_hint ! = 0 ) ;
type = ImageType : : e2D ;
size . width = config . Width ( ) ;
size . height = config . Height ( ) ;
resources . layers = config . BaseLayer ( ) + config . Depth ( ) * 6 ;
break ;
case TextureType : : Texture3D :
ASSERT ( config . BaseLayer ( ) = = 0 ) ;
type = ImageType : : e3D ;
size . width = config . Width ( ) ;
size . height = config . Height ( ) ;
size . depth = config . Depth ( ) ;
resources . layers = 1 ;
break ;
case TextureType : : Texture1DBuffer :
type = ImageType : : Buffer ;
size . width = config . Width ( ) ;
resources . layers = 1 ;
break ;
default :
ASSERT_MSG ( false , " Invalid texture_type={} " , static_cast < int > ( config . texture_type . Value ( ) ) ) ;
break ;
//Normalize so that the 1D that actually uses layers is treated as 1DArray
TextureType tex_type = config . texture_type ;
if ( tex_type = = TextureType : : Texture1D & &
( config . Depth ( ) > 1 | | config . BaseLayer ( ) ! = 0 ) ) {
tex_type = TextureType : : Texture1DArray ;
}
switch ( tex_type ) {
case TextureType : : Texture1D :
ASSERT ( config . BaseLayer ( ) = = 0 ) ;
type = ImageType : : e1D ;
size . width = config . Width ( ) ;
resources . layers = 1 ;
break ;
case TextureType : : Texture1DArray :
type = ImageType : : e1D ;
size . width = config . Width ( ) ;
resources . layers = config . BaseLayer ( ) + config . Depth ( ) ;
break ;
case TextureType : : Texture2D :
case TextureType : : Texture2DNoMipmap :
ASSERT ( config . Depth ( ) = = 1 ) ;
type = config . IsPitchLinear ( ) ? ImageType : : Linear : ImageType : : e2D ;
rescaleable = ! config . IsPitchLinear ( ) ;
size . width = config . Width ( ) ;
size . height = config . Height ( ) ;
resources . layers = config . BaseLayer ( ) + 1 ;
break ;
case TextureType : : Texture2DArray :
type = ImageType : : e2D ;
rescaleable = true ;
size . width = config . Width ( ) ;
size . height = config . Height ( ) ;
resources . layers = config . BaseLayer ( ) + config . Depth ( ) ;
break ;
case TextureType : : TextureCubemap :
ASSERT ( config . Depth ( ) = = 1 ) ;
type = ImageType : : e2D ;
size . width = config . Width ( ) ;
size . height = config . Height ( ) ;
resources . layers = config . BaseLayer ( ) + 6 ;
break ;
case TextureType : : TextureCubeArray :
UNIMPLEMENTED_IF ( config . load_store_hint ! = 0 ) ;
type = ImageType : : e2D ;
size . width = config . Width ( ) ;
size . height = config . Height ( ) ;
resources . layers = config . BaseLayer ( ) + config . Depth ( ) * 6 ;
break ;
case TextureType : : Texture3D :
ASSERT ( config . BaseLayer ( ) = = 0 ) ;
type = ImageType : : e3D ;
size . width = config . Width ( ) ;
size . height = config . Height ( ) ;
size . depth = config . Depth ( ) ;
resources . layers = 1 ;
break ;
case TextureType : : Texture1DBuffer :
type = ImageType : : Buffer ;
size . width = config . Width ( ) ;
resources . layers = 1 ;
break ;
default :
ASSERT_MSG ( false , " Invalid texture_type={} " , static_cast < int > ( config . texture_type . Value ( ) ) ) ;
break ;
}
if ( num_samples > 1 ) {
size . width * = NumSamplesX ( config . msaa_mode ) ;
size . width * = NumSamplesX ( config . msaa_mode ) ;
size . height * = NumSamplesY ( config . msaa_mode ) ;
}
if ( type ! = ImageType : : Linear ) {
@ -118,7 +126,7 @@ ImageInfo::ImageInfo(const TICEntry& config) noexcept {
maybe_unaligned_layer_stride = CalculateLayerSize ( * this ) ;
rescaleable & = ( block . depth = = 0 ) & & resources . levels = = 1 ;
rescaleable & = size . height > RescaleHeightThreshold | |
GetFormatType ( format ) ! = SurfaceType : : ColorTexture ;
GetFormatType ( format ) ! = SurfaceType : : ColorTexture ;
downscaleable = size . height > DownscaleHeightThreshold ;
}
}