mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-30 10:42:47 +01:00
decoders: Fix calc of swizzle image_width_in_gobs.
This commit is contained in:
parent
29aff8d5ab
commit
b496a9eefe
1 changed files with 4 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
|
@ -17,7 +18,9 @@ namespace Texture {
|
||||||
* Taken from the Tegra X1 TRM.
|
* Taken from the Tegra X1 TRM.
|
||||||
*/
|
*/
|
||||||
static u32 GetSwizzleOffset(u32 x, u32 y, u32 image_width, u32 bytes_per_pixel, u32 block_height) {
|
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 +
|
u32 GOB_address = 0 + (y / (8 * block_height)) * 512 * block_height * image_width_in_gobs +
|
||||||
(x * bytes_per_pixel / 64) * 512 * block_height +
|
(x * bytes_per_pixel / 64) * 512 * block_height +
|
||||||
(y % (8 * block_height) / 8) * 512;
|
(y % (8 * block_height) / 8) * 512;
|
||||||
|
|
Loading…
Reference in a new issue