aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-05-22 17:18:21 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-22 17:18:21 -0700
commitaa999cb952753d373c03befa7fce8c4700ef9308 (patch)
tree187820613cb390da6f4ce7aca7e4da08eab31f69 /src/opts
parentd23a395d519835f78630aaea3f2a2c30ecdffe87 (diff)
Everyone gets a namespace {}.
If we include Sk4px.h, SkPMFloat.h, or SkNx.h into files with different SIMD flags, that could cause different definitions of the same method. Normally that's moot, because all the code inlines, but in Debug it tends not to. So in Debug, the linker picks one definition for us. That breaks _someone_. Wrapping everything in a namespace {} keeps the definitions separate. Tested locally, it fixes this bug. BUG=skia:3861 This code is not yet enabled in Chrome, so shouldn't affect the roll. NOTREECHECKS=true Review URL: https://codereview.chromium.org/1154523004
Diffstat (limited to 'src/opts')
-rw-r--r--src/opts/Sk4px_NEON.h4
-rw-r--r--src/opts/Sk4px_SSE2.h4
-rw-r--r--src/opts/Sk4px_none.h3
-rw-r--r--src/opts/SkNx_neon.h4
-rw-r--r--src/opts/SkNx_sse.h5
-rw-r--r--src/opts/SkPMFloat_SSE2.h4
-rw-r--r--src/opts/SkPMFloat_SSSE3.h4
-rw-r--r--src/opts/SkPMFloat_neon.h4
-rw-r--r--src/opts/SkPMFloat_none.h4
9 files changed, 34 insertions, 2 deletions
diff --git a/src/opts/Sk4px_NEON.h b/src/opts/Sk4px_NEON.h
index f0d9b56c71..494052ceb7 100644
--- a/src/opts/Sk4px_NEON.h
+++ b/src/opts/Sk4px_NEON.h
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+namespace { // See Sk4px.h
+
inline Sk4px::Sk4px(SkPMColor px) : INHERITED((uint8x16_t)vdupq_n_u32(px)) {}
inline Sk4px Sk4px::Load4(const SkPMColor px[4]) {
@@ -88,3 +90,5 @@ inline Sk4px Sk4px::zeroAlphas() const {
return Sk16b(vbicq_u8(this->fVec, (uint8x16_t)vdupq_n_u32(0xFF << SK_A32_SHIFT)));
}
+} // namespace
+
diff --git a/src/opts/Sk4px_SSE2.h b/src/opts/Sk4px_SSE2.h
index 9ba510347e..ee58c38ab0 100644
--- a/src/opts/Sk4px_SSE2.h
+++ b/src/opts/Sk4px_SSE2.h
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+namespace { // See Sk4px.h
+
inline Sk4px::Sk4px(SkPMColor px) : INHERITED(_mm_set1_epi32(px)) {}
inline Sk4px Sk4px::Load4(const SkPMColor px[4]) {
@@ -85,3 +87,5 @@ inline Sk4px Sk4px::zeroAlphas() const {
// andnot(a,b) == ~a & b
return Sk16b(_mm_andnot_si128(_mm_set1_epi32(0xFF << SK_A32_SHIFT), this->fVec));
}
+
+} // namespace
diff --git a/src/opts/Sk4px_none.h b/src/opts/Sk4px_none.h
index 541443d772..d3ead31491 100644
--- a/src/opts/Sk4px_none.h
+++ b/src/opts/Sk4px_none.h
@@ -7,6 +7,8 @@
#include "SkUtils.h"
+namespace { // See Sk4px.h
+
static_assert(sizeof(Sk4px) == 16, "This file uses memcpy / sk_memset32, so exact size matters.");
inline Sk4px::Sk4px(SkPMColor px) {
@@ -94,3 +96,4 @@ inline Sk4px Sk4px::zeroColors() const {
0,0,0, this->kth<15>());
}
+} // namespace
diff --git a/src/opts/SkNx_neon.h b/src/opts/SkNx_neon.h
index 08691fef42..2087b8899b 100644
--- a/src/opts/SkNx_neon.h
+++ b/src/opts/SkNx_neon.h
@@ -8,7 +8,7 @@
#ifndef SkNx_neon_DEFINED
#define SkNx_neon_DEFINED
-#include <arm_neon.h>
+namespace { // See SkNx.h
// Well, this is absurd. The shifts require compile-time constant arguments.
@@ -380,4 +380,6 @@ public:
#undef SHIFT16
#undef SHIFT8
+} // namespace
+
#endif//SkNx_neon_DEFINED
diff --git a/src/opts/SkNx_sse.h b/src/opts/SkNx_sse.h
index 0e9494c238..ed78892856 100644
--- a/src/opts/SkNx_sse.h
+++ b/src/opts/SkNx_sse.h
@@ -9,7 +9,8 @@
#define SkNx_sse_DEFINED
// This file may assume <= SSE2, but must check SK_CPU_SSE_LEVEL for anything more recent.
-#include <immintrin.h>
+
+namespace { // See SkNx.h
template <>
class SkNb<2, 4> {
@@ -327,4 +328,6 @@ public:
__m128i fVec;
};
+} // namespace
+
#endif//SkNx_sse_DEFINED
diff --git a/src/opts/SkPMFloat_SSE2.h b/src/opts/SkPMFloat_SSE2.h
index 88a38039b5..c7e791ff62 100644
--- a/src/opts/SkPMFloat_SSE2.h
+++ b/src/opts/SkPMFloat_SSE2.h
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+namespace { // See SkPMFloat.h
+
// For SkPMFloat(SkPMColor), we widen our 8 bit components (fix8) to 8-bit components in 16 bits
// (fix8_16), then widen those to 8-bit-in-32-bits (fix8_32), and finally convert those to floats.
@@ -78,3 +80,5 @@ inline void SkPMFloat::RoundClampTo4PMColors(
SkPMColorAssert(colors[2]);
SkPMColorAssert(colors[3]);
}
+
+} // namespace
diff --git a/src/opts/SkPMFloat_SSSE3.h b/src/opts/SkPMFloat_SSSE3.h
index 9ff73568fc..67116ec2dd 100644
--- a/src/opts/SkPMFloat_SSSE3.h
+++ b/src/opts/SkPMFloat_SSSE3.h
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+namespace { // See SkPMFloat.h
+
// For SkPMFloat(SkPMColor), we widen our 8 bit components (fix8) to 8-bit components in 32 bits
// (fix8_32), then convert those to floats.
@@ -81,3 +83,5 @@ inline void SkPMFloat::RoundClampTo4PMColors(
SkPMColorAssert(colors[2]);
SkPMColorAssert(colors[3]);
}
+
+} // namespace
diff --git a/src/opts/SkPMFloat_neon.h b/src/opts/SkPMFloat_neon.h
index 1c01bc4803..cabb29a2a8 100644
--- a/src/opts/SkPMFloat_neon.h
+++ b/src/opts/SkPMFloat_neon.h
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+namespace { // See SkPMFloat.h
+
// For SkPMFloat(SkPMFColor), we widen our 8 bit components (fix8) to 8-bit components in 16 bits
// (fix8_16), then widen those to 8-bit-in-32-bits (fix8_32), and finally convert those to floats.
@@ -70,3 +72,5 @@ inline void SkPMFloat::RoundClampTo4PMColors(
colors[2] = c.roundClamp();
colors[3] = d.roundClamp();
}
+
+} // namespace
diff --git a/src/opts/SkPMFloat_none.h b/src/opts/SkPMFloat_none.h
index 50f242749a..9bb584ed86 100644
--- a/src/opts/SkPMFloat_none.h
+++ b/src/opts/SkPMFloat_none.h
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+namespace { // See SkPMFloat.h
+
inline SkPMFloat::SkPMFloat(SkPMColor c) {
*this = SkPMFloat::FromARGB(SkGetPackedA32(c),
SkGetPackedR32(c),
@@ -62,3 +64,5 @@ inline void SkPMFloat::RoundClampTo4PMColors(
colors[2] = c.roundClamp();
colors[3] = d.roundClamp();
}
+
+} // namespace