summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2009-02-26 08:48:51 +0000
committer Aaron Giles <aaron@aarongiles.com>2009-02-26 08:48:51 +0000
commitd848af288dfb4d638a7c065c17e98d39724b5f80 (patch)
tree0ed2579e97a688432f90aae95cff74f96b2dac32
parent6f6ef146a710f267e54dfb2bf6c4f6ecda726766 (diff)
From: Christophe Jaillet [christophe.jaillet@wanadoo.fr]
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
-rw-r--r--src/emu/tilemap.c2
-rw-r--r--src/mame/video/mcatadv.c21
2 files changed, 10 insertions, 13 deletions
diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c
index d3a78256f01..b7d7f1fe583 100644
--- a/src/emu/tilemap.c
+++ b/src/emu/tilemap.c
@@ -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))
diff --git a/src/mame/video/mcatadv.c b/src/mame/video/mcatadv.c
index 97d62ee009f..185d23ab54a 100644
--- a/src/mame/video/mcatadv.c
+++ b/src/mame/video/mcatadv.c
@@ -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++;
}
}