summaryrefslogtreecommitdiffstats
path: root/src/video_core/textures
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-18 06:15:20 +0200
committerbunnei <bunneidev@gmail.com>2018-07-19 03:42:52 +0200
commitb496a9eefe57f1b7a261546c8149f250288b9698 (patch)
treeb8b58572d942f2ad3899d653ff9e12a985ec166f /src/video_core/textures
parentVirtual Filesystem 2: Electric Boogaloo (#676) (diff)
downloadyuzu-b496a9eefe57f1b7a261546c8149f250288b9698.tar
yuzu-b496a9eefe57f1b7a261546c8149f250288b9698.tar.gz
yuzu-b496a9eefe57f1b7a261546c8149f250288b9698.tar.bz2
yuzu-b496a9eefe57f1b7a261546c8149f250288b9698.tar.lz
yuzu-b496a9eefe57f1b7a261546c8149f250288b9698.tar.xz
yuzu-b496a9eefe57f1b7a261546c8149f250288b9698.tar.zst
yuzu-b496a9eefe57f1b7a261546c8149f250288b9698.zip
Diffstat (limited to 'src/video_core/textures')
-rw-r--r--src/video_core/textures/decoders.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/video_core/textures/decoders.cpp b/src/video_core/textures/decoders.cpp
index be18aa299..a3684a195 100644
--- a/src/video_core/textures/decoders.cpp
+++ b/src/video_core/textures/decoders.cpp
@@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <cmath>
#include <cstring>
#include "common/assert.h"
#include "core/memory.h"
@@ -17,7 +18,9 @@ namespace Texture {
* Taken from the Tegra X1 TRM.
*/
static u32 GetSwizzleOffset(u32 x, u32 y, u32 image_width, u32 bytes_per_pixel, u32 block_height) {
- u32 image_width_in_gobs = image_width * bytes_per_pixel / 64;
+ // Round up to the next gob
+ const u32 image_width_in_gobs{(image_width * bytes_per_pixel + 63) / 64};
+
u32 GOB_address = 0 + (y / (8 * block_height)) * 512 * block_height * image_width_in_gobs +
(x * bytes_per_pixel / 64) * 512 * block_height +
(y % (8 * block_height) / 8) * 512;