diff options
author | Fernando S <fsahmkow27@gmail.com> | 2023-03-05 15:30:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-05 15:30:47 +0100 |
commit | fdae95efaa84fe1baeab0b4dd1435720cae0f88d (patch) | |
tree | 383070bd0d4a33189f38423ceea9a5692d38ba09 /src/video_core/texture_cache/image_info.cpp | |
parent | Merge pull request #9884 from liamwhite/service-cleanup (diff) | |
parent | Engines: Implement Accelerate DMA Texture. (diff) | |
download | yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar.gz yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar.bz2 yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar.lz yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar.xz yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.tar.zst yuzu-fdae95efaa84fe1baeab0b4dd1435720cae0f88d.zip |
Diffstat (limited to 'src/video_core/texture_cache/image_info.cpp')
-rw-r--r-- | src/video_core/texture_cache/image_info.cpp | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/src/video_core/texture_cache/image_info.cpp b/src/video_core/texture_cache/image_info.cpp index e9100091e..a1296b574 100644 --- a/src/video_core/texture_cache/image_info.cpp +++ b/src/video_core/texture_cache/image_info.cpp @@ -216,10 +216,51 @@ ImageInfo::ImageInfo(const Tegra::Engines::Fermi2D::Surface& config) noexcept { .height = config.height, .depth = 1, }; - rescaleable = block.depth == 0; - rescaleable &= size.height > 256; + rescaleable = block.depth == 0 && size.height > 256; downscaleable = size.height > 512; } } +static PixelFormat ByteSizeToFormat(u32 bytes_per_pixel) { + switch (bytes_per_pixel) { + case 1: + return PixelFormat::R8_UINT; + case 2: + return PixelFormat::R8G8_UINT; + case 4: + return PixelFormat::A8B8G8R8_UINT; + case 8: + return PixelFormat::R16G16B16A16_UINT; + case 16: + return PixelFormat::R32G32B32A32_UINT; + default: + UNIMPLEMENTED(); + return PixelFormat::Invalid; + } +} + +ImageInfo::ImageInfo(const Tegra::DMA::ImageOperand& config) noexcept { + const u32 bytes_per_pixel = config.bytes_per_pixel; + format = ByteSizeToFormat(bytes_per_pixel); + type = config.params.block_size.depth > 0 ? ImageType::e3D : ImageType::e2D; + num_samples = 1; + block = Extent3D{ + .width = config.params.block_size.width, + .height = config.params.block_size.height, + .depth = config.params.block_size.depth, + }; + size = Extent3D{ + .width = config.params.width, + .height = config.params.height, + .depth = config.params.depth, + }; + tile_width_spacing = 0; + resources.levels = 1; + resources.layers = 1; + layer_stride = CalculateLayerStride(*this); + maybe_unaligned_layer_stride = CalculateLayerSize(*this); + rescaleable = block.depth == 0 && size.height > 256; + downscaleable = size.height > 512; +} + } // namespace VideoCommon |