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

Unified Diff: src/gpu/GrInOrderDrawBuffer.h

Issue 1120143002: Move state management to GrInOrderDrawBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@batchownsbounds
Patch Set: a bit more Created 5 years, 8 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/GrAtlasTextContext.h ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrInOrderDrawBuffer.h
diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h
index ce82c889a76037d7ed751308d8f630bf77dff12a..b253768f84bdde01d8b8844fc039dcb9dc6fa334 100644
--- a/src/gpu/GrInOrderDrawBuffer.h
+++ b/src/gpu/GrInOrderDrawBuffer.h
@@ -72,6 +72,17 @@ protected:
private:
friend class GrTargetCommands;
+ typedef GrTargetCommands::State State;
+
+ State* allocState(const GrPrimitiveProcessor* primProc = NULL) {
+ void* allocation = fPipelineBuffer.alloc(sizeof(State), SkChunkAlloc::kThrow_AllocFailType);
+ return SkNEW_PLACEMENT_ARGS(allocation, State, (primProc));
+ }
+
+ void unallocState(State* state) {
+ state->unref();
+ fPipelineBuffer.unalloc(state);
+ }
void onReset() override;
void onFlush() override;
@@ -84,7 +95,6 @@ private:
const SkRect& rect,
const SkRect* localRect,
const SkMatrix* localMatrix) override;
-
void onStencilPath(const GrPipelineBuilder&,
const GrPathProcessor*,
const GrPath*,
@@ -122,17 +132,29 @@ private:
}
bool isIssued(uint32_t drawID) override { return drawID != fDrawID; }
+ State* SK_WARN_UNUSED_RESULT setupPipelineAndShouldDraw(const GrPrimitiveProcessor*,
+ const GrDrawTarget::PipelineInfo&);
+ State* SK_WARN_UNUSED_RESULT setupPipelineAndShouldDraw(GrBatch*,
+ const GrDrawTarget::PipelineInfo&);
+
// TODO: Use a single allocator for commands and records
enum {
kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's
kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms
+ kPipelineBufferMinReserve = 32 * sizeof(State),
};
+ // every 100 flushes we should reset our fPipelineBuffer to prevent us from holding at a
+ // highwater mark
+ static const int kPipelineBufferHighWaterMark = 100;
+
GrTargetCommands fCommands;
SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers;
SkChunkAlloc fPathIndexBuffer;
SkChunkAlloc fPathTransformBuffer;
+ SkChunkAlloc fPipelineBuffer;
uint32_t fDrawID;
+ SkAutoTUnref<State> fPrevState;
typedef GrClipTarget INHERITED;
};
« no previous file with comments | « src/gpu/GrAtlasTextContext.h ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698