centralize VECTORCALL as SK_VECTORCALL
Gonna start using this, might as well define it once centrally.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2126253002
No public API changes.
TBR=reed@google.com
Review-Url: https://codereview.chromium.org/2126253002
diff --git a/src/core/SkLinearBitmapPipeline.cpp b/src/core/SkLinearBitmapPipeline.cpp
index 3a86062..cfad6ec 100644
--- a/src/core/SkLinearBitmapPipeline.cpp
+++ b/src/core/SkLinearBitmapPipeline.cpp
@@ -92,12 +92,12 @@
: fNext{next}
, fStrategy{stage.fStrategy} { }
- void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
fStrategy.processPoints(&xs, &ys);
fNext->pointListFew(n, xs, ys);
}
- void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
fStrategy.processPoints(&xs, &ys);
fNext->pointList4(xs, ys);
}
@@ -178,13 +178,13 @@
, fXStrategy{stage.fXStrategy}
, fYStrategy{stage.fYStrategy} { }
- void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
fXStrategy.tileXPoints(&xs);
fYStrategy.tileYPoints(&ys);
fNext->pointListFew(n, xs, ys);
}
- void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
fXStrategy.tileXPoints(&xs);
fYStrategy.tileYPoints(&ys);
fNext->pointList4(xs, ys);
@@ -227,7 +227,7 @@
, fXStrategy{stage.fXStrategy}
, fYStrategy{stage.fYStrategy} { }
- void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
fXStrategy.tileXPoints(&xs);
fYStrategy.tileYPoints(&ys);
// TODO: check to see if xs and ys are in range then just call pointListFew on next.
@@ -236,7 +236,7 @@
if (n >= 3) this->bilerpPoint(xs[2], ys[2]);
}
- void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
fXStrategy.tileXPoints(&xs);
fYStrategy.tileYPoints(&ys);
// TODO: check to see if xs and ys are in range then just call pointList4 on next.
@@ -421,7 +421,7 @@
RGBA8888UnitRepeatSrc(const uint32_t* src, int32_t width)
: fSrc{src}, fWidth{width} { }
- void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
SkASSERT(fDest + n <= fEnd);
// At this point xs and ys should be >= 0, so trunc is the same as floor.
Sk4i iXs = SkNx_cast<int>(xs);
@@ -432,7 +432,7 @@
if (n >= 3) *fDest++ = *this->pixelAddress(iXs[2], iYs[2]);
}
- void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
SkASSERT(fDest + 4 <= fEnd);
Sk4i iXs = SkNx_cast<int>(xs);
Sk4i iYs = SkNx_cast<int>(ys);
@@ -467,7 +467,7 @@
fDest = dest;
}
- void VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) override { SkFAIL("Not Implemented"); }
+ void SK_VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) override { SkFAIL("Not Implemented"); }
void bilerpSpan(Span span, SkScalar y) override { SkFAIL("Not Implemented"); }
@@ -495,7 +495,7 @@
RGBA8888UnitRepeatSrcOver(const uint32_t* src, int32_t width)
: fSrc{src}, fWidth{width} { }
- void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
SkASSERT(fDest + n <= fEnd);
// At this point xs and ys should be >= 0, so trunc is the same as floor.
Sk4i iXs = SkNx_cast<int>(xs);
@@ -506,7 +506,7 @@
if (n >= 3) blendPixelAt(iXs[2], iYs[2]);
}
- void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
SkASSERT(fDest + 4 <= fEnd);
Sk4i iXs = SkNx_cast<int>(xs);
Sk4i iYs = SkNx_cast<int>(ys);
@@ -538,7 +538,7 @@
SkASSERT(fDest <= fEnd);
}
- void VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) override { SkFAIL("Not Implemented"); }
+ void SK_VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) override { SkFAIL("Not Implemented"); }
void bilerpSpan(Span span, SkScalar y) override { SkFAIL("Not Implemented"); }
@@ -648,13 +648,13 @@
public:
SrcFPPixel(float postAlpha) : fPostAlpha{postAlpha} { }
SrcFPPixel(const SrcFPPixel& Blender) : fPostAlpha(Blender.fPostAlpha) {}
- void VECTORCALL blendPixel(Sk4f pixel) override {
+ void SK_VECTORCALL blendPixel(Sk4f pixel) override {
SkASSERT(fDst + 1 <= fEnd );
SrcPixel(fDst, pixel, 0);
fDst += 1;
}
- void VECTORCALL blend4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) override {
+ void SK_VECTORCALL blend4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) override {
SkASSERT(fDst + 4 <= fEnd);
SkPM4f* dst = fDst;
SrcPixel(dst, p0, 0);
@@ -670,7 +670,7 @@
}
private:
- void VECTORCALL SrcPixel(SkPM4f* dst, Sk4f pixel, int index) {
+ void SK_VECTORCALL SrcPixel(SkPM4f* dst, Sk4f pixel, int index) {
Sk4f newPixel = pixel;
if (alphaType == kUnpremul_SkAlphaType) {
newPixel = Premultiply(pixel);
@@ -678,7 +678,7 @@
newPixel = newPixel * fPostAlpha;
newPixel.store(dst + index);
}
- static Sk4f VECTORCALL Premultiply(Sk4f pixel) {
+ static Sk4f SK_VECTORCALL Premultiply(Sk4f pixel) {
float alpha = pixel[3];
return pixel * Sk4f{alpha, alpha, alpha, 1.0f};
}
diff --git a/src/core/SkLinearBitmapPipeline_core.h b/src/core/SkLinearBitmapPipeline_core.h
index db3c4d0..21fa487 100644
--- a/src/core/SkLinearBitmapPipeline_core.h
+++ b/src/core/SkLinearBitmapPipeline_core.h
@@ -21,15 +21,6 @@
// - introduce new point API
// - Add tile for new api.
-// Tweak ABI of functions that pass Sk4f by value to pass them via registers.
-#if defined(_MSC_VER) && SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
- #define VECTORCALL __vectorcall
-#elif defined(SK_CPU_ARM32) && defined(SK_ARM_HAS_NEON)
- #define VECTORCALL __attribute__((pcs("aapcs-vfp")))
-#else
- #define VECTORCALL
-#endif
-
namespace {
struct X {
explicit X(SkScalar val) : fVal{val} { }
@@ -194,9 +185,9 @@
// Take the first n (where 0 < n && n < 4) items from xs and ys and sample those points. For
// nearest neighbor, that means just taking the floor xs and ys. For bilerp, this means
// to expand the bilerp filter around the point and sample using that filter.
- virtual void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) = 0;
+ virtual void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) = 0;
// Same as pointListFew, but n = 4.
- virtual void VECTORCALL pointList4(Sk4s xs, Sk4s ys) = 0;
+ virtual void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) = 0;
// A span is a compact form of sample points that are obtained by mapping points from
// destination space to source space. This is used for horizontal lines only, and is mainly
// used to take advantage of memory coherence for horizontal spans.
@@ -222,7 +213,7 @@
// +--------+--------+
// These pixels coordinates are arranged in the following order in xs and ys:
// px00 px10 px01 px11
- virtual void VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) = 0;
+ virtual void SK_VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) = 0;
// A span represents sample points that have been mapped from destination space to source
// space. Each sample point is then expanded to the four bilerp points by add +/- 0.5. The
@@ -243,8 +234,8 @@
class SkLinearBitmapPipeline::BlendProcessorInterface
: public SkLinearBitmapPipeline::DestinationInterface {
public:
- virtual void VECTORCALL blendPixel(Sk4f pixel0) = 0;
- virtual void VECTORCALL blend4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) = 0;
+ virtual void SK_VECTORCALL blendPixel(Sk4f pixel0) = 0;
+ virtual void SK_VECTORCALL blend4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) = 0;
};
#endif // SkLinearBitmapPipeline_core_DEFINED
diff --git a/src/core/SkLinearBitmapPipeline_sample.h b/src/core/SkLinearBitmapPipeline_sample.h
index 56f4322..5d1f26f 100644
--- a/src/core/SkLinearBitmapPipeline_sample.h
+++ b/src/core/SkLinearBitmapPipeline_sample.h
@@ -39,7 +39,7 @@
// * px01 -> (1 - x)y = y - xy
// * px11 -> xy
// So x * y is calculated first and then used to calculate all the other factors.
-static Sk4s VECTORCALL bilerp4(Sk4s xs, Sk4s ys, Sk4f px00, Sk4f px10,
+static Sk4s SK_VECTORCALL bilerp4(Sk4s xs, Sk4s ys, Sk4f px00, Sk4f px10,
Sk4f px01, Sk4f px11) {
// Calculate fractional xs and ys.
Sk4s fxs = xs - xs.floor();
@@ -216,7 +216,7 @@
, fWidth{srcPixmap.rowBytesAsPixels()}
, fGetter{srcPixmap, std::move<Args>(args)...} { }
- void VECTORCALL getFewPixels(int n, Sk4s xs, Sk4s ys, Sk4f* px0, Sk4f* px1, Sk4f* px2) {
+ void SK_VECTORCALL getFewPixels(int n, Sk4s xs, Sk4s ys, Sk4f* px0, Sk4f* px1, Sk4f* px2) {
Sk4i XIs = SkNx_cast<int, SkScalar>(xs);
Sk4i YIs = SkNx_cast<int, SkScalar>(ys);
Sk4i bufferLoc = YIs * fWidth + XIs;
@@ -232,7 +232,7 @@
}
}
- void VECTORCALL get4Pixels(Sk4s xs, Sk4s ys, Sk4f* px0, Sk4f* px1, Sk4f* px2, Sk4f* px3) {
+ void SK_VECTORCALL get4Pixels(Sk4s xs, Sk4s ys, Sk4f* px0, Sk4f* px1, Sk4f* px2, Sk4f* px3) {
Sk4i XIs = SkNx_cast<int, SkScalar>(xs);
Sk4i YIs = SkNx_cast<int, SkScalar>(ys);
Sk4i bufferLoc = YIs * fWidth + XIs;
@@ -319,7 +319,7 @@
const NearestNeighborSampler& sampler)
: fNext{next}, fStrategy{sampler.fStrategy} { }
- void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
SkASSERT(0 < n && n < 4);
Sk4f px0, px1, px2;
fStrategy.getFewPixels(n, xs, ys, &px0, &px1, &px2);
@@ -328,7 +328,7 @@
if (n >= 3) fNext->blendPixel(px2);
}
- void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
Sk4f px0, px1, px2, px3;
fStrategy.get4Pixels(xs, ys, &px0, &px1, &px2, &px3);
fNext->blend4Pixels(px0, px1, px2, px3);
@@ -357,7 +357,7 @@
}
}
- void VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) override {
SkFAIL("Using nearest neighbor sampler, but calling a bilerpEdge.");
}
@@ -453,7 +453,7 @@
return bilerp4(xs, ys, px00, px10, px01, px11);
}
- void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
SkASSERT(0 < n && n < 4);
auto bilerpPixel = [&](int index) {
return this->bilerpNonEdgePixel(xs[index], ys[index]);
@@ -464,7 +464,7 @@
if (n >= 3) fNext->blendPixel(bilerpPixel(2));
}
- void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
+ void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
auto bilerpPixel = [&](int index) {
return this->bilerpNonEdgePixel(xs[index], ys[index]);
};
@@ -482,7 +482,7 @@
}
}
- void VECTORCALL bilerpEdge(Sk4s sampleXs, Sk4s sampleYs) override {
+ void SK_VECTORCALL bilerpEdge(Sk4s sampleXs, Sk4s sampleYs) override {
Sk4f px00, px10, px01, px11;
Sk4f xs = Sk4f{sampleXs[0]};
Sk4f ys = Sk4f{sampleYs[0]};