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

Unified Diff: src/gpu/batches/GrBatch.h

Issue 1296483002: Split GrDrawBatch and GrVertexBatch into their own files (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add new files to git 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/batches/GrBWFillRectBatch.cpp ('k') | src/gpu/batches/GrBatch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrBatch.h
diff --git a/src/gpu/batches/GrBatch.h b/src/gpu/batches/GrBatch.h
index ef8f56c4b9daa1a5241abbd91947878c437ac59b..7bb6af1265361bba946f8e88d561cdd0c6605167 100644
--- a/src/gpu/batches/GrBatch.h
+++ b/src/gpu/batches/GrBatch.h
@@ -9,17 +9,11 @@
#define GrBatch_DEFINED
#include <new>
-#include "GrBatchTarget.h"
-#include "GrGeometryProcessor.h"
#include "GrNonAtomicRef.h"
-#include "GrVertices.h"
-#include "SkAtomics.h"
-#include "SkTypes.h"
-class GrGpu;
-class GrPipeline;
+#include "SkRect.h"
-struct GrInitInvariantOutput;
+class GrCaps;
/**
* GrBatch is the base class for all Ganesh deferred geometry generators. To facilitate
@@ -130,94 +124,4 @@ private:
typedef GrNonAtomicRef INHERITED;
};
-/**
- * Base class for GrBatches that draw. These batches have a GrPipeline installed by GrDrawTarget.
- */
-class GrDrawBatch : public GrBatch {
-public:
- GrDrawBatch();
- ~GrDrawBatch() override;
-
- virtual void getInvariantOutputColor(GrInitInvariantOutput* out) const = 0;
- virtual void getInvariantOutputCoverage(GrInitInvariantOutput* out) const = 0;
-
- const GrPipeline* pipeline() const {
- SkASSERT(fPipelineInstalled);
- return reinterpret_cast<const GrPipeline*>(fPipelineStorage.get());
- }
-
- bool installPipeline(const GrPipeline::CreateArgs&);
-
- // TODO no GrPrimitiveProcessors yet read fragment position
- bool willReadFragmentPosition() const { return false; }
-
-private:
- /**
- * initBatchTracker is a hook for the some additional overrides / optimization possibilities
- * from the GrXferProcessor.
- */
- virtual void initBatchTracker(const GrPipelineOptimizations&) = 0;
-
- SkAlignedSTStorage<1, GrPipeline> fPipelineStorage;
- bool fPipelineInstalled;
- typedef GrBatch INHERITED;
-};
-
-/**
- * Base class for vertex-based GrBatches.
- */
-class GrVertexBatch : public GrDrawBatch {
-public:
- GrVertexBatch();
-
- virtual void generateGeometry(GrBatchTarget*) = 0;
-
- // TODO this goes away when batches are everywhere
- void setNumberOfDraws(int numberOfDraws) { fNumberOfDraws = numberOfDraws; }
- int numberOfDraws() const { return fNumberOfDraws; }
-
-protected:
- /** Helper for rendering instances using an instanced index index buffer. This class creates the
- space for the vertices and flushes the draws to the batch target. */
- class InstancedHelper {
- public:
- InstancedHelper() {}
- /** Returns the allocated storage for the vertices. The caller should populate the before
- vertices before calling issueDraws(). */
- void* init(GrBatchTarget* batchTarget, GrPrimitiveType, size_t vertexStride,
- const GrIndexBuffer*, int verticesPerInstance, int indicesPerInstance,
- int instancesToDraw);
-
- /** Call after init() to issue draws to the batch target.*/
- void issueDraw(GrBatchTarget* batchTarget) {
- SkASSERT(fVertices.instanceCount());
- batchTarget->draw(fVertices);
- }
- private:
- GrVertices fVertices;
- };
-
- static const int kVerticesPerQuad = 4;
- static const int kIndicesPerQuad = 6;
-
- /** A specialization of InstanceHelper for quad rendering. */
- class QuadHelper : private InstancedHelper {
- public:
- QuadHelper() : INHERITED() {}
- /** Finds the cached quad index buffer and reserves vertex space. Returns NULL on failure
- and on sucess a pointer to the vertex data that the caller should populate before
- calling issueDraws(). */
- void* init(GrBatchTarget* batchTarget, size_t vertexStride, int quadsToDraw);
-
- using InstancedHelper::issueDraw;
-
- private:
- typedef InstancedHelper INHERITED;
- };
-
-private:
- int fNumberOfDraws;
- typedef GrDrawBatch INHERITED;
-};
-
#endif
« no previous file with comments | « src/gpu/batches/GrBWFillRectBatch.cpp ('k') | src/gpu/batches/GrBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698