summaryrefslogtreecommitdiff
path: root/src/video_core/textures/decoders.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2020-05-05 17:12:42 -0400
committerGravatar GitHub2020-05-05 17:12:42 -0400
commit41682e0888f7cb640787ab8d9a7e5c0ebb83d8fa (patch)
tree64c61fda0aaa076cd54c46e8c271e67888c79c61 /src/video_core/textures/decoders.cpp
parentMerge pull request #3881 from lioncash/mem-warning (diff)
parentUpdate src/video_core/gpu.cpp (diff)
downloadyuzu-41682e0888f7cb640787ab8d9a7e5c0ebb83d8fa.tar.gz
yuzu-41682e0888f7cb640787ab8d9a7e5c0ebb83d8fa.tar.xz
yuzu-41682e0888f7cb640787ab8d9a7e5c0ebb83d8fa.zip
Merge pull request #3815 from FernandoS27/command-list-2
GPU: More optimizations to GPU Command List Processing and DMA Copy Optimizations
Diffstat (limited to 'src/video_core/textures/decoders.cpp')
-rw-r--r--src/video_core/textures/decoders.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index fae8638ec..548e4c3fe 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -382,4 +382,18 @@ std::size_t CalculateSize(bool tiled, u32 bytes_per_pixel, u32 width, u32 height
382 } 382 }
383} 383}
384 384
385u64 GetGOBOffset(u32 width, u32 height, u32 dst_x, u32 dst_y, u32 block_height,
386 u32 bytes_per_pixel) {
387 auto div_ceil = [](const u32 x, const u32 y) { return ((x + y - 1) / y); };
388 const u32 gobs_in_block = 1 << block_height;
389 const u32 y_blocks = gob_size_y << block_height;
390 const u32 x_per_gob = gob_size_x / bytes_per_pixel;
391 const u32 x_blocks = div_ceil(width, x_per_gob);
392 const u32 block_size = gob_size * gobs_in_block;
393 const u32 stride = block_size * x_blocks;
394 const u32 base = (dst_y / y_blocks) * stride + (dst_x / x_per_gob) * block_size;
395 const u32 relative_y = dst_y % y_blocks;
396 return base + (relative_y / gob_size_y) * gob_size;
397}
398
385} // namespace Tegra::Texture 399} // namespace Tegra::Texture