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

Unified Diff: include/gpu/GrXferProcessor.h

Issue 1287973003: Check for xfer barriers in GrBatch, auto-issue barriers in GrGpu (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 5 years, 4 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/gpu/GrAAConvexPathRenderer.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 41f8abb74058503441e8fa94dbeb27f7310bdfe5..1d571db64eedc37b0ed1cf00032e09cf096c13d3 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -25,9 +25,12 @@ class GrProcOptInfo;
* required after a pixel has been written, before it can be safely read again.
*/
enum GrXferBarrierType {
- kTexture_GrXferBarrierType, //<! Required when a shader reads and renders to the same texture.
- kBlend_GrXferBarrierType, //<! Required by certain blend extensions.
+ kNone_GrXferBarrierType = 0, //<! No barrier is required
+ kTexture_GrXferBarrierType, //<! Required when a shader reads and renders to the same texture.
+ kBlend_GrXferBarrierType, //<! Required by certain blend extensions.
};
+/** Should be able to treat kNone as false in boolean expressions */
+GR_STATIC_ASSERT(SkToBool(kNone_GrXferBarrierType) == false);
/**
* GrXferProcessor is responsible for implementing the xfer mode that blends the src color and dst
@@ -148,9 +151,7 @@ public:
* Returns whether this XP will require an Xfer barrier on the given rt. If true, outBarrierType
* is updated to contain the type of barrier needed.
*/
- bool willNeedXferBarrier(const GrRenderTarget* rt,
- const GrCaps& caps,
- GrXferBarrierType* outBarrierType) const;
+ GrXferBarrierType xferBarrierType(const GrRenderTarget* rt, const GrCaps& caps) const;
struct BlendInfo {
void reset() {
@@ -256,13 +257,12 @@ private:
GrProcessorKeyBuilder* b) const = 0;
/**
- * If not using a texture barrier, retrieves whether the subclass will require a different type
- * of barrier.
+ * Determines the type of barrier (if any) required by the subclass. Note that the possibility
+ * that a kTexture type barrier is required is handled by the base class and need not be
+ * considered by subclass overrides of this function.
*/
- virtual bool onWillNeedXferBarrier(const GrRenderTarget*,
- const GrCaps&,
- GrXferBarrierType* outBarrierType SK_UNUSED) const {
- return false;
+ virtual GrXferBarrierType onXferBarrier(const GrRenderTarget*, const GrCaps&) const {
+ return kNone_GrXferBarrierType;
}
/**
« no previous file with comments | « no previous file | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698