From 30585a50b753ff166cbd21ff8459ad40125877bc Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Fri, 8 Feb 2013 12:57:16 +0000 Subject: [PATCH] First pass in rewriting VDP2 bitmap layers. RGB32 being the first one --- src/mame/includes/stv.h | 2 + src/mame/video/stvvdp2.c | 85 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h index d4c7d70a372..725d2c1d6cc 100644 --- a/src/mame/includes/stv.h +++ b/src/mame/includes/stv.h @@ -387,6 +387,8 @@ public: void stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const rectangle &cliprect); void stv_vdp2_draw_basic_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); +// void draw_rgb16_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); + void draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect); void stv_vdp2_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx, UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,int transparency,int transparent_color,int scalex, int scaley,int sprite_screen_width, int sprite_screen_height, int alpha); void stv_vdp2_drawgfxzoom_rgb555(bitmap_rgb32 &dest_bmp,const rectangle &clip,UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,int transparency,int transparent_color,int scalex, int scaley,int sprite_screen_width, int sprite_screen_height, int alpha); diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c index 515d3dccfb0..976c825f6b8 100644 --- a/src/mame/video/stvvdp2.c +++ b/src/mame/video/stvvdp2.c @@ -2731,7 +2731,7 @@ void saturn_state::stv_vdp2_drawgfxzoom_rgb555( int x, x_index = x_index_base; for( x=sx; x>16)*2] << 8) | source[(x_index>>16)*2+1]; + data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1]; b = pal5bit((data & 0x7c00) >> 10); g = pal5bit((data & 0x03e0) >> 5); r = pal5bit( data & 0x001f); @@ -2999,6 +2999,64 @@ void saturn_state::stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectan } +#define BITMAP_RGB32 4 + + +#if 0 +void saturn_state::draw_rgb16_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + // ... +} +#endif + +void saturn_state::draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + int xsize, ysize; + int xsrc,ysrc,xdst,ydst; + int src_offs; + UINT8* vram = m_vdp2.gfx_decode; + UINT32 map_offset = stv2_current_tilemap.bitmap_map * 0x20000; + int scrollx = stv2_current_tilemap.scrollx; + int scrolly = stv2_current_tilemap.scrolly; + int r,g,b; + UINT32 dot_data; + + /* TODO: clean this up. */ + xsize = (stv2_current_tilemap.bitmap_size & 2) ? 1024 : 512; + ysize = (stv2_current_tilemap.bitmap_size & 1) ? 512 : 256; + + for(ydst=cliprect.min_y;ydst> 16); + g = ((dot_data & 0x0000ff00) >> 8); + r = ((dot_data & 0x000000ff) >> 0); + + if(stv2_current_tilemap.fade_control & 1) + stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2); + + if ( stv2_current_tilemap.colour_calculation_enabled == 0 ) + bitmap.pix32(ydst, xdst) = MAKE_RGB(r, g, b); + else + bitmap.pix32(ydst, xdst) = alpha_blend_r32( bitmap.pix32(ydst, xdst), MAKE_RGB(r, g, b), stv2_current_tilemap.alpha ); + } + } + } +} + + void saturn_state::stv_vdp2_draw_basic_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect) { // if(LOG_VDP2) logerror ("bitmap enable %02x size %08x depth %08x\n", stv2_current_tilemap.layer_name, stv2_current_tilemap.bitmap_size, stv2_current_tilemap.colour_depth); @@ -3017,6 +3075,31 @@ void saturn_state::stv_vdp2_draw_basic_bitmap(bitmap_rgb32 &bitmap, const rectan if (!stv2_current_tilemap.enabled) return; + /* new bitmap code, supposed to rewrite the old one. Not supposed to be clean, but EFFICIENT! */ + if(stv2_current_tilemap.incx == 0x10000 && stv2_current_tilemap.incy == 0x10000) + { + switch(stv2_current_tilemap.colour_depth) + { + case BITMAP_RGB32: draw_rgb32_bitmap(bitmap,cliprect); return; + } + + /* intentional fall-through*/ + popmessage("%d %s %s %s %s",stv2_current_tilemap.colour_depth, + stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE ? "no trans" : "trans", + stv2_current_tilemap.window_control & 6 ? "window" : "no window", + stv2_current_tilemap.colour_calculation_enabled ? "cc" : "no cc", + (stv2_current_tilemap.incx == 0x10000 && stv2_current_tilemap.incy == 0x10000) ? "no zoom" : "zoom"); + } + else + { + /* intentional fall-through*/ + popmessage("%d %s %s %s %s",stv2_current_tilemap.colour_depth, + stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE ? "no trans" : "trans", + stv2_current_tilemap.window_control & 6 ? "window" : "no window", + stv2_current_tilemap.colour_calculation_enabled ? "cc" : "no cc", + (stv2_current_tilemap.incx == 0x10000 && stv2_current_tilemap.incy == 0x10000) ? "no zoom" : "zoom"); + } + /* size for n0 / n1 */ switch (stv2_current_tilemap.bitmap_size) {