aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-06-29 13:46:42 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-29 19:13:50 +0000
commit41dc6cc6213a4e54597325026b4a08aaf27b8780 (patch)
treec043c2a2a305691849cf112147e72df16bbccbdf /src/core
parent5d00f008cea93671b0f48736f6f4bbe6cb964391 (diff)
remove unreachable samples for non-N32 imageshaders
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Bug: skia: Change-Id: I2d9a22b22d72c81a742b8fd497797bff8174915b Reviewed-on: https://skia-review.googlesource.com/21264 Commit-Queue: Eric Boren <borenet@google.com> Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkBitmapProcState.cpp100
-rw-r--r--src/core/SkBitmapProcState_procs.h147
2 files changed, 6 insertions, 241 deletions
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 4149661309..6223c0239f 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -21,12 +21,6 @@
#if defined(SK_ARM_HAS_NEON)
// These are defined in src/opts/SkBitmapProcState_arm_neon.cpp
extern const SkBitmapProcState::SampleProc32 gSkBitmapProcStateSample32_neon[];
-extern void S16_D16_filter_DX_neon(const SkBitmapProcState&, const uint32_t*, int, uint16_t*);
-extern void Clamp_S16_D16_filter_DX_shaderproc_neon(const void *, int, int, uint16_t*, int);
-extern void Repeat_S16_D16_filter_DX_shaderproc_neon(const void *, int, int, uint16_t*, int);
-extern void SI8_opaque_D32_filter_DX_neon(const SkBitmapProcState&, const uint32_t*, int, SkPMColor*);
-extern void SI8_opaque_D32_filter_DX_shaderproc_neon(const void *, int, int, uint32_t*, int);
-extern void Clamp_SI8_opaque_D32_filter_DX_shaderproc_neon(const void*, int, int, uint32_t*, int);
#endif
extern void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const void*, int, int, uint32_t*, int);
@@ -215,22 +209,24 @@ bool SkBitmapProcState::chooseProcs() {
}
bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp) {
+ SkASSERT(fPixmap.colorType() == kN32_SkColorType);
+
fMatrixProc = this->chooseMatrixProc(trivialMatrix);
// TODO(dominikg): SkASSERT(fMatrixProc) instead? chooseMatrixProc never returns nullptr.
if (nullptr == fMatrixProc) {
return false;
}
- ///////////////////////////////////////////////////////////////////////
-
const SkAlphaType at = fPixmap.alphaType();
+ if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) {
+ return false;
+ }
// No need to do this if we're doing HQ sampling; if filter quality is
// still set to HQ by the time we get here, then we must have installed
// the shader procs above and can skip all this.
if (fFilterQuality < kHigh_SkFilterQuality) {
-
int index = 0;
if (fAlphaScale < 256) { // note: this distinction is not used for D16
index |= 1;
@@ -241,41 +237,6 @@ bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp)
if (fFilterQuality > kNone_SkFilterQuality) {
index |= 4;
}
- // bits 3,4,5 encoding the source bitmap format
- switch (fPixmap.colorType()) {
- case kN32_SkColorType:
- if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) {
- return false;
- }
- index |= 0;
- break;
- case kRGB_565_SkColorType:
- index |= 8;
- break;
- case kIndex_8_SkColorType:
- if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) {
- return false;
- }
- index |= 16;
- break;
- case kARGB_4444_SkColorType:
- if (kPremul_SkAlphaType != at && kOpaque_SkAlphaType != at) {
- return false;
- }
- index |= 24;
- break;
- case kAlpha_8_SkColorType:
- index |= 32;
- fPaintPMColor = SkPreMultiplyColor(fPaintColor);
- break;
- case kGray_8_SkColorType:
- index |= 40;
- fPaintPMColor = SkPreMultiplyColor(fPaintColor);
- break;
- default:
- // TODO(dominikg): Should we ever get here? SkASSERT(false) instead?
- return false;
- }
#if !defined(SK_ARM_HAS_NEON)
static const SampleProc32 gSkBitmapProcStateSample32[] = {
@@ -287,62 +248,13 @@ bool SkBitmapProcState::chooseScanlineProcs(bool trivialMatrix, bool clampClamp)
S32_alpha_D32_filter_DXDY,
S32_opaque_D32_filter_DX,
S32_alpha_D32_filter_DX,
-
- S16_opaque_D32_nofilter_DXDY,
- S16_alpha_D32_nofilter_DXDY,
- S16_opaque_D32_nofilter_DX,
- S16_alpha_D32_nofilter_DX,
- S16_opaque_D32_filter_DXDY,
- S16_alpha_D32_filter_DXDY,
- S16_opaque_D32_filter_DX,
- S16_alpha_D32_filter_DX,
-
- SI8_opaque_D32_nofilter_DXDY,
- SI8_alpha_D32_nofilter_DXDY,
- SI8_opaque_D32_nofilter_DX,
- SI8_alpha_D32_nofilter_DX,
- SI8_opaque_D32_filter_DXDY,
- SI8_alpha_D32_filter_DXDY,
- SI8_opaque_D32_filter_DX,
- SI8_alpha_D32_filter_DX,
-
- S4444_opaque_D32_nofilter_DXDY,
- S4444_alpha_D32_nofilter_DXDY,
- S4444_opaque_D32_nofilter_DX,
- S4444_alpha_D32_nofilter_DX,
- S4444_opaque_D32_filter_DXDY,
- S4444_alpha_D32_filter_DXDY,
- S4444_opaque_D32_filter_DX,
- S4444_alpha_D32_filter_DX,
-
- // A8 treats alpha/opaque the same (equally efficient)
- SA8_alpha_D32_nofilter_DXDY,
- SA8_alpha_D32_nofilter_DXDY,
- SA8_alpha_D32_nofilter_DX,
- SA8_alpha_D32_nofilter_DX,
- SA8_alpha_D32_filter_DXDY,
- SA8_alpha_D32_filter_DXDY,
- SA8_alpha_D32_filter_DX,
- SA8_alpha_D32_filter_DX,
-
- // todo: possibly specialize on opaqueness
- SG8_alpha_D32_nofilter_DXDY,
- SG8_alpha_D32_nofilter_DXDY,
- SG8_alpha_D32_nofilter_DX,
- SG8_alpha_D32_nofilter_DX,
- SG8_alpha_D32_filter_DXDY,
- SG8_alpha_D32_filter_DXDY,
- SG8_alpha_D32_filter_DX,
- SG8_alpha_D32_filter_DX
};
#endif
fSampleProc32 = SK_ARM_NEON_WRAP(gSkBitmapProcStateSample32)[index];
// our special-case shaderprocs
- if (SK_ARM_NEON_WRAP(SI8_opaque_D32_filter_DX) == fSampleProc32 && clampClamp) {
- fShaderProc32 = SK_ARM_NEON_WRAP(Clamp_SI8_opaque_D32_filter_DX_shaderproc);
- } else if (S32_opaque_D32_nofilter_DX == fSampleProc32 && clampClamp) {
+ if (S32_opaque_D32_nofilter_DX == fSampleProc32 && clampClamp) {
fShaderProc32 = Clamp_S32_opaque_D32_nofilter_DX_shaderproc;
}
diff --git a/src/core/SkBitmapProcState_procs.h b/src/core/SkBitmapProcState_procs.h
index fb104ace9c..e0aff3fdd6 100644
--- a/src/core/SkBitmapProcState_procs.h
+++ b/src/core/SkBitmapProcState_procs.h
@@ -76,12 +76,6 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
return result >> 8;
}
-/*****************************************************************************
- *
- * D32 functions
- *
- */
-
// SRC == 8888
#define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_opaque)(x, y, a, b, c, d, dst)
@@ -106,145 +100,4 @@ static inline U8CPU Filter_8(unsigned x, unsigned y,
#define SRC_TO_FILTER(src) src
#include "SkBitmapProcState_sample.h"
-// SRC == 565
-
-#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) \
- do { \
- uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \
- *(dst) = SkExpanded_565_To_PMColor(tmp); \
- } while (0)
-
-#define MAKENAME(suffix) NAME_WRAP(S16_opaque_D32 ## suffix)
-#define SRCTYPE uint16_t
-#define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fPixmap.colorType()); \
- SkASSERT(state.fAlphaScale == 256)
-#define RETURNDST(src) SkPixel16ToPixel32(src)
-#define SRC_TO_FILTER(src) src
-#include "SkBitmapProcState_sample.h"
-
-#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) \
- do { \
- uint32_t tmp = Filter_565_Expanded(x, y, a, b, c, d); \
- *(dst) = SkAlphaMulQ(SkExpanded_565_To_PMColor(tmp), alphaScale); \
- } while (0)
-
-#define MAKENAME(suffix) NAME_WRAP(S16_alpha_D32 ## suffix)
-#define SRCTYPE uint16_t
-#define CHECKSTATE(state) SkASSERT(kRGB_565_SkColorType == state.fPixmap.colorType()); \
- SkASSERT(state.fAlphaScale < 256)
-#define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale
-#define RETURNDST(src) SkAlphaMulQ(SkPixel16ToPixel32(src), alphaScale)
-#define SRC_TO_FILTER(src) src
-#include "SkBitmapProcState_sample.h"
-
-// SRC == Index8
-
-#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_opaque)(x, y, a, b, c, d, dst)
-
-#define MAKENAME(suffix) NAME_WRAP(SI8_opaque_D32 ## suffix)
-#define SRCTYPE uint8_t
-#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fPixmap.colorType()); \
- SkASSERT(state.fAlphaScale == 256)
-#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fPixmap.ctable()->readColors()
-#define RETURNDST(src) table[src]
-#define SRC_TO_FILTER(src) table[src]
-#define POSTAMBLE(state)
-#include "SkBitmapProcState_sample.h"
-
-#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_alpha)(x, y, a, b, c, d, dst, alphaScale)
-
-#define MAKENAME(suffix) NAME_WRAP(SI8_alpha_D32 ## suffix)
-#define SRCTYPE uint8_t
-#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fPixmap.colorType()); \
- SkASSERT(state.fAlphaScale < 256)
-#define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale; \
- const SkPMColor* SK_RESTRICT table = state.fPixmap.ctable()->readColors()
-#define RETURNDST(src) SkAlphaMulQ(table[src], alphaScale)
-#define SRC_TO_FILTER(src) table[src]
-#define POSTAMBLE(state)
-#include "SkBitmapProcState_sample.h"
-
-// SRC == 4444
-
-#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) *(dst) = Filter_4444_D32(x, y, a, b, c, d)
-
-#define MAKENAME(suffix) NAME_WRAP(S4444_opaque_D32 ## suffix)
-#define SRCTYPE SkPMColor16
-#define CHECKSTATE(state) SkASSERT(kARGB_4444_SkColorType == state.fPixmap.colorType()); \
- SkASSERT(state.fAlphaScale == 256)
-#define RETURNDST(src) SkPixel4444ToPixel32(src)
-#define SRC_TO_FILTER(src) src
-#include "SkBitmapProcState_sample.h"
-
-#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) \
- do { \
- uint32_t tmp = Filter_4444_D32(x, y, a, b, c, d); \
- *(dst) = SkAlphaMulQ(tmp, alphaScale); \
- } while (0)
-
-#define MAKENAME(suffix) NAME_WRAP(S4444_alpha_D32 ## suffix)
-#define SRCTYPE SkPMColor16
-#define CHECKSTATE(state) SkASSERT(kARGB_4444_SkColorType == state.fPixmap.colorType()); \
- SkASSERT(state.fAlphaScale < 256)
-#define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale
-#define RETURNDST(src) SkAlphaMulQ(SkPixel4444ToPixel32(src), alphaScale)
-#define SRC_TO_FILTER(src) src
-#include "SkBitmapProcState_sample.h"
-
-// SRC == A8
-
-#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) \
- do { \
- unsigned tmp = Filter_8(x, y, a, b, c, d); \
- *(dst) = SkAlphaMulQ(pmColor, SkAlpha255To256(tmp)); \
- } while (0)
-
-#define MAKENAME(suffix) NAME_WRAP(SA8_alpha_D32 ## suffix)
-#define SRCTYPE uint8_t
-#define CHECKSTATE(state) SkASSERT(kAlpha_8_SkColorType == state.fPixmap.colorType());
-#define PREAMBLE(state) const SkPMColor pmColor = state.fPaintPMColor;
-#define RETURNDST(src) SkAlphaMulQ(pmColor, SkAlpha255To256(src))
-#define SRC_TO_FILTER(src) src
-#include "SkBitmapProcState_sample.h"
-
-// SRC == Gray8
-
-#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) \
- do { \
- unsigned tmp = Filter_8(x, y, a, b, c, d); \
- SkPMColor color = SkPackARGB32(0xFF, tmp, tmp, tmp); \
- *(dst) = SkAlphaMulQ(color, alphaScale); \
- } while (0)
-
-#define MAKENAME(suffix) NAME_WRAP(SG8_alpha_D32 ## suffix)
-#define SRCTYPE uint8_t
-#define CHECKSTATE(state) SkASSERT(kGray_8_SkColorType == state.fPixmap.colorType());
-#define PREAMBLE(state) unsigned alphaScale = state.fAlphaScale
-#define RETURNDST(src) SkAlphaMulQ(SkPackARGB32(0xFF, src, src, src), alphaScale)
-#define SRC_TO_FILTER(src) src
-#include "SkBitmapProcState_sample.h"
-
-
-#define TILEX_PROCF(fx, max) SkClampMax((fx) >> 16, max)
-#define TILEY_PROCF(fy, max) SkClampMax((fy) >> 16, max)
-#define EXTRACT_LOW_BITS(v, max) (((v) >> 12) & 0xF)
-
-#undef FILTER_PROC
-#define FILTER_PROC(x, y, a, b, c, d, dst) NAME_WRAP(Filter_32_opaque)(x, y, a, b, c, d, dst)
-#define MAKENAME(suffix) NAME_WRAP(Clamp_SI8_opaque_D32 ## suffix)
-#define SRCTYPE uint8_t
-#define CHECKSTATE(state) SkASSERT(kIndex_8_SkColorType == state.fPixmap.colorType())
-#define PREAMBLE(state) const SkPMColor* SK_RESTRICT table = state.fPixmap.ctable()->readColors()
-#define SRC_TO_FILTER(src) table[src]
-#define POSTAMBLE(state)
-#include "SkBitmapProcState_shaderproc.h"
-
#undef NAME_WRAP