aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/gpu/GrContext.h5
-rw-r--r--src/gpu/GrContext.cpp62
-rw-r--r--src/gpu/GrDrawTarget.cpp52
-rw-r--r--src/gpu/GrDrawTarget.h1
-rw-r--r--src/gpu/GrGpuGLShaders.cpp3
-rw-r--r--src/gpu/SkGpuDevice.cpp3
6 files changed, 35 insertions, 91 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 8a838ea6c6..0308b5d1fc 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -451,11 +451,6 @@ public:
// Misc.
/**
- * Currently needed by SkGpuDevice. Ideally this shouldn't be exposed.
- */
- bool supportsShaders() const;
-
- /**
* Flags that affect flush() behavior.
*/
enum FlushBits {
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index d4264d53a2..151575d78e 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -676,7 +676,6 @@ inline bool disable_coverage_aa_for_blend(GrDrawTarget* target) {
struct GrContext::OffscreenRecord {
enum Downsample {
- k4x4TwoPass_Downsample,
k4x4SinglePass_Downsample,
kFSAA_Downsample
} fDownsample;
@@ -685,8 +684,7 @@ struct GrContext::OffscreenRecord {
int fTileCountX;
int fTileCountY;
int fScale;
- GrAutoScratchTexture fOffscreen0;
- GrAutoScratchTexture fOffscreen1;
+ GrAutoScratchTexture fOffscreen;
GrDrawTarget::SavedDrawState fSavedState;
GrClip fClip;
};
@@ -749,9 +747,7 @@ bool GrContext::prepareForOffscreenAA(GrDrawTarget* target,
record->fScale = 1;
desc.fAALevel = kMed_GrAALevel;
} else {
- record->fDownsample = fGpu->getCaps().fShaderSupport ?
- OffscreenRecord::k4x4SinglePass_Downsample :
- OffscreenRecord::k4x4TwoPass_Downsample;
+ record->fDownsample = OffscreenRecord::k4x4SinglePass_Downsample;
record->fScale = OFFSCREEN_SSAA_SCALE;
// both downsample paths assume this
GR_STATIC_ASSERT(4 == OFFSCREEN_SSAA_SCALE);
@@ -760,29 +756,17 @@ bool GrContext::prepareForOffscreenAA(GrDrawTarget* target,
desc.fWidth *= record->fScale;
desc.fHeight *= record->fScale;
- record->fOffscreen0.set(this, desc);
- if (NULL == record->fOffscreen0.texture()) {
+ record->fOffscreen.set(this, desc);
+ if (NULL == record->fOffscreen.texture()) {
return false;
}
// the approximate lookup might have given us some slop space, might as well
// use it when computing the tiles size.
// these are scale values, will adjust after considering
// the possible second offscreen.
- record->fTileSizeX = record->fOffscreen0.texture()->width();
- record->fTileSizeY = record->fOffscreen0.texture()->height();
-
- if (OffscreenRecord::k4x4TwoPass_Downsample == record->fDownsample) {
- desc.fWidth /= 2;
- desc.fHeight /= 2;
- record->fOffscreen1.set(this, desc);
- if (NULL == record->fOffscreen1.texture()) {
- return false;
- }
- record->fTileSizeX = GrMin(record->fTileSizeX,
- 2 * record->fOffscreen0.texture()->width());
- record->fTileSizeY = GrMin(record->fTileSizeY,
- 2 * record->fOffscreen0.texture()->height());
- }
+ record->fTileSizeX = record->fOffscreen.texture()->width();
+ record->fTileSizeY = record->fOffscreen.texture()->height();
+
record->fTileSizeX /= record->fScale;
record->fTileSizeY /= record->fScale;
@@ -800,14 +784,14 @@ void GrContext::setupOffscreenAAPass1(GrDrawTarget* target,
int tileX, int tileY,
OffscreenRecord* record) {
- GrRenderTarget* offRT0 = record->fOffscreen0.texture()->asRenderTarget();
- GrAssert(NULL != offRT0);
+ GrRenderTarget* offRT = record->fOffscreen.texture()->asRenderTarget();
+ GrAssert(NULL != offRT);
GrPaint tempPaint;
tempPaint.reset();
this->setPaint(tempPaint, target);
GrDrawState* drawState = target->drawState();
- drawState->setRenderTarget(offRT0);
+ drawState->setRenderTarget(offRT);
#if PREFER_MSAA_OFFSCREEN_AA
drawState->enableState(GrDrawState::kHWAntialias_StateBit);
#endif
@@ -868,7 +852,7 @@ void GrContext::doOffscreenAAPass2(GrDrawTarget* target,
filter = GrSamplerState::kBilinear_Filter;
}
- GrTexture* src = record->fOffscreen0.texture();
+ GrTexture* src = record->fOffscreen.texture();
int scale;
enum {
@@ -877,25 +861,7 @@ void GrContext::doOffscreenAAPass2(GrDrawTarget* target,
GrDrawState* drawState = target->drawState();
- if (OffscreenRecord::k4x4TwoPass_Downsample == record->fDownsample) {
- GrAssert(NULL != record->fOffscreen1.texture());
- scale = 2;
- GrRenderTarget* dst = record->fOffscreen1.texture()->asRenderTarget();
-
- // Do 2x2 downsample from first to second
- drawState->setTexture(kOffscreenStage, src);
- drawState->setRenderTarget(dst);
- drawState->setViewMatrix(GrMatrix::I());
- GrSamplerState* sampler = drawState->sampler(kOffscreenStage);
- sampler->reset(GrSamplerState::kClamp_WrapMode, filter);
- sampler->matrix()->setScale(scale * GR_Scalar1 / src->width(),
- scale * GR_Scalar1 / src->height());
- GrRect rect = SkRect::MakeWH(SkIntToScalar(scale * tileRect.width()),
- SkIntToScalar(scale * tileRect.height()));
- target->drawSimpleRect(rect, NULL, 1 << kOffscreenStage);
-
- src = record->fOffscreen1.texture();
- } else if (OffscreenRecord::kFSAA_Downsample == record->fDownsample) {
+ if (OffscreenRecord::kFSAA_Downsample == record->fDownsample) {
scale = 1;
GrIRect rect = SkIRect::MakeWH(tileRect.width(), tileRect.height());
src->asRenderTarget()->overrideResolveRect(rect);
@@ -1612,10 +1578,6 @@ void GrContext::drawPath(const GrPaint& paint, const GrPath& path,
////////////////////////////////////////////////////////////////////////////////
-bool GrContext::supportsShaders() const {
- return fGpu->getCaps().fShaderSupport;
-}
-
void GrContext::flush(int flagsBitfield) {
if (kDiscard_FlushBit & flagsBitfield) {
fDrawBuffer->reset();
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 6f059124cb..be6bd0a95c 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -888,12 +888,8 @@ GrDrawTarget::getBlendOpts(bool forceCoverage,
// (0,1).
if ((kZero_BlendCoeff == *srcCoeff && dstCoeffIsOne)) {
if (drawState.getStencil().doesWrite()) {
- if (fCaps.fShaderSupport) {
- return kDisableBlend_BlendOptFlag |
- kEmitTransBlack_BlendOptFlag;
- } else {
- return kDisableBlend_BlendOptFlag;
- }
+ return kDisableBlend_BlendOptFlag |
+ kEmitTransBlack_BlendOptFlag;
} else {
return kSkipDraw_BlendOptFlag;
}
@@ -920,8 +916,7 @@ GrDrawTarget::getBlendOpts(bool forceCoverage,
// if there is no coverage and coeffs are (1,0) then we
// won't need to read the dst at all, it gets replaced by src
return kDisableBlend_BlendOptFlag;
- } else if (kZero_BlendCoeff == *srcCoeff &&
- fCaps.fShaderSupport) {
+ } else if (kZero_BlendCoeff == *srcCoeff) {
// if the op is "clear" then we don't need to emit a color
// or blend, just write transparent black into the dst.
*srcCoeff = kOne_BlendCoeff;
@@ -936,30 +931,26 @@ GrDrawTarget::getBlendOpts(bool forceCoverage,
if (this->canTweakAlphaForCoverage()) {
return kCoverageAsAlpha_BlendOptFlag;
}
- // We haven't implemented support for these optimizations in the
- // fixed pipe (which is on its deathbed)
- if (fCaps.fShaderSupport) {
- if (dstCoeffIsZero) {
- if (kZero_BlendCoeff == *srcCoeff) {
- // the source color is not included in the blend
- // the dst coeff is effectively zero so blend works out to:
- // (c)(0)D + (1-c)D = (1-c)D.
- *dstCoeff = kISA_BlendCoeff;
- return kEmitCoverage_BlendOptFlag;
- } else if (srcAIsOne) {
- // the dst coeff is effectively zero so blend works out to:
- // cS + (c)(0)D + (1-c)D = cS + (1-c)D.
- // If Sa is 1 then we can replace Sa with c
- // and set dst coeff to 1-Sa.
- *dstCoeff = kISA_BlendCoeff;
- return kCoverageAsAlpha_BlendOptFlag;
- }
- } else if (dstCoeffIsOne) {
- // the dst coeff is effectively one so blend works out to:
- // cS + (c)(1)D + (1-c)D = cS + D.
- *dstCoeff = kOne_BlendCoeff;
+ if (dstCoeffIsZero) {
+ if (kZero_BlendCoeff == *srcCoeff) {
+ // the source color is not included in the blend
+ // the dst coeff is effectively zero so blend works out to:
+ // (c)(0)D + (1-c)D = (1-c)D.
+ *dstCoeff = kISA_BlendCoeff;
+ return kEmitCoverage_BlendOptFlag;
+ } else if (srcAIsOne) {
+ // the dst coeff is effectively zero so blend works out to:
+ // cS + (c)(0)D + (1-c)D = cS + (1-c)D.
+ // If Sa is 1 then we can replace Sa with c
+ // and set dst coeff to 1-Sa.
+ *dstCoeff = kISA_BlendCoeff;
return kCoverageAsAlpha_BlendOptFlag;
}
+ } else if (dstCoeffIsOne) {
+ // the dst coeff is effectively one so blend works out to:
+ // cS + (c)(1)D + (1-c)D = cS + D.
+ *dstCoeff = kOne_BlendCoeff;
+ return kCoverageAsAlpha_BlendOptFlag;
}
}
return kNone_BlendOpt;
@@ -1213,7 +1204,6 @@ void GrDrawTarget::Caps::print() const {
GrPrintf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport]);
GrPrintf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]);
GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]);
- GrPrintf("Shader Support : %s\n", gNY[fShaderSupport]);
GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]);
GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]);
GrPrintf("FSAA Support : %s\n", gNY[fFSAASupport]);
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 76aa411801..d52565d520 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -45,7 +45,6 @@ public:
bool fTwoSidedStencilSupport : 1;
bool fStencilWrapOpsSupport : 1;
bool fHWAALineSupport : 1;
- bool fShaderSupport : 1;
bool fShaderDerivativeSupport : 1;
bool fGeometryShaderSupport : 1;
bool fFSAASupport : 1;
diff --git a/src/gpu/GrGpuGLShaders.cpp b/src/gpu/GrGpuGLShaders.cpp
index e9aea2abfa..c2031683a5 100644
--- a/src/gpu/GrGpuGLShaders.cpp
+++ b/src/gpu/GrGpuGLShaders.cpp
@@ -309,8 +309,7 @@ GrGpuGLShaders::GrGpuGLShaders(const GrGLInterface* gl)
GrGLSLGeneration glslGeneration =
GetGLSLGeneration(this->glBinding(), gl);
- // Enable supported shader-releated caps
- fCaps.fShaderSupport = true;
+ // Enable supported shader-related caps
fCaps.fSupportPerVertexCoverage = true;
if (kDesktop_GrGLBinding == this->glBinding()) {
fCaps.fDualSourceBlendingSupport =
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 49b94c3b9b..96d9fc61bc 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -856,8 +856,7 @@ static bool drawWithGPUMaskFilter(GrContext* context, const SkPath& path,
#endif
SkMaskFilter::BlurInfo info;
SkMaskFilter::BlurType blurType = filter->asABlur(&info);
- if (SkMaskFilter::kNone_BlurType == blurType ||
- !context->supportsShaders()) {
+ if (SkMaskFilter::kNone_BlurType == blurType) {
return false;
}
SkScalar radius = info.fIgnoreTransform ? info.fRadius