summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Huw Pascoe2017-09-24 22:24:45 +0100
committerGravatar Huw Pascoe2017-09-24 22:27:14 +0100
commit876aa82c29d2e17f8b5a4f74155971cba78c00b6 (patch)
tree9acc1b95692a25e99820cf13762b971ebada3157
parentMerge pull request #2921 from jroweboy/batch-fix-2 (diff)
downloadyuzu-876aa82c29d2e17f8b5a4f74155971cba78c00b6.tar.gz
yuzu-876aa82c29d2e17f8b5a4f74155971cba78c00b6.tar.xz
yuzu-876aa82c29d2e17f8b5a4f74155971cba78c00b6.zip
Optimized Morton
Diffstat (limited to '')
-rw-r--r--src/video_core/utils.h14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/video_core/utils.h b/src/video_core/utils.h
index 7ce83a055..d8567f314 100644
--- a/src/video_core/utils.h
+++ b/src/video_core/utils.h
@@ -8,17 +8,11 @@
8 8
9namespace VideoCore { 9namespace VideoCore {
10 10
11/** 11// 8x8 Z-Order coordinate from 2D coordinates
12 * Interleave the lower 3 bits of each coordinate to get the intra-block offsets, which are
13 * arranged in a Z-order curve. More details on the bit manipulation at:
14 * https://fgiesen.wordpress.com/2009/12/13/decoding-morton-codes/
15 */
16static inline u32 MortonInterleave(u32 x, u32 y) { 12static inline u32 MortonInterleave(u32 x, u32 y) {
17 u32 i = (x & 7) | ((y & 7) << 8); // ---- -210 13 static const u32 xlut[] = {0x00, 0x01, 0x04, 0x05, 0x10, 0x11, 0x14, 0x15};
18 i = (i ^ (i << 2)) & 0x1313; // ---2 --10 14 static const u32 ylut[] = {0x00, 0x02, 0x08, 0x0a, 0x20, 0x22, 0x28, 0x2a};
19 i = (i ^ (i << 1)) & 0x1515; // ---2 -1-0 15 return xlut[x % 8] + ylut[y % 8];
20 i = (i | (i >> 7)) & 0x3F;
21 return i;
22} 16}
23 17
24/** 18/**