diff options
author | Feng Chen <vonchenplus@gmail.com> | 2023-03-15 14:17:44 +0100 |
---|---|---|
committer | Feng Chen <vonchenplus@gmail.com> | 2023-03-31 06:33:07 +0200 |
commit | ff2089fdf5c25e439099fed2a8bc5029aa7985eb (patch) | |
tree | af706722c8577d0ebbdd18bbf5859acf8d3dec52 | |
parent | video_core: Better defined ImageInfo parameters (diff) | |
download | yuzu-ff2089fdf5c25e439099fed2a8bc5029aa7985eb.tar yuzu-ff2089fdf5c25e439099fed2a8bc5029aa7985eb.tar.gz yuzu-ff2089fdf5c25e439099fed2a8bc5029aa7985eb.tar.bz2 yuzu-ff2089fdf5c25e439099fed2a8bc5029aa7985eb.tar.lz yuzu-ff2089fdf5c25e439099fed2a8bc5029aa7985eb.tar.xz yuzu-ff2089fdf5c25e439099fed2a8bc5029aa7985eb.tar.zst yuzu-ff2089fdf5c25e439099fed2a8bc5029aa7985eb.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/engines/maxwell_3d.h | 8 | ||||
-rw-r--r-- | src/video_core/texture_cache/image_info.cpp | 33 |
2 files changed, 22 insertions, 19 deletions
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index c89969bb4..6c19354e1 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -856,8 +856,8 @@ public: struct ZetaSize { enum class DimensionControl : u32 { - DepthDefinesArray = 0, - ArraySizeOne = 1, + DefineArraySize = 0, + ArraySizeIsOne = 1, }; u32 width; @@ -1104,8 +1104,8 @@ public: struct TileMode { enum class DimensionControl : u32 { - DepthDefinesArray = 0, - DepthDefinesDepth = 1, + DefineArraySize = 0, + DefineDepthSize = 1, }; union { BitField<0, 4, u32> block_width; diff --git a/src/video_core/texture_cache/image_info.cpp b/src/video_core/texture_cache/image_info.cpp index 0b231887c..11f3f78a1 100644 --- a/src/video_core/texture_cache/image_info.cpp +++ b/src/video_core/texture_cache/image_info.cpp @@ -14,6 +14,7 @@ namespace VideoCommon { +using Tegra::Engines::Fermi2D; using Tegra::Engines::Maxwell3D; using Tegra::Texture::TextureType; using Tegra::Texture::TICEntry; @@ -114,13 +115,13 @@ ImageInfo::ImageInfo(const TICEntry& config) noexcept { } } -ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::RenderTargetConfig& ct, +ImageInfo::ImageInfo(const Maxwell3D::Regs::RenderTargetConfig& ct, Tegra::Texture::MsaaMode msaa_mode) noexcept { format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(ct.format); rescaleable = false; if (ct.tile_mode.is_pitch_linear) { ASSERT(ct.tile_mode.dim_control == - Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesArray); + Maxwell3D::Regs::TileMode::DimensionControl::DefineArraySize); type = ImageType::Linear; pitch = ct.width; size = Extent3D{ @@ -140,8 +141,7 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::RenderTargetConfig& .height = ct.tile_mode.block_height, .depth = ct.tile_mode.block_depth, }; - if (ct.tile_mode.dim_control == - Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesDepth) { + if (ct.tile_mode.dim_control == Maxwell3D::Regs::TileMode::DimensionControl::DefineDepthSize) { type = ImageType::e3D; size.depth = ct.depth; } else { @@ -153,8 +153,7 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::RenderTargetConfig& } } -ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::Zeta& zt, - const Tegra::Engines::Maxwell3D::Regs::ZetaSize& zt_size, +ImageInfo::ImageInfo(const Maxwell3D::Regs::Zeta& zt, const Maxwell3D::Regs::ZetaSize& zt_size, Tegra::Texture::MsaaMode msaa_mode) noexcept { format = VideoCore::Surface::PixelFormatFromDepthFormat(zt.format); size.width = zt_size.width; @@ -171,30 +170,34 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::Zeta& zt, }; if (zt.tile_mode.is_pitch_linear) { ASSERT(zt.tile_mode.dim_control == - Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesArray); + Maxwell3D::Regs::TileMode::DimensionControl::DefineArraySize); type = ImageType::Linear; pitch = size.width * BytesPerBlock(format); } else if (zt.tile_mode.dim_control == - Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesDepth) { - ASSERT(zt.tile_mode.is_pitch_linear == 0); - ASSERT(zt_size.dim_control == Maxwell3D::Regs::ZetaSize::DimensionControl::ArraySizeOne); + Maxwell3D::Regs::TileMode::DimensionControl::DefineDepthSize) { + ASSERT(zt_size.dim_control == Maxwell3D::Regs::ZetaSize::DimensionControl::ArraySizeIsOne); type = ImageType::e3D; size.depth = zt_size.depth; } else { - ASSERT(zt_size.dim_control == - Maxwell3D::Regs::ZetaSize::DimensionControl::DepthDefinesArray); rescaleable = block.depth == 0; downscaleable = size.height > 512; type = ImageType::e2D; - resources.layers = zt_size.depth; + switch (zt_size.dim_control) { + case Maxwell3D::Regs::ZetaSize::DimensionControl::DefineArraySize: + resources.layers = zt_size.depth; + break; + case Maxwell3D::Regs::ZetaSize::DimensionControl::ArraySizeIsOne: + resources.layers = 1; + break; + } } } -ImageInfo::ImageInfo(const Tegra::Engines::Fermi2D::Surface& config) noexcept { +ImageInfo::ImageInfo(const Fermi2D::Surface& config) noexcept { UNIMPLEMENTED_IF_MSG(config.layer != 0, "Surface layer is not zero"); format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(config.format); rescaleable = false; - if (config.linear == Tegra::Engines::Fermi2D::MemoryLayout::Pitch) { + if (config.linear == Fermi2D::MemoryLayout::Pitch) { type = ImageType::Linear; size = Extent3D{ .width = config.pitch / VideoCore::Surface::BytesPerBlock(format), |