Sent: Monday, February 16, 2009 1:03 PM
To: submit@mamedev.org
Subject: Speed up 'src\mame\video\mcatadv.c'

Hi,

here is a patch against 'src\mame\video\mcatadv.c'

This patch moves a call to 'memory_region' outside of a hot loop in the 'draw_sprites' function.
This gives a fiew pourcents speed up in games such as 'nost'.

Hope this helps,
Best regards,
Christophe Jaillet

--

From: Christophe Jaillet [christophe.jaillet@wanadoo.fr]
Sent: Monday, February 16, 2009 1:53 PM
To: submit@mamedev.org
Subject: Another speed up in 'src\mame\video\mcatadv.c'

Hi,

here is a patch against 'src\mame\video\mcatadv.c'

This patch , by re-arranging the code, give a +/- 5% speed up in the emulation.

Before, we :
    - fetch a pixel,
    - make some computation for lower/higher part of it
    - check if we should render it
    - test for priority
    - update destination if necessary

With this patch, we check priority first in order to avoid useless processing and testing on pixel that can't be displayed due to priority reason. So in the best case, it is faster, in the worse case execution time should be more or less the same because :
       if ((drawxpos >= cliprect->min_x) && (drawxpos <= cliprect->max_x) &&
pix)
is likely to be true (IMO). So the same tests are performed, only the order is different.


Hope this helps,
Best regards,
Christophe Jaillet

--

From: Christophe Jaillet [christophe.jaillet@wanadoo.fr]
Sent: Monday, February 16, 2009 1:09 PM
To: submit@mamedev.org
Subject: Clean up of 'src\emu\tilemap.c' (with the patch...)

Hi,

here is a patch against 'src\emu\tilemap.c'

This patch removes a variable called 'original_cliprect' from the top of 'tilemap_get_tile_flags'.
This variable is useless because all cases that need it, already make the same copy in a variable with the same name, shodawing the former one.

Hope this helps,
Best regards,
Christophe Jaillet
This commit is contained in:
Aaron Giles 2009-02-26 08:48:51 +00:00
parent 6f6ef146a7
commit d848af288d
2 changed files with 10 additions and 13 deletions

View File

@ -775,7 +775,6 @@ UINT8 *tilemap_get_tile_flags(tilemap *tmap)
void tilemap_draw_primask(bitmap_t *dest, const rectangle *cliprect, tilemap *tmap, UINT32 flags, UINT8 priority, UINT8 priority_mask)
{
UINT32 width, height;
rectangle original_cliprect;
blit_parameters blit;
int xpos, ypos;
@ -786,7 +785,6 @@ void tilemap_draw_primask(bitmap_t *dest, const rectangle *cliprect, tilemap *tm
profiler_mark(PROFILER_TILEMAP_DRAW);
/* configure the blit parameters based on the input parameters */
configure_blit_parameters(&blit, tmap, dest, cliprect, flags, priority, priority_mask);
original_cliprect = blit.cliprect;
/* if the whole map is dirty, mark it as such */
if (tmap->all_tiles_dirty || gfx_elements_changed(tmap))

View File

@ -65,6 +65,7 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
UINT16 *destline;
UINT8 *priline;
UINT8 *sprdata = memory_region ( machine, "gfx1" );
int xstart, xend, xinc;
int ystart, yend, yinc;
@ -93,8 +94,6 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
int width = ((source[2]&0xf000)>>12)*16;
int offset = tileno * 256;
UINT8 *sprdata = memory_region ( machine, "gfx1" );
int drawxpos, drawypos;
int xcnt,ycnt;
int pix;
@ -130,16 +129,16 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
for (xcnt = xstart; xcnt != xend; xcnt += xinc) {
drawxpos = x+xcnt-global_x;
if (offset >= 0x500000*2) offset = 0;
pix = sprdata[offset/2];
if (offset & 1) pix = pix >> 4;
pix &= 0x0f;
if ((drawxpos >= cliprect->min_x) && (drawxpos <= cliprect->max_x) && pix)
if((priline[drawxpos] < pri))
destline[drawxpos] = (pix + (pen<<4));
if((priline[drawxpos] < pri)) {
if (offset >= 0x500000*2) offset = 0;
pix = sprdata[offset/2];
if (offset & 1) pix = pix >> 4;
pix &= 0x0f;
if ((drawxpos >= cliprect->min_x) && (drawxpos <= cliprect->max_x) && pix)
destline[drawxpos] = (pix + pen);
}
offset++;
}
}