summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2018-07-18 18:55:37 -0700
committerGravatar GitHub2018-07-18 18:55:37 -0700
commit89f0acfd36223976afd60fca5f30881fe0ecca7f (patch)
tree0a38b48388fd9f74256787178062f4551aafa562
parentMerge pull request #685 from lioncash/build (diff)
parentdecoders: Fix calc of swizzle image_width_in_gobs. (diff)
downloadyuzu-89f0acfd36223976afd60fca5f30881fe0ecca7f.tar.gz
yuzu-89f0acfd36223976afd60fca5f30881fe0ecca7f.tar.xz
yuzu-89f0acfd36223976afd60fca5f30881fe0ecca7f.zip
Merge pull request #680 from bunnei/fix-swizz
decoders: Fix calc of swizzle image_width_in_gobs.
-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 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cmath>
5#include <cstring> 6#include <cstring>
6#include "common/assert.h" 7#include "common/assert.h"
7#include "core/memory.h" 8#include "core/memory.h"
@@ -17,7 +18,9 @@ namespace Texture {
17 * Taken from the Tegra X1 TRM. 18 * Taken from the Tegra X1 TRM.
18 */ 19 */
19static u32 GetSwizzleOffset(u32 x, u32 y, u32 image_width, u32 bytes_per_pixel, u32 block_height) { 20static u32 GetSwizzleOffset(u32 x, u32 y, u32 image_width, u32 bytes_per_pixel, u32 block_height) {
20 u32 image_width_in_gobs = image_width * bytes_per_pixel / 64; 21 // Round up to the next gob
22 const u32 image_width_in_gobs{(image_width * bytes_per_pixel + 63) / 64};
23
21 u32 GOB_address = 0 + (y / (8 * block_height)) * 512 * block_height * image_width_in_gobs + 24 u32 GOB_address = 0 + (y / (8 * block_height)) * 512 * block_height * image_width_in_gobs +
22 (x * bytes_per_pixel / 64) * 512 * block_height + 25 (x * bytes_per_pixel / 64) * 512 * block_height +
23 (y % (8 * block_height) / 8) * 512; 26 (y % (8 * block_height) / 8) * 512;