voodoo: Also calculate dither pointer when needed for fogging. Fixes graphics crash in sf2049. (nw)

This commit is contained in:
Ted Green 2017-06-04 07:18:32 -06:00
parent 4aa87523ea
commit 108e1faed2
2 changed files with 5 additions and 4 deletions

View File

@ -336,13 +336,14 @@ inline uint32_t voodoo_device::raster_info::compute_hash() const
const uint8_t *dither = nullptr const uint8_t *dither = nullptr
#define DECLARE_DITHER_POINTERS_NO_DITHER_VAR \ #define DECLARE_DITHER_POINTERS_NO_DITHER_VAR \
const uint8_t *dither_lookup = nullptr; const uint8_t *dither_lookup = nullptr;
#define COMPUTE_DITHER_POINTERS(FBZMODE, YY) \ #define COMPUTE_DITHER_POINTERS(FBZMODE, YY, FOGMODE) \
do \ do \
{ \ { \
if (FBZMODE_ENABLE_DITHERING(FBZMODE) || FOGMODE_FOG_DITHER(FOGMODE)) \
dither4 = &dither_matrix_4x4[((YY) & 3) * 4]; \
/* compute the dithering pointers */ \ /* compute the dithering pointers */ \
if (FBZMODE_ENABLE_DITHERING(FBZMODE)) \ if (FBZMODE_ENABLE_DITHERING(FBZMODE)) \
{ \ { \
dither4 = &dither_matrix_4x4[((YY) & 3) * 4]; \
if (FBZMODE_DITHER_TYPE(FBZMODE) == 0) \ if (FBZMODE_DITHER_TYPE(FBZMODE) == 0) \
{ \ { \
dither = dither4; \ dither = dither4; \
@ -2653,7 +2654,7 @@ void voodoo_device::raster_##name(void *destbase, int32_t y, const poly_extent *
scry = (vd->fbi.yorigin - y) & 0x3ff; \ scry = (vd->fbi.yorigin - y) & 0x3ff; \
\ \
/* compute dithering */ \ /* compute dithering */ \
COMPUTE_DITHER_POINTERS(FBZMODE, y); \ COMPUTE_DITHER_POINTERS(FBZMODE, y, FOGMODE); \
\ \
/* apply clipping */ \ /* apply clipping */ \
if (FBZMODE_ENABLE_CLIPPING(FBZMODE)) \ if (FBZMODE_ENABLE_CLIPPING(FBZMODE)) \

View File

@ -3247,7 +3247,7 @@ int32_t voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, uint32_t data, ui
depth += scry * vd->fbi.rowpixels; depth += scry * vd->fbi.rowpixels;
/* compute dithering */ /* compute dithering */
COMPUTE_DITHER_POINTERS(vd->reg[fbzMode].u, y); COMPUTE_DITHER_POINTERS(vd->reg[fbzMode].u, y, vd->reg[fogMode].u);
/* loop over up to two pixels */ /* loop over up to two pixels */
for (pix = 0; mask; pix++) for (pix = 0; mask; pix++)