OpenGL Cache: Optimize Morton Copy to copy in tiles

Compiles two lookup arrays of functions for the different
configurations of Morton Copy.
This commit is contained in:
James Rowe 2017-11-16 21:20:50 -07:00
parent 160ac25527
commit e9e2d444ef
3 changed files with 202 additions and 50 deletions

View file

@ -9,9 +9,9 @@
namespace VideoCore {
// 8x8 Z-Order coordinate from 2D coordinates
static inline u32 MortonInterleave(u32 x, u32 y) {
static const u32 xlut[] = {0x00, 0x01, 0x04, 0x05, 0x10, 0x11, 0x14, 0x15};
static const u32 ylut[] = {0x00, 0x02, 0x08, 0x0a, 0x20, 0x22, 0x28, 0x2a};
static constexpr u32 MortonInterleave(u32 x, u32 y) {
constexpr u32 xlut[] = {0x00, 0x01, 0x04, 0x05, 0x10, 0x11, 0x14, 0x15};
constexpr u32 ylut[] = {0x00, 0x02, 0x08, 0x0a, 0x20, 0x22, 0x28, 0x2a};
return xlut[x % 8] + ylut[y % 8];
}