diff --git a/wii/video.c b/wii/video.c index c9e844bd22..c766d10091 100644 --- a/wii/video.c +++ b/wii/video.c @@ -186,33 +186,33 @@ static void *wii_init(const video_info_t *video, return (void*)-1; } +// Set MSB to get full RGB555. +#define RGB15toRGB5A3(col) ((col) | 0x80008000u) + +#define BLIT_LINE(off) \ +{ \ + const uint32_t *tmp_src = src; \ + uint32_t *tmp_dst = dst; \ + for (unsigned x = 0; x < width; x += 8, tmp_src += 8, tmp_dst += 32) \ + { \ + tmp_dst[ 0 + off] = RGB15toRGB5A3(tmp_src[0]); \ + tmp_dst[ 1 + off] = RGB15toRGB5A3(tmp_src[1]); \ + tmp_dst[ 8 + off] = RGB15toRGB5A3(tmp_src[2]); \ + tmp_dst[ 9 + off] = RGB15toRGB5A3(tmp_src[3]); \ + tmp_dst[16 + off] = RGB15toRGB5A3(tmp_src[4]); \ + tmp_dst[17 + off] = RGB15toRGB5A3(tmp_src[5]); \ + tmp_dst[24 + off] = RGB15toRGB5A3(tmp_src[6]); \ + tmp_dst[25 + off] = RGB15toRGB5A3(tmp_src[7]); \ + } \ + src += pitch; \ +} + static void update_texture(const uint32_t *src, unsigned width, unsigned height, unsigned pitch) { pitch >>= 2; width &= ~15; height &= ~3; - -// Set MSB to get full RGB555. -#define RGB15toRGB5A3(col) ((col) | 0x80008000u) - -#define BLIT_CHUNK(off) { \ - tmp_dst[ 0 + off] = RGB15toRGB5A3(tmp_src[0]); \ - tmp_dst[ 1 + off] = RGB15toRGB5A3(tmp_src[1]); \ - tmp_dst[ 8 + off] = RGB15toRGB5A3(tmp_src[2]); \ - tmp_dst[ 9 + off] = RGB15toRGB5A3(tmp_src[3]); \ - tmp_dst[16 + off] = RGB15toRGB5A3(tmp_src[4]); \ - tmp_dst[17 + off] = RGB15toRGB5A3(tmp_src[5]); \ - tmp_dst[24 + off] = RGB15toRGB5A3(tmp_src[6]); \ - tmp_dst[25 + off] = RGB15toRGB5A3(tmp_src[7]); } - -#define BLIT_LINE(off) { \ - const uint32_t *tmp_src = src; \ - uint32_t *tmp_dst = dst; \ - for (unsigned x = 0; x < width; x += 8, tmp_src += 8, tmp_dst += 32) \ - BLIT_CHUNK(off) \ - src += pitch; } - width >>= 1; // Texture data is 4x4 tiled @ 15bpp.