diff options
| author | 2019-03-16 21:59:45 -0400 | |
|---|---|---|
| committer | 2019-03-16 21:59:45 -0400 | |
| commit | 2392e146b09c2a4b3bb557bb3a20c4afc7f75957 (patch) | |
| tree | 1eafa50be7af78d74b4781fbe858277ac8ab1d35 /src/video_core/morton.cpp | |
| parent | Merge pull request #2243 from bunnei/mem-simplify-cache (diff) | |
| parent | video_core: Refactor to use MemoryManager interface for all memory access. (diff) | |
| download | yuzu-2392e146b09c2a4b3bb557bb3a20c4afc7f75957.tar.gz yuzu-2392e146b09c2a4b3bb557bb3a20c4afc7f75957.tar.xz yuzu-2392e146b09c2a4b3bb557bb3a20c4afc7f75957.zip | |
Merge pull request #2244 from bunnei/gpu-mem-refactor
video_core: Refactor to use MemoryManager interface for all memory access.
Diffstat (limited to 'src/video_core/morton.cpp')
| -rw-r--r-- | src/video_core/morton.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/video_core/morton.cpp b/src/video_core/morton.cpp index 9692ce143..3e91cbc83 100644 --- a/src/video_core/morton.cpp +++ b/src/video_core/morton.cpp | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | #include <cstring> | 6 | #include <cstring> |
| 7 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/memory.h" | ||
| 10 | #include "video_core/morton.h" | 9 | #include "video_core/morton.h" |
| 11 | #include "video_core/surface.h" | 10 | #include "video_core/surface.h" |
| 12 | #include "video_core/textures/decoders.h" | 11 | #include "video_core/textures/decoders.h" |
| @@ -16,12 +15,12 @@ namespace VideoCore { | |||
| 16 | using Surface::GetBytesPerPixel; | 15 | using Surface::GetBytesPerPixel; |
| 17 | using Surface::PixelFormat; | 16 | using Surface::PixelFormat; |
| 18 | 17 | ||
| 19 | using MortonCopyFn = void (*)(u32, u32, u32, u32, u32, u32, u8*, VAddr); | 18 | using MortonCopyFn = void (*)(u32, u32, u32, u32, u32, u32, u8*, u8*); |
| 20 | using ConversionArray = std::array<MortonCopyFn, Surface::MaxPixelFormat>; | 19 | using ConversionArray = std::array<MortonCopyFn, Surface::MaxPixelFormat>; |
| 21 | 20 | ||
| 22 | template <bool morton_to_linear, PixelFormat format> | 21 | template <bool morton_to_linear, PixelFormat format> |
| 23 | static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth, u32 depth, | 22 | static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth, u32 depth, |
| 24 | u32 tile_width_spacing, u8* buffer, VAddr addr) { | 23 | u32 tile_width_spacing, u8* buffer, u8* addr) { |
| 25 | constexpr u32 bytes_per_pixel = GetBytesPerPixel(format); | 24 | constexpr u32 bytes_per_pixel = GetBytesPerPixel(format); |
| 26 | 25 | ||
| 27 | // With the BCn formats (DXT and DXN), each 4x4 tile is swizzled instead of just individual | 26 | // With the BCn formats (DXT and DXN), each 4x4 tile is swizzled instead of just individual |
| @@ -34,10 +33,10 @@ static void MortonCopy(u32 stride, u32 block_height, u32 height, u32 block_depth | |||
| 34 | stride, height, depth, block_height, block_depth, | 33 | stride, height, depth, block_height, block_depth, |
| 35 | tile_width_spacing); | 34 | tile_width_spacing); |
| 36 | } else { | 35 | } else { |
| 37 | Tegra::Texture::CopySwizzledData( | 36 | Tegra::Texture::CopySwizzledData((stride + tile_size_x - 1) / tile_size_x, |
| 38 | (stride + tile_size_x - 1) / tile_size_x, (height + tile_size_y - 1) / tile_size_y, | 37 | (height + tile_size_y - 1) / tile_size_y, depth, |
| 39 | depth, bytes_per_pixel, bytes_per_pixel, Memory::GetPointer(addr), buffer, false, | 38 | bytes_per_pixel, bytes_per_pixel, addr, buffer, false, |
| 40 | block_height, block_depth, tile_width_spacing); | 39 | block_height, block_depth, tile_width_spacing); |
| 41 | } | 40 | } |
| 42 | } | 41 | } |
| 43 | 42 | ||
| @@ -282,7 +281,7 @@ static u32 GetMortonOffset128(u32 x, u32 y, u32 bytes_per_pixel) { | |||
| 282 | 281 | ||
| 283 | void MortonSwizzle(MortonSwizzleMode mode, Surface::PixelFormat format, u32 stride, | 282 | void MortonSwizzle(MortonSwizzleMode mode, Surface::PixelFormat format, u32 stride, |
| 284 | u32 block_height, u32 height, u32 block_depth, u32 depth, u32 tile_width_spacing, | 283 | u32 block_height, u32 height, u32 block_depth, u32 depth, u32 tile_width_spacing, |
| 285 | u8* buffer, VAddr addr) { | 284 | u8* buffer, u8* addr) { |
| 286 | GetSwizzleFunction(mode, format)(stride, block_height, height, block_depth, depth, | 285 | GetSwizzleFunction(mode, format)(stride, block_height, height, block_depth, depth, |
| 287 | tile_width_spacing, buffer, addr); | 286 | tile_width_spacing, buffer, addr); |
| 288 | } | 287 | } |