diff options
| author | 2023-03-15 21:17:44 +0800 | |
|---|---|---|
| committer | 2023-03-31 12:33:07 +0800 | |
| commit | ff2089fdf5c25e439099fed2a8bc5029aa7985eb (patch) | |
| tree | af706722c8577d0ebbdd18bbf5859acf8d3dec52 /src | |
| parent | video_core: Better defined ImageInfo parameters (diff) | |
| download | yuzu-ff2089fdf5c25e439099fed2a8bc5029aa7985eb.tar.gz yuzu-ff2089fdf5c25e439099fed2a8bc5029aa7985eb.tar.xz yuzu-ff2089fdf5c25e439099fed2a8bc5029aa7985eb.zip | |
video_core: Keep the definition of DimensionControl consistent with nvidia open doc
Diffstat (limited to 'src')
| -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: | |||
| 856 | 856 | ||
| 857 | struct ZetaSize { | 857 | struct ZetaSize { |
| 858 | enum class DimensionControl : u32 { | 858 | enum class DimensionControl : u32 { |
| 859 | DepthDefinesArray = 0, | 859 | DefineArraySize = 0, |
| 860 | ArraySizeOne = 1, | 860 | ArraySizeIsOne = 1, |
| 861 | }; | 861 | }; |
| 862 | 862 | ||
| 863 | u32 width; | 863 | u32 width; |
| @@ -1104,8 +1104,8 @@ public: | |||
| 1104 | 1104 | ||
| 1105 | struct TileMode { | 1105 | struct TileMode { |
| 1106 | enum class DimensionControl : u32 { | 1106 | enum class DimensionControl : u32 { |
| 1107 | DepthDefinesArray = 0, | 1107 | DefineArraySize = 0, |
| 1108 | DepthDefinesDepth = 1, | 1108 | DefineDepthSize = 1, |
| 1109 | }; | 1109 | }; |
| 1110 | union { | 1110 | union { |
| 1111 | BitField<0, 4, u32> block_width; | 1111 | 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 @@ | |||
| 14 | 14 | ||
| 15 | namespace VideoCommon { | 15 | namespace VideoCommon { |
| 16 | 16 | ||
| 17 | using Tegra::Engines::Fermi2D; | ||
| 17 | using Tegra::Engines::Maxwell3D; | 18 | using Tegra::Engines::Maxwell3D; |
| 18 | using Tegra::Texture::TextureType; | 19 | using Tegra::Texture::TextureType; |
| 19 | using Tegra::Texture::TICEntry; | 20 | using Tegra::Texture::TICEntry; |
| @@ -114,13 +115,13 @@ ImageInfo::ImageInfo(const TICEntry& config) noexcept { | |||
| 114 | } | 115 | } |
| 115 | } | 116 | } |
| 116 | 117 | ||
| 117 | ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::RenderTargetConfig& ct, | 118 | ImageInfo::ImageInfo(const Maxwell3D::Regs::RenderTargetConfig& ct, |
| 118 | Tegra::Texture::MsaaMode msaa_mode) noexcept { | 119 | Tegra::Texture::MsaaMode msaa_mode) noexcept { |
| 119 | format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(ct.format); | 120 | format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(ct.format); |
| 120 | rescaleable = false; | 121 | rescaleable = false; |
| 121 | if (ct.tile_mode.is_pitch_linear) { | 122 | if (ct.tile_mode.is_pitch_linear) { |
| 122 | ASSERT(ct.tile_mode.dim_control == | 123 | ASSERT(ct.tile_mode.dim_control == |
| 123 | Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesArray); | 124 | Maxwell3D::Regs::TileMode::DimensionControl::DefineArraySize); |
| 124 | type = ImageType::Linear; | 125 | type = ImageType::Linear; |
| 125 | pitch = ct.width; | 126 | pitch = ct.width; |
| 126 | size = Extent3D{ | 127 | size = Extent3D{ |
| @@ -140,8 +141,7 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::RenderTargetConfig& | |||
| 140 | .height = ct.tile_mode.block_height, | 141 | .height = ct.tile_mode.block_height, |
| 141 | .depth = ct.tile_mode.block_depth, | 142 | .depth = ct.tile_mode.block_depth, |
| 142 | }; | 143 | }; |
| 143 | if (ct.tile_mode.dim_control == | 144 | if (ct.tile_mode.dim_control == Maxwell3D::Regs::TileMode::DimensionControl::DefineDepthSize) { |
| 144 | Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesDepth) { | ||
| 145 | type = ImageType::e3D; | 145 | type = ImageType::e3D; |
| 146 | size.depth = ct.depth; | 146 | size.depth = ct.depth; |
| 147 | } else { | 147 | } else { |
| @@ -153,8 +153,7 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::RenderTargetConfig& | |||
| 153 | } | 153 | } |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::Zeta& zt, | 156 | ImageInfo::ImageInfo(const Maxwell3D::Regs::Zeta& zt, const Maxwell3D::Regs::ZetaSize& zt_size, |
| 157 | const Tegra::Engines::Maxwell3D::Regs::ZetaSize& zt_size, | ||
| 158 | Tegra::Texture::MsaaMode msaa_mode) noexcept { | 157 | Tegra::Texture::MsaaMode msaa_mode) noexcept { |
| 159 | format = VideoCore::Surface::PixelFormatFromDepthFormat(zt.format); | 158 | format = VideoCore::Surface::PixelFormatFromDepthFormat(zt.format); |
| 160 | size.width = zt_size.width; | 159 | size.width = zt_size.width; |
| @@ -171,30 +170,34 @@ ImageInfo::ImageInfo(const Tegra::Engines::Maxwell3D::Regs::Zeta& zt, | |||
| 171 | }; | 170 | }; |
| 172 | if (zt.tile_mode.is_pitch_linear) { | 171 | if (zt.tile_mode.is_pitch_linear) { |
| 173 | ASSERT(zt.tile_mode.dim_control == | 172 | ASSERT(zt.tile_mode.dim_control == |
| 174 | Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesArray); | 173 | Maxwell3D::Regs::TileMode::DimensionControl::DefineArraySize); |
| 175 | type = ImageType::Linear; | 174 | type = ImageType::Linear; |
| 176 | pitch = size.width * BytesPerBlock(format); | 175 | pitch = size.width * BytesPerBlock(format); |
| 177 | } else if (zt.tile_mode.dim_control == | 176 | } else if (zt.tile_mode.dim_control == |
| 178 | Maxwell3D::Regs::TileMode::DimensionControl::DepthDefinesDepth) { | 177 | Maxwell3D::Regs::TileMode::DimensionControl::DefineDepthSize) { |
| 179 | ASSERT(zt.tile_mode.is_pitch_linear == 0); | 178 | ASSERT(zt_size.dim_control == Maxwell3D::Regs::ZetaSize::DimensionControl::ArraySizeIsOne); |
| 180 | ASSERT(zt_size.dim_control == Maxwell3D::Regs::ZetaSize::DimensionControl::ArraySizeOne); | ||
| 181 | type = ImageType::e3D; | 179 | type = ImageType::e3D; |
| 182 | size.depth = zt_size.depth; | 180 | size.depth = zt_size.depth; |
| 183 | } else { | 181 | } else { |
| 184 | ASSERT(zt_size.dim_control == | ||
| 185 | Maxwell3D::Regs::ZetaSize::DimensionControl::DepthDefinesArray); | ||
| 186 | rescaleable = block.depth == 0; | 182 | rescaleable = block.depth == 0; |
| 187 | downscaleable = size.height > 512; | 183 | downscaleable = size.height > 512; |
| 188 | type = ImageType::e2D; | 184 | type = ImageType::e2D; |
| 189 | resources.layers = zt_size.depth; | 185 | switch (zt_size.dim_control) { |
| 186 | case Maxwell3D::Regs::ZetaSize::DimensionControl::DefineArraySize: | ||
| 187 | resources.layers = zt_size.depth; | ||
| 188 | break; | ||
| 189 | case Maxwell3D::Regs::ZetaSize::DimensionControl::ArraySizeIsOne: | ||
| 190 | resources.layers = 1; | ||
| 191 | break; | ||
| 192 | } | ||
| 190 | } | 193 | } |
| 191 | } | 194 | } |
| 192 | 195 | ||
| 193 | ImageInfo::ImageInfo(const Tegra::Engines::Fermi2D::Surface& config) noexcept { | 196 | ImageInfo::ImageInfo(const Fermi2D::Surface& config) noexcept { |
| 194 | UNIMPLEMENTED_IF_MSG(config.layer != 0, "Surface layer is not zero"); | 197 | UNIMPLEMENTED_IF_MSG(config.layer != 0, "Surface layer is not zero"); |
| 195 | format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(config.format); | 198 | format = VideoCore::Surface::PixelFormatFromRenderTargetFormat(config.format); |
| 196 | rescaleable = false; | 199 | rescaleable = false; |
| 197 | if (config.linear == Tegra::Engines::Fermi2D::MemoryLayout::Pitch) { | 200 | if (config.linear == Fermi2D::MemoryLayout::Pitch) { |
| 198 | type = ImageType::Linear; | 201 | type = ImageType::Linear; |
| 199 | size = Extent3D{ | 202 | size = Extent3D{ |
| 200 | .width = config.pitch / VideoCore::Surface::BytesPerBlock(format), | 203 | .width = config.pitch / VideoCore::Surface::BytesPerBlock(format), |