diff options
| -rw-r--r-- | src/video_core/textures/decoders.cpp | 5 |
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 | */ |
| 19 | static u32 GetSwizzleOffset(u32 x, u32 y, u32 image_width, u32 bytes_per_pixel, u32 block_height) { | 20 | static 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; |