Move willColorBlendWithDst from pipeline builder to GrPipelineOptimizations.
Review URL: https://codereview.chromium.org/1285193004
This commit is contained in:
parent
7ef45a1aeb
commit
2d563030a8
@ -66,7 +66,7 @@ void GrBufferedDrawTarget::onDrawPaths(const GrPathProcessor* pathProc,
|
||||
}
|
||||
fCommands->recordDrawPaths(state, this, pathProc, pathRange, indices, indexType,
|
||||
transformValues, transformType, count, stencilSettings,
|
||||
pipelineInfo);
|
||||
opts);
|
||||
}
|
||||
|
||||
void GrBufferedDrawTarget::onClear(const SkIRect& rect, GrColor color,
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
GrDrawTarget::PathTransformType ,
|
||||
int,
|
||||
const GrStencilSettings&,
|
||||
const GrDrawTarget::PipelineInfo&) = 0;
|
||||
const GrPipelineOptimizations&) = 0;
|
||||
virtual Cmd* recordClear(const SkIRect& rect,
|
||||
GrColor,
|
||||
GrRenderTarget*);
|
||||
|
@ -216,10 +216,6 @@ public:
|
||||
return fArgs;
|
||||
}
|
||||
|
||||
bool willColorBlendWithDst(const GrPrimitiveProcessor* primProc) const {
|
||||
SkASSERT(this->valid());
|
||||
return fArgs.fPipelineBuilder->willColorBlendWithDst(primProc);
|
||||
}
|
||||
private:
|
||||
GrPipeline::CreateArgs fArgs;
|
||||
};
|
||||
|
@ -78,7 +78,7 @@ GrInOrderCommandBuilder::recordDrawPaths(State* state,
|
||||
GrDrawTarget::PathTransformType transformType,
|
||||
int count,
|
||||
const GrStencilSettings& stencilSettings,
|
||||
const GrDrawTarget::PipelineInfo& pipelineInfo) {
|
||||
const GrPipelineOptimizations& opts) {
|
||||
SkASSERT(pathRange);
|
||||
SkASSERT(indexValues);
|
||||
SkASSERT(transformValues);
|
||||
@ -105,7 +105,7 @@ GrInOrderCommandBuilder::recordDrawPaths(State* state,
|
||||
stencilSettings == previous->fStencilSettings &&
|
||||
path_fill_type_is_winding(stencilSettings) &&
|
||||
previous->fState == state &&
|
||||
!pipelineInfo.willColorBlendWithDst(pathProc)) {
|
||||
!opts.willColorBlendWithDst()) {
|
||||
|
||||
const int indexBytes = GrPathRange::PathIndexSizeInBytes(indexType);
|
||||
const int xformSize = GrPathRendering::PathTransformSize(transformType);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
GrDrawTarget::PathTransformType ,
|
||||
int,
|
||||
const GrStencilSettings&,
|
||||
const GrDrawTarget::PipelineInfo&) override;
|
||||
const GrPipelineOptimizations&) override;
|
||||
|
||||
private:
|
||||
typedef GrCommandBuilder INHERITED;
|
||||
|
@ -120,6 +120,13 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
|
||||
if (SkToBool(optFlags & GrXferProcessor::kCanTweakAlphaForCoverage_OptFlag)) {
|
||||
opts->fFlags |= GrPipelineOptimizations::kCanTweakAlphaForCoverage_Flag;
|
||||
}
|
||||
|
||||
GrXPFactory::InvariantBlendedColor blendedColor;
|
||||
builder.fXPFactory->getInvariantBlendedColor(args.fColorPOI, &blendedColor);
|
||||
if (blendedColor.fWillBlendWithDst) {
|
||||
opts->fFlags |= GrPipelineOptimizations::kWillColorBlendWithDst_Flag;
|
||||
}
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
|
@ -133,14 +133,6 @@ GrPipelineBuilder::~GrPipelineBuilder() {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool GrPipelineBuilder::willColorBlendWithDst(const GrPrimitiveProcessor* pp) const {
|
||||
this->calcColorInvariantOutput(pp);
|
||||
|
||||
GrXPFactory::InvariantBlendedColor blendedColor;
|
||||
fXPFactory->getInvariantBlendedColor(fColorProcInfo, &blendedColor);
|
||||
return blendedColor.fWillBlendWithDst;
|
||||
}
|
||||
|
||||
void GrPipelineBuilder::calcColorInvariantOutput(const GrPrimitiveProcessor* pp) const {
|
||||
fColorProcInfo.calcColorWithPrimProc(pp, fColorStages.begin(), this->numColorFragmentStages());
|
||||
fColorProcInfoValid = false;
|
||||
|
@ -160,14 +160,6 @@ public:
|
||||
/// @name Blending
|
||||
////
|
||||
|
||||
/**
|
||||
* Returns true if this pipeline's color output will be affected by the existing render target
|
||||
* destination pixel values (meaning we need to be careful with overlapping draws). Note that we
|
||||
* can conflate coverage and color, so the destination color may still bleed into pixels that
|
||||
* have partial coverage, even if this function returns false.
|
||||
*/
|
||||
bool willColorBlendWithDst(const GrPrimitiveProcessor*) const;
|
||||
|
||||
/**
|
||||
* Installs a GrXPFactory. This object controls how src color, fractional pixel coverage,
|
||||
* and the dst color are blended.
|
||||
@ -430,7 +422,6 @@ private:
|
||||
//
|
||||
// canUseFracCoveragePrimProc() - Called in regular skia draw, caches results but only for a
|
||||
// specific color and coverage. May be called multiple times
|
||||
// willColorBlendWithDst() - only called by Nvpr, does not cache results
|
||||
// GrOptDrawState constructor - never caches results
|
||||
|
||||
/**
|
||||
|
@ -113,6 +113,19 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the pipeline's color output will be affected by the existing render target
|
||||
* destination pixel values (meaning we need to be careful with overlapping draws). Note that we
|
||||
* can conflate coverage and color, so the destination color may still bleed into pixels that
|
||||
* have partial coverage, even if this function returns false.
|
||||
*
|
||||
* The above comment seems incorrect for the use case. This funciton is used to turn two
|
||||
* overlapping draws into a single draw (really to stencil multiple paths and do a single
|
||||
* cover). It seems that what really matters is whether the dst is read for color OR for
|
||||
* coverage.
|
||||
*/
|
||||
bool willColorBlendWithDst() const { return SkToBool(kWillColorBlendWithDst_Flag & fFlags); }
|
||||
|
||||
private:
|
||||
enum {
|
||||
// If this is not set the primitive processor need not produce a color output
|
||||
@ -131,6 +144,8 @@ private:
|
||||
// If this flag is set the GrPrimitiveProcessor must produce fOverrideColor as its
|
||||
// output color. If not set fOverrideColor is to be ignored.
|
||||
kUseOverrideColor_Flag = 0x10,
|
||||
|
||||
kWillColorBlendWithDst_Flag = 0x20,
|
||||
};
|
||||
|
||||
uint32_t fFlags;
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
GrDrawTarget::PathTransformType ,
|
||||
int,
|
||||
const GrStencilSettings&,
|
||||
const GrDrawTarget::PipelineInfo&) override {
|
||||
const GrPipelineOptimizations&) override {
|
||||
SkFAIL("Unsupported\n");
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user