8#ifndef GrProcessorSet_DEFINED
9#define GrProcessorSet_DEFINED
24 enum class Empty { kEmpty };
40 return fColorFragmentProcessor.get();
43 return fCoverageFragmentProcessor.get();
48 return fXP.fProcessor;
56 return std::move(fColorFragmentProcessor);
60 return std::move(fCoverageFragmentProcessor);
74 Analysis() { *
reinterpret_cast<uint32_t*
>(
this) = 0; }
88 return fInputColorType == kOverridden_InputColorType;
95 : fUsesLocalCoords(
false)
96 , fCompatibleWithCoverageAsAlpha(
true)
97 , fRequiresDstTexture(
false)
98 , fRequiresNonOverlappingDraws(
false)
99 , fHasColorFragmentProcessor(
false)
100 , fIsInitialized(
true)
101 , fUsesNonCoherentHWBlending(
false)
102 , fUnaffectedByDstValue(
false)
103 , fInputColorType(kOriginal_InputColorType) {}
104 enum InputColorType : uint32_t {
105 kOriginal_InputColorType,
106 kOverridden_InputColorType,
107 kIgnored_InputColorType
111 using PackedBool = uint32_t;
112 using PackedInputColorType = uint32_t;
114 PackedBool fUsesLocalCoords : 1;
115 PackedBool fCompatibleWithCoverageAsAlpha : 1;
116 PackedBool fRequiresDstTexture : 1;
117 PackedBool fRequiresNonOverlappingDraws : 1;
118 PackedBool fHasColorFragmentProcessor : 1;
119 PackedBool fIsInitialized : 1;
120 PackedBool fUsesNonCoherentHWBlending : 1;
121 PackedBool fUnaffectedByDstValue : 1;
122 PackedInputColorType fInputColorType : 2;
126 static_assert(
sizeof(
Analysis) <=
sizeof(uint32_t));
153#if defined(GR_TEST_UTILS)
162 int numFragmentProcessors()
const {
163 return (fColorFragmentProcessor ? 1 : 0) + (fCoverageFragmentProcessor ? 1 : 0);
166 enum Flags : uint16_t { kFinalized_Flag = 0x1 };
169 XP(
const GrXPFactory* factory) : fFactory(factory) {}
171 explicit XP(XP&& that) : fProcessor(that.fProcessor) {
172 SkASSERT(fProcessor == that.fProcessor);
173 that.fProcessor =
nullptr;
184 std::unique_ptr<GrFragmentProcessor> fColorFragmentProcessor;
185 std::unique_ptr<GrFragmentProcessor> fCoverageFragmentProcessor;
GrProcessorAnalysisCoverage
std::function< void(GrSurfaceProxy *, skgpu::Mipmapped)> GrVisitProxyFunc
sk_sp< T > sk_ref_sp(T *obj)
static constexpr bool SkToBool(const T &x)
bool inputColorIsIgnored() const
bool requiresNonOverlappingDraws() const
bool inputColorIsOverridden() const
bool usesLocalCoords() const
Analysis(const Analysis &)=default
bool usesNonCoherentHWBlending() const
bool unaffectedByDstValue() const
bool isInitialized() const
bool hasColorFragmentProcessor() const
Analysis & operator=(const Analysis &other)=default
bool requiresDstTexture() const
bool isCompatibleWithCoverageAsAlpha() const
const GrFragmentProcessor * coverageFragmentProcessor() const
std::unique_ptr< GrFragmentProcessor > detachCoverageFragmentProcessor()
bool operator!=(const GrProcessorSet &that) const
static constexpr Analysis EmptySetAnalysis()
bool hasCoverageFragmentProcessor() const
void visitProxies(const GrVisitProxyFunc &) const
std::unique_ptr< GrFragmentProcessor > detachColorFragmentProcessor()
GrProcessorSet & operator=(const GrProcessorSet &)=delete
bool hasColorFragmentProcessor() const
GrProcessorSet(const GrProcessorSet &)=delete
GrProcessorSet(GrPaint &&)
static const GrProcessorSet & EmptySet()
Analysis finalize(const GrProcessorAnalysisColor &, const GrProcessorAnalysisCoverage, const GrAppliedClip *, const GrUserStencilSettings *, const GrCaps &, GrClampType, SkPMColor4f *inputColorOverride)
bool operator==(const GrProcessorSet &that) const
const GrFragmentProcessor * colorFragmentProcessor() const
const GrXferProcessor * xferProcessor() const
static GrProcessorSet MakeEmptySet()
sk_sp< const GrXferProcessor > refXferProcessor() const