diff options
| author | 2018-11-16 13:01:54 -0400 | |
|---|---|---|
| committer | 2018-11-26 09:05:12 -0400 | |
| commit | ddfbe0b58d856ae4a62683943cb35c2ae8f13b95 (patch) | |
| tree | 51210c339a0aabe9e86eb3b830262ffa53eb2b57 /src/video_core/morton.cpp | |
| parent | Merge pull request #1763 from ReinUsesLisp/bfi (diff) | |
| download | yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.tar.gz yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.tar.xz yuzu-ddfbe0b58d856ae4a62683943cb35c2ae8f13b95.zip | |
Implemented Tile Width Spacing
Diffstat (limited to 'src/video_core/morton.cpp')
| -rw-r--r-- | src/video_core/morton.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp index f14abba7d..1cf27ee25 100644 --- a/src/video_core/morton.cpp +++ b/src/video_core/morton.cpp | |||
| @@ -16,12 +16,12 @@ namespace VideoCore { | |||
| 16 | using Surface::GetBytesPerPixel; | 16 | using Surface::GetBytesPerPixel; |
| 17 | using Surface::PixelFormat; | 17 | using Surface::PixelFormat; |
| 18 | 18 | ||
| 19 | using MortonCopyFn = void (*)(u32, u32, u32, u32, u32, u8*, std::size_t, VAddr); | 19 | using MortonCopyFn = void (*)(u32, u32, u32, u32, u32, u32, u8*, std::size_t, VAddr); |
| 20 | using ConversionArray = std::array<MortonCopyFn, Surface::MaxPixelFormat>; | 20 | using ConversionArray = std::array<MortonCopyFn, Surface::MaxPixelFormat>; |
| 21 | 21 | ||
| 22 | template <bool morton_to_linear, PixelFormat format> | 22 | template <bool morton_to_linear, PixelFormat format> |
| 23 | static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth, u32 depth, | 23 | static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth, u32 depth, |
| 24 | u8* buffer, std::size_t buffer_size, VAddr addr) { | 24 | u32 tile_width_spacing, u8* buffer, std::size_t buffer_size, VAddr addr) { |
| 25 | constexpr u32 bytes_per_pixel = GetBytesPerPixel(format); | 25 | constexpr u32 bytes_per_pixel = GetBytesPerPixel(format); |
| 26 | 26 | ||
| 27 | // With the BCn formats (DXT and DXN), each 4x4 tile is swizzled instead of just individual | 27 | // With the BCn formats (DXT and DXN), each 4x4 tile is swizzled instead of just individual |
| @@ -31,12 +31,13 @@ static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth | |||
| 31 | 31 | ||
| 32 | if constexpr (morton_to_linear) { | 32 | if constexpr (morton_to_linear) { |
| 33 | Tegra::Texture::UnswizzleTexture(buffer, addr, tile_size_x, tile_size_y, bytes_per_pixel, | 33 | Tegra::Texture::UnswizzleTexture(buffer, addr, tile_size_x, tile_size_y, bytes_per_pixel, |
| 34 | stride, height, depth, block_height, block_depth); | 34 | stride, height, depth, block_height, block_depth, |
| 35 | tile_width_spacing); | ||
| 35 | } else { | 36 | } else { |
| 36 | Tegra::Texture::CopySwizzledData((stride + tile_size_x - 1) / tile_size_x, | 37 | Tegra::Texture::CopySwizzledData( |
| 37 | (height + tile_size_y - 1) / tile_size_y, depth, | 38 | (stride + tile_size_x - 1) / tile_size_x, (height + tile_size_y - 1) / tile_size_y, |
| 38 | bytes_per_pixel, bytes_per_pixel, Memory::GetPointer(addr), | 39 | depth, bytes_per_pixel, bytes_per_pixel, Memory::GetPointer(addr), buffer, false, |
| 39 | buffer, false, block_height, block_depth); | 40 | block_height, block_depth, tile_width_spacing); |
| 40 | } | 41 | } |
| 41 | } | 42 | } |
| 42 | 43 | ||
| @@ -325,11 +326,11 @@ static u32 GetMortonOffset128(u32 x, u32 y, u32 bytes_per_pixel) { | |||
| 325 | } | 326 | } |
| 326 | 327 | ||
| 327 | void MortonSwizzle(MortonSwizzleMode mode, Surface::PixelFormat format, u32 stride, | 328 | void MortonSwizzle(MortonSwizzleMode mode, Surface::PixelFormat format, u32 stride, |
| 328 | u32 block_height, u32 height, u32 block_depth, u32 depth, u8* buffer, | 329 | u32 block_height, u32 height, u32 block_depth, u32 depth, u32 tile_width_spacing, |
| 329 | std::size_t buffer_size, VAddr addr) { | 330 | u8* buffer, std::size_t buffer_size, VAddr addr) { |
| 330 | 331 | ||
| 331 | GetSwizzleFunction(mode, format)(stride, block_height, height, block_depth, depth, buffer, | 332 | GetSwizzleFunction(mode, format)(stride, block_height, height, block_depth, depth, |
| 332 | buffer_size, addr); | 333 | tile_width_spacing, buffer, buffer_size, addr); |
| 333 | } | 334 | } |
| 334 | 335 | ||
| 335 | void MortonCopyPixels128(u32 width, u32 height, u32 bytes_per_pixel, u32 linear_bytes_per_pixel, | 336 | void MortonCopyPixels128(u32 width, u32 height, u32 bytes_per_pixel, u32 linear_bytes_per_pixel, |
| @@ -350,4 +351,4 @@ void MortonCopyPixels128(u32 width, u32 height, u32 bytes_per_pixel, u32 linear_ | |||
| 350 | } | 351 | } |
| 351 | } | 352 | } |
| 352 | 353 | ||
| 353 | } // namespace VideoCore \ No newline at end of file | 354 | } // namespace VideoCore |