summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/video/rgbvmx.h
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2016-07-14 00:50:19 +1000
committer Vas Crabb <vas@vastheman.com>2016-07-14 00:50:19 +1000
commitac7c2ce2d47483396a1825538156866174f21640 (patch)
treefa8e04b01c29e3274136a1d19ca9426d6ce229bf /src/emu/video/rgbvmx.h
parent32873fc1dd2587977b4b2cb31e6dfa6f50a690e1 (diff)
Introduce validity checks for RGB utilities and fix bugs uncovered [Vas Crabb]
* Added several missing functions to rgbgen * Fixed logical shift right in rgbgen * Fixed sra that should be sra_imm in rdptpipe * Added some simple SSE4.1 optimisations in rgbsse * Re-organised rgbsse, rgbvmx and rgbgen to be in more logical order * Fixed return on some modifying operators * Made some more reference parameters const * Removed inline qualifier from a number of methods as it's implied when body is present at declaration * Mark some constructors explicit
Diffstat (limited to 'src/emu/video/rgbvmx.h')
-rw-r--r--src/emu/video/rgbvmx.h186
1 files changed, 93 insertions, 93 deletions
diff --git a/src/emu/video/rgbvmx.h b/src/emu/video/rgbvmx.h
index e034261461e..4aca3ff8fa9 100644
--- a/src/emu/video/rgbvmx.h
+++ b/src/emu/video/rgbvmx.h
@@ -28,15 +28,15 @@ protected:
typedef __vector unsigned int VECU32;
public:
- inline rgbaint_t() { set(0, 0, 0, 0); }
- inline rgbaint_t(UINT32 rgba) { set(rgba); }
- inline rgbaint_t(INT32 a, INT32 r, INT32 g, INT32 b) { set(a, r, g, b); }
- inline rgbaint_t(const rgb_t& rgb) { set(rgb); }
- inline rgbaint_t(VECS32 rgba) : m_value(rgba) { }
+ rgbaint_t() { set(0, 0, 0, 0); }
+ explicit rgbaint_t(UINT32 rgba) { set(rgba); }
+ rgbaint_t(INT32 a, INT32 r, INT32 g, INT32 b) { set(a, r, g, b); }
+ explicit rgbaint_t(const rgb_t& rgb) { set(rgb); }
+ explicit rgbaint_t(VECS32 rgba) : m_value(rgba) { }
- inline void set(rgbaint_t& other) { m_value = other.m_value; }
+ void set(const rgbaint_t& other) { m_value = other.m_value; }
- inline void set(UINT32 rgba)
+ void set(UINT32 rgba)
{
const VECU32 zero = { 0, 0, 0, 0 };
#ifdef __LITTLE_ENDIAN__
@@ -48,7 +48,7 @@ public:
#endif
}
- inline void set(INT32 a, INT32 r, INT32 g, INT32 b)
+ void set(INT32 a, INT32 r, INT32 g, INT32 b)
{
#ifdef __LITTLE_ENDIAN__
const VECS32 result = { b, g, r, a };
@@ -58,7 +58,7 @@ public:
m_value = result;
}
- inline void set(const rgb_t& rgb)
+ void set(const rgb_t& rgb)
{
const VECU32 zero = { 0, 0, 0, 0 };
#ifdef __LITTLE_ENDIAN__
@@ -88,94 +88,31 @@ public:
return result;
}
- inline void add(const rgbaint_t& color2)
- {
- m_value = vec_add(m_value, color2.m_value);
- }
-
- inline void add_imm(const INT32 imm)
- {
- const VECS32 temp = { imm, imm, imm, imm };
- m_value = vec_add(m_value, temp);
- }
-
- inline void add_imm_rgba(const INT32 a, const INT32 r, const INT32 g, const INT32 b)
- {
-#ifdef __LITTLE_ENDIAN__
- const VECS32 temp = { b, g, r, a };
-#else
- const VECS32 temp = { a, r, g, b };
-#endif
- m_value = vec_add(m_value, temp);
- }
-
- inline void sub(const rgbaint_t& color2)
- {
- m_value = vec_sub(m_value, color2.m_value);
- }
-
- inline void sub_imm(const INT32 imm)
- {
- const VECS32 temp = { imm, imm, imm, imm };
- m_value = vec_sub(m_value, temp);
- }
-
- inline void sub_imm_rgba(const INT32 a, const INT32 r, const INT32 g, const INT32 b)
- {
-#ifdef __LITTLE_ENDIAN__
- const VECS32 temp = { b, g, r, a };
-#else
- const VECS32 temp = { a, r, g, b };
-#endif
- m_value = vec_sub(m_value, temp);
- }
-
- inline void subr(rgbaint_t& color2)
- {
- m_value = vec_sub(color2.m_value, m_value);
- }
-
- inline void subr_imm(const INT32 imm)
- {
- const VECS32 temp = { imm, imm, imm, imm };
- m_value = vec_sub(temp, m_value);
- }
-
- inline void subr_imm_rgba(const INT32 a, const INT32 r, const INT32 g, const INT32 b)
- {
-#ifdef __LITTLE_ENDIAN__
- const VECS32 temp = { b, g, r, a };
-#else
- const VECS32 temp = { a, r, g, b };
-#endif
- m_value = vec_sub(temp, m_value);
- }
-
- inline void set_a(const INT32 value)
+ void set_a(const INT32 value)
{
const VECS32 temp = { value, value, value, value };
m_value = vec_perm(m_value, temp, alpha_perm);
}
- inline void set_r(const INT32 value)
+ void set_r(const INT32 value)
{
const VECS32 temp = { value, value, value, value };
m_value = vec_perm(m_value, temp, red_perm);
}
- inline void set_g(const INT32 value)
+ void set_g(const INT32 value)
{
const VECS32 temp = { value, value, value, value };
m_value = vec_perm(m_value, temp, green_perm);
}
- inline void set_b(const INT32 value)
+ void set_b(const INT32 value)
{
const VECS32 temp = { value, value, value, value };
m_value = vec_perm(m_value, temp, blue_perm);
}
- inline UINT8 get_a() const
+ UINT8 get_a() const
{
UINT8 result;
#ifdef __LITTLE_ENDIAN__
@@ -186,7 +123,7 @@ public:
return result;
}
- inline UINT8 get_r() const
+ UINT8 get_r() const
{
UINT8 result;
#ifdef __LITTLE_ENDIAN__
@@ -197,7 +134,7 @@ public:
return result;
}
- inline UINT8 get_g() const
+ UINT8 get_g() const
{
UINT8 result;
#ifdef __LITTLE_ENDIAN__
@@ -208,7 +145,7 @@ public:
return result;
}
- inline UINT8 get_b() const
+ UINT8 get_b() const
{
UINT8 result;
#ifdef __LITTLE_ENDIAN__
@@ -219,7 +156,7 @@ public:
return result;
}
- inline INT32 get_a32() const
+ INT32 get_a32() const
{
INT32 result;
#ifdef __LITTLE_ENDIAN__
@@ -230,7 +167,7 @@ public:
return result;
}
- inline INT32 get_r32() const
+ INT32 get_r32() const
{
INT32 result;
#ifdef __LITTLE_ENDIAN__
@@ -241,7 +178,7 @@ public:
return result;
}
- inline INT32 get_g32() const
+ INT32 get_g32() const
{
INT32 result;
#ifdef __LITTLE_ENDIAN__
@@ -252,7 +189,7 @@ public:
return result;
}
- inline INT32 get_b32() const
+ INT32 get_b32() const
{
INT32 result;
#ifdef __LITTLE_ENDIAN__
@@ -263,6 +200,69 @@ public:
return result;
}
+ inline void add(const rgbaint_t& color2)
+ {
+ m_value = vec_add(m_value, color2.m_value);
+ }
+
+ inline void add_imm(const INT32 imm)
+ {
+ const VECS32 temp = { imm, imm, imm, imm };
+ m_value = vec_add(m_value, temp);
+ }
+
+ inline void add_imm_rgba(const INT32 a, const INT32 r, const INT32 g, const INT32 b)
+ {
+#ifdef __LITTLE_ENDIAN__
+ const VECS32 temp = { b, g, r, a };
+#else
+ const VECS32 temp = { a, r, g, b };
+#endif
+ m_value = vec_add(m_value, temp);
+ }
+
+ inline void sub(const rgbaint_t& color2)
+ {
+ m_value = vec_sub(m_value, color2.m_value);
+ }
+
+ inline void sub_imm(const INT32 imm)
+ {
+ const VECS32 temp = { imm, imm, imm, imm };
+ m_value = vec_sub(m_value, temp);
+ }
+
+ inline void sub_imm_rgba(const INT32 a, const INT32 r, const INT32 g, const INT32 b)
+ {
+#ifdef __LITTLE_ENDIAN__
+ const VECS32 temp = { b, g, r, a };
+#else
+ const VECS32 temp = { a, r, g, b };
+#endif
+ m_value = vec_sub(m_value, temp);
+ }
+
+ inline void subr(const rgbaint_t& color2)
+ {
+ m_value = vec_sub(color2.m_value, m_value);
+ }
+
+ inline void subr_imm(const INT32 imm)
+ {
+ const VECS32 temp = { imm, imm, imm, imm };
+ m_value = vec_sub(temp, m_value);
+ }
+
+ inline void subr_imm_rgba(const INT32 a, const INT32 r, const INT32 g, const INT32 b)
+ {
+#ifdef __LITTLE_ENDIAN__
+ const VECS32 temp = { b, g, r, a };
+#else
+ const VECS32 temp = { a, r, g, b };
+#endif
+ m_value = vec_sub(temp, m_value);
+ }
+
inline void mul(const rgbaint_t& color)
{
const VECU32 shift = vec_splat_u32(-16);
@@ -545,7 +545,7 @@ public:
m_value = VECS32(vec_cmplt(m_value, temp));
}
- inline rgbaint_t operator=(const rgbaint_t& other)
+ inline rgbaint_t &operator=(const rgbaint_t& other)
{
m_value = other.m_value;
return *this;
@@ -607,7 +607,7 @@ public:
m_value = vec_perm(m_value, alpha.m_value, alpha_perm);
}
- static UINT32 bilinear_filter(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
+ static UINT32 bilinear_filter(const UINT32 &rgb00, const UINT32 &rgb01, const UINT32 &rgb10, const UINT32 &rgb11, UINT8 u, UINT8 v)
{
const VECS32 zero = vec_splat_s32(0);
@@ -650,7 +650,7 @@ public:
return result;
}
- inline void bilinear_filter_rgbaint(UINT32 rgb00, UINT32 rgb01, UINT32 rgb10, UINT32 rgb11, UINT8 u, UINT8 v)
+ void bilinear_filter_rgbaint(const UINT32 &rgb00, const UINT32 &rgb01, const UINT32 &rgb10, const UINT32 &rgb11, UINT8 u, UINT8 v)
{
const VECS32 zero = vec_splat_s32(0);
@@ -688,13 +688,13 @@ public:
}
protected:
- VECS32 m_value;
+ VECS32 m_value;
- static const VECU8 alpha_perm;
- static const VECU8 red_perm;
- static const VECU8 green_perm;
- static const VECU8 blue_perm;
- static const VECS16 scale_table[256];
+ static const VECU8 alpha_perm;
+ static const VECU8 red_perm;
+ static const VECU8 green_perm;
+ static const VECU8 blue_perm;
+ static const VECS16 scale_table[256];
};