Remove srgb flags from GrProcessorSet
Bug: skia: Change-Id: Icbb1b2f39cac70c9d74603514786d76b46d0afd9 Reviewed-on: https://skia-review.googlesource.com/14603 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
fe53e5828f
commit
611572ce3e
@ -36,12 +36,6 @@ void GrPipeline::init(const InitArgs& args) {
|
||||
if (args.fProcessors->usesDistanceVectorField()) {
|
||||
fFlags |= kUsesDistanceVectorField_Flag;
|
||||
}
|
||||
if (args.fProcessors->disableOutputConversionToSRGB()) {
|
||||
fFlags |= kDisableOutputConversionToSRGB_Flag;
|
||||
}
|
||||
if (args.fProcessors->allowSRGBInputs()) {
|
||||
fFlags |= kAllowSRGBInputs_Flag;
|
||||
}
|
||||
if (!args.fUserStencil->isDisabled(fFlags & kHasStencilClip_Flag)) {
|
||||
fFlags |= kStencilEnabled_Flag;
|
||||
}
|
||||
|
@ -46,13 +46,27 @@ public:
|
||||
* the 3D API.
|
||||
*/
|
||||
kHWAntialias_Flag = 0x1,
|
||||
|
||||
/**
|
||||
* Modifies the vertex shader so that vertices will be positioned at pixel centers.
|
||||
*/
|
||||
kSnapVerticesToPixelCenters_Flag = 0x2,
|
||||
/** Disables conversion to sRGB from linear when writing to a sRGB destination. */
|
||||
kDisableOutputConversionToSRGB_Flag = 0x4,
|
||||
/** Allows conversion from sRGB to linear when reading from processor's sRGB texture. */
|
||||
kAllowSRGBInputs_Flag = 0x8,
|
||||
};
|
||||
|
||||
static uint32_t SRGBFlagsFromPaint(const GrPaint& paint) {
|
||||
uint32_t flags = 0;
|
||||
if (paint.getAllowSRGBInputs()) {
|
||||
flags |= kAllowSRGBInputs_Flag;
|
||||
}
|
||||
if (paint.getDisableOutputConversionToSRGB()) {
|
||||
flags |= kDisableOutputConversionToSRGB_Flag;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
struct InitArgs {
|
||||
uint32_t fFlags = 0;
|
||||
GrDrawFace fDrawFace = GrDrawFace::kBoth;
|
||||
@ -217,8 +231,6 @@ public:
|
||||
private:
|
||||
/** This is a continuation of the public "Flags" enum. */
|
||||
enum PrivateFlags {
|
||||
kDisableOutputConversionToSRGB_Flag = 0x4,
|
||||
kAllowSRGBInputs_Flag = 0x8,
|
||||
kUsesDistanceVectorField_Flag = 0x10,
|
||||
kHasStencilClip_Flag = 0x20,
|
||||
kStencilEnabled_Flag = 0x40,
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
* which is unmodified by this function and clipping which will be enabled.
|
||||
*/
|
||||
GrPipelineBuilder(GrPaint&& paint, GrAAType aaType)
|
||||
: fFlags(0x0)
|
||||
: fFlags(GrPipeline::SRGBFlagsFromPaint(paint))
|
||||
, fDrawFace(GrDrawFace::kBoth)
|
||||
, fUserStencilSettings(&GrUserStencilSettings::kUnused)
|
||||
, fProcessors(std::move(paint)) {
|
||||
|
@ -30,12 +30,6 @@ GrProcessorSet::GrProcessorSet(GrPaint&& paint) : fXP(paint.getXPFactory()) {
|
||||
SkDebugf("Insane number of color fragment processors in paint. Dropping all processors.");
|
||||
fColorFragmentProcessorCnt = 0;
|
||||
}
|
||||
if (paint.getDisableOutputConversionToSRGB()) {
|
||||
fFlags |= kDisableOutputConversionToSRGB_Flag;
|
||||
}
|
||||
if (paint.getAllowSRGBInputs()) {
|
||||
fFlags |= kAllowSRGBInputs_Flag;
|
||||
}
|
||||
}
|
||||
|
||||
GrProcessorSet::~GrProcessorSet() {
|
||||
|
@ -49,10 +49,6 @@ public:
|
||||
}
|
||||
|
||||
bool usesDistanceVectorField() const { return SkToBool(fFlags & kUseDistanceVectorField_Flag); }
|
||||
bool disableOutputConversionToSRGB() const {
|
||||
return SkToBool(fFlags & kDisableOutputConversionToSRGB_Flag);
|
||||
}
|
||||
bool allowSRGBInputs() const { return SkToBool(fFlags & kAllowSRGBInputs_Flag); }
|
||||
|
||||
/** Comparisons are only legal on finalized processor sets. */
|
||||
bool operator==(const GrProcessorSet& that) const;
|
||||
@ -130,12 +126,7 @@ private:
|
||||
// This absurdly large limit allows Analysis and this to pack fields together.
|
||||
static constexpr int kMaxColorProcessors = UINT8_MAX;
|
||||
|
||||
enum Flags : uint16_t {
|
||||
kUseDistanceVectorField_Flag = 0x1,
|
||||
kDisableOutputConversionToSRGB_Flag = 0x2,
|
||||
kAllowSRGBInputs_Flag = 0x4,
|
||||
kFinalized_Flag = 0x8
|
||||
};
|
||||
enum Flags : uint16_t { kUseDistanceVectorField_Flag = 0x1, kFinalized_Flag = 0x2 };
|
||||
|
||||
union XP {
|
||||
XP(const GrXPFactory* factory) : fFactory(factory) {}
|
||||
|
@ -17,13 +17,15 @@ namespace gr_instanced {
|
||||
|
||||
InstancedOp::InstancedOp(uint32_t classID, GrPaint&& paint, OpAllocator* alloc)
|
||||
: INHERITED(classID)
|
||||
, fAllocator(alloc)
|
||||
, fInstancedRendering(nullptr)
|
||||
, fProcessors(std::move(paint))
|
||||
, fIsTracked(false)
|
||||
, fRequiresBarrierOnOverlap(false)
|
||||
, fAllowsSRGBInputs(paint.getAllowSRGBInputs())
|
||||
, fDisableSRGBOutputConversion(paint.getDisableOutputConversionToSRGB())
|
||||
, fNumDraws(1)
|
||||
, fNumChangesInGeometry(0) {
|
||||
, fNumChangesInGeometry(0)
|
||||
, fAllocator(alloc)
|
||||
, fInstancedRendering(nullptr)
|
||||
, fProcessors(std::move(paint)) {
|
||||
fHeadDraw = fTailDraw = alloc->allocateDraw();
|
||||
#ifdef SK_DEBUG
|
||||
fHeadDraw->fGeometry = {-1, 0};
|
||||
@ -173,6 +175,10 @@ bool InstancedOp::onCombineIfPossible(GrOp* other, const GrCaps&) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fAllowsSRGBInputs != that->fAllowsSRGBInputs ||
|
||||
fDisableSRGBOutputConversion != that->fDisableSRGBOutputConversion) {
|
||||
return false;
|
||||
}
|
||||
SkASSERT(fRequiresBarrierOnOverlap == that->fRequiresBarrierOnOverlap);
|
||||
if (fRequiresBarrierOnOverlap && this->bounds().intersects(that->bounds())) {
|
||||
return false;
|
||||
@ -225,6 +231,12 @@ void InstancedOp::onExecute(GrOpFlushState* state) {
|
||||
args.fCaps = &state->caps();
|
||||
args.fProcessors = &fProcessors;
|
||||
args.fFlags = GrAATypeIsHW(fInfo.aaType()) ? GrPipeline::kHWAntialias_Flag : 0;
|
||||
if (fAllowsSRGBInputs) {
|
||||
args.fFlags |= GrPipeline::kAllowSRGBInputs_Flag;
|
||||
}
|
||||
if (fDisableSRGBOutputConversion) {
|
||||
args.fFlags |= GrPipeline::kDisableOutputConversionToSRGB_Flag;
|
||||
}
|
||||
args.fRenderTarget = state->drawOpArgs().fRenderTarget;
|
||||
args.fDstTexture = state->drawOpArgs().fDstTexture;
|
||||
pipeline.init(args);
|
||||
|
@ -72,18 +72,20 @@ public:
|
||||
protected:
|
||||
InstancedOp(uint32_t classID, GrPaint&&, OpAllocator*);
|
||||
|
||||
bool fIsTracked : 1;
|
||||
bool fRequiresBarrierOnOverlap : 1;
|
||||
bool fAllowsSRGBInputs : 1;
|
||||
bool fDisableSRGBOutputConversion : 1;
|
||||
int fNumDraws;
|
||||
int fNumChangesInGeometry;
|
||||
Draw* fHeadDraw;
|
||||
Draw* fTailDraw;
|
||||
OpAllocator* fAllocator;
|
||||
InstancedRendering* fInstancedRendering;
|
||||
OpInfo fInfo;
|
||||
SkScalar fPixelLoad;
|
||||
GrProcessorSet fProcessors;
|
||||
SkSTArray<5, ParamsTexel, true> fParams;
|
||||
bool fIsTracked : 1;
|
||||
bool fRequiresBarrierOnOverlap : 1;
|
||||
int fNumDraws;
|
||||
int fNumChangesInGeometry;
|
||||
Draw* fHeadDraw;
|
||||
Draw* fTailDraw;
|
||||
|
||||
private:
|
||||
bool onCombineIfPossible(GrOp* other, const GrCaps& caps) override;
|
||||
|
@ -16,11 +16,10 @@ GrDrawPathOpBase::GrDrawPathOpBase(uint32_t classID, const SkMatrix& viewMatrix,
|
||||
: INHERITED(classID)
|
||||
, fViewMatrix(viewMatrix)
|
||||
, fInputColor(paint.getColor())
|
||||
, fProcessorSet(std::move(paint))
|
||||
, fFillType(fill)
|
||||
, fAAType(aaType) {
|
||||
SkASSERT(fAAType != GrAAType::kCoverage);
|
||||
}
|
||||
, fAAType(aaType)
|
||||
, fPipelineSRGBFlags(GrPipeline::SRGBFlagsFromPaint(paint))
|
||||
, fProcessorSet(std::move(paint)) {}
|
||||
|
||||
SkString GrDrawPathOp::dumpInfo() const {
|
||||
SkString string;
|
||||
@ -41,7 +40,10 @@ void GrDrawPathOpBase::initPipeline(const GrOpFlushState& state, GrPipeline* pip
|
||||
};
|
||||
GrPipeline::InitArgs args;
|
||||
args.fProcessors = &this->processors();
|
||||
args.fFlags = GrAATypeIsHW(fAAType) ? GrPipeline::kHWAntialias_Flag : 0;
|
||||
args.fFlags = fPipelineSRGBFlags;
|
||||
if (GrAATypeIsHW(fAAType)) {
|
||||
args.fFlags |= GrPipeline::kHWAntialias_Flag;
|
||||
}
|
||||
args.fUserStencil = &kCoverPass;
|
||||
args.fAppliedClip = state.drawOpArgs().fAppliedClip;
|
||||
args.fRenderTarget = state.drawOpArgs().fRenderTarget;
|
||||
@ -113,6 +115,9 @@ bool GrDrawPathRangeOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) {
|
||||
if (this->processors() != that->processors()) {
|
||||
return false;
|
||||
}
|
||||
if (this->pipelineSRGBFlags() != that->pipelineSRGBFlags()) {
|
||||
return false;
|
||||
}
|
||||
switch (fDraws.head()->fInstanceData->transformType()) {
|
||||
case GrPathRendering::kNone_PathTransformType:
|
||||
if (this->fDraws.head()->fX != that->fDraws.head()->fX ||
|
||||
|
@ -40,6 +40,7 @@ protected:
|
||||
GrColor color() const { return fInputColor; }
|
||||
GrPathRendering::FillType fillType() const { return fFillType; }
|
||||
const GrProcessorSet& processors() const { return fProcessorSet; }
|
||||
uint32_t pipelineSRGBFlags() const { return fPipelineSRGBFlags; }
|
||||
void initPipeline(const GrOpFlushState&, GrPipeline*);
|
||||
const GrProcessorSet::Analysis& doProcessorAnalysis(const GrCaps& caps,
|
||||
const GrAppliedClip* clip) {
|
||||
@ -58,10 +59,11 @@ private:
|
||||
|
||||
SkMatrix fViewMatrix;
|
||||
GrColor fInputColor;
|
||||
GrProcessorSet fProcessorSet;
|
||||
GrProcessorSet::Analysis fAnalysis;
|
||||
GrPathRendering::FillType fFillType;
|
||||
GrAAType fAAType;
|
||||
uint32_t fPipelineSRGBFlags;
|
||||
GrProcessorSet fProcessorSet;
|
||||
|
||||
typedef GrDrawOp INHERITED;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user