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