aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-01-20 11:30:37 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-20 17:20:34 +0000
commitf833215420847565b4c9945aebdc2e7ae182937f (patch)
treef23c58f718082ffdbcace1d267a8d24c27f6fb44 /include
parent77505da16093695f717ad34ff100ec11ffb2835b (diff)
Make it possible to query GrXPFactory for dst texture without GrPipelineAnalysis.
Change-Id: I8c140eb4e3e5f2d21ecbf8f8f3c8533dc7f50e7c Reviewed-on: https://skia-review.googlesource.com/7316 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrXferProcessor.h27
-rw-r--r--include/gpu/effects/GrCoverageSetOpXP.h4
-rw-r--r--include/gpu/effects/GrPorterDuffXferProcessor.h2
3 files changed, 25 insertions, 8 deletions
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 17cd2c7bf3..353c682f96 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -307,6 +307,16 @@ GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags);
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 };
+
+ /**
+ * 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 };
+
GrXferProcessor* createXferProcessor(const GrPipelineAnalysis&,
bool hasMixedSamples,
const DstTexture*,
@@ -329,24 +339,33 @@ public:
virtual void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
InvariantBlendedColor*) const = 0;
- bool willNeedDstTexture(const GrCaps& caps, const GrPipelineAnalysis&) const;
+ bool willNeedDstTexture(const GrCaps& caps, const GrPipelineAnalysis& analysis) const;
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:
virtual GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
const GrPipelineAnalysis&,
bool hasMixedSamples,
const DstTexture*) const = 0;
- bool willReadDstColor(const GrCaps&, const GrPipelineAnalysis&) const;
+ bool willReadDstColor(const GrCaps& caps, const GrPipelineAnalysis& analysis) const;
/**
* Returns true if the XP generated by this factory will explicitly read dst in the fragment
- * shader.
+ * shader. This will not be called for draws that read from PLS since the dst color is always
+ * available in such draws.
*/
- virtual bool onWillReadDstColor(const GrCaps&, const GrPipelineAnalysis&) const = 0;
+ virtual bool willReadDstColor(const GrCaps&, ColorType, CoverageType) const = 0;
};
#if defined(__GNUC__) || defined(__clang)
#pragma GCC diagnostic pop
diff --git a/include/gpu/effects/GrCoverageSetOpXP.h b/include/gpu/effects/GrCoverageSetOpXP.h
index ca71abc4e0..385cad865e 100644
--- a/include/gpu/effects/GrCoverageSetOpXP.h
+++ b/include/gpu/effects/GrCoverageSetOpXP.h
@@ -40,9 +40,7 @@ private:
bool hasMixedSamples,
const DstTexture*) const override;
- bool onWillReadDstColor(const GrCaps&, const GrPipelineAnalysis&) const override {
- return false;
- }
+ bool willReadDstColor(const GrCaps&, ColorType, CoverageType) const override { return false; }
GR_DECLARE_XP_FACTORY_TEST;
diff --git a/include/gpu/effects/GrPorterDuffXferProcessor.h b/include/gpu/effects/GrPorterDuffXferProcessor.h
index ca14275926..028cac65c8 100644
--- a/include/gpu/effects/GrPorterDuffXferProcessor.h
+++ b/include/gpu/effects/GrPorterDuffXferProcessor.h
@@ -63,7 +63,7 @@ private:
bool hasMixedSamples,
const DstTexture*) const override;
- bool onWillReadDstColor(const GrCaps&, const GrPipelineAnalysis&) const override;
+ bool willReadDstColor(const GrCaps&, ColorType, CoverageType) const override;
GR_DECLARE_XP_FACTORY_TEST;
static void TestGetXPOutputTypes(const GrXferProcessor*, int* outPrimary, int* outSecondary);