summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2009-05-04 23:22:54 +0000
committer Olivier Galibert <galibert@pobox.com>2009-05-04 23:22:54 +0000
commitf0d2b4ff53926457d06f63f456ab2368cc168773 (patch)
tree49bd2d80b517bf390706372eb799e8628975b5f4 /src
parent0480162bcc0474dfda86fde1d76714b2896164bf (diff)
Naomi renderer: add yuv-linear textures, but it's kinda useless without the TA yuv pipe.
Diffstat (limited to 'src')
-rw-r--r--src/mame/video/dc.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/mame/video/dc.c b/src/mame/video/dc.c
index c966effca8d..d83d31a3585 100644
--- a/src/mame/video/dc.c
+++ b/src/mame/video/dc.c
@@ -149,6 +149,31 @@ INLINE UINT32 cv_4444(UINT16 c)
((c << 4) & 0x000000f0) | ((c ) & 0x0000000f);
}
+INLINE UINT32 cv_yuv(UINT16 c1, UINT16 c2, int x)
+{
+ int u = 11*((c1 & 0xff) - 128);
+ int v = 11*((c2 & 0xff) - 128);
+ int y = (x & 1 ? c2 : c1) >> 8;
+ int r = y + v/8;
+ int g = y - u/32 - v/16;
+ int b = y + (3*u)/16;
+ r = r < 0 ? 0 : r > 255 ? 255 : r;
+ g = g < 0 ? 0 : g > 255 ? 255 : g;
+ b = b < 0 ? 0 : b > 255 ? 255 : b;
+ return 0xff000000 | (r << 16) | (g << 8) | b;
+}
+
+
+static UINT32 tex_r_yuv_n(texinfo *t, float x, float y)
+{
+ int xt = ((int)x) & (t->sizex-1);
+ int yt = ((int)y) & (t->sizey-1);
+ int addrp = t->address + (t->sizex*yt + (xt & ~1))*2;
+ UINT16 c1 = *(UINT16 *)(((UINT8 *)dc_texture_ram) + WORD_XOR_LE(addrp));
+ UINT16 c2 = *(UINT16 *)(((UINT8 *)dc_texture_ram) + WORD_XOR_LE(addrp+2));
+ return cv_yuv(c1, c2, xt);
+}
+
static UINT32 tex_r_1555_n(texinfo *t, float x, float y)
{
int xt = ((int)x) & (t->sizex-1);
@@ -418,6 +443,11 @@ static void tex_prepare(texinfo *t)
break;
case 3: // yuv422
+ switch(t->mode) {
+ case 0: /*t->r = tex_r_yuv_tw*/; break;
+ case 1: t->r = tex_r_yuv_n; break;
+ default: /*t->r = tex_r_yuv_vq*/; break;
+ }
break;
case 4: // bumpmap