Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: include/gpu/GrXferProcessor.h

Issue 1170553002: Apply coverage in XP base class when using dst reads (Closed) Base URL: https://skia.googlesource.com/skia.git@upload2_reenablebea
Patch Set: names Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/effects/SkArithmeticMode_gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrXferProcessor.h
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index d39163c6df00989f9da0df5731cdb74875c8e6b9..7ed98a34bc049cbfd8832855437e525db12d22cd 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -90,13 +90,16 @@ enum GrXferBarrierType {
/**
* GrXferProcessor is responsible for implementing the xfer mode that blends the src color and dst
- * color. It does this by emitting fragment shader code and controlling the fixed-function blend
- * state. The inputs to its shader code are the final computed src color and fractional pixel
- * coverage. The GrXferProcessor's shader code writes the fragment shader output color that goes
- * into the fixed-function blend. When dual-source blending is available, it may also write a
- * seconday fragment shader output color. When allowed by the backend API, the GrXferProcessor may
- * read the destination color. The GrXferProcessor is responsible for setting the blend coefficients
- * and blend constant color.
+ * color, and for applying any coverage. It does this by emitting fragment shader code and
+ * controlling the fixed-function blend state. When dual-source blending is available, it may also
+ * write a seconday fragment shader output color. GrXferProcessor has two modes of operation:
+ *
+ * Dst read: When allowed by the backend API, or when supplied a texture of the destination, the
+ * GrXferProcessor may read the destination color. While operating in this mode, the subclass only
+ * provides shader code that blends the src and dst colors, and the base class applies coverage.
+ *
+ * No dst read: When not performing a dst read, the subclass is given full control of the fixed-
+ * function blend state and/or secondary output, and is responsible to apply coverage on its own.
*
* A GrXferProcessor is never installed directly into our draw state, but instead is created from a
* GrXPFactory once we have finalized the state of our draw.
@@ -228,10 +231,7 @@ public:
bool fWriteColor;
};
- void getBlendInfo(BlendInfo* blendInfo) const {
- blendInfo->reset();
- this->onGetBlendInfo(blendInfo);
- }
+ void getBlendInfo(BlendInfo* blendInfo) const;
bool willReadDstColor() const { return fWillReadDstColor; }
@@ -256,11 +256,11 @@ public:
*/
bool readsCoverage() const { return fReadsCoverage; }
- /**
+ /**
* Returns whether or not this xferProcossor will set a secondary output to be used with dual
* source blending.
*/
- virtual bool hasSecondaryOutput() const { return false; }
+ bool hasSecondaryOutput() const;
/** Returns true if this and other processor conservatively draw identically. It can only return
true when the two processor are of the same subclass (i.e. they return the same object from
@@ -317,9 +317,16 @@ private:
}
/**
- * Retrieves the hardware blend state required by this Xfer processor. The BlendInfo struct
- * comes initialized to default values, so the Xfer processor only needs to set the state it
- * needs. It may not even need to override this method at all.
+ * If we are not performing a dst read, returns whether the subclass will set a secondary
+ * output. When using dst reads, the base class disables the secondary output and this method
+ * will not be called.
+ */
+ virtual bool onHasSecondaryOutput() const { return false; }
+
+ /**
+ * If we are not performing a dst read, retrieves the fixed-function blend state required by the
+ * subclass. When using dst reads, the base class disables fixed-function blending and this
+ * method will not be called. The BlendInfo struct comes initialized to "no blending".
*/
virtual void onGetBlendInfo(BlendInfo*) const {}
« no previous file with comments | « no previous file | src/effects/SkArithmeticMode_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698