-newport: Basic support for shade DDAs and some other command configs. Fixes 'jot' on IRIX. [Ryan Holtz]

This commit is contained in:
MooglyGuy 2019-02-21 23:56:12 +01:00
parent 763479a597
commit 7936b0fc04
2 changed files with 67 additions and 23 deletions

View File

@ -1244,8 +1244,11 @@ READ64_MEMBER(newport_video_device::rex3_r)
return ret; return ret;
} }
void newport_video_device::write_pixel(uint8_t color) void newport_video_device::write_pixel(uint8_t color, bool shade)
{ {
if (shade)
write_pixel(m_rex3.m_x_start_i, m_rex3.m_y_start_i, (uint8_t)(m_rex3.m_color_red >> 11));
else
write_pixel(m_rex3.m_x_start_i, m_rex3.m_y_start_i, color); write_pixel(m_rex3.m_x_start_i, m_rex3.m_y_start_i, color);
} }
@ -1388,7 +1391,7 @@ void newport_video_device::write_pixel(int16_t x, int16_t y, uint8_t color)
} }
} }
void newport_video_device::do_v_iline(uint8_t color, bool skip_last) void newport_video_device::do_v_iline(uint8_t color, bool skip_last, bool shade)
{ {
int16_t x1 = m_rex3.m_x_start_i; int16_t x1 = m_rex3.m_x_start_i;
int16_t y1 = m_rex3.m_y_start_i; int16_t y1 = m_rex3.m_y_start_i;
@ -1398,11 +1401,22 @@ void newport_video_device::do_v_iline(uint8_t color, bool skip_last)
do do
{ {
if (shade)
write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
else
write_pixel(x1, y1, color); write_pixel(x1, y1, color);
y1 += incy; y1 += incy;
if (shade)
m_rex3.m_color_red += m_rex3.m_slope_red;
} while (y1 != y2); } while (y1 != y2);
if (!skip_last) { if (!skip_last)
{
if (shade)
write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
else
write_pixel(x1, y1, color); write_pixel(x1, y1, color);
} }
@ -1410,7 +1424,7 @@ void newport_video_device::do_v_iline(uint8_t color, bool skip_last)
write_y_start(y1 << 11); write_y_start(y1 << 11);
} }
void newport_video_device::do_h_iline(uint8_t color, bool skip_last) void newport_video_device::do_h_iline(uint8_t color, bool skip_last, bool shade)
{ {
int16_t x1 = m_rex3.m_x_start_i; int16_t x1 = m_rex3.m_x_start_i;
int16_t y1 = m_rex3.m_y_start_i; int16_t y1 = m_rex3.m_y_start_i;
@ -1420,11 +1434,21 @@ void newport_video_device::do_h_iline(uint8_t color, bool skip_last)
do do
{ {
if (shade)
write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
else
write_pixel(x1, y1, color); write_pixel(x1, y1, color);
x1 += incx; x1 += incx;
if (shade)
m_rex3.m_color_red += m_rex3.m_slope_red;
} while (x1 != x2); } while (x1 != x2);
if (!skip_last) { if (!skip_last) {
if (shade)
write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
else
write_pixel(x1, y1, color); write_pixel(x1, y1, color);
} }
@ -1432,7 +1456,7 @@ void newport_video_device::do_h_iline(uint8_t color, bool skip_last)
write_y_start(y1 << 11); write_y_start(y1 << 11);
} }
void newport_video_device::do_iline(uint8_t color, bool skip_last) void newport_video_device::do_iline(uint8_t color, bool skip_last, bool shade)
{ {
int16_t x1 = m_rex3.m_x_start_i; int16_t x1 = m_rex3.m_x_start_i;
int16_t y1 = m_rex3.m_y_start_i; int16_t y1 = m_rex3.m_y_start_i;
@ -1486,6 +1510,9 @@ void newport_video_device::do_iline(uint8_t color, bool skip_last)
{ {
do do
{ {
if (shade)
write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
else
write_pixel(x1, y1, color); write_pixel(x1, y1, color);
if (e > 0) if (e > 0)
@ -1499,12 +1526,17 @@ void newport_video_device::do_iline(uint8_t color, bool skip_last)
} }
x1++; x1++;
if (shade)
m_rex3.m_color_red += m_rex3.m_slope_red;
} while (x1 != x2); } while (x1 != x2);
} }
else else
{ {
do do
{ {
if (shade)
write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
else
write_pixel(x1, y1, color); write_pixel(x1, y1, color);
if (e > 0) if (e > 0)
@ -1518,10 +1550,16 @@ void newport_video_device::do_iline(uint8_t color, bool skip_last)
} }
x1++; x1++;
if (shade)
m_rex3.m_color_red += m_rex3.m_slope_red;
} while (x1 != x2); } while (x1 != x2);
} }
if (!skip_last) { if (!skip_last)
{
if (shade)
write_pixel(x1, y1, (uint8_t)(m_rex3.m_color_red >> 11));
else
write_pixel(x1, y1, color); write_pixel(x1, y1, color);
} }
@ -1595,7 +1633,7 @@ void newport_video_device::do_rex3_command()
{ {
LOGMASKED(LOG_COMMANDS, "%04x, %04x = %02x\n", start_x, start_y, m_rex3.m_color_i & 0xff); LOGMASKED(LOG_COMMANDS, "%04x, %04x = %02x\n", start_x, start_y, m_rex3.m_color_i & 0xff);
m_rex3.m_bres_octant_inc1 = 0; m_rex3.m_bres_octant_inc1 = 0;
write_pixel(m_rex3.m_color_i & 0xff); write_pixel(m_rex3.m_color_i & 0xff, false);
start_x++; start_x++;
if (start_x > end_x) if (start_x > end_x)
{ {
@ -1651,6 +1689,7 @@ void newport_video_device::do_rex3_command()
case 0x00000122: // StopOnX, DoSetup, Span, Draw case 0x00000122: // StopOnX, DoSetup, Span, Draw
case 0x00022102: // LSOpaque, EnLSPattern, StopOnX, Span, Draw case 0x00022102: // LSOpaque, EnLSPattern, StopOnX, Span, Draw
case 0x00080122: // LROnly, StopOnX, DoSetup, Span, Draw case 0x00080122: // LROnly, StopOnX, DoSetup, Span, Draw
case 0x000c0122: // Shade, LROnly, StopOnX, DoSetup, Span, Draw
{ {
if (BIT(mode0, 19) && dx < 0) // LROnly if (BIT(mode0, 19) && dx < 0) // LROnly
break; break;
@ -1715,27 +1754,32 @@ void newport_video_device::do_rex3_command()
case 0x0000032a: // StopOnX, StopOnY, DoSetup, I_Line, Draw case 0x0000032a: // StopOnX, StopOnY, DoSetup, I_Line, Draw
case 0x00000b2a: // SkipLast, StopOnX, StopOnY, DoSetup, I_Line, Draw case 0x00000b2a: // SkipLast, StopOnX, StopOnY, DoSetup, I_Line, Draw
case 0x0000232e: // EnLSPattern, StopOnX, StopOnY, DoSetup, F_Line, Draw case 0x0000232e: // EnLSPattern, StopOnX, StopOnY, DoSetup, F_Line, Draw
case 0x0004232e: // Shade, EnLSPattern, StopOnX, StopOnY, DoSetup, F_Line, Draw
{ {
const bool skip_last = BIT(mode0, 11);
const bool shade = BIT(mode0, 18);
LOGMASKED(LOG_COMMANDS, "%cLine: %04x, %04x to %04x, %04x = %08x\n", (mode0 & 0x1c) == 3 ? 'F' : 'I', LOGMASKED(LOG_COMMANDS, "%cLine: %04x, %04x to %04x, %04x = %08x\n", (mode0 & 0x1c) == 3 ? 'F' : 'I',
start_x, start_y, end_x, end_y, m_cmap0.m_palette[m_rex3.m_color_i]); start_x, start_y, end_x, end_y, m_cmap0.m_palette[m_rex3.m_color_i]);
if (start_x == end_x && start_y == end_y) if (start_x == end_x && start_y == end_y)
{ {
write_pixel(m_rex3.m_color_i); write_pixel(m_rex3.m_color_i, shade);
} }
else if (start_x == end_x) else if (start_x == end_x)
{ {
do_v_iline(m_rex3.m_color_i, BIT(mode0, 11)); do_v_iline(m_rex3.m_color_i, skip_last, shade);
} }
else if (start_y == end_y) else if (start_y == end_y)
{ {
do_h_iline(m_rex3.m_color_i, BIT(mode0, 11)); do_h_iline(m_rex3.m_color_i, skip_last, shade);
} }
else else
{ {
do_iline(m_rex3.m_color_i, BIT(mode0, 11)); do_iline(m_rex3.m_color_i, skip_last, shade);
} }
break; break;
} }
case 0x00001106: // EnZPattern, StopOnX, Block, Draw
case 0x00002106: // EnLSPattern, StopOnX, Block, Draw case 0x00002106: // EnLSPattern, StopOnX, Block, Draw
case 0x00009106: // Length32, EnZPattern, StopOnX, Block, Draw case 0x00009106: // Length32, EnZPattern, StopOnX, Block, Draw
case 0x00022106: // LSOpaque, EnLSPattern, StopOnX, Block, Draw case 0x00022106: // LSOpaque, EnLSPattern, StopOnX, Block, Draw

View File

@ -187,13 +187,13 @@ private:
void write_y_end(int32_t val); void write_y_end(int32_t val);
bool pixel_clip_pass(int16_t x, int16_t y); bool pixel_clip_pass(int16_t x, int16_t y);
void write_pixel(uint8_t color); void write_pixel(uint8_t color, bool shade);
void write_pixel(int16_t x, int16_t y, uint8_t color); void write_pixel(int16_t x, int16_t y, uint8_t color);
void store_pixel(uint8_t *dest_buf, const uint8_t src); void store_pixel(uint8_t *dest_buf, const uint8_t src);
void do_v_iline(uint8_t color, bool skip_last); void do_v_iline(uint8_t color, bool skip_last, bool shade);
void do_h_iline(uint8_t color, bool skip_last); void do_h_iline(uint8_t color, bool skip_last, bool shade);
void do_iline(uint8_t color, bool skip_last); void do_iline(uint8_t color, bool skip_last, bool shade);
uint8_t do_pixel_read(); uint8_t do_pixel_read();
uint64_t do_pixel_word_read(); uint64_t do_pixel_word_read();
void do_rex3_command(); void do_rex3_command();