aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrXferProcessor.h
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-02-22 11:52:03 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-22 19:41:30 +0000
commit5298dc8bf30f580f551d130346c007efaf4b2098 (patch)
treeea8df60caf9add5e08f06bdd6615f67307256f23 /src/gpu/GrXferProcessor.h
parent3661bc997620899695041010a750d11dbe8a972d (diff)
Make GrPipelineAnalysis a nested class of GrProcessorSet.
It is renamed to FragmentProcessorAnalysis since it represents the outputs of the final FPs. It now stores the analysis results that are subsequently needed rather than exposing GrProcOptInfo. GrProcOptInfo is now only used on color FPs (not coverage). Miscellaneous related renamings. Change-Id: I95c518a7a76df6dc294a9fa67c611f8f653247bc Reviewed-on: https://skia-review.googlesource.com/8534 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrXferProcessor.h')
-rw-r--r--src/gpu/GrXferProcessor.h55
1 files changed, 21 insertions, 34 deletions
diff --git a/src/gpu/GrXferProcessor.h b/src/gpu/GrXferProcessor.h
index 9cb7189133..5ce06571a2 100644
--- a/src/gpu/GrXferProcessor.h
+++ b/src/gpu/GrXferProcessor.h
@@ -11,13 +11,13 @@
#include "GrBlend.h"
#include "GrColor.h"
#include "GrProcessor.h"
+#include "GrProcessorSet.h"
#include "GrTexture.h"
#include "GrTypes.h"
class GrShaderCaps;
class GrGLSLXferProcessor;
class GrProcOptInfo;
-struct GrPipelineAnalysis;
/**
* Barriers for blending. When a shader reads the dst directly, an Xfer barrier is sometimes
@@ -49,6 +49,8 @@ GR_STATIC_ASSERT(SkToBool(kNone_GrXferBarrierType) == false);
*/
class GrXferProcessor : public GrProcessor {
public:
+ using FragmentProcessorAnalysis = GrProcessorSet::FragmentProcessorAnalysis;
+
/**
* A texture that contains the dst pixel values and an integer coord offset from device space
* to the space of the texture. Depending on GPU capabilities a DstTexture may be used by a
@@ -131,11 +133,11 @@ public:
* the draw with this xfer processor. If this function is called, the xfer processor may change
* its state to reflected the given blend optimizations. If the XP needs to see a specific input
* color to blend correctly, it will set the OverrideColor flag and the output parameter
- * overrideColor will be the required value that should be passed into the XP.
+ * overrideColor will be the required value that should be passed into the XP.
* A caller who calls this function on a XP is required to honor the returned OptFlags
* and color values for its draw.
*/
- OptFlags getOptimizations(const GrPipelineAnalysis&,
+ OptFlags getOptimizations(const FragmentProcessorAnalysis&,
bool doesStencilWrite,
GrColor* overrideColor,
const GrCaps& caps) const;
@@ -231,7 +233,7 @@ protected:
private:
void notifyRefCntIsZero() const final {}
- virtual OptFlags onGetOptimizations(const GrPipelineAnalysis&,
+ virtual OptFlags onGetOptimizations(const FragmentProcessorAnalysis&,
bool doesStencilWrite,
GrColor* overrideColor,
const GrCaps& caps) const = 0;
@@ -306,18 +308,11 @@ GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags);
#endif
class GrXPFactory {
public:
- typedef GrXferProcessor::DstTexture DstTexture;
-
- /** Describes known properties of a draw's color input to the GrXferProcessor. */
- enum class ColorType { kUnknown, kOpaqueConstant, kConstant, kOpaque };
+ using FragmentProcessorAnalysis = GrProcessorSet::FragmentProcessorAnalysis;
- /**
- * Indicates whether a draw's coverage input to the GrXferProcessor is solid, single channel
- * or LCD (four channel coverage).
- */
- enum class CoverageType { kNone, kSingleChannel, kLCD };
+ typedef GrXferProcessor::DstTexture DstTexture;
- GrXferProcessor* createXferProcessor(const GrPipelineAnalysis&,
+ GrXferProcessor* createXferProcessor(const FragmentProcessorAnalysis&,
bool hasMixedSamples,
const DstTexture*,
const GrCaps& caps) const;
@@ -325,44 +320,36 @@ public:
/**
* Is the destination color required either in the shader or fixed function blending.
*/
- static bool WillReadDst(const GrXPFactory*, const GrProcOptInfo& colorInput,
- const GrProcOptInfo& coverageInput);
+ static bool WillReadDst(const GrXPFactory*, const FragmentProcessorAnalysis&);
- /**
- * This will return true if the xfer processor needs the dst color in the shader and the way
- * that the color will be made available to the xfer processor is by sampling a texture.
- */
- bool willNeedDstTexture(const GrCaps& caps, const GrPipelineAnalysis& analysis) const;
+ /**
+ * This will return true if the xfer processor needs the dst color in the shader and the way
+ * that the color will be made available to the xfer processor is by sampling a texture.
+ */
+ static bool WillNeedDstTexture(const GrXPFactory*,
+ const GrCaps&,
+ const FragmentProcessorAnalysis&);
protected:
constexpr GrXPFactory() {}
- static bool ColorTypeIsOpaque(ColorType type) {
- return ColorType::kOpaqueConstant == type || ColorType::kOpaque == type;
- }
-
- static bool ColorTypeIsConstant(ColorType type) {
- return ColorType::kOpaqueConstant == type || ColorType::kConstant == type;
- }
-
private:
/** Subclass-specific implementation of WillReadDst(). */
- virtual bool willReadsDst(const GrProcOptInfo& colorInput,
- const GrProcOptInfo& coverageInput) const = 0;
+ virtual bool willReadsDst(const FragmentProcessorAnalysis& pipelineAnalysis) const = 0;
virtual GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
- const GrPipelineAnalysis&,
+ const FragmentProcessorAnalysis&,
bool hasMixedSamples,
const DstTexture*) const = 0;
- bool willReadDstInShader(const GrCaps& caps, const GrPipelineAnalysis& analysis) const;
+ bool willReadDstInShader(const GrCaps& caps, const FragmentProcessorAnalysis& analysis) const;
/**
* Returns true if the XP generated by this factory will explicitly read dst in the fragment
* shader. This will not be called for draws that read from PLS since the dst color is always
* available in such draws.
*/
- virtual bool willReadDstInShader(const GrCaps&, ColorType, CoverageType) const = 0;
+ virtual bool onWillReadDstInShader(const GrCaps&, const FragmentProcessorAnalysis&) const = 0;
};
#if defined(__GNUC__) || defined(__clang)
#pragma GCC diagnostic pop