зеркало из https://github.com/mozilla/moz-skia.git
Remove shadersupport caps bit
Review URL: http://codereview.appspot.com/5528076/ git-svn-id: http://skia.googlecode.com/svn/trunk@3015 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
3d19c385e7
Коммит
dafde9e2c1
|
@ -450,11 +450,6 @@ public:
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// Misc.
|
||||
|
||||
/**
|
||||
* Currently needed by SkGpuDevice. Ideally this shouldn't be exposed.
|
||||
*/
|
||||
bool supportsShaders() const;
|
||||
|
||||
/**
|
||||
* Flags that affect flush() behavior.
|
||||
*/
|
||||
|
|
|
@ -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();
|
||||
record->fTileSizeX = record->fOffscreen.texture()->width();
|
||||
record->fTileSizeY = record->fOffscreen.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->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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
} 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,9 +931,6 @@ 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
|
||||
|
@ -961,7 +953,6 @@ GrDrawTarget::getBlendOpts(bool forceCoverage,
|
|||
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]);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче