diff options
author | therealmogminer@gmail.com <therealmogminer@gmail.com> | 2015-06-21 04:51:05 +0200 |
---|---|---|
committer | therealmogminer@gmail.com <therealmogminer@gmail.com> | 2015-06-23 21:02:29 +0200 |
commit | c4875690426ecad36f08f6ec458b5d56d54f7564 (patch) | |
tree | 0dc07dae4927b7092d1c78613f14465ec1a21e84 | |
parent | 15279b7178a40601e11c4735a8d0eef2e8b464c8 (diff) |
nw, update rgbgen
-rw-r--r-- | src/emu/rendersw.inc | 10 | ||||
-rw-r--r-- | src/emu/video/rgbgen.c | 130 | ||||
-rw-r--r-- | src/emu/video/rgbgen.h | 958 | ||||
-rw-r--r-- | src/emu/video/rgbsse.c | 77 | ||||
-rw-r--r-- | src/emu/video/rgbsse.h | 297 | ||||
-rw-r--r-- | src/emu/video/vooddefs.h | 78 | ||||
-rw-r--r-- | src/mame/drivers/cobra.c | 2 | ||||
-rw-r--r-- | src/mame/includes/namcos22.h | 6 | ||||
-rw-r--r-- | src/mame/video/gaelco3d.c | 6 | ||||
-rw-r--r-- | src/mame/video/midzeus.c | 2 | ||||
-rw-r--r-- | src/mame/video/midzeus2.c | 2 | ||||
-rw-r--r-- | src/mame/video/n64.c | 20 | ||||
-rw-r--r-- | src/mame/video/namcos22.c | 76 | ||||
-rw-r--r-- | src/mame/video/rdpblend.c | 18 | ||||
-rw-r--r-- | src/mame/video/rdpspn16.c | 29 | ||||
-rw-r--r-- | src/mame/video/rdptpipe.c | 140 | ||||
-rw-r--r-- | src/mame/video/rdptpipe.h | 2 |
17 files changed, 940 insertions, 913 deletions
diff --git a/src/emu/rendersw.inc b/src/emu/rendersw.inc index 5659317a914..3ab326a5459 100644 --- a/src/emu/rendersw.inc +++ b/src/emu/rendersw.inc @@ -149,7 +149,7 @@ private: UINT32 pix01 = palbase[texbase[u1]]; UINT32 pix10 = palbase[texbase[v1]]; UINT32 pix11 = palbase[texbase[u1 + v1]]; - return rgbint_t::bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); + return rgbaint_t::bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); } else { @@ -181,7 +181,7 @@ private: const UINT16 *texbase = reinterpret_cast<const UINT16 *>(texture.base); texbase += v0 * texture.rowpixels + u0; - return rgbint_t::bilinear_filter(palbase[texbase[0]], palbase[texbase[u1]], palbase[texbase[v1]], palbase[texbase[u1 + v1]], curu >> 8, curv >> 8); + return rgbaint_t::bilinear_filter(palbase[texbase[0]], palbase[texbase[u1]], palbase[texbase[v1]], palbase[texbase[u1 + v1]], curu >> 8, curv >> 8); } else { @@ -243,7 +243,7 @@ private: else pix11 = pix10; } - return rgbint_t::bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); + return rgbaint_t::bilinear_filter(pix00, pix01, pix10, pix11, curu >> 8, curv >> 8); } else { @@ -274,7 +274,7 @@ private: const UINT32 *texbase = reinterpret_cast<const UINT32 *>(texture.base); texbase += v0 * texture.rowpixels + u0; - return rgbint_t::bilinear_filter(texbase[0], texbase[u1], texbase[v1], texbase[u1 + v1], curu >> 8, curv >> 8); + return rgbaint_t::bilinear_filter(texbase[0], texbase[u1], texbase[v1], texbase[u1 + v1], curu >> 8, curv >> 8); } else { @@ -305,7 +305,7 @@ private: const UINT32 *texbase = reinterpret_cast<const UINT32 *>(texture.base); texbase += v0 * texture.rowpixels + u0; - return rgbint_t::bilinear_filter(texbase[0], texbase[u1], texbase[v1], texbase[u1 + v1], curu >> 8, curv >> 8); + return rgbaint_t::bilinear_filter(texbase[0], texbase[u1], texbase[v1], texbase[u1 + v1], curu >> 8, curv >> 8); } else { diff --git a/src/emu/video/rgbgen.c b/src/emu/video/rgbgen.c new file mode 100644 index 00000000000..9ce4db96cb8 --- /dev/null +++ b/src/emu/video/rgbgen.c @@ -0,0 +1,130 @@ +// license:BSD-3-Clause +// copyright-holders:Vas Crabb, Ryan Holtz +/*************************************************************************** + + rgbgen.c + + General RGB utilities. + +***************************************************************************/ + +#include "emu.h" +#include "rgbgen.h" + +/*************************************************************************** + HIGHER LEVEL OPERATIONS +***************************************************************************/ + +/*------------------------------------------------- + rgbaint_blend - blend two colors by the given + scale factor +-------------------------------------------------*/ + +void rgbaint_t::blend(const rgbaint_t& color2, UINT8 color1scale) +{ + INT32 scale1 = (INT32)color1scale; + INT32 scale2 = 256 - scale1; + + m_a = (m_a * scale1 + color2.m_a * scale2) >> 8; + m_r = (m_r * scale1 + color2.m_r * scale2) >> 8; + m_g = (m_g * scale1 + color2.m_g * scale2) >> 8; + m_b = (m_b * scale1 + color2.m_b * scale2) >> 8; +} + + +/*------------------------------------------------- + rgbaint_scale_and_clamp - scale the given + color by an 8.8 scale factor, immediate or + per channel, and clamp to byte values +-------------------------------------------------*/ + +void rgbaint_t::scale_imm_and_clamp(INT32 scale) +{ + m_a = (m_a * scale) >> 8; + if (m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } + m_r = (m_r * scale) >> 8; + if (m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } + m_g = (m_g * scale) >> 8; + if (m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } + m_b = (m_b * scale) >> 8; + if (m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } +} + +void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) +{ + m_a = (m_a * scale.m_a) >> 8; + if (m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } + m_r = (m_r * scale.m_r) >> 8; + if (m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } + m_g = (m_g * scale.m_g) >> 8; + if (m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } + m_b = (m_b * scale.m_b) >> 8; + if (m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } +} + + +void rgbaint_t::scale_imm_add_and_clamp(INT32 scale, const rgbaint_t& other) +{ + m_a = (m_a * scale) >> 8; + m_a += other.m_a; + if (m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } + m_r = (m_r * scale) >> 8; + m_r += other.m_r; + if (m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } + m_g = (m_g * scale) >> 8; + m_g += other.m_g; + if (m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } + m_b = (m_b * scale) >> 8; + m_b += other.m_b; + if (m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } +} + +void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other) +{ + m_a = (m_a * scale.m_a) >> 8; + m_a += other.m_a; + if (m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } + m_r = (m_r * scale.m_r) >> 8; + m_r += other.m_r; + if (m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } + m_g = (m_g * scale.m_g) >> 8; + m_g += other.m_g; + if (m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } + m_b = (m_b * scale.m_b) >> 8; + m_b += other.m_b; + if (m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } +} + +void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2) +{ + m_a = (m_a * scale.m_a + other.m_a * scale2.m_a) >> 8; + if ((UINT16)m_a > 255) { m_a = (m_a < 0) ? 0 : 255; } + m_r = (m_r * scale.m_r + other.m_r * scale2.m_r) >> 8; + if ((UINT16)m_r > 255) { m_r = (m_r < 0) ? 0 : 255; } + m_g = (m_g * scale.m_g + other.m_g * scale2.m_g) >> 8; + if ((UINT16)m_g > 255) { m_g = (m_g < 0) ? 0 : 255; } + m_b = (m_b * scale.m_b + other.m_b * scale2.m_b) >> 8; + if ((UINT16)m_b > 255) { m_b = (m_b < 0) ? 0 : 255; } +} + + +/*------------------------------------------------- + bilinear_filter - bilinear filter between + four pixel values; this code is derived from + code provided by Michael Herf +-------------------------------------------------*/ + +UINT32 rgbaint_t::bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) +{ + UINT32 ag0, ag1, rb0, rb1; + + rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); + rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); + ag0 = (rgb00 & 0xff00ff00) + ((((rgb01 & 0xff00ff00) - (rgb00 & 0xff00ff00)) * u) >> 8); + ag1 = (rgb10 & 0xff00ff00) + ((((rgb11 & 0xff00ff00) - (rgb10 & 0xff00ff00)) * u) >> 8); + + rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); + ag0 = (ag0 & 0xff00ff00) + ((((ag1 & 0xff00ff00) - (ag0 & 0xff00ff00)) * v) >> 8); + + return (ag0 & 0xff00ff00) | (rb0 & 0x00ff00ff); +} diff --git a/src/emu/video/rgbgen.h b/src/emu/video/rgbgen.h index db88f65b4a0..6bb2edb78d6 100644 --- a/src/emu/video/rgbgen.h +++ b/src/emu/video/rgbgen.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Vas Crabb +// copyright-holders:Vas Crabb, Ryan Holtz /*************************************************************************** rgbgen.h @@ -16,511 +16,451 @@ TYPE DEFINITIONS ***************************************************************************/ -/* intermediate RGB values are stored in a struct */ -struct rgbint { INT16 dummy, r, g, b; }; - -/* intermediate RGB values are stored in a struct */ -struct rgbaint { INT16 a, r, g, b; }; - - - -/*************************************************************************** - BASIC CONVERSIONS -***************************************************************************/ - -/*------------------------------------------------- - rgb_comp_to_rgbint - converts a trio of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgb_comp_to_rgbint(rgbint *rgb, INT16 r, INT16 g, INT16 b) -{ - rgb->r = r; - rgb->g = g; - rgb->b = b; -} - - -/*------------------------------------------------- - rgba_comp_to_rgbint - converts a quad of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgba_comp_to_rgbaint(rgbaint *rgb, INT16 a, INT16 r, INT16 g, INT16 b) -{ - rgb->a = a; - rgb->r = r; - rgb->g = g; - rgb->b = b; -} - - -/*------------------------------------------------- - rgb_to_rgbint - converts a packed trio of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgb_to_rgbint(rgbint *rgb, rgb_t color) -{ - rgb->r = color.r(); - rgb->g = color.g(); - rgb->b = color.b(); -} - - -/*------------------------------------------------- - rgba_to_rgbaint - converts a packed quad of RGB - components to an rgbint type --------------------------------------------------*/ - -INLINE void rgba_to_rgbaint(rgbaint *rgb, rgb_t color) -{ - rgb->a = color.a(); - rgb->r = color.r(); - rgb->g = color.g(); - rgb->b = color.b(); -} - - -/*------------------------------------------------- - rgbint_to_rgb - converts an rgbint back to - a packed trio of RGB values --------------------------------------------------*/ - -INLINE rgb_t rgbint_to_rgb(const rgbint *color) -{ - return rgb_t(color->r, color->g, color->b); -} - - -/*------------------------------------------------- - rgbaint_to_rgba - converts an rgbint back to - a packed quad of RGB values --------------------------------------------------*/ - -INLINE rgb_t rgbaint_to_rgba(const rgbaint *color) -{ - return rgb_t(color->a, color->r, color->g, color->b); -} - - -/*------------------------------------------------- - rgbint_to_rgb_clamp - converts an rgbint back - to a packed trio of RGB values, clamping them - to bytes first --------------------------------------------------*/ - -INLINE rgb_t rgbint_to_rgb_clamp(const rgbint *color) -{ - UINT8 r = (color->r < 0) ? 0 : (color->r > 255) ? 255 : color->r; - UINT8 g = (color->g < 0) ? 0 : (color->g > 255) ? 255 : color->g; - UINT8 b = (color->b < 0) ? 0 : (color->b > 255) ? 255 : color->b; - return rgb_t(r, g, b); -} - - -/*------------------------------------------------- - rgbaint_to_rgba_clamp - converts an rgbint back - to a packed quad of RGB values, clamping them - to bytes first --------------------------------------------------*/ - -INLINE rgb_t rgbaint_to_rgba_clamp(const rgbaint *color) -{ - UINT8 a = (color->a < 0) ? 0 : (color->a > 255) ? 255 : color->a; - UINT8 r = (color->r < 0) ? 0 : (color->r > 255) ? 255 : color->r; - UINT8 g = (color->g < 0) ? 0 : (color->g > 255) ? 255 : color->g; - UINT8 b = (color->b < 0) ? 0 : (color->b > 255) ? 255 : color->b; - return rgb_t(a, r, g, b); -} - - - -/*************************************************************************** - CORE MATH -***************************************************************************/ - -/*------------------------------------------------- - rgbint_add - add two rgbint values --------------------------------------------------*/ - -INLINE void rgbint_add(rgbint *color1, const rgbint *color2) -{ - color1->r += color2->r; - color1->g += color2->g; - color1->b += color2->b; -} - - -/*------------------------------------------------- - rgbaint_add - add two rgbaint values --------------------------------------------------*/ - -INLINE void rgbaint_add(rgbaint *color1, const rgbaint *color2) -{ - color1->a += color2->a; - color1->r += color2->r; - color1->g += color2->g; - color1->b += color2->b; -} - -/*------------------------------------------------- - rgbaint_add_imm - add immediate INT16 to rgbaint value --------------------------------------------------*/ - -INLINE void rgbaint_add_imm(rgbaint *color1, const INT16 imm) -{ - color1->a += imm; - color1->r += imm; - color1->g += imm; - color1->b += imm; -} - - -/*------------------------------------------------- - rgbint_sub - subtract two rgbint values --------------------------------------------------*/ - -INLINE void rgbint_sub(rgbint *color1, const rgbint *color2) -{ - color1->r -= color2->r; - color1->g -= color2->g; - color1->b -= color2->b; -} - - -/*------------------------------------------------- - rgbaint_sub - subtract two rgbaint values --------------------------------------------------*/ - -INLINE void rgbaint_sub(rgbaint *color1, const rgbaint *color2) -{ - color1->a -= color2->a; - color1->r -= color2->r; - color1->g -= color2->g; - color1->b -= color2->b; -} - - -/*------------------------------------------------- - rgbint_subr - reverse subtract two rgbint - values --------------------------------------------------*/ - -INLINE void rgbint_subr(rgbint *color1, const rgbint *color2) -{ - color1->r = color2->r - color1->r; - color1->g = color2->g - color1->g; - color1->b = color2->b - color1->b; -} - - -/*------------------------------------------------- - rgbaint_subr - reverse subtract two rgbaint - values --------------------------------------------------*/ - -INLINE void rgbaint_subr(rgbaint *color1, const rgbaint *color2) -{ - color1->a = color2->a - color1->a; - color1->r = color2->r - color1->r; - color1->g = color2->g - color1->g; - color1->b = color2->b - color1->b; -} - - -/*------------------------------------------------- - rgbint_shl - shift each component of an - rgbint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbint_shl(rgbint *color, UINT8 shift) -{ - color->r <<= shift; - color->g <<= shift; - color->b <<= shift; -} - - -/*------------------------------------------------- - rgbaint_shl - shift each component of an - rgbaint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbaint_shl(rgbaint *color, UINT8 shift) -{ - color->r <<= shift; - color->g <<= shift; - color->b <<= shift; - color->a <<= shift; -} - - -/*------------------------------------------------- - rgbint_shr - shift each component of an - rgbint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbint_shr(rgbint *color, UINT8 shift) -{ - color->r >>= shift; - color->g >>= shift; - color->b >>= shift; -} - - -/*------------------------------------------------- - rgbaint_shr - shift each component of an - rgbaint struct by the given number of bits --------------------------------------------------*/ - -INLINE void rgbaint_shr(rgbaint *color, UINT8 shift) -{ - color->r >>= shift; - color->g >>= shift; - color->b >>= shift; - color->a >>= shift; -} - - - -/*************************************************************************** - HIGHER LEVEL OPERATIONS -***************************************************************************/ - -/*------------------------------------------------- - rgbint_blend - blend two colors by the given - scale factor --------------------------------------------------*/ - -INLINE void rgbint_blend(rgbint *color1, const rgbint *color2, UINT8 color1scale) -{ - int scale1 = (int)color1scale; - int scale2 = 256 - scale1; - - color1->r = (color1->r * scale1 + color2->r * scale2) >> 8; - color1->g = (color1->g * scale1 + color2->g * scale2) >> 8; - color1->b = (color1->b * scale1 + color2->b * scale2) >> 8; -} - - -/*------------------------------------------------- - rgbaint_blend - blend two colors by the given - scale factor --------------------------------------------------*/ - -INLINE void rgbaint_blend(rgbaint *color1, const rgbaint *color2, UINT8 color1scale) -{ - int scale1 = (int)color1scale; - int scale2 = 256 - scale1; - - color1->a = (color1->a * scale1 + color2->a * scale2) >> 8; - color1->r = (color1->r * scale1 + color2->r * scale2) >> 8; - color1->g = (color1->g * scale1 + color2->g * scale2) >> 8; - color1->b = (color1->b * scale1 + color2->b * scale2) >> 8; -} - -/*------------------------------------------------- - rgbint_scale_and_clamp - scale the given - color by an 8.8 scale factor, immediate or - per channel, and clamp to byte values --------------------------------------------------*/ - -INLINE void rgbint_scale_immediate_and_clamp(rgbint *color, INT16 colorscale) -{ - color->r = (color->r * colorscale) >> 8; - if ((UINT16)color->r > 255) { color->r = (color->r < 0) ? 0 : 255; } - color->g = (color->g * colorscale) >> 8; - if ((UINT16)color->g > 255) { color->g = (color->g < 0) ? 0 : 255; } - color->b = (color->b * colorscale) >> 8; - if ((UINT16)color->b > 255) { color->b = (color->b < 0) ? 0 : 255; } -} - -INLINE void rgbint_scale_channel_and_clamp(rgbint *color, const rgbint *colorscale) -{ - color->r = (color->r * colorscale->r) >> 8; - if ((UINT16)color->r > 255) { color->r = (color->r < 0) ? 0 : 255; } - color->g = (color->g * colorscale->g) >> 8; - if ((UINT16)color->g > 255) { color->g = (color->g < 0) ? 0 : 255; } - color->b = (color->b * colorscale->b) >> 8; - if ((UINT16)color->b > 255) { color->b = (color->b < 0) ? 0 : 255; } -} - - -/*------------------------------------------------- - rgbaint_scale_and_clamp - scale the given - color by an 8.8 scale factor, immediate or - per channel, and clamp to byte values --------------------------------------------------*/ - -INLINE void rgbaint_scale_immediate_and_clamp(rgbaint *color, INT16 colorscale) -{ - color->a = (color->a * colorscale) >> 8; - if ((UINT16)color->a > 255) { color->a = (color->a < 0) ? 0 : 255; } - color->r = (color->r * colorscale) >> 8; - if ((UINT16)color->r > 255) { color->r = (color->r < 0) ? 0 : 255; } - color->g = (color->g * colorscale) >> 8; - if ((UINT16)color->g > 255) { color->g = (color->g < 0) ? 0 : 255; } - color->b = (color->b * colorscale) >> 8; - if ((UINT16)color->b > 255) { color->b = (color->b < 0) ? 0 : 255; } -} - -INLINE void rgbaint_scale_channel_and_clamp(rgbaint *color, const rgbaint *colorscale) -{ - color->a = (color->a * colorscale->a) >> 8; - if ((UINT16)color->a > 255) { color->a = (color->a < 0) ? 0 : 255; } - color->r = (color->r * colorscale->r) >> 8; - if ((UINT16)color->r > 255) { color->r = (color->r < 0) ? 0 : 255; } - color->g = (color->g * colorscale->g) >> 8; - if ((UINT16)color->g > 255) { color->g = (color->g < 0) ? 0 : 255; } - color->b = (color->b * colorscale->b) >> 8; - if ((UINT16)color->b > 255) { color->b = (color->b < 0) ? 0 : 255; } -} - -INLINE void rgbaint_scale_immediate_add_and_clamp(rgbaint *color1, INT16 colorscale, const rgbaint *color2) -{ - color1->a = (color1->a * colorscale) >> 8; - color1->a += color2->a; - if ((UINT16)color1->a > 255) { color1->a = (color1->a < 0) ? 0 : 255; } - color1->r = (color1->r * colorscale) >> 8; - color1->r += color2->r; - if ((UINT16)color1->r > 255) { color1->r = (color1->r < 0) ? 0 : 255; } - color1->g = (color1->g * colorscale) >> 8; - color1->g += color2->g; - if ((UINT16)color1->g > 255) { color1->g = (color1->g < 0) ? 0 : 255; } - color1->b = (color1->b * colorscale) >> 8; - color1->b += color2->b; - if ((UINT16)color1->b > 255) { color1->b = (color1->b < 0) ? 0 : 255; } -} - -INLINE void rgbaint_scale_channel_add_and_clamp(rgbaint *color1, const rgbaint *colorscale, const rgbaint *color2) -{ - color1->a = (color1->a * colorscale->a) >> 8; - color1->a += color2->a; - if ((UINT16)color1->a > 255) { color1->a = (color1->a < 0) ? 0 : 255; } - color1->r = (color1->r * colorscale->r) >> 8; - color1->r += color2->r; - if ((UINT16)color1->r > 255) { color1->r = (color1->r < 0) ? 0 : 255; } - color1->g = (color1->g * colorscale->g) >> 8; - color1->g += color2->g; - if ((UINT16)color1->g > 255) { color1->g = (color1->g < 0) ? 0 : 255; } - color1->b = (color1->b * colorscale->b) >> 8; - color1->b += color2->b; - if ((UINT16)color1->b > 255) { color1->b = (color1->b < 0) ? 0 : 255; } -} - -INLINE void rgbaint_scale_channel_add_and_clamp(rgbaint *color1, const rgbaint *colorscale1, const rgbaint *color2, const rgbaint *colorscale2) -{ - color1->a = (color1->a * colorscale1->a + color2->a * colorscale2->a) >> 8; - if ((UINT16)color1->a > 255) { color1->a = (color1->a < 0) ? 0 : 255; } - color1->r = (color1->r * colorscale1->r + color2->r * colorscale2->r) >> 8; - if ((UINT16)color1->r > 255) { color1->r = (color1->r < 0) ? 0 : 255; } - color1->g = (color1->g * colorscale1->g + color2->g * colorscale2->g) >> 8; - if ((UINT16)color1->g > 255) { color1->g = (color1->g < 0) ? 0 : 255; } - color1->b = (color1->b * colorscale1->b + color2->b * colorscale2->b) >> 8; - if ((UINT16)color1->b > 255) { color1->b = (color1->b < 0) ? 0 : 255; } -} - - -/*------------------------------------------------- - rgb_bilinear_filter - bilinear filter between - four pixel values; this code is derived from - code provided by Michael Herf --------------------------------------------------*/ - -INLINE UINT32 rgb_bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - UINT32 ag0, ag1, rb0, rb1; - - rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - ag0 = (rgb00 & 0x0000ff00) + ((((rgb01 & 0x0000ff00) - (rgb00 & 0x0000ff00)) * u) >> 8); - ag1 = (rgb10 & 0x0000ff00) + ((((rgb11 & 0x0000ff00) - (rgb10 & 0x0000ff00)) * u) >> 8); - - rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); - ag0 = (ag0 & 0x0000ff00) + ((((ag1 & 0x0000ff00) - (ag0 & 0x0000ff00)) * v) >> 8); - - return (ag0 & 0x0000ff00) | (rb0 & 0x00ff00ff); -} - - -/*------------------------------------------------- - rgba_bilinear_filter - bilinear filter between - four pixel values; this code is derived from - code provided by Michael Herf --------------------------------------------------*/ - -INLINE UINT32 rgba_bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - UINT32 ag0, ag1, rb0, rb1; - - rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - rgb00 = rgb00 >> 8; - rgb01 = rgb01 >> 8; - rgb10 = rgb10 >> 8; - rgb11 = rgb11 >> 8; - ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - - rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); - ag0 = (ag0 & 0x00ff00ff) + ((((ag1 & 0x00ff00ff) - (ag0 & 0x00ff00ff)) * v) >> 8); - - return ((ag0 << 8) & 0xff00ff00) | (rb0 & 0x00ff00ff); -} - - -/*------------------------------------------------- - rgbint_bilinear_filter - bilinear filter between - four pixel values; this code is derived from - code provided by Michael Herf --------------------------------------------------*/ - -INLINE void rgbint_bilinear_filter(rgbint *color, UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - UINT32 ag0, ag1, rb0, rb1; - - rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - ag0 = (rgb00 & 0x0000ff00) + ((((rgb01 & 0x0000ff00) - (rgb00 & 0x0000ff00)) * u) >> 8); - ag1 = (rgb10 & 0x0000ff00) + ((((rgb11 & 0x0000ff00) - (rgb10 & 0x0000ff00)) * u) >> 8); - - rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); - ag0 = (ag0 & 0x0000ff00) + ((((ag1 & 0x0000ff00) - (ag0 & 0x0000ff00)) * v) >> 8); - - color->r = rb0 >> 16; - color->g = ag0 >> 8; - color->b = rb0; -} - - -/*------------------------------------------------- - rgbaint_bilinear_filter - bilinear filter between - four pixel values; this code is derived from - code provided by Michael Herf --------------------------------------------------*/ - -INLINE void rgbaint_bilinear_filter(rgbaint *color, UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) -{ - UINT32 ag0, ag1, rb0, rb1; - - rb0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - rb1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - rgb00 = rgb00 >> 8; - rgb01 = rgb01 >> 8; - rgb10 = rgb10 >> 8; - rgb11 = rgb11 >> 8; - ag0 = (rgb00 & 0x00ff00ff) + ((((rgb01 & 0x00ff00ff) - (rgb00 & 0x00ff00ff)) * u) >> 8); - ag1 = (rgb10 & 0x00ff00ff) + ((((rgb11 & 0x00ff00ff) - (rgb10 & 0x00ff00ff)) * u) >> 8); - - rb0 = (rb0 & 0x00ff00ff) + ((((rb1 & 0x00ff00ff) - (rb0 & 0x00ff00ff)) * v) >> 8); - ag0 = (ag0 & 0x00ff00ff) + ((((ag1 & 0x00ff00ff) - (ag0 & 0x00ff00ff)) * v) >> 8); - - color->a = ag0 >> 16; - color->r = rb0 >> 16; - color->g = ag0; - color->b = rb0; -} - - -#endif /* __RGBUTIL__ */ +class rgbaint_t +{ +public: + inline rgbaint_t() { } + inline rgbaint_t(UINT32 a, UINT32 r, UINT32 g, UINT32 b) { set(a, r, g, b); } + inline rgbaint_t(rgb_t& rgba) { set(rgba); } + + inline void set(rgbaint_t& other) { set(other.m_a, other.m_r, other.m_g, other.m_b); } + inline void set(UINT32 rgba) { set((rgba >> 24) & 0xff, (rgba >> 16) & 0xff, (rgba >> 8) & 0xff, rgba & 0xff); } + inline void set(UINT32 a, UINT32 r, UINT32 g, UINT32 b) + { + m_a = a; + m_r = r; + m_g = g; + m_b = b; + } + inline void set(rgb_t& rgba) { set(rgba.a(), rgba.r(), rgba.g(), rgba.b()); } + + inline rgb_t to_rgba() + { + return rgb_t(m_a, m_r, m_g, m_b); + } + + inline rgb_t to_rgba_clamp() + { + UINT8 a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a; + UINT8 r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r; + UINT8 g = (m_g < 0) ? 0 : (m_g > 255) ? 255 : m_g; + UINT8 b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b; + return rgb_t(a, r, g, b); + } + + inline void add(const rgbaint_t& color) + { + add_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void add_imm(const UINT32 imm) + { + add_imm_rgba(imm, imm, imm, imm); + } + + inline void add_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a += a; + m_r += r; + m_g += g; + m_b += b; + } + + inline void sub(const rgbaint_t& color) + { + sub_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void sub_imm(const UINT32 imm) + { + sub_imm_rgba(imm, imm, imm, imm); + } + + inline void sub_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a -= a; + m_r -= r; + m_g -= g; + m_b -= b; + } + + inline void subr(rgbaint_t& color) + { + subr_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void subr_imm(const UINT32 imm) + { + subr_imm_rgba(imm, imm, imm, imm); + } + + inline void subr_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a = a - m_a; + m_r = r - m_r; + m_g = g - m_g; + m_b = b - m_b; + } + + inline void set_a(const UINT32 value) + { + m_r = value; + } + + inline void set_r(const UINT32 value) + { + m_r = value; + } + + inline void set_g(const UINT32 value) + { + m_g = value; + } + + inline void set_b(const UINT32 value) + { + m_b = value; + } + + inline UINT8 get_a() + { + return m_r; + } + + inline UINT8 get_r() + { + return m_r; + } + + inline UINT8 get_g() + { + return m_g; + } + + inline UINT8 get_b() + { + return m_b; + } + + inline UINT32 get_a32() + { + return m_a; + } + + inline UINT32 get_r32() + { + return m_r; + } + + inline UINT32 get_g32() + { + return m_g; + } + + inline UINT32 get_b32() + { + return m_b; + } + + inline void mul(rgbaint_t& color) + { + mul_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void mul_imm(const UINT32 imm) + { + mul_imm_rgba(imm, imm, imm, imm); + } + + inline void mul_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a *= a; + m_r *= r; + m_g *= g; + m_b *= b; + } + + inline void shl(const rgbaint_t& shift) + { + m_a <<= shift.m_a; + m_r <<= shift.m_r; + m_g <<= shift.m_g; + m_b <<= shift.m_b; + } + + inline void shl_imm(const UINT8 shift) + { + if (shift == 0) + return; + + m_a <<= shift; + m_r <<= shift; + m_g <<= shift; + m_b <<= shift; + } + + inline void shl_imm_all(const UINT8 shift) + { + if (shift == 0) + return; + + m_a <<= shift; + m_a |= m_r >> (32 - shift); + m_r <<= shift; + m_r |= m_g >> (32 - shift); + m_g <<= shift; + m_g |= m_b >> (32 - shift); + m_b <<= shift; + } + + inline void shr(const rgbaint_t& shift) + { + m_a >>= shift.m_a; + m_r >>= shift.m_r; + m_g >>= shift.m_g; + m_b >>= shift.m_b; + } + + inline void shr_imm(const UINT8 shift) + { + if (shift == 0) + return; + + m_a >>= shift; + m_r >>= shift; + m_g >>= shift; + m_b >>= shift; + } + + inline void shr_imm_all(const UINT8 shift) + { + if (shift == 0) + return; + + m_b >>= shift; + m_b |= m_g << (32 - shift); + m_g >>= shift; + m_g |= m_r << (32 - shift); + m_r >>= shift; + m_r |= m_a << (32 - shift); + m_a >>= shift; + } + + inline void sra(const rgbaint_t& shift) + { + m_a >>= shift.m_a; + if (m_a & (1 << (31 - shift.m_a))) + m_a |= ~0 << (32 - shift.m_a); + + m_r >>= shift.m_r; + if (m_r & (1 << (31 - shift.m_r))) + m_r |= ~0 << (32 - shift.m_r); + + m_g >>= shift.m_g; + if (m_g & (1 << (31 - shift.m_g))) + m_g |= ~0 << (32 - shift.m_g); + + m_b >>= shift.m_b; + if (m_b & (1 << (31 - shift.m_b))) + m_b |= ~0 << (32 - shift.m_b); + } + + inline void sra_imm(const UINT8 shift) + { + const UINT32 high_bit = 1 << (31 - shift); + const UINT32 high_mask = ~0 << (32 - shift); + + m_a >>= shift; + if (m_a & high_bit) + m_a |= high_mask; + + m_r >>= shift; + if (m_r & high_bit) + m_r |= high_mask; + + m_g >>= shift; + if (m_g & high_bit) + m_g |= high_mask; + + m_b >>= shift; + if (m_b & high_bit) + m_b |= high_mask; + } + + inline void or_reg(const rgbaint_t& color) + { + or_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void or_imm(const UINT32 imm) + { + or_imm_rgba(imm, imm, imm, imm); + } + + inline void or_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a |= a; + m_r |= r; + m_g |= g; + m_b |= b; + } + + inline void and_reg(const rgbaint_t& color) + { + and_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void and_imm(const UINT32 imm) + { + and_imm_rgba(imm, imm, imm, imm); + } + + inline void and_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a &= a; + m_r &= r; + m_g &= g; + m_b &= b; + } + + inline void xor_reg(const rgbaint_t& color) + { + xor_imm_rgba(color.m_a, color.m_r, color.m_g, color.m_b); + } + + inline void xor_imm(const UINT32 imm) + { + xor_imm_rgba(imm, imm, imm, imm); + } + + inline void xor_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_a ^= a; + m_r ^= r; + m_g ^= g; + m_b ^= b; + } + + inline void clamp_and_clear(const UINT32 sign) + { + if (m_a & sign) + m_a = 0; + + if (m_r & sign) + m_r = 0; + + if (m_g & sign) + m_g = 0; + + if (m_b & sign) + m_b = 0; + + m_a = (m_a < 0) ? 0 : (m_a > 255) ? 255 : m_a; + m_r = (m_r < 0) ? 0 : (m_r > 255) ? 255 : m_r; + m_g = (m_g < 0) ? 0 : (m_g > 255) ? 255 : m_g; + m_b = (m_b < 0) ? 0 : (m_b > 255) ? 255 : m_b; + } + + inline void sign_extend(const UINT32 compare, const UINT32 sign) + { + if ((m_a & compare) == compare) + m_a |= sign; + + if ((m_r & compare) == compare) + m_r |= sign; + + if ((m_g & compare) == compare) + m_g |= sign; + + if ((m_b & compare) == compare) + m_b |= sign; + } + + inline void min(const UINT32 value) + { + m_a = (m_a > value) ? value : m_a; + m_r = (m_r > value) ? value : m_r; + m_g = (m_g > value) ? value : m_g; + m_b = (m_b > value) ? value : m_b; + } + + void blend(const rgbaint_t& other, UINT8 factor); + + void scale_and_clamp(const rgbaint_t& scale); + void scale_imm_and_clamp(const INT32 scale); + void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2); + void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other); + void scale_imm_add_and_clamp(const INT32 scale, const rgbaint_t& other); + + inline void cmpeq(const rgbaint_t& value) + { + m_a = (m_a == value.m_a) ? 0xffffffff : 0; + m_r = (m_r == value.m_r) ? 0xffffffff : 0; + m_g = (m_g == value.m_g) ? 0xffffffff : 0; + m_b = (m_b == value.m_b) ? 0xffffffff : 0; + } + + inline void cmpeq_imm(const UINT32 value) + { + m_a = (m_a == value) ? 0xffffffff : 0; + m_r = (m_r == value) ? 0xffffffff : 0; + m_g = (m_g == value) ? 0xffffffff : 0; + m_b = (m_b == value) ? 0xffffffff : 0; + } + + inline void cmpgt(const rgbaint_t& value) + { + m_a = (m_a > value.m_a) ? 0xffffffff : 0; + m_r = (m_r > value.m_r) ? 0xffffffff : 0; + m_g = (m_g > value.m_g) ? 0xffffffff : 0; + m_b = (m_b > value.m_b) ? 0xffffffff : 0; + } + + inline void cmpgt_imm(const UINT32 value) + { + m_a = (m_a > value) ? 0xffffffff : 0; + m_r = (m_r > value) ? 0xffffffff : 0; + m_g = (m_g > value) ? 0xffffffff : 0; + m_b = (m_b > value) ? 0xffffffff : 0; + } + + inline void cmplt(const rgbaint_t& value) + { + m_a = (m_a < value.m_a) ? 0xffffffff : 0; + m_r = (m_r < value.m_r) ? 0xffffffff : 0; + m_g = (m_g < value.m_g) ? 0xffffffff : 0; + m_b = (m_b < value.m_b) ? 0xffffffff : 0; + } + + inline void cmplt_imm(const UINT32 value) + { + m_a = (m_a < value) ? 0xffffffff : 0; + m_r = (m_r < value) ? 0xffffffff : 0; + m_g = (m_g < value) ? 0xffffffff : 0; + m_b = (m_b < value) ? 0xffffffff : 0; + } + + inline void merge_alpha(rgbaint_t& alpha) + { + m_a = alpha.m_a; + } + + inline rgbaint_t operator=(const rgbaint_t& other) + { + m_a = other.m_a; + m_r = other.m_r; + m_g = other.m_g; + m_b = other.m_b; + return *this; + } + + static UINT32 bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v); + +protected: + UINT32 m_a; + UINT32 m_r; + UINT32 m_g; + UINT32 m_b; +}; + +#endif /* __RGBGEN__ */ diff --git a/src/emu/video/rgbsse.c b/src/emu/video/rgbsse.c index c7566a18f38..5845ee2dae8 100644 --- a/src/emu/video/rgbsse.c +++ b/src/emu/video/rgbsse.c @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Vas Crabb,Ryan Holtz +// copyright-holders:Vas Crabb, Ryan Holtz /*************************************************************************** rgbsse.c @@ -14,77 +14,60 @@ #include <emmintrin.h> #include "rgbutil.h" -void rgbint_t::print() -{ - printf("%04x ", _mm_extract_epi16(m_value, 7)); - printf("%04x ", _mm_extract_epi16(m_value, 6)); - printf("%04x ", _mm_extract_epi16(m_value, 5)); - printf("%04x ", _mm_extract_epi16(m_value, 4)); - printf("%04x ", _mm_extract_epi16(m_value, 3)); - printf("%04x ", _mm_extract_epi16(m_value, 2)); - printf("%04x ", _mm_extract_epi16(m_value, 1)); - printf("%04x\n", _mm_extract_epi16(m_value, 0)); -} - /*************************************************************************** HIGHER LEVEL OPERATIONS ***************************************************************************/ -void rgbint_t::blend(const rgbint_t& other, UINT8 factor) +void rgbaint_t::blend(const rgbaint_t& other, UINT8 factor) { m_value = _mm_unpacklo_epi16(m_value, other.m_value); m_value = _mm_madd_epi16(m_value, *(__m128i *)&rgbsse_statics.scale_table[factor][0]); m_value = _mm_srli_epi32(m_value, 8); } -void rgbint_t::scale_and_clamp(const rgbint_t& scale) +void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) { - __m128i mscale = _mm_unpacklo_epi16(scale.m_value, _mm_setzero_si128()); - m_value = _mm_unpacklo_epi16(m_value, _mm_setzero_si128()); - m_value = _mm_madd_epi16(m_value, mscale); - m_value = _mm_srli_epi32(m_value, 8); - m_value = _mm_min_epi16(m_value, *(__m128i *)&rgbsse_statics.maxbyte); + mul(scale); + shr(8); + min(255); } -void rgbint_t::scale_imm_and_clamp(const INT16 scale) +void rgbaint_t::scale_imm_and_clamp(const INT32 scale) { - __m128i mscale = _mm_set1_epi16(scale); - m_value = _mm_unpacklo_epi16(m_value, _mm_setzero_si128()); - m_value = _mm_madd_epi16(m_value, mscale); - m_value = _mm_srli_epi32(m_value, 8); - m_value = _mm_min_epi16(m_value, *(__m128i *)&rgbsse_statics.maxbyte); + mul_imm(scale); + shr(8); + min(255); } -void rgbint_t::scale_add_and_clamp(const rgbint_t& scale, const rgbint_t& other, const rgbint_t& scale2) +void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2) { - __m128i mscale = _mm_unpacklo_epi16(scale.m_value, scale2.m_value); - m_value = _mm_unpacklo_epi16(m_value, other.m_value); - m_value = _mm_madd_epi16(m_value, mscale); - m_value = _mm_srli_epi32(m_value, 8); - m_value = _mm_min_epi16(m_value, *(__m128i *)&rgbsse_statics.maxbyte); + mul(scale); + rgbaint_t color2(other); + color2.mul(scale2); + + mul(scale); + add(color2); + shr(8); + min(255); } -void rgbint_t::scale_imm_add_and_clamp(const INT16 scale, const rgbint_t& other) +void rgbaint_t::scale_imm_add_and_clamp(const INT32 scale, const rgbaint_t& other) { - // color2 will get mutiplied by 2^8 (256) and then divided by 2^8 by the shift by 8 - __m128i mscale = _mm_unpacklo_epi16(_mm_set1_epi16(scale), _mm_set_epi16(0, 0, 0, 0, 256, 256, 256, 256)); - m_value = _mm_unpacklo_epi16(m_value, other.m_value); - m_value = _mm_madd_epi16(m_value, mscale); - m_value = _mm_srli_epi32(m_value, 8); - m_value = _mm_min_epi16(m_value, *(__m128i *)&rgbsse_statics.maxbyte); + mul_imm(scale); + add(other); + shr(8); + min(255); } -void rgbint_t::scale_add_and_clamp(const rgbint_t& scale, const rgbint_t& other) +void rgbaint_t::scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other) { - // color2 will get mutiplied by 2^8 (256) and then divided by 2^8 by the shift by 8 - __m128i mscale = _mm_unpacklo_epi16(scale.m_value, _mm_set_epi16(0, 0, 0, 0, 256, 256, 256, 256)); - m_value = _mm_unpacklo_epi16(m_value, other.m_value); - m_value = _mm_madd_epi16(m_value, mscale); - m_value = _mm_srli_epi32(m_value, 8); - m_value = _mm_min_epi16(m_value, *(__m128i *)&rgbsse_statics.maxbyte); + mul(scale); + add(other); + shr(8); + min(255); } -UINT32 rgbint_t::bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) +UINT32 rgbaint_t::bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v) { __m128i color00 = _mm_cvtsi32_si128(rgb00); __m128i color01 = _mm_cvtsi32_si128(rgb01); diff --git a/src/emu/video/rgbsse.h b/src/emu/video/rgbsse.h index b6c78059bfc..1e1fafbce4f 100644 --- a/src/emu/video/rgbsse.h +++ b/src/emu/video/rgbsse.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Vas Crabb +// copyright-holders:Vas Crabb, Ryan Holtz /*************************************************************************** rgbsse.h @@ -34,144 +34,143 @@ extern const struct _rgbsse_statics TYPE DEFINITIONS ***************************************************************************/ -class rgbint_t +class rgbaint_t { public: - inline rgbint_t() { } - inline rgbint_t(UINT32 rgb) { set_rgb(rgb); } - inline rgbint_t(UINT32 r, UINT32 g, UINT32 b) { set_rgb(r, g, b); } - inline rgbint_t(rgb_t& rgb) { m_value = _mm_unpacklo_epi8(_mm_cvtsi32_si128(rgb), _mm_setzero_si128()); } + inline rgbaint_t() { } + inline rgbaint_t(UINT32 rgba) { set(rgba); } + inline rgbaint_t(UINT32 a, UINT32 r, UINT32 g, UINT32 b) { set(a, r, g, b); } + inline rgbaint_t(rgb_t& rgba) { set(rgba); } - inline void set(void* value) { m_value = *(__m128i*)value; } - inline __m128i get() { return m_value; } - inline void set(__m128i value) { m_value = value; } - inline void set(rgbint_t& other) { m_value = other.m_value; } - inline void set_rgb(UINT32 rgb) { m_value = _mm_and_si128(_mm_set1_epi32(0xff), _mm_set_epi32(0, rgb, rgb >> 8, rgb >> 16)); } - inline void set_rgb(INT32 r, INT32 g, INT32 b) { m_value = _mm_set_epi32(0, r, g, b); } - inline void set_rgb(rgb_t& rgb) { m_value = _mm_unpacklo_epi16(_mm_unpacklo_epi8(_mm_cvtsi32_si128(rgb), _mm_setzero_si128()), _mm_setzero_si128()); } + inline void set(rgbaint_t& other) { m_value = other.m_value; } + inline void set(UINT32 rgba) { m_value = _mm_and_si128(_mm_set1_epi32(0xff), _mm_set_epi32(rgba >> 24, rgba >> 16, rgba >> 8, rgba)); } + inline void set(UINT32 a, UINT32 r, UINT32 g, UINT32 b) { m_value = _mm_set_epi32(a, r, g, b); } + inline void set(rgb_t& rgb) { m_value = _mm_unpacklo_epi16(_mm_unpacklo_epi8(_mm_cvtsi32_si128(rgb), _mm_setzero_si128()), _mm_setzero_si128()); } - inline rgb_t to_rgb() + inline rgb_t to_rgba() { __m128i anded = _mm_and_si128(m_value, _mm_set1_epi32(0x000000ff)); return _mm_cvtsi128_si32(_mm_packus_epi16(_mm_packs_epi32(anded, anded), _mm_setzero_si128())); } - inline rgb_t to_rgb_clamp() - { - return _mm_cvtsi128_si32(_mm_packus_epi16(_mm_packs_epi32(m_value, m_value), _mm_setzero_si128())); - } - - inline rgb_t to_rgba() - { - return to_rgb(); - } - inline rgb_t to_rgba_clamp() { - return to_rgb_clamp(); + return _mm_cvtsi128_si32(_mm_packus_epi16(_mm_packs_epi32(m_value, m_value), _mm_setzero_si128())); } - inline void add(const rgbint_t& color2) + inline void add(const rgbaint_t& color2) { m_value = _mm_add_epi32(m_value, color2.m_value); } - inline void add_imm(const INT32 imm) + inline void add_imm(const UINT32 imm) { - __m128i temp = _mm_set1_epi32(imm); - m_value = _mm_add_epi32(m_value, temp); + m_value = _mm_add_epi32(m_value, _mm_set1_epi32(imm)); } - inline void add_imm_rgb(const INT32 r, const INT32 g, const INT32 b) + inline void add_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) { - __m128i temp = _mm_set_epi32(0, r, g, b); - m_value = _mm_add_epi32(m_value, temp); + m_value = _mm_add_epi32(m_value, _mm_set_epi32(a, r, g, b)); } - inline void sub(const rgbint_t& color2) + inline void sub(const rgbaint_t& color2) { m_value = _mm_sub_epi32(m_value, color2.m_value); } - inline void sub_imm(const INT32 imm) + inline void sub_imm(const UINT32 imm) { m_value = _mm_sub_epi32(m_value, _mm_set1_epi32(imm)); } - inline void sub_imm_rgb(const INT32 r, const INT32 g, const INT32 b) + inline void sub_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) { - m_value = _mm_sub_epi32(m_value, _mm_set_epi32(0, r, g, b)); + m_value = _mm_sub_epi32(m_value, _mm_set_epi32(a, r, g, b)); } - inline void subr(rgbint_t& color2) + inline void subr(rgbaint_t& color2) { m_value = _mm_sub_epi32(color2.m_value, m_value); } - inline void subr_imm(const INT32 imm) + inline void subr_imm(const UINT32 imm) { m_value = _mm_sub_epi32(_mm_set1_epi32(imm), m_value); } - inline void subr_imm_rgb(const INT32 r, const INT32 g, const INT32 b) + inline void subr_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) { - __m128i temp = _mm_set_epi32(0, r, g, b); - m_value = _mm_sub_epi32(temp, m_value); + m_value = _mm_sub_epi32(_mm_set_epi32(a, r, g, b), m_value); + } + + inline void set_a(const UINT32 value) + { + m_value = _mm_or_si128(_mm_and_si128(m_value, *(__m128i *)&rgbsse_statics.alpha_mask), _mm_set_epi32(value, 0, 0, 0)); } - inline void set_r(const INT32 value) + inline void set_r(const UINT32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, *(__m128i *)&rgbsse_statics.red_mask), _mm_set_epi32(0, value, 0, 0)); } - inline void set_g(const INT32 value) + inline void set_g(const UINT32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, *(__m128i *)&rgbsse_statics.green_mask), _mm_set_epi32(0, 0, value, 0)); } - inline void set_b(const INT32 value) + inline void set_b(const UINT32 value) { m_value = _mm_or_si128(_mm_and_si128(m_value, *(__m128i *)&rgbsse_statics.blue_mask), _mm_set_epi32(0, 0, 0, value)); } + inline UINT8 get_a() + { + return _mm_extract_epi16(m_value, 6); + } + inline UINT8 get_r() { - return _mm_extract_epi16(m_value, 4) & 0xff; + return _mm_extract_epi16(m_value, 4); } inline UINT8 get_g() { - return _mm_extract_epi16(m_value, 2) & 0xff; + return _mm_extract_epi16(m_value, 2); } inline UINT8 get_b() { - return _mm_extract_epi16(m_value, 0) & 0xff; + return _mm_extract_epi16(m_value, 0); + } + + inline UINT16 get_a32() + { + return (_mm_extract_epi16(m_value, 7) << 16) | _mm_extract_epi16(m_value, 6); } inline UINT16 get_r32() { - return _mm_extract_epi16(m_value, 4); + return (_mm_extract_epi16(m_value, 5) << 16) | _mm_extract_epi16(m_value, 4); } inline UINT16 get_g32() { - return _mm_extract_epi16(m_value, 2); + return (_mm_extract_epi16(m_value, 3) << 16) | _mm_extract_epi16(m_value, 2); } inline UINT16 get_b32() { - return _mm_extract_epi16(m_value, 0); + return (_mm_extract_epi16(m_value, 1) << 16) | _mm_extract_epi16(m_value, 0); } - inline void mul(rgbint_t& color) + inline void mul(const rgbaint_t& color) { __m128i tmp1 = _mm_mul_epu32(m_value, color.m_value); __m128i tmp2 = _mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(color.m_value, 4)); m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE(0, 0, 2, 0))); } - inline void mul_imm(const INT32 imm) + inline void mul_imm(const UINT32 imm) { __m128i immv = _mm_set1_epi32(imm); __m128i tmp1 = _mm_mul_epu32(m_value, immv); @@ -179,15 +178,15 @@ public: m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE(0, 0, 2, 0))); } - inline void mul_imm_rgb(const INT32 r, const INT32 g, const INT32 b) + inline void mul_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) { - __m128i immv = _mm_set_epi32(0, r, g, b); + __m128i immv = _mm_set_epi32(a, r, g, b); __m128i tmp1 = _mm_mul_epu32(m_value, immv); __m128i tmp2 = _mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(immv, 4)); m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE(0, 0, 2, 0))); } - inline void shl(const rgbint_t& shift) + inline void shl(const rgbaint_t& shift) { m_value = _mm_sll_epi32(m_value, shift.m_value); } @@ -202,7 +201,7 @@ public: m_value = _mm_slli_si128(m_value, shift >> 3); } - inline void shr(const rgbint_t& shift) + inline void shr(const rgbaint_t& shift) { m_value = _mm_srl_epi32(m_value, shift.m_value); } @@ -217,7 +216,7 @@ public: m_value = _mm_srli_si128(m_value, shift >> 3); } - inline void sra(const rgbint_t& shift) + inline void sra(const rgbaint_t& shift) { m_value = _mm_sra_epi32(m_value, shift.m_value); } @@ -227,32 +226,37 @@ public: m_value = _mm_srai_epi32(m_value, shift); } - inline void or_reg(const rgbint_t& color2) + inline void or_reg(const rgbaint_t& color2) { m_value = _mm_or_si128(m_value, color2.m_value); } - inline void or_imm(const INT32 value) + inline void or_imm(const UINT32 value) { m_value = _mm_or_si128(m_value, _mm_set1_epi32(value)); } - inline void and_reg(const rgbint_t& color) + inline void or_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_value = _mm_or_si128(m_value, _mm_set_epi32(a, r, g, b)); + } + + inline void and_reg(const rgbaint_t& color) { m_value = _mm_and_si128(m_value, color.m_value); } - inline void and_imm(const INT32 value) + inline void and_imm(const UINT32 value) { m_value = _mm_and_si128(m_value, _mm_set1_epi32(value)); } - inline void and_imm_rgb(const INT32 r, const INT32 g, const INT32 b) + inline void and_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) { - m_value = _mm_and_si128(m_value, _mm_set_epi32(0xffffffff, r, g, b)); + m_value = _mm_and_si128(m_value, _mm_set_epi32(a, r, g, b)); } - inline void xor_reg(const rgbint_t& color2) + inline void xor_reg(const rgbaint_t& color2) { m_value = _mm_xor_si128(m_value, color2.m_value); } @@ -262,34 +266,22 @@ public: m_value = _mm_xor_si128(m_value, _mm_set1_epi32(value)); } - inline void clamp_and_clear(const rgbint_t& color, const INT32 sign) + inline void xor_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) + { + m_value = _mm_xor_si128(m_value, _mm_set_epi32(a, r, g, b)); + } + + inline void clamp_and_clear(const UINT32 sign) { __m128i vsign = _mm_set1_epi32(sign); - m_value = _mm_and_si128(color.m_value, _mm_cmpeq_epi32(_mm_and_si128(color.m_value, vsign), _mm_setzero_si128())); + m_value = _mm_and_si128(m_value, _mm_cmpeq_epi32(_mm_and_si128(m_value, vsign), _mm_setzero_si128())); vsign = _mm_srai_epi32(vsign, 1); vsign = _mm_xor_si128(vsign, _mm_set1_epi32(0xffffffff)); - __m128i mask = _mm_cmpgt_epi32(m_value, vsign); // m_value > vsign ? 0xffffffff : 0 + __m128i mask = _mm_cmpgt_epi32(m_value, vsign); m_value = _mm_or_si128(_mm_and_si128(vsign, mask), _mm_and_si128(m_value, _mm_xor_si128(mask, _mm_set1_epi32(0xffffffff)))); } - inline void min(const INT32 value) - { - __m128i val = _mm_set1_epi32(value); - __m128i mask = _mm_cmpgt_epi32(m_value, val); // m_value > value ? 0xffffffff : 0 - m_value = _mm_or_si128(_mm_and_si128(val, mask), _mm_and_si128(m_value, _mm_xor_si128(mask, _mm_set1_epi32(0xffffffff)))); - } - - void blend(const rgbint_t& other, UINT8 factor); - - void scale_and_clamp(const rgbint_t& scale); - void scale_imm_and_clamp(const INT16 scale); - void scale_add_and_clamp(const rgbint_t& scale, const rgbint_t& other, const rgbint_t& scale2); - void scale_add_and_clamp(const rgbint_t& scale, const rgbint_t& other); - void scale_imm_add_and_clamp(const INT16 scale, const rgbint_t& other); - - void max(const rgbint_t& max); - - inline void sign_extend(const INT32 compare, const INT32 sign) + inline void sign_extend(const UINT32 compare, const UINT32 sign) { __m128i compare_vec = _mm_set1_epi32(compare); __m128i compare_mask = _mm_cmpeq_epi32(_mm_and_si128(m_value, compare_vec), compare_vec); @@ -297,9 +289,22 @@ public: m_value = _mm_or_si128(m_value, compared); } - void print(); + inline void min(const UINT32 value) + { + __m128i val = _mm_set1_epi32(value); + __m128i mask = _mm_cmpgt_epi32(m_value, val); + m_value = _mm_or_si128(_mm_and_si128(val, mask), _mm_and_si128(m_value, _mm_xor_si128(mask, _mm_set1_epi32(0xffffffff)))); + } + + void blend(const rgbaint_t& other, UINT8 factor); - inline void cmpeq(const rgbint_t& value) + void scale_and_clamp(const rgbaint_t& scale); + void scale_imm_and_clamp(const INT32 scale); + void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other, const rgbaint_t& scale2); + void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other); + void scale_imm_add_and_clamp(const INT32 scale, const rgbaint_t& other); + + inline void cmpeq(const rgbaint_t& value) { m_value = _mm_cmpeq_epi32(m_value, value.m_value); } @@ -309,127 +314,82 @@ public: m_value = _mm_cmpeq_epi32(m_value, _mm_set1_epi32(value)); } - inline void cmpgt(const rgbint_t& value) + inline void cmpeq_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) { - m_value = _mm_cmpgt_epi32(m_value, value.m_value); + m_value = _mm_cmpeq_epi32(m_value, _mm_set_epi32(a, r, g, b)); } - inline void cmplt(const rgbint_t& value) + inline void cmpgt(const rgbaint_t& value) { - m_value = _mm_cmplt_epi32(m_value, value.m_value); + m_value = _mm_cmpgt_epi32(m_value, value.m_value); } - inline rgbint_t operator=(const rgbint_t& other) + inline void cmpgt_imm(const UINT32 value) { - m_value = other.m_value; - return *this; + m_value = _mm_cmpgt_epi32(m_value, _mm_set1_epi32(value)); } - inline rgbint_t& operator+=(const rgbint_t& other) + inline void cmpgt_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) { - m_value = _mm_add_epi32(m_value, other.m_value); - return *this; + m_value = _mm_cmpgt_epi32(m_value, _mm_set_epi32(a, r, g, b)); } - inline rgbint_t& operator+=(const INT32 other) + inline void cmplt(const rgbaint_t& value) { - m_value = _mm_add_epi32(m_value, _mm_set1_epi32(other)); - return *this; + m_value = _mm_cmplt_epi32(m_value, value.m_value); } - inline rgbint_t& operator-=(const rgbint_t& other) + inline void cmplt_imm(const UINT32 value) { - m_value = _mm_sub_epi32(m_value, other.m_value); - return *this; + m_value = _mm_cmplt_epi32(m_value, _mm_set1_epi32(value)); } - inline rgbint_t& operator*=(const rgbint_t& other) + inline void cmplt_imm_rgba(const UINT32 a, const UINT32 r, const UINT32 g, const UINT32 b) { - m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(_mm_mul_epu32(m_value, other.m_value), _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(other.m_value, 4)), _MM_SHUFFLE(0, 0, 2, 0))); - return *this; + m_value = _mm_cmplt_epi32(m_value, _mm_set_epi32(a, r, g, b)); } - inline rgbint_t& operator*=(const INT32 other) + inline rgbaint_t operator=(const rgbaint_t& other) { - const __m128i immv = _mm_set1_epi32(other); - m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(_mm_mul_epu32(m_value, immv), _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(immv, 4)), _MM_SHUFFLE(0, 0, 2, 0))); + m_value = other.m_value; return *this; } - inline rgbint_t& operator>>=(const INT32 shift) + inline rgbaint_t& operator+=(const rgbaint_t& other) { - m_value = _mm_srai_epi32(m_value, shift); + m_value = _mm_add_epi32(m_value, other.m_value); return *this; } - static UINT32 bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v); - -protected: - __m128i m_value; - -private: - rgbint_t(__m128i value); -}; - -class rgbaint_t : public rgbint_t -{ -public: - inline rgbaint_t() { } - inline rgbaint_t(UINT32 rgba) { m_value = _mm_and_si128(_mm_set1_epi32(0xff), _mm_set_epi32(rgba >> 24, rgba >> 16, rgba >> 8, rgba)); } - inline rgbaint_t(UINT32 a, UINT32 r, UINT32 g, UINT32 b) { set_rgba(a, r, g, b); } - inline rgbaint_t(rgb_t& rgba) { m_value = _mm_unpacklo_epi8(_mm_cvtsi32_si128(rgba), _mm_setzero_si128()); } - - inline void set(rgbaint_t& other) { m_value = other.m_value; } - inline void set(__m128i value) { m_value = value; } - inline void set_rgba(INT32 a, INT32 r, INT32 g, INT32 b) - { - m_value = _mm_set_epi32(a, r, g, b); - } - - inline void set_a(const INT32 value) - { - m_value = _mm_or_si128(_mm_and_si128(m_value, *(__m128i *)&rgbsse_statics.alpha_mask), _mm_set_epi32(value, 0, 0, 0)); - } - - inline UINT8 get_a() - { - return _mm_extract_epi16(m_value, 6) & 0xff; - } - - inline UINT16 get_a32() + inline rgbaint_t& operator+=(const INT32 other) { - return _mm_extract_epi16(m_value, 6); - } - - inline void and_imm_rgba(const INT32 a, const INT32 r, const INT32 g, const INT32 b) - { - m_value = _mm_and_si128(m_value, _mm_set_epi32(a, r, g, b)); + m_value = _mm_add_epi32(m_value, _mm_set1_epi32(other)); + return *this; } - inline void add_imm_rgba(const INT32 a, const INT32 r, const INT32 g, const INT32 b) + inline rgbaint_t& operator-=(const rgbaint_t& other) { - __m128i temp = _mm_set_epi32(a, r, g, b); - m_value = _mm_add_epi32(m_value, temp); + m_value = _mm_sub_epi32(m_value, other.m_value); + return *this; } - inline void sub_imm_rgba(const INT32 a, const INT32 r, const INT32 g, const INT32 b) + inline rgbaint_t& operator*=(const rgbaint_t& other) { - __m128i temp = _mm_set_epi32(a, r, g, b); - m_value = _mm_sub_epi32(m_value, temp); + m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(_mm_mul_epu32(m_value, other.m_value), _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(other.m_value, 4)), _MM_SHUFFLE(0, 0, 2, 0))); + return *this; } - inline void subr_imm_rgba(const INT32 a, const INT32 r, const INT32 g, const INT32 b) + inline rgbaint_t& operator*=(const INT32 other) { - __m128i temp = _mm_set_epi32(a, r, g, b); - m_value = _mm_sub_epi32(temp, m_value); + const __m128i immv = _mm_set1_epi32(other); + m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(_mm_mul_epu32(m_value, immv), _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(_mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(immv, 4)), _MM_SHUFFLE(0, 0, 2, 0))); + return *this; } - inline void mul_imm_rgba(const INT32 a, const INT32 r, const INT32 g, const INT32 b) + inline rgbaint_t& operator>>=(const INT32 shift) { - __m128i immv = _mm_set_epi32(a, r, g, b); - __m128i tmp1 = _mm_mul_epu32(m_value, immv); - __m128i tmp2 = _mm_mul_epu32(_mm_srli_si128(m_value, 4), _mm_srli_si128(immv, 4)); - m_value = _mm_unpacklo_epi32(_mm_shuffle_epi32(tmp1, _MM_SHUFFLE(0, 0, 2, 0)), _mm_shuffle_epi32(tmp2, _MM_SHUFFLE(0, 0, 2, 0))); + m_value = _mm_srai_epi32(m_value, shift); + return *this; } inline void merge_alpha(rgbaint_t& alpha) @@ -437,6 +397,11 @@ public: m_value = _mm_insert_epi16(m_value, _mm_extract_epi16(alpha.m_value, 7), 7); m_value = _mm_insert_epi16(m_value, _mm_extract_epi16(alpha.m_value, 6), 6); } + + static UINT32 bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v); + +protected: + __m128i m_value; }; #endif /* __RGBSSE__ */ diff --git a/src/emu/video/vooddefs.h b/src/emu/video/vooddefs.h index 369eabc4572..17264ad8bc5 100644 --- a/src/emu/video/vooddefs.h +++ b/src/emu/video/vooddefs.h @@ -2199,33 +2199,33 @@ while (0) /* use SSE on 64-bit implementations, where it can be assumed */ #if (!defined(MAME_DEBUG) || defined(__OPTIMIZE__)) && (defined(__SSE2__) || defined(_MSC_VER)) && defined(PTR64) +// NB: This code should no longer be SSE2-specific now that it uses rgbaint_t, consider removing the #define and the #else case. INLINE UINT32 clampARGB(INT32 iterr, INT32 iterg, INT32 iterb, INT32 itera, UINT32 FBZCP) { rgb_t result; - rgbaint_t colorint((INT16) (itera>>12), (INT16) (iterr>>12), (INT16) (iterg>>12), (INT16) (iterb>>12)); + rgbaint_t colorint((INT32) (itera>>12), (INT32) (iterr>>12), (INT32) (iterg>>12), (INT32) (iterb>>12)); if (FBZCP_RGBZW_CLAMP(FBZCP) == 0) { //r &= 0xfff; - __m128i temp = _mm_set1_epi16(0xfff); - colorint.set(_mm_and_si128(colorint.get(), temp)); + colorint.and_imm(0xfff); //if (r == 0xfff) - temp = _mm_cmpeq_epi16(colorint.get(), temp); + rgbaint_t temp(colorint); + temp.cmpeq_imm(0xfff); // result.rgb.r = 0; - colorint.set(_mm_andnot_si128(temp, colorint.get())); + temp.xor_imm(0xffffffff); + colorint.and_reg(temp); //else if (r == 0x100) - temp = _mm_set1_epi16(0x100); - temp = _mm_cmpeq_epi16(colorint.get(), temp); + temp.set(colorint); + temp.cmpeq_imm(0x100); // result.rgb.r = 0xff; - colorint.set(_mm_or_si128(colorint.get(), temp)); - result = colorint.to_rgba(); + return colorint.to_rgba(); } else { - result = colorint.to_rgba_clamp(); + return colorint.to_rgba_clamp(); } - return result; } #else @@ -2841,19 +2841,19 @@ INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, INT32 x, const UINT8 *d { default: /* reserved */ case 0: /* AZERO */ - srcScale.set_rgba(srcAlphaScale, 0, 0, 0); + srcScale.set(srcAlphaScale, 0, 0, 0); //(RR) = (GG) = (BB) = 0; break; case 1: /* ASRC_ALPHA */ - srcScale.set_rgba(srcAlphaScale, sa, sa, sa); + srcScale.set(srcAlphaScale, sa, sa, sa); //(RR) = (sr * (sa + 1)) >> 8; //(GG) = (sg * (sa + 1)) >> 8; //(BB) = (sb * (sa + 1)) >> 8; break; case 2: /* A_COLOR */ - srcScale.set_rgba(srcAlphaScale-1, dr, dg, db); + srcScale.set(srcAlphaScale-1, dr, dg, db); srcScale.add_imm(1); //(RR) = (sr * (dr + 1)) >> 8; //(GG) = (sg * (dg + 1)) >> 8; @@ -2862,26 +2862,26 @@ INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, INT32 x, const UINT8 *d case 3: /* ADST_ALPHA */ ta = da + 1; - srcScale.set_rgba(srcAlphaScale, ta, ta, ta); + srcScale.set(srcAlphaScale, ta, ta, ta); //(RR) = (sr * (da + 1)) >> 8; //(GG) = (sg * (da + 1)) >> 8; //(BB) = (sb * (da + 1)) >> 8; break; case 4: /* AONE */ - srcScale.set_rgba(srcAlphaScale, 256, 256, 256); + srcScale.set(srcAlphaScale, 256, 256, 256); break; case 5: /* AOMSRC_ALPHA */ ta = (0x100 - sa); - srcScale.set_rgba(srcAlphaScale, ta, ta, ta); + srcScale.set(srcAlphaScale, ta, ta, ta); //(RR) = (sr * (0x100 - sa)) >> 8; //(GG) = (sg * (0x100 - sa)) >> 8; //(BB) = (sb * (0x100 - sa)) >> 8; break; case 6: /* AOM_COLOR */ - srcScale.set_rgba(srcAlphaScale, (0x100 - dr), (0x100 - dg), (0x100 - db)); + srcScale.set(srcAlphaScale, (0x100 - dr), (0x100 - dg), (0x100 - db)); //(RR) = (sr * (0x100 - dr)) >> 8; //(GG) = (sg * (0x100 - dg)) >> 8; //(BB) = (sb * (0x100 - db)) >> 8; @@ -2889,7 +2889,7 @@ INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, INT32 x, const UINT8 *d case 7: /* AOMDST_ALPHA */ ta = (0x100 - da); - srcScale.set_rgba(srcAlphaScale, ta, ta, ta); + srcScale.set(srcAlphaScale, ta, ta, ta); //(RR) = (sr * (0x100 - da)) >> 8; //(GG) = (sg * (0x100 - da)) >> 8; //(BB) = (sb * (0x100 - da)) >> 8; @@ -2897,7 +2897,7 @@ INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, INT32 x, const UINT8 *d case 15: /* ASATURATE */ ta = (sa < (0x100 - da)) ? sa : (0x100 - da); - srcScale.set_rgba(srcAlphaScale, ta, ta, ta); + srcScale.set(srcAlphaScale, ta, ta, ta); //(RR) = (sr * (ta + 1)) >> 8; //(GG) = (sg * (ta + 1)) >> 8; //(BB) = (sb * (ta + 1)) >> 8; @@ -2915,11 +2915,11 @@ INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, INT32 x, const UINT8 *d { default: /* reserved */ case 0: /* AZERO */ - destScale.set_rgba(destAlphaScale, 0, 0, 0); + destScale.set(destAlphaScale, 0, 0, 0); break; case 1: /* ASRC_ALPHA */ - destScale.set_rgba(destAlphaScale, sa, sa, sa); + destScale.set(destAlphaScale, sa, sa, sa); destScale.add_imm(1); //(RR) += (dr * (sa + 1)) >> 8; //(GG) += (dg * (sa + 1)) >> 8; @@ -2927,7 +2927,7 @@ INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, INT32 x, const UINT8 *d break; case 2: /* A_COLOR */ - destScale.set_rgb((rgb_t) (((destAlphaScale-1)<<24) | (color.u & 0x00ffffff))); + destScale.set((rgb_t) (((destAlphaScale-1)<<24) | (color.u & 0x00ffffff))); destScale.add_imm(1); //(RR) += (dr * (sr + 1)) >> 8; //(GG) += (dg * (sg + 1)) >> 8; @@ -2936,14 +2936,14 @@ INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, INT32 x, const UINT8 *d case 3: /* ADST_ALPHA */ ta = da + 1; - destScale.set_rgba(destAlphaScale, ta, ta, ta); + destScale.set(destAlphaScale, ta, ta, ta); //(RR) += (dr * (da + 1)) >> 8; //(GG) += (dg * (da + 1)) >> 8; //(BB) += (db * (da + 1)) >> 8; break; case 4: /* AONE */ - destScale.set_rgba(destAlphaScale, 256, 256, 256); + destScale.set(destAlphaScale, 256, 256, 256); //(RR) += dr; //(GG) += dg; //(BB) += db; @@ -2951,14 +2951,14 @@ INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, INT32 x, const UINT8 *d case 5: /* AOMSRC_ALPHA */ ta = (0x100 - sa); - destScale.set_rgba(destAlphaScale, ta, ta, ta); + destScale.set(destAlphaScale, ta, ta, ta); //(RR) += (dr * (0x100 - sa)) >> 8; //(GG) += (dg * (0x100 - sa)) >> 8; //(BB) += (db * (0x100 - sa)) >> 8; break; case 6: /* AOM_COLOR */ - destScale.set_rgba(destAlphaScale, (0x100 - color.rgb.r), (0x100 - color.rgb.g), (0x100 - color.rgb.b)); + destScale.set(destAlphaScale, (0x100 - color.rgb.r), (0x100 - color.rgb.g), (0x100 - color.rgb.b)); //(RR) += (dr * (0x100 - sr)) >> 8; //(GG) += (dg * (0x100 - sg)) >> 8; //(BB) += (db * (0x100 - sb)) >> 8; @@ -2966,14 +2966,14 @@ INLINE void alphaBlend(UINT32 FBZMODE, UINT32 ALPHAMODE, INT32 x, const UINT8 *d case 7: /* AOMDST_ALPHA */ ta = (0x100 - da); - destScale.set_rgba(destAlphaScale, ta, ta, ta); + destScale.set(destAlphaScale, ta, ta, ta); //(RR) += (dr * (0x100 - da)) >> 8; //(GG) += (dg * (0x100 - da)) >> 8; //(BB) += (db * (0x100 - da)) >> 8; break; case 15: /* A_COLORBEFOREFOG */ - destScale.set_rgb((rgb_t) (((destAlphaScale-1)<<24) | (preFog.u & 0x00ffffff))); + destScale.set((rgb_t) (((destAlphaScale-1)<<24) | (preFog.u & 0x00ffffff))); destScale.add_imm(1); //(RR) += (dr * (prefogr + 1)) >> 8; //(GG) += (dg * (prefogg + 1)) >> 8; @@ -3124,7 +3124,7 @@ INLINE void applyFogging(voodoo_state *v, UINT32 fogModeReg, UINT32 fbzCpReg, I rgbaint_t tmpB((rgb_t) color.u); if (FOGMODE_FOG_CONSTANT(fogModeReg)) { - tmpA.set_rgb((rgb_t) fogColorLocal.u); + tmpA.set((rgb_t) fogColorLocal.u); /* if fog_mult is 0, we add this to the original color */ if (FOGMODE_FOG_MULT(fogModeReg) == 0) { @@ -3149,7 +3149,7 @@ INLINE void applyFogging(voodoo_state *v, UINT32 fogModeReg, UINT32 fbzCpReg, I fogColorLocal.u = 0; //fr = fg = fb = 0; - tmpA.set_rgb((rgb_t) fogColorLocal.u); + tmpA.set((rgb_t) fogColorLocal.u); /* if fog_mult is zero, we subtract the incoming color */ if (!FOGMODE_FOG_MULT(fogModeReg)) @@ -4296,7 +4296,7 @@ INLINE bool combineColor(voodoo_state *VV, stats_block *STATS, UINT32 FBZCOLORPA if (FBZCP_CCA_ZERO_OTHER(FBZCOLORPATH)) c_other.u &= 0x00ffffff; - tmpA.set_rgb((rgb_t) c_other.u); + tmpA.set((rgb_t) c_other.u); /* subtract a/c_local */ if (FBZCP_CC_SUB_CLOCAL(FBZCOLORPATH) || (FBZCP_CCA_SUB_CLOCAL(FBZCOLORPATH))) @@ -4309,7 +4309,7 @@ INLINE bool combineColor(voodoo_state *VV, stats_block *STATS, UINT32 FBZCOLORPA if (!FBZCP_CCA_SUB_CLOCAL(FBZCOLORPATH)) sub_val.u &= 0x00ffffff; - tmpB.set_rgb((rgb_t) sub_val.u); + tmpB.set((rgb_t) sub_val.u); tmpA.sub(tmpB); } @@ -4404,9 +4404,9 @@ INLINE bool combineColor(voodoo_state *VV, stats_block *STATS, UINT32 FBZCOLORPA //CLAMP(color.rgb.r, 0x00, 0xff); //CLAMP(color.rgb.g, 0x00, 0xff); //CLAMP(color.rgb.b, 0x00, 0xff); - tmpB.set_rgb((rgb_t) c_local.u); + tmpB.set((rgb_t) c_local.u); tmpB.add_imm(1); - tmpC.set_rgb((rgb_t) add_val.u); + tmpC.set((rgb_t) add_val.u); tmpA.scale_add_and_clamp(tmpB, tmpC); color.u = tmpA.to_rgba(); @@ -4826,7 +4826,7 @@ INLINE UINT32 combineTexture(tmu_state *TT, const UINT32 TEXMODE, rgb_union c_lo if (TEXMODE_TCA_ZERO_OTHER(TEXMODE)) c_other.u &= 0x00ffffff; - tmpA.set_rgb((rgb_t) c_other.u); + tmpA.set((rgb_t) c_other.u); if (TEXMODE_TC_SUB_CLOCAL(TEXMODE) || TEXMODE_TCA_SUB_CLOCAL(TEXMODE)) { @@ -4839,7 +4839,7 @@ INLINE UINT32 combineTexture(tmu_state *TT, const UINT32 TEXMODE, rgb_union c_lo if (!TEXMODE_TCA_SUB_CLOCAL(TEXMODE)) sub_val.u &= 0x00ffffff; - tmpB.set_rgb((rgb_t) sub_val.u); + tmpB.set((rgb_t) sub_val.u); tmpA.sub(tmpB); } @@ -4960,9 +4960,9 @@ INLINE UINT32 combineTexture(tmu_state *TT, const UINT32 TEXMODE, rgb_union c_lo //result.rgb.g = (tg < 0) ? 0 : (tg > 0xff) ? 0xff : tg; //result.rgb.b = (tb < 0) ? 0 : (tb > 0xff) ? 0xff : tb; //result.rgb.a = (ta < 0) ? 0 : (ta > 0xff) ? 0xff : ta; - tmpB.set_rgb((rgb_t) c_local.u); + tmpB.set((rgb_t) c_local.u); tmpB.add_imm(1); - tmpC.set_rgb((rgb_t) add_val.u); + tmpC.set((rgb_t) add_val.u); tmpA.scale_add_and_clamp(tmpB, tmpC); result = tmpA.to_rgba(); diff --git a/src/mame/drivers/cobra.c b/src/mame/drivers/cobra.c index 8ce29e9fa09..2552f56300b 100644 --- a/src/mame/drivers/cobra.c +++ b/src/mame/drivers/cobra.c @@ -895,7 +895,7 @@ void cobra_renderer::render_texture_scan(INT32 scanline, const extent_t &extent, rgb_t texel10 = texture_fetch(&m_texture_ram[tex_address], iu, iv+1, texture_width, tex_format); rgb_t texel11 = texture_fetch(&m_texture_ram[tex_address], iu+1, iv+1, texture_width, tex_format); - rgb_t texel = rgbint_t::bilinear_filter(texel00, texel01, texel10, texel11, (int)(lerp_u * 255), (int)(lerp_v * 255)); + rgb_t texel = rgbaint_t::bilinear_filter(texel00, texel01, texel10, texel11, (int)(lerp_u * 255), (int)(lerp_v * 255)); #endif diff --git a/src/mame/includes/namcos22.h b/src/mame/includes/namcos22.h index 2840fbc2c1d..61a0830fa96 100644 --- a/src/mame/includes/namcos22.h +++ b/src/mame/includes/namcos22.h @@ -93,9 +93,9 @@ struct namcos22_scenenode struct namcos22_object_data { /* poly / sprites */ - rgbint_t fogcolor; - rgbint_t fadecolor; - rgbint_t polycolor; + rgbaint_t fogcolor; + rgbaint_t fadecolor; + rgbaint_t polycolor; const pen_t *pens; bitmap_rgb32 *destbase; bitmap_ind8 *primap; diff --git a/src/mame/video/gaelco3d.c b/src/mame/video/gaelco3d.c index c5ca6d01aad..f0b45a94ee9 100644 --- a/src/mame/video/gaelco3d.c +++ b/src/mame/video/gaelco3d.c @@ -228,7 +228,7 @@ void gaelco3d_renderer::render_noz_noperspective(INT32 scanline, const extent_t UINT32 rgb01 = palsource[m_texture[(pixeloffs + 1) & endmask]]; UINT32 rgb10 = palsource[m_texture[(pixeloffs + 4096) & endmask]]; UINT32 rgb11 = palsource[m_texture[(pixeloffs + 4097) & endmask]]; - const UINT32 filtered = rgbint_t::bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v); + const UINT32 filtered = rgbaint_t::bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v); dest[x] = (filtered & 0x1f) | ((filtered & 0x1ff800) >> 6); zbuf[x] = zbufval; } @@ -275,7 +275,7 @@ void gaelco3d_renderer::render_normal(INT32 scanline, const extent_t &extent, co UINT32 rgb01 = palsource[m_texture[(pixeloffs + 1) & endmask]]; UINT32 rgb10 = palsource[m_texture[(pixeloffs + 4096) & endmask]]; UINT32 rgb11 = palsource[m_texture[(pixeloffs + 4097) & endmask]]; - const UINT32 filtered = rgbint_t::bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v); + const UINT32 filtered = rgbaint_t::bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v); dest[x] = (filtered & 0x1f) | ((filtered & 0x1ff800) >> 6); zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; } @@ -325,7 +325,7 @@ void gaelco3d_renderer::render_alphablend(INT32 scanline, const extent_t &extent UINT32 rgb01 = palsource[m_texture[(pixeloffs + 1) & endmask]]; UINT32 rgb10 = palsource[m_texture[(pixeloffs + 4096) & endmask]]; UINT32 rgb11 = palsource[m_texture[(pixeloffs + 4097) & endmask]]; - const UINT32 filtered = rgbint_t::bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v) >> 1; + const UINT32 filtered = rgbaint_t::bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v) >> 1; dest[x] = ((filtered & 0x0f) | ((filtered & 0x0f7800) >> 6)) + ((dest[x] >> 1) & 0x3def); zbuf[x] = (zbufval < 0) ? -zbufval : zbufval; } diff --git a/src/mame/video/midzeus.c b/src/mame/video/midzeus.c index 4548a4c4326..da34aa8da44 100644 --- a/src/mame/video/midzeus.c +++ b/src/mame/video/midzeus.c @@ -1309,7 +1309,7 @@ static void render_poly_texture(void *dest, INT32 scanline, const poly_extent *e color1 = ((color1 & 0x7fe0) << 6) | (color1 & 0x1f); color2 = ((color2 & 0x7fe0) << 6) | (color2 & 0x1f); color3 = ((color3 & 0x7fe0) << 6) | (color3 & 0x1f); - rgb_t filtered = rgbint_t::bilinear_filter(color0, color1, color2, color3, curu, curv); + rgb_t filtered = rgbaint_t::bilinear_filter(color0, color1, color2, color3, curu, curv); WAVERAM_WRITEPIX(zeus_renderbase, scanline, x, ((filtered >> 6) & 0x7fe0) | (filtered & 0x1f)); *depthptr = depth; } diff --git a/src/mame/video/midzeus2.c b/src/mame/video/midzeus2.c index bce45585859..db96c9bf8e4 100644 --- a/src/mame/video/midzeus2.c +++ b/src/mame/video/midzeus2.c @@ -1297,7 +1297,7 @@ static void render_poly_8bit(void *dest, INT32 scanline, const poly_extent *exte color1 = ((color1 & 0x7c00) << 9) | ((color1 & 0x3e0) << 6) | ((color1 & 0x1f) << 3); color2 = ((color2 & 0x7c00) << 9) | ((color2 & 0x3e0) << 6) | ((color2 & 0x1f) << 3); color3 = ((color3 & 0x7c00) << 9) | ((color3 & 0x3e0) << 6) | ((color3 & 0x1f) << 3); - rgb_t filtered = rgbint_t::bilinear_filter(color0, color1, color2, color3, curu, curv); + rgb_t filtered = rgbaint_t::bilinear_filter(color0, color1, color2, color3, curu, curv); WAVERAM_WRITEPIX(zeus_renderbase, scanline, x, filtered); *depthptr = depth; } diff --git a/src/mame/video/n64.c b/src/mame/video/n64.c index c5a81ed0d36..f27743f3a52 100644 --- a/src/mame/video/n64.c +++ b/src/mame/video/n64.c @@ -2839,28 +2839,28 @@ void n64_rdp::cmd_fill_rect(UINT32 w1, UINT32 w2) void n64_rdp::cmd_set_fog_color(UINT32 w1, UINT32 w2) { - m_fog_color.set_rgba(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); + m_fog_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); } void n64_rdp::cmd_set_blend_color(UINT32 w1, UINT32 w2) { - m_blend_color.set_rgba(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); + m_blend_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); } void n64_rdp::cmd_set_prim_color(UINT32 w1, UINT32 w2) { m_misc_state.m_min_level = (w1 >> 8) & 0x1f; const UINT8 prim_lod_fraction = w1 & 0xff; - m_prim_lod_fraction.set_rgba(prim_lod_fraction, prim_lod_fraction, prim_lod_fraction, prim_lod_fraction); + m_prim_lod_fraction.set(prim_lod_fraction, prim_lod_fraction, prim_lod_fraction, prim_lod_fraction); - m_prim_color.set_rgba(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); - m_prim_alpha.set_rgba(w2 & 0xff, w2 & 0xff, w2 & 0xff, w2 & 0xff); + m_prim_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); + m_prim_alpha.set(w2 & 0xff, w2 & 0xff, w2 & 0xff, w2 & 0xff); } void n64_rdp::cmd_set_env_color(UINT32 w1, UINT32 w2) { - m_env_color.set_rgba(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); - m_env_alpha.set_rgba(w2 & 0xff, w2 & 0xff, w2 & 0xff, w2 & 0xff); + m_env_color.set(w2 & 0xff, (w2 >> 24) & 0xff, (w2 >> 16) & 0xff, (w2 >> 8) & 0xff); + m_env_alpha.set(w2 & 0xff, w2 & 0xff, w2 & 0xff, w2 & 0xff); } void n64_rdp::cmd_set_combine(UINT32 w1, UINT32 w2) @@ -3060,8 +3060,8 @@ n64_rdp::n64_rdp(n64_state &state) : poly_manager<UINT32, rdp_poly_state, 8, 320 m_tiles[i].num = i; } - m_one.set_rgba(0xff, 0xff, 0xff, 0xff); - m_zero.set_rgba(0, 0, 0, 0); + m_one.set(0xff, 0xff, 0xff, 0xff); + m_zero.set(0, 0, 0, 0); m_tmem = NULL; @@ -3069,7 +3069,7 @@ n64_rdp::n64_rdp(n64_state &state) : poly_manager<UINT32, rdp_poly_state, 8, 320 //memset(m_hidden_bits, 3, 8388608); - m_prim_lod_fraction.set_rgba(0, 0, 0, 0); + m_prim_lod_fraction.set(0, 0, 0, 0); for (INT32 i = 0; i < 256; i++) { diff --git a/src/mame/video/namcos22.c b/src/mame/video/namcos22.c index 3b91dad40f8..8801fa0a10b 100644 --- a/src/mame/video/namcos22.c +++ b/src/mame/video/namcos22.c @@ -83,9 +83,9 @@ void namcos22_renderer::renderscanline_uvi_full(INT32 scanline, const extent_t & int fogfactor = 0xff - extra.fogfactor; int fadefactor = 0xff - extra.fadefactor; int alphafactor = 0xff - m_state.m_poly_translucency; - rgbint_t fogcolor = extra.fogcolor; - rgbint_t fadecolor = extra.fadecolor; - rgbint_t polycolor = extra.polycolor; + rgbaint_t fogcolor = extra.fogcolor; + rgbaint_t fadecolor = extra.fadecolor; + rgbaint_t polycolor = extra.polycolor; int polyfade_enabled = extra.pfade_enabled; int penmask = 0xff; int penshift = 0; @@ -124,7 +124,7 @@ void namcos22_renderer::renderscanline_uvi_full(INT32 scanline, const extent_t & INT32 pen = ttdata[(ttmap[to] << 8) | tt_ayx_to_pixel[ttattr[to] << 8 | (ty << 4 & 0xf0) | (tx & 0xf)]]; // pen = 0x55; // debug: disable textures - rgbint_t rgb(pens[pen >> penshift & penmask]); + rgbaint_t rgb(pens[pen >> penshift & penmask]); // apply shading before fog INT32 shade = i*ooz; @@ -161,10 +161,10 @@ void namcos22_renderer::renderscanline_uvi_full(INT32 scanline, const extent_t & if (alphafactor != 0xff) { - rgb.blend(rgbint_t(dest[x]), alphafactor); + rgb.blend(rgbaint_t(dest[x]), alphafactor); } - dest[x] = rgb.to_rgb(); + dest[x] = rgb.to_rgba(); primap[x] |= prioverchar; u += du; @@ -184,7 +184,7 @@ void namcos22_renderer::renderscanline_uvi_full(INT32 scanline, const extent_t & int pen = ttdata[(ttmap[to] << 8) | tt_ayx_to_pixel[ttattr[to] << 8 | (ty << 4 & 0xf0) | (tx & 0xf)]]; // pen = 0x55; // debug: disable textures - rgbint_t rgb(pens[pen >> penshift & penmask]); + rgbaint_t rgb(pens[pen >> penshift & penmask]); // per-z distance fogging if (zfog_enabled) @@ -213,7 +213,7 @@ void namcos22_renderer::renderscanline_uvi_full(INT32 scanline, const extent_t & rgb.scale_and_clamp(polycolor); } - dest[x] = rgb.to_rgb(); + dest[x] = rgb.to_rgba(); primap[x] |= prioverchar; u += du; @@ -235,8 +235,8 @@ void namcos22_renderer::renderscanline_sprite(INT32 scanline, const extent_t &ex int alphafactor = extra.alpha; int fogfactor = 0xff - extra.fogfactor; int fadefactor = 0xff - extra.fadefactor; - rgbint_t fogcolor(extra.fogcolor); - rgbint_t fadecolor(extra.fadecolor); + rgbaint_t fogcolor(extra.fogcolor); + rgbaint_t fadecolor(extra.fadecolor); UINT8 *source = (UINT8 *)extra.source + y_index * extra.line_modulo; UINT32 *dest = &extra.destbase->pix32(scanline); UINT8 *primap = &extra.primap->pix8(scanline); @@ -246,7 +246,7 @@ void namcos22_renderer::renderscanline_sprite(INT32 scanline, const extent_t &ex int pen = source[(int)x_index]; if (pen != 0xff) { - rgbint_t rgb(pal[pen]); + rgbaint_t rgb(pal[pen]); if (fogfactor != 0xff) { @@ -260,10 +260,10 @@ void namcos22_renderer::renderscanline_sprite(INT32 scanline, const extent_t &ex if (alphafactor != 0xff) { - rgb.blend(rgbint_t(dest[x]), alphafactor); + rgb.blend(rgbaint_t(dest[x]), alphafactor); } - dest[x] = rgb.to_rgb(); + dest[x] = rgb.to_rgba(); primap[x] |= prioverchar; } x_index += dx; @@ -365,12 +365,12 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit if (m_state.m_mixer_flags & 1) { extra.fadefactor = m_state.m_screen_fade_factor; - extra.fadecolor.set_rgb(m_state.m_screen_fade_r, m_state.m_screen_fade_g, m_state.m_screen_fade_b); + extra.fadecolor.set(0, m_state.m_screen_fade_r, m_state.m_screen_fade_g, m_state.m_screen_fade_b); } // poly fade extra.pfade_enabled = m_state.m_poly_fade_enabled; - extra.polycolor.set_rgb(m_state.m_poly_fade_r, m_state.m_poly_fade_g, m_state.m_poly_fade_b); + extra.polycolor.set(0, m_state.m_poly_fade_r, m_state.m_poly_fade_g, m_state.m_poly_fade_b); /* poly fog (not completely accurate yet) @@ -441,7 +441,7 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit if (nthword(m_state.m_czattr, 4) & (4 << (cztype * 4))) { int delta = (INT16)nthword(m_state.m_czattr, cztype); - extra.fogcolor.set_rgb(m_state.m_fog_r, m_state.m_fog_g, m_state.m_fog_b); + extra.fogcolor.set(0, m_state.m_fog_r, m_state.m_fog_g, m_state.m_fog_b); if (direct) { int cz = ((flags & 0x1fff00) + cz_adjust) >> 8; @@ -471,7 +471,7 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit if (m_state.m_mixer_flags & 1) { extra.pfade_enabled = m_state.m_poly_fade_enabled; - extra.polycolor.set_rgb(m_state.m_poly_fade_r, m_state.m_poly_fade_g, m_state.m_poly_fade_b); + extra.polycolor.set(0, m_state.m_poly_fade_r, m_state.m_poly_fade_g, m_state.m_poly_fade_b); } // poly fog @@ -479,7 +479,7 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit { int cztype = flags & 3; int czcolor = cztype & nthbyte(&m_state.m_fog_colormask, cztype); - extra.fogcolor.set_rgb(m_state.m_fog_r_per_cztype[czcolor], m_state.m_fog_g_per_cztype[czcolor], m_state.m_fog_b_per_cztype[czcolor]); + extra.fogcolor.set(0, m_state.m_fog_r_per_cztype[czcolor], m_state.m_fog_g_per_cztype[czcolor], m_state.m_fog_b_per_cztype[czcolor]); if (direct) { @@ -564,7 +564,7 @@ void namcos22_renderer::poly3d_drawsprite( if (m_state.m_mixer_flags & 2) { extra.fadefactor = m_state.m_screen_fade_factor; - extra.fadecolor.set_rgb(m_state.m_screen_fade_r, m_state.m_screen_fade_g, m_state.m_screen_fade_b); + extra.fadecolor.set(0, m_state.m_screen_fade_r, m_state.m_screen_fade_g, m_state.m_screen_fade_b); } // fog, 0xfe is a special case for sprite priority over textlayer @@ -572,7 +572,7 @@ void namcos22_renderer::poly3d_drawsprite( { // or does it fetch from poly-cz ram? that will break timecris though extra.fogfactor = cz_factor; - extra.fogcolor.set_rgb(m_state.m_fog_r, m_state.m_fog_g, m_state.m_fog_b); + extra.fogcolor.set(0, m_state.m_fog_r, m_state.m_fog_g, m_state.m_fog_b); } render_triangle_fan(m_cliprect, render_delegate(FUNC(namcos22_renderer::renderscanline_sprite), this), 2, 4, vert); @@ -1892,7 +1892,7 @@ void namcos22_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb3 // prepare fader bool fade_enabled = (m_mixer_flags & 2) && m_screen_fade_factor; int fade_factor = 0xff - m_screen_fade_factor; - rgbint_t fade_color(m_screen_fade_r, m_screen_fade_g, m_screen_fade_b); + rgbaint_t fade_color(0, m_screen_fade_r, m_screen_fade_g, m_screen_fade_b); // mix textlayer with poly/sprites for (int y = cliprect.min_y; y <= cliprect.max_y; y++) @@ -1905,7 +1905,7 @@ void namcos22_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb3 // skip if transparent or under poly/sprite if (pri[x] == prival) { - rgbint_t rgb(pens[src[x]]); + rgbaint_t rgb(pens[src[x]]); // apply alpha if (alpha_factor) @@ -1913,7 +1913,7 @@ void namcos22_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb3 UINT8 pen = src[x] & 0xff; if ((pen & 0xf) == alpha_mask || pen == alpha_check12 || pen == alpha_check13) { - rgb.blend(rgbint_t(dest[x]), 0xff - alpha_factor); + rgb.blend(rgbaint_t(dest[x]), 0xff - alpha_factor); } } @@ -1921,11 +1921,11 @@ void namcos22_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb3 if (spot_enabled) { UINT8 pen = src[x] & 0xff; - rgbint_t mix(dest[x]); + rgbaint_t mix(dest[x]); if (spot_flags & 8) { // mix with per-channel brightness - rgbint_t shade((0xff - (m_spotram[pen << 2 | 1] & 0xff)) << 2, (0xff - (m_spotram[pen << 2 | 2] & 0xff)) << 2, (0xff - (m_spotram[pen << 2 | 3] & 0xff)) << 2); + rgbaint_t shade(0, (0xff - (m_spotram[pen << 2 | 1] & 0xff)) << 2, (0xff - (m_spotram[pen << 2 | 2] & 0xff)) << 2, (0xff - (m_spotram[pen << 2 | 3] & 0xff)) << 2); mix.scale_and_clamp(shade); } @@ -1941,7 +1941,7 @@ void namcos22_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb3 rgb.blend(fade_color, fade_factor); } - dest[x] = rgb.to_rgb(); + dest[x] = rgb.to_rgba(); } } } @@ -1958,11 +1958,11 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 bool fade_enabled = m_mixer_flags & 2 && m_poly_fade_enabled; bool shadow_enabled = (m_mixer_flags & 0x100) != 0; // ? (ridgerac is the only game not using shadow) - rgbint_t fade_color(m_poly_fade_r, m_poly_fade_g, m_poly_fade_b); - rgbint_t rgb_mix[3] = { - rgbint_t(nthbyte(m_mixer, 0x08), nthbyte(m_mixer, 0x09), nthbyte(m_mixer, 0x0a)), // pen c - rgbint_t(nthbyte(m_mixer, 0x0b), nthbyte(m_mixer, 0x0c), nthbyte(m_mixer, 0x0d)), // pen d - rgbint_t(nthbyte(m_mixer, 0x0e), nthbyte(m_mixer, 0x0f), nthbyte(m_mixer, 0x10)) // pen e + rgbaint_t fade_color(0, m_poly_fade_r, m_poly_fade_g, m_poly_fade_b); + rgbaint_t rgb_mix[3] = { + rgbaint_t(0, nthbyte(m_mixer, 0x08), nthbyte(m_mixer, 0x09), nthbyte(m_mixer, 0x0a)), // pen c + rgbaint_t(0, nthbyte(m_mixer, 0x0b), nthbyte(m_mixer, 0x0c), nthbyte(m_mixer, 0x0d)), // pen d + rgbaint_t(0, nthbyte(m_mixer, 0x0e), nthbyte(m_mixer, 0x0f), nthbyte(m_mixer, 0x10)) // pen e }; // mix textlayer with poly/sprites @@ -1977,7 +1977,7 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 if (pri[x] == 2) { // apply shadow - rgbint_t rgb; + rgbaint_t rgb; switch (src[x] & 0xff) { case 0xfc: @@ -1985,13 +1985,13 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 case 0xfe: if (shadow_enabled) { - rgb.set_rgb(dest[x]); + rgb.set(dest[x]); rgb.scale_and_clamp(rgb_mix[(src[x] & 0xf) - 0xc]); break; } // (fall through) default: - rgb.set_rgb(pens[src[x]]); + rgb.set(pens[src[x]]); break; } @@ -2004,7 +2004,7 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 // eg. a rr-gg-bb of 3f-7f-00 will fade to ff-ff-00 and not ff-ff-ff // seen in victlapw attract mode - dest[x] = rgb.to_rgb(); + dest[x] = rgb.to_rgba(); } } } @@ -2285,13 +2285,13 @@ UINT32 namcos22_state::screen_update_namcos22s(screen_device &screen, bitmap_rgb screen.priority().fill(0, cliprect); // background color - rgbint_t bg_color(nthbyte(m_mixer, 0x08), nthbyte(m_mixer, 0x09), nthbyte(m_mixer, 0x0a)); + rgbaint_t bg_color(0, nthbyte(m_mixer, 0x08), nthbyte(m_mixer, 0x09), nthbyte(m_mixer, 0x0a)); if (m_mixer_flags & 1 && m_screen_fade_factor) { - rgbint_t fade_color(m_screen_fade_r, m_screen_fade_g, m_screen_fade_b); + rgbaint_t fade_color(0, m_screen_fade_r, m_screen_fade_g, m_screen_fade_b); bg_color.blend(fade_color, 0xff - m_screen_fade_factor); } - bitmap.fill(bg_color.to_rgb(), cliprect); + bitmap.fill(bg_color.to_rgba(), cliprect); // layers UINT8 layer = nthbyte(m_mixer, 0x1f); diff --git a/src/mame/video/rdpblend.c b/src/mame/video/rdpblend.c index a431a985b74..f71cda4599f 100644 --- a/src/mame/video/rdpblend.c +++ b/src/mame/video/rdpblend.c @@ -124,7 +124,7 @@ bool n64_blender_t::cycle1_noblend_noacvg_dither(color_t& blended_pixel, int dit index.shl_imm(3); index.or_imm(dith); index.and_imm(0x7ff); - blended_pixel.set_rgba(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); + blended_pixel.set(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); return true; } @@ -155,7 +155,7 @@ bool n64_blender_t::cycle1_noblend_acvg_dither(color_t& blended_pixel, int dith, index.shl_imm(3); index.or_imm(dith); index.and_imm(0x7ff); - blended_pixel.set_rgba(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); + blended_pixel.set(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); return true; } @@ -191,7 +191,7 @@ bool n64_blender_t::cycle1_blend_noacvg_dither(color_t& blended_pixel, int dith, rgb.shl_imm(3); rgb.or_imm(dith); rgb.and_imm(0x7ff); - blended_pixel.set_rgba(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); + blended_pixel.set(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); return true; } @@ -225,7 +225,7 @@ bool n64_blender_t::cycle1_blend_acvg_dither(color_t& blended_pixel, int dith, i rgb.shl_imm(3); rgb.or_imm(dith); rgb.and_imm(0x7ff); - blended_pixel.set_rgba(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); + blended_pixel.set(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); return true; } @@ -267,7 +267,7 @@ bool n64_blender_t::cycle2_noblend_noacvg_dither(color_t& blended_pixel, int dit index.shl_imm(3); index.or_imm(dith); index.and_imm(0x7ff); - blended_pixel.set_rgba(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); + blended_pixel.set(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); return true; } @@ -307,7 +307,7 @@ bool n64_blender_t::cycle2_noblend_acvg_dither(color_t& blended_pixel, int dith, index.shl_imm(3); index.or_imm(dith); index.and_imm(0x7ff); - blended_pixel.set_rgba(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); + blended_pixel.set(0, m_color_dither[index.get_r32()], m_color_dither[index.get_g32()], m_color_dither[index.get_b32()]); return true; } @@ -351,7 +351,7 @@ bool n64_blender_t::cycle2_blend_noacvg_dither(color_t& blended_pixel, int dith, rgb.shl_imm(3); rgb.or_imm(dith); rgb.and_imm(0x7ff); - blended_pixel.set_rgba(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); + blended_pixel.set(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); return true; } @@ -393,7 +393,7 @@ bool n64_blender_t::cycle2_blend_acvg_dither(color_t& blended_pixel, int dith, i rgb.shl_imm(3); rgb.or_imm(dith); rgb.and_imm(0x7ff); - blended_pixel.set_rgba(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); + blended_pixel.set(0, m_color_dither[rgb.get_r32()], m_color_dither[rgb.get_g32()], m_color_dither[rgb.get_b32()]); return true; } @@ -444,7 +444,7 @@ void n64_blender_t::blend_pipe(const int cycle, const int special, color_t& out, } else { - temp.set_rgba(0, 0xff, 0xff, 0xff); + temp.set(0, 0xff, 0xff, 0xff); } } diff --git a/src/mame/video/rdpspn16.c b/src/mame/video/rdpspn16.c index 6498da54164..dab36695736 100644 --- a/src/mame/video/rdpspn16.c +++ b/src/mame/video/rdpspn16.c @@ -82,9 +82,10 @@ void n64_rdp::render_spans(INT32 start, INT32 end, INT32 tilenum, bool flip, ext void n64_rdp::rgbaz_clip(INT32 sr, INT32 sg, INT32 sb, INT32 sa, INT32* sz, rdp_span_aux* userdata) { - userdata->m_shade_color.clamp_and_clear(rgbaint_t(sa, sr, sg, sb), 0xfffffe00); + userdata->m_shade_color.set(sa, sr, sg, sb); + userdata->m_shade_color.clamp_and_clear(0xfffffe00); UINT32 a = userdata->m_shade_color.get_a(); - userdata->m_shade_alpha.set_rgba(a, a, a, a); + userdata->m_shade_alpha.set(a, a, a, a); INT32 zanded = (*sz) & 0x60000; @@ -235,7 +236,7 @@ inline void n64_rdp::read_pixel(UINT32 curpixel, rdp_span_aux* userdata, const r { const UINT16 fword = RREADIDX16((object.m_misc_state.m_fb_address >> 1) + curpixel); - userdata->m_memory_color.set_rgba(0, GETHICOL(fword), GETMEDCOL(fword), GETLOWCOL(fword)); + userdata->m_memory_color.set(0, GETHICOL(fword), GETMEDCOL(fword), GETLOWCOL(fword)); if (object.m_other_modes.image_read_en) { UINT8 hbyte = HREADADDR8((object.m_misc_state.m_fb_address >> 1) + curpixel); @@ -251,7 +252,7 @@ inline void n64_rdp::read_pixel(UINT32 curpixel, rdp_span_aux* userdata, const r else // 32-bit framebuffer { const UINT32 mem = RREADIDX32((object.m_misc_state.m_fb_address >> 2) + curpixel); - userdata->m_memory_color.set_rgba(0, (mem >> 24) & 0xff, (mem >> 16) & 0xff, (mem >> 8) & 0xff); + userdata->m_memory_color.set(0, (mem >> 24) & 0xff, (mem >> 16) & 0xff, (mem >> 8) & 0xff); if (object.m_other_modes.image_read_en) { userdata->m_memory_color.set_a(mem & 0xff); @@ -430,10 +431,10 @@ void n64_rdp::span_draw_1cycle(INT32 scanline, const extent_t &extent, const rdp ((m_tex_pipe).*(m_tex_pipe.m_cycle[cycle0]))(&userdata->m_texel0_color, &userdata->m_texel0_color, sss, sst, tilenum, 0, userdata, object); UINT32 t0a = userdata->m_texel0_color.get_a(); - userdata->m_texel0_alpha.set_rgba(t0a, t0a, t0a, t0a); + userdata->m_texel0_alpha.set(t0a, t0a, t0a, t0a); const UINT8 noise = rand() << 3; // Not accurate - userdata->m_noise_color.set_rgba(0, noise, noise, noise); + userdata->m_noise_color.set(0, noise, noise, noise); rgbaint_t rgbsub_a(*userdata->m_color_inputs.combiner_rgbsub_a[1]); rgbaint_t rgbsub_b(*userdata->m_color_inputs.combiner_rgbsub_b[1]); @@ -455,7 +456,7 @@ void n64_rdp::span_draw_1cycle(INT32 scanline, const extent_t &extent, const rdp rgbsub_a.add(rgbadd); rgbsub_a.add_imm(0x0080); rgbsub_a.sra_imm(8); - rgbsub_a.clamp_and_clear(rgbsub_a, 0xfffffe00); + rgbsub_a.clamp_and_clear(0xfffffe00); userdata->m_pixel_color = rgbsub_a; @@ -657,12 +658,12 @@ void n64_rdp::span_draw_2cycle(INT32 scanline, const extent_t &extent, const rdp UINT32 t0a = userdata->m_texel0_color.get_a(); UINT32 t1a = userdata->m_texel1_color.get_a(); UINT32 tna = userdata->m_next_texel_color.get_a(); - userdata->m_texel0_alpha.set_rgba(t0a, t0a, t0a, t0a); - userdata->m_texel1_alpha.set_rgba(t1a, t1a, t1a, t1a); - userdata->m_next_texel_alpha.set_rgba(tna, tna, tna, tna); + userdata->m_texel0_alpha.set(t0a, t0a, t0a, t0a); + userdata->m_texel1_alpha.set(t1a, t1a, t1a, t1a); + userdata->m_next_texel_alpha.set(tna, tna, tna, tna); const UINT8 noise = rand() << 3; // Not accurate - userdata->m_noise_color.set_rgba(0, noise, noise, noise); + userdata->m_noise_color.set(0, noise, noise, noise); rgbaint_t rgbsub_a(*userdata->m_color_inputs.combiner_rgbsub_a[0]); rgbaint_t rgbsub_b(*userdata->m_color_inputs.combiner_rgbsub_b[0]); @@ -685,14 +686,14 @@ void n64_rdp::span_draw_2cycle(INT32 scanline, const extent_t &extent, const rdp rgbsub_a.add(rgbadd); rgbsub_a.add_imm(0x0080); rgbsub_a.sra_imm(8); - rgbsub_a.clamp_and_clear(rgbsub_a, 0xfffffe00); + rgbsub_a.clamp_and_clear(0xfffffe00); userdata->m_combined_color.set(rgbsub_a); userdata->m_texel0_color.set(userdata->m_texel1_color); userdata->m_texel1_color.set(userdata->m_next_texel_color); UINT32 ca = userdata->m_combined_color.get_a(); - userdata->m_combined_alpha.set_rgba(ca, ca, ca, ca); + userdata->m_combined_alpha.set(ca, ca, ca, ca); userdata->m_texel0_alpha.set(userdata->m_texel1_alpha); userdata->m_texel1_alpha.set(userdata->m_next_texel_alpha); @@ -716,7 +717,7 @@ void n64_rdp::span_draw_2cycle(INT32 scanline, const extent_t &extent, const rdp rgbsub_a.add(rgbadd); rgbsub_a.add_imm(0x0080); rgbsub_a.sra_imm(8); - rgbsub_a.clamp_and_clear(rgbsub_a, 0xfffffe00); + rgbsub_a.clamp_and_clear(0xfffffe00); userdata->m_pixel_color.set(rgbsub_a); diff --git a/src/mame/video/rdptpipe.c b/src/mame/video/rdptpipe.c index d10f237bb2b..8740451088a 100644 --- a/src/mame/video/rdptpipe.c +++ b/src/mame/video/rdptpipe.c @@ -61,14 +61,14 @@ void n64_texture_pipe_t::set_machine(running_machine &machine) } } - m_st2_add.set_rgba(0, 1, 0, 1); - m_v1.set_rgba(1, 1, 1, 1); + m_st2_add.set(0, 1, 0, 1); + m_v1.set(1, 1, 1, 1); } void n64_texture_pipe_t::mask(rgbaint_t& st, const n64_tile_t& tile) { rgbaint_t wrap(st); - wrap.shr(tile.wrapped_mask); + wrap.sra(tile.wrapped_mask); wrap.and_reg(m_v1); wrap.cmpeq(m_v1); wrap.and_reg(tile.mm); @@ -83,7 +83,7 @@ void n64_texture_pipe_t::mask_coupled(rgbaint_t& sstt, const n64_tile_t& tile) rgbaint_t maskbits(s_mask_bits, s_mask_bits, t_mask_bits, t_mask_bits); rgbaint_t wrap(sstt); - wrap.shr(tile.wrapped_mask); + wrap.sra(tile.wrapped_mask); wrap.and_reg(m_v1); wrap.cmpeq(m_v1); wrap.and_reg(tile.mm); @@ -196,10 +196,10 @@ void n64_texture_pipe_t::cycle_nearest(color_t* TEX, color_t* prev, INT32 SSS, I clamp_cycle_light(st, maxst, tilenum, tile, userdata); mask(st, tile); - UINT32 tbase = tile.tmem + ((tile.line * st.get_b()) & 0x1ff); + UINT32 tbase = tile.tmem + ((tile.line * st.get_b32()) & 0x1ff); rgbaint_t t0; - ((this)->*(m_texel_fetch[index]))(t0, st.get_r(), st.get_b(), tbase, tile.palette, userdata); + ((this)->*(m_texel_fetch[index]))(t0, st.get_r32(), st.get_b32(), tbase, tile.palette, userdata); if (object.m_other_modes.convert_one && cycle) { t0.set(*prev); @@ -208,14 +208,14 @@ void n64_texture_pipe_t::cycle_nearest(color_t* TEX, color_t* prev, INT32 SSS, I t0.sign_extend(0x00000100, 0xffffff00); rgbaint_t k1r(m_rdp->get_k1()); - k1r.mul_imm(t0.get_r()); + k1r.mul_imm(t0.get_r32()); TEX->set(m_rdp->get_k023()); - TEX->mul_imm(t0.get_g()); + TEX->mul_imm(t0.get_g32()); TEX->add(k1r); TEX->add_imm(0x80); TEX->shr_imm(8); - TEX->add_imm(t0.get_b()); + TEX->add_imm(t0.get_b32()); TEX->and_imm(0x1ff); } @@ -229,9 +229,9 @@ void n64_texture_pipe_t::cycle_nearest_lerp(color_t* TEX, color_t* prev, INT32 S clamp_cycle_light(st, maxst, tilenum, tile, userdata); mask(st, tile); - UINT32 tbase = tile.tmem + ((tile.line * st.get_b()) & 0x1ff); + UINT32 tbase = tile.tmem + ((tile.line * st.get_b32()) & 0x1ff); - ((this)->*(m_texel_fetch[index]))(*TEX, st.get_r(), st.get_b(), tbase, tile.palette, userdata); + ((this)->*(m_texel_fetch[index]))(*TEX, st.get_r32(), st.get_b32(), tbase, tile.palette, userdata); } void n64_texture_pipe_t::cycle_linear(color_t* TEX, color_t* prev, INT32 SSS, INT32 SST, UINT32 tilenum, UINT32 cycle, rdp_span_aux* userdata, const rdp_poly_state& object) @@ -253,22 +253,26 @@ void n64_texture_pipe_t::cycle_linear(color_t* TEX, color_t* prev, INT32 SSS, IN mask_coupled(sstt, tile); - const UINT32 tbase = tile.tmem + ((tile.line * st1.get_b()) & 0x1ff); + const UINT32 tbase = tile.tmem + ((tile.line * st1.get_b32()) & 0x1ff); - bool upper = ((stfrac.get_r() + stfrac.get_b()) >= 0x20); + bool upper = ((stfrac.get_r32() + stfrac.get_b32()) >= 0x20); - rgbaint_t invstf(0); + rgbaint_t invstf; if (upper) { invstf.set(stfrac); invstf.subr_imm(0x20); invstf.shl_imm(3); } + else + { + invstf.set(0, 0, 0, 0); + } stfrac.shl_imm(3); rgbaint_t t0; - ((this)->*(m_texel_fetch[index]))(t0, st1.get_r(), st1.get_b(), tbase, tile.palette, userdata); + ((this)->*(m_texel_fetch[index]))(t0, st1.get_r32(), st1.get_b32(), tbase, tile.palette, userdata); if (object.m_other_modes.convert_one && cycle) { t0.set(*prev); @@ -277,14 +281,14 @@ void n64_texture_pipe_t::cycle_linear(color_t* TEX, color_t* prev, INT32 SSS, IN t0.sign_extend(0x00000100, 0xffffff00); rgbaint_t k1r(m_rdp->get_k1()); - k1r.mul_imm(t0.get_r()); + k1r.mul_imm(t0.get_r32()); TEX->set(m_rdp->get_k023()); - TEX->mul_imm(t0.get_g()); + TEX->mul_imm(t0.get_g32()); TEX->add(k1r); TEX->add_imm(0x80); TEX->shr_imm(8); - TEX->add_imm(t0.get_b()); + TEX->add_imm(t0.get_b32()); TEX->and_imm(0x1ff); } @@ -314,34 +318,38 @@ void n64_texture_pipe_t::cycle_linear_lerp(color_t* TEX, color_t* prev, INT32 SS bool upper = ((stfrac.get_r32() + stfrac.get_b32()) >= 0x20); - rgbaint_t invstf(0); + rgbaint_t invstf; if (upper) { invstf.set(stfrac); invstf.subr_imm(0x20); invstf.shl_imm(3); } + else + { + invstf.set(0, 0, 0, 0); + } stfrac.shl_imm(3); - bool center = (stfrac.get_r() == 0x10) && (stfrac.get_b() == 0x10) && object.m_other_modes.mid_texel; + bool center = (stfrac.get_r32() == 0x10) && (stfrac.get_b32() == 0x10) && object.m_other_modes.mid_texel; rgbaint_t t2; - ((this)->*(m_texel_fetch[index]))(*TEX, sstt.get_a(), sstt.get_b(), tbase1, tpal, userdata); - ((this)->*(m_texel_fetch[index]))(t2, sstt.get_r(), sstt.get_g(), tbase2, tpal, userdata); + ((this)->*(m_texel_fetch[index]))(*TEX, sstt.get_a32(), sstt.get_b32(), tbase1, tpal, userdata); + ((this)->*(m_texel_fetch[index]))(t2, sstt.get_r32(), sstt.get_g32(), tbase2, tpal, userdata); if (!center) { if (upper) { rgbaint_t t3; - ((this)->*(m_texel_fetch[index]))(t3, sstt.get_a(), sstt.get_g(), tbase2, tpal, userdata); + ((this)->*(m_texel_fetch[index]))(t3, sstt.get_a32(), sstt.get_g32(), tbase2, tpal, userdata); TEX->sub(t3); t2.sub(t3); - TEX->mul_imm(invstf.get_b()); - t2.mul_imm(invstf.get_r()); + TEX->mul_imm(invstf.get_b32()); + t2.mul_imm(invstf.get_r32()); TEX->add(t2); TEX->add_imm(0x0080); @@ -351,13 +359,13 @@ void n64_texture_pipe_t::cycle_linear_lerp(color_t* TEX, color_t* prev, INT32 SS else { rgbaint_t t0; - ((this)->*(m_texel_fetch[index]))(t0, sstt.get_r(), sstt.get_b(), tbase1, tpal, userdata); + ((this)->*(m_texel_fetch[index]))(t0, sstt.get_r32(), sstt.get_b32(), tbase1, tpal, userdata); TEX->sub(t0); t2.sub(t0); - TEX->mul_imm(stfrac.get_r()); - t2.mul_imm(stfrac.get_b()); + TEX->mul_imm(stfrac.get_r32()); + t2.mul_imm(stfrac.get_b32()); TEX->add(t2); TEX->add_imm(0x80); @@ -368,8 +376,8 @@ void n64_texture_pipe_t::cycle_linear_lerp(color_t* TEX, color_t* prev, INT32 SS else { rgbaint_t t0, t3; - ((this)->*(m_texel_fetch[index]))(t0, sstt.get_r(), sstt.get_b(), tbase1, tpal, userdata); - ((this)->*(m_texel_fetch[index]))(t3, sstt.get_a(), sstt.get_g(), tbase2, tpal, userdata); + ((this)->*(m_texel_fetch[index]))(t0, sstt.get_r32(), sstt.get_b32(), tbase1, tpal, userdata); + ((this)->*(m_texel_fetch[index]))(t3, sstt.get_a32(), sstt.get_g32(), tbase2, tpal, userdata); TEX->add(t0); TEX->add(t2); TEX->add(t3); @@ -396,8 +404,8 @@ void n64_texture_pipe_t::copy(color_t* TEX, INT32 SSS, INT32 SST, UINT32 tilenum mask(st, tile); const UINT32 index = (tile.format << 4) | (tile.size << 2) | ((UINT32) object.m_other_modes.en_tlut << 1) | (UINT32) object.m_other_modes.tlut_type; - const UINT32 tbase = tile.tmem + ((tile.line * st.get_b()) & 0x1ff); - ((this)->*(m_texel_fetch[index]))(*TEX, st.get_r(), st.get_b(), tbase, tile.palette, userdata); + const UINT32 tbase = tile.tmem + ((tile.line * st.get_b32()) & 0x1ff); + ((this)->*(m_texel_fetch[index]))(*TEX, st.get_r32(), st.get_b32(), tbase, tile.palette, userdata); } void n64_texture_pipe_t::lod_1cycle(INT32* sss, INT32* sst, const INT32 s, const INT32 t, const INT32 w, const INT32 dsinc, const INT32 dtinc, const INT32 dwinc, rdp_span_aux* userdata, const rdp_poly_state& object) @@ -464,7 +472,7 @@ void n64_texture_pipe_t::lod_1cycle(INT32* sss, INT32* sst, const INT32 s, const } } - userdata->m_lod_fraction.set_rgba(lod_fraction, lod_fraction, lod_fraction, lod_fraction); + userdata->m_lod_fraction.set(lod_fraction, lod_fraction, lod_fraction, lod_fraction); /* FIXME: ??? if(object.m_other_modes.sharpen_tex_en && magnify) { @@ -537,7 +545,7 @@ void n64_texture_pipe_t::lod_2cycle(INT32* sss, INT32* sst, const INT32 s, const } } - userdata->m_lod_fraction.set_rgba(lod_fraction, lod_fraction, lod_fraction, lod_fraction); + userdata->m_lod_fraction.set(lod_fraction, lod_fraction, lod_fraction, lod_fraction); /* FIXME: ??? if(object.m_other_modes.sharpen_tex_en && magnify) @@ -666,20 +674,20 @@ void n64_texture_pipe_t::calculate_clamp_diffs(UINT32 prim_tile, rdp_span_aux* u { for (INT32 start = 0; start <= 7; start++) { - userdata->m_clamp_diff[start].set_rgba(0, (tiles[start].sh >> 2) - (tiles[start].sl >> 2), 0, (tiles[start].th >> 2) - (tiles[start].tl >> 2)); + userdata->m_clamp_diff[start].set(0, (tiles[start].sh >> 2) - (tiles[start].sl >> 2), 0, (tiles[start].th >> 2) - (tiles[start].tl >> 2)); } } else { const INT32 start = prim_tile; const INT32 end = (prim_tile + 1) & 7; - userdata->m_clamp_diff[start].set_rgba(0, (tiles[start].sh >> 2) - (tiles[start].sl >> 2), 0, (tiles[start].th >> 2) - (tiles[start].tl >> 2)); - userdata->m_clamp_diff[end].set_rgba(0, (tiles[end].sh >> 2) - (tiles[end].sl >> 2), 0, (tiles[end].th >> 2) - (tiles[end].tl >> 2)); + userdata->m_clamp_diff[start].set(0, (tiles[start].sh >> 2) - (tiles[start].sl >> 2), 0, (tiles[start].th >> 2) - (tiles[start].tl >> 2)); + userdata->m_clamp_diff[end].set(0, (tiles[end].sh >> 2) - (tiles[end].sl >> 2), 0, (tiles[end].th >> 2) - (tiles[end].tl >> 2)); } } else//1-cycle or copy { - userdata->m_clamp_diff[prim_tile].set_rgba(0, (tiles[prim_tile].sh >> 2) - (tiles[prim_tile].sl >> 2), 0, (tiles[prim_tile].th >> 2) - (tiles[prim_tile].tl >> 2)); + userdata->m_clamp_diff[prim_tile].set(0, (tiles[prim_tile].sh >> 2) - (tiles[prim_tile].sl >> 2), 0, (tiles[prim_tile].th >> 2) - (tiles[prim_tile].tl >> 2)); } } @@ -698,7 +706,7 @@ void n64_texture_pipe_t::fetch_rgba16_tlut0(rgbaint_t& out, INT32 s, INT32 t, IN #if USE_64K_LUT out.set(m_expand_16to32_table[c]); #else - out.set_rgba((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } @@ -710,7 +718,7 @@ void n64_texture_pipe_t::fetch_rgba16_tlut1(rgbaint_t& out, INT32 s, INT32 t, IN c = ((UINT16*)(userdata->m_tmem + 0x800))[(c >> 8) << 2]; const UINT8 k = (c >> 8) & 0xff; - out.set_rgba(c & 0xff, k, k, k); + out.set(c & 0xff, k, k, k); } void n64_texture_pipe_t::fetch_rgba16_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -722,7 +730,7 @@ void n64_texture_pipe_t::fetch_rgba16_raw(rgbaint_t& out, INT32 s, INT32 t, INT3 #if USE_64K_LUT out.set(m_expand_16to32_table[c]); #else - out.set_rgba((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } @@ -737,7 +745,7 @@ void n64_texture_pipe_t::fetch_rgba32_tlut0(rgbaint_t& out, INT32 s, INT32 t, IN #if USE_64K_LUT out.set(m_expand_16to32_table[c]); #else - out.set_rgba((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } @@ -750,7 +758,7 @@ void n64_texture_pipe_t::fetch_rgba32_tlut1(rgbaint_t& out, INT32 s, INT32 t, IN c = ((UINT16*)(userdata->m_tmem + 0x800))[(c >> 24) << 2]; const UINT8 k = (c >> 8) & 0xff; - out.set_rgba(c & 0xff, k, k, k); + out.set(c & 0xff, k, k, k); } void n64_texture_pipe_t::fetch_rgba32_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -760,7 +768,7 @@ void n64_texture_pipe_t::fetch_rgba32_raw(rgbaint_t& out, INT32 s, INT32 t, INT3 const UINT16 cl = ((UINT16*)userdata->m_tmem)[taddr]; const UINT16 ch = ((UINT16*)userdata->m_tmem)[taddr | 0x400]; - out.set_rgba(ch & 0xff, cl >> 8, cl & 0xff, ch >> 8); + out.set(ch & 0xff, cl >> 8, cl & 0xff, ch >> 8); } void n64_texture_pipe_t::fetch_nop(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) { } @@ -782,7 +790,7 @@ void n64_texture_pipe_t::fetch_yuv(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase u |= ((u & 0x80) << 1); v |= ((v & 0x80) << 1); - out.set_rgba(y, y, u, v); + out.set(y, y, u, v); } void n64_texture_pipe_t::fetch_ci4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -796,7 +804,7 @@ void n64_texture_pipe_t::fetch_ci4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 #if USE_64K_LUT out.set(m_expand_16to32_table[c]); #else - out.set_rgba((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } @@ -809,7 +817,7 @@ void n64_texture_pipe_t::fetch_ci4_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[((tpal << 4) | p) << 2]; const UINT8 k = (c >> 8) & 0xff; - out.set_rgba(c & 0xff, k, k, k); + out.set(c & 0xff, k, k, k); } void n64_texture_pipe_t::fetch_ci4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -820,7 +828,7 @@ void n64_texture_pipe_t::fetch_ci4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 t UINT8 p = (s & 1) ? (tc[taddr] & 0xf) : (tc[taddr] >> 4); p = (tpal << 4) | p; - out.set_rgba(p, p, p, p); + out.set(p, p, p, p); } void n64_texture_pipe_t::fetch_ci8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -834,7 +842,7 @@ void n64_texture_pipe_t::fetch_ci8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 #if USE_64K_LUT out.set(m_expand_16to32_table[c]); #else - out.set_rgba((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } @@ -847,7 +855,7 @@ void n64_texture_pipe_t::fetch_ci8_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[p << 2]; const UINT8 k = (c >> 8) & 0xff; - out.set_rgba(c & 0xff, k, k, k); + out.set(c & 0xff, k, k, k); } void n64_texture_pipe_t::fetch_ci8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -856,7 +864,7 @@ void n64_texture_pipe_t::fetch_ci8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 t const INT32 taddr = (((tbase << 3) + s) ^ sTexAddrSwap8[t & 1]) & 0xfff; const UINT8 p = tc[taddr]; - out.set_rgba(p, p, p, p); + out.set(p, p, p, p); } void n64_texture_pipe_t::fetch_ia4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -870,7 +878,7 @@ void n64_texture_pipe_t::fetch_ia4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 #if USE_64K_LUT out.set(m_expand_16to32_table[c]); #else - out.set_rgba((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } @@ -883,7 +891,7 @@ void n64_texture_pipe_t::fetch_ia4_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[((tpal << 4) | p) << 2]; const UINT8 k = (c >> 8) & 0xff; - out.set_rgba(c & 0xff, k, k, k); + out.set(c & 0xff, k, k, k); } void n64_texture_pipe_t::fetch_ia4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -895,7 +903,7 @@ void n64_texture_pipe_t::fetch_ia4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 t UINT8 i = p & 0xe; i = (i << 4) | (i << 1) | (i >> 2); - out.set_rgba((p & 1) * 0xff, i, i, i); + out.set((p & 1) * 0xff, i, i, i); } void n64_texture_pipe_t::fetch_ia8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -909,7 +917,7 @@ void n64_texture_pipe_t::fetch_ia8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 #if USE_64K_LUT out.set(m_expand_16to32_table[c]); #else - out.set_rgba((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } @@ -922,7 +930,7 @@ void n64_texture_pipe_t::fetch_ia8_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 const UINT16 c = ((UINT16*)(userdata->m_tmem + 0x800))[p << 2]; const UINT8 k = (c >> 8) & 0xff; - out.set_rgba(c & 0xff, k, k, k); + out.set(c & 0xff, k, k, k); } void n64_texture_pipe_t::fetch_ia8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -934,7 +942,7 @@ void n64_texture_pipe_t::fetch_ia8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 t UINT8 i = p & 0xf0; i |= (i >> 4); - out.set_rgba((p << 4) | (p & 0xf), i, i, i); + out.set((p << 4) | (p & 0xf), i, i, i); } void n64_texture_pipe_t::fetch_ia16_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -948,7 +956,7 @@ void n64_texture_pipe_t::fetch_ia16_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT3 #if USE_64K_LUT out.set(m_expand_16to32_table[c]); #else - out.set_rgba((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } @@ -961,7 +969,7 @@ void n64_texture_pipe_t::fetch_ia16_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT3 c = ((UINT16*)(userdata->m_tmem + 0x800))[(c >> 8) << 2]; const UINT8 k = (c >> 8) & 0xff; - out.set_rgba(c & 0xff, k, k, k); + out.set(c & 0xff, k, k, k); } void n64_texture_pipe_t::fetch_ia16_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -971,7 +979,7 @@ void n64_texture_pipe_t::fetch_ia16_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 const UINT16 c = tc[taddr]; const UINT8 i = (c >> 8); - out.set_rgba(c & 0xff, i, i, i); + out.set(c & 0xff, i, i, i); } void n64_texture_pipe_t::fetch_i4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -986,7 +994,7 @@ void n64_texture_pipe_t::fetch_i4_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 #if USE_64K_LUT out.set(m_expand_16to32_table[k]); #else - out.set_rgba((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } @@ -1000,7 +1008,7 @@ void n64_texture_pipe_t::fetch_i4_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 const UINT16 k = ((UINT16*)(userdata->m_tmem + 0x800))[((tpal << 4) | c) << 2]; const UINT8 i = (k >> 8) & 0xff; - out.set_rgba(k & 0xff, i, i, i); + out.set(k & 0xff, i, i, i); } void n64_texture_pipe_t::fetch_i4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -1012,7 +1020,7 @@ void n64_texture_pipe_t::fetch_i4_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tb UINT8 c = ((s & 1)) ? (byteval & 0xf) : ((byteval >> 4) & 0xf); c |= (c << 4); - out.set_rgba(c, c, c, c); + out.set(c, c, c, c); } void n64_texture_pipe_t::fetch_i8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -1026,7 +1034,7 @@ void n64_texture_pipe_t::fetch_i8_tlut0(rgbaint_t& out, INT32 s, INT32 t, INT32 #if USE_64K_LUT out.set(m_expand_16to32_table[k]); #else - out.set_rgba((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); + out.set((c & 1) * 0xff, GET_HI_RGBA16_TMEM(c), GET_MED_RGBA16_TMEM(c), GET_LOW_RGBA16_TMEM(c)); #endif } @@ -1039,7 +1047,7 @@ void n64_texture_pipe_t::fetch_i8_tlut1(rgbaint_t& out, INT32 s, INT32 t, INT32 const UINT16 k = ((UINT16*)(userdata->m_tmem + 0x800))[c << 2]; const UINT8 i = (k >> 8) & 0xff; - out.set_rgba(k & 0xff, i, i, i); + out.set(k & 0xff, i, i, i); } void n64_texture_pipe_t::fetch_i8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tbase, INT32 tpal, rdp_span_aux* userdata) @@ -1049,5 +1057,5 @@ void n64_texture_pipe_t::fetch_i8_raw(rgbaint_t& out, INT32 s, INT32 t, INT32 tb const UINT8 c = tc[taddr]; - out.set_rgba(c, c, c, c); + out.set(c, c, c, c); } diff --git a/src/mame/video/rdptpipe.h b/src/mame/video/rdptpipe.h index 4493eb39aa1..0dbd4fc8030 100644 --- a/src/mame/video/rdptpipe.h +++ b/src/mame/video/rdptpipe.h @@ -27,7 +27,7 @@ class n64_texture_pipe_t n64_texture_pipe_t() { - m_maskbits_table[0] = ~0; + m_maskbits_table[0] = 0x3ff; for(int i = 1; i < 16; i++) { m_maskbits_table[i] = ((UINT16)(0xffff) >> (16 - i)) & 0x3ff; |