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

Unified Diff: src/gpu/GrPipeline.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 | « src/gpu/GrPathRendering.h ('k') | src/gpu/GrPipeline.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPipeline.h
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index ef81d216a62d277a213558bfe6a6c7d9b266f7a4..ea2ea855dc651d9b33fe832190c4c6fc331d2414 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -29,6 +29,9 @@ class GrPipelineBuilder;
*/
class GrPipeline : public GrNonAtomicRef {
public:
+ ///////////////////////////////////////////////////////////////////////////
+ /// @name Creation
+
struct CreateArgs {
const GrPipelineBuilder* fPipelineBuilder;
const GrCaps* fCaps;
@@ -41,13 +44,39 @@ public:
/** Creates a pipeline into a pre-allocated buffer */
static GrPipeline* CreateAt(void* memory, const CreateArgs&, GrPipelineOptimizations*);
- /*
+ /// @}
+
+ ///////////////////////////////////////////////////////////////////////////
+ /// @name Comparisons
+
+ /**
* Returns true if these pipelines are equivalent. Coord transforms may be applied either on
* the GPU or the CPU. When we apply them on the CPU then the matrices need not agree in order
* to combine draws. Therefore we take a param that indicates whether coord transforms should be
* compared."
*/
- bool isEqual(const GrPipeline& that, bool ignoreCoordTransforms = false) const;
+ static bool AreEqual(const GrPipeline& a, const GrPipeline& b, bool ignoreCoordTransforms);
+
+ /**
+ * Allows a GrBatch subclass to determine whether two GrBatches can combine. This is a stricter
+ * test than isEqual because it also considers blend barriers when the two batches' bounds
+ * overlap
+ */
+ static bool CanCombine(const GrPipeline& a, const SkRect& aBounds,
+ const GrPipeline& b, const SkRect& bBounds,
+ const GrCaps& caps,
+ bool ignoreCoordTransforms = false) {
+ if (!AreEqual(a, b, ignoreCoordTransforms)) {
+ return false;
+ }
+ if (a.xferBarrierType(caps)) {
+ return aBounds.fRight <= bBounds.fLeft ||
+ aBounds.fBottom <= bBounds.fTop ||
+ bBounds.fRight <= aBounds.fLeft ||
+ bBounds.fBottom <= aBounds.fTop;
+ }
+ return true;
+ }
/// @}
@@ -90,6 +119,10 @@ public:
bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); }
bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVertices_Flag); }
+ GrXferBarrierType xferBarrierType(const GrCaps& caps) const {
+ return fXferProcessor->xferBarrierType(fRenderTarget.get(), caps);
+ }
+
/**
* Gets whether the target is drawing clockwise, counterclockwise,
* or both faces.
« no previous file with comments | « src/gpu/GrPathRendering.h ('k') | src/gpu/GrPipeline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698