mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
Optimize a bit.
This commit is contained in:
parent
7d1ebdf94a
commit
eeebc2d06b
63
wii/video.c
63
wii/video.c
@ -31,7 +31,7 @@ static unsigned g_filter;
|
|||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint16_t data[512 * 512];
|
uint32_t data[512 * 256];
|
||||||
GXTexObj obj;
|
GXTexObj obj;
|
||||||
} static g_tex ATTRIBUTE_ALIGN(32);
|
} static g_tex ATTRIBUTE_ALIGN(32);
|
||||||
|
|
||||||
@ -152,43 +152,44 @@ static void *wii_init(const video_info_t *video,
|
|||||||
return (void*)-1;
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_texture(const uint16_t *src,
|
static void update_texture(const uint32_t *src,
|
||||||
unsigned width, unsigned height, unsigned pitch)
|
unsigned width, unsigned height, unsigned pitch)
|
||||||
{
|
{
|
||||||
pitch >>= 1;
|
pitch >>= 2;
|
||||||
width &= ~3;
|
width &= ~15;
|
||||||
height &= ~3;
|
height &= ~3;
|
||||||
|
|
||||||
// Texture data is 4x4 tiled @ 16bpp.
|
#define BLIT_CHUNK(off) { \
|
||||||
uint16_t *dst = g_tex.data;
|
tmp_dst[ 0 + off] = tmp_src[0]; \
|
||||||
for (unsigned i = 0; i < height; i += 4, src += 4 * pitch)
|
tmp_dst[ 1 + off] = tmp_src[1]; \
|
||||||
|
tmp_dst[ 8 + off] = tmp_src[2]; \
|
||||||
|
tmp_dst[ 9 + off] = tmp_src[3]; \
|
||||||
|
tmp_dst[16 + off] = tmp_src[4]; \
|
||||||
|
tmp_dst[17 + off] = tmp_src[5]; \
|
||||||
|
tmp_dst[24 + off] = tmp_src[6]; \
|
||||||
|
tmp_dst[25 + off] = 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 (docs say it's RGB565, but apparently it's RGB555).
|
||||||
|
// Use 32-bit to transfer more data per cycle.
|
||||||
|
uint32_t *dst = g_tex.data;
|
||||||
|
for (unsigned i = 0; i < height; i += 4, dst += 4 * width)
|
||||||
{
|
{
|
||||||
for (unsigned x = 0; x < width; x += 4, dst += 16)
|
BLIT_LINE(0)
|
||||||
{
|
BLIT_LINE(2)
|
||||||
const uint16_t *tmp_src = src + x;
|
BLIT_LINE(4)
|
||||||
dst[ 0] = tmp_src[0];
|
BLIT_LINE(6)
|
||||||
dst[ 1] = tmp_src[1];
|
|
||||||
dst[ 2] = tmp_src[2];
|
|
||||||
dst[ 3] = tmp_src[3];
|
|
||||||
tmp_src += pitch;
|
|
||||||
dst[ 4] = tmp_src[0];
|
|
||||||
dst[ 5] = tmp_src[1];
|
|
||||||
dst[ 6] = tmp_src[2];
|
|
||||||
dst[ 7] = tmp_src[3];
|
|
||||||
tmp_src += pitch;
|
|
||||||
dst[ 8] = tmp_src[0];
|
|
||||||
dst[ 9] = tmp_src[1];
|
|
||||||
dst[10] = tmp_src[2];
|
|
||||||
dst[11] = tmp_src[3];
|
|
||||||
tmp_src += pitch;
|
|
||||||
dst[12] = tmp_src[0];
|
|
||||||
dst[13] = tmp_src[1];
|
|
||||||
dst[14] = tmp_src[2];
|
|
||||||
dst[15] = tmp_src[3];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init_texture(width, height);
|
init_texture(width << 1, height);
|
||||||
DCFlushRange(g_tex.data, sizeof(g_tex.data));
|
DCFlushRange(g_tex.data, sizeof(g_tex.data));
|
||||||
GX_InvalidateTexAll();
|
GX_InvalidateTexAll();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user