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

Side by Side Diff: src/gpu/GrInOrderDrawBuffer.h

Issue 1119353002: Revert of Move state management to GrInOrderDrawBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@batchownsbounds
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrAtlasTextContext.h ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrInOrderDrawBuffer_DEFINED 8 #ifndef GrInOrderDrawBuffer_DEFINED
9 #define GrInOrderDrawBuffer_DEFINED 9 #define GrInOrderDrawBuffer_DEFINED
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (0 != xformBytes) { 65 if (0 != xformBytes) {
66 *xformsLocation = (float*) fPathTransformBuffer.alloc(count * xformB ytes, 66 *xformsLocation = (float*) fPathTransformBuffer.alloc(count * xformB ytes,
67 SkChunkAlloc::kTh row_AllocFailType); 67 SkChunkAlloc::kTh row_AllocFailType);
68 SkASSERT(SkIsAlign4((uintptr_t)*xformsLocation)); 68 SkASSERT(SkIsAlign4((uintptr_t)*xformsLocation));
69 memcpy(*xformsLocation, transformValues, count * xformBytes); 69 memcpy(*xformsLocation, transformValues, count * xformBytes);
70 } 70 }
71 } 71 }
72 72
73 private: 73 private:
74 friend class GrTargetCommands; 74 friend class GrTargetCommands;
75 typedef GrTargetCommands::State State;
76
77 State* allocState(const GrPrimitiveProcessor* primProc = NULL) {
78 void* allocation = fPipelineBuffer.alloc(sizeof(State), SkChunkAlloc::kT hrow_AllocFailType);
79 return SkNEW_PLACEMENT_ARGS(allocation, State, (primProc));
80 }
81
82 void unallocState(State* state) {
83 state->unref();
84 fPipelineBuffer.unalloc(state);
85 }
86 75
87 void onReset() override; 76 void onReset() override;
88 void onFlush() override; 77 void onFlush() override;
89 78
90 // overrides from GrDrawTarget 79 // overrides from GrDrawTarget
91 void onDrawBatch(GrBatch*, const PipelineInfo&) override; 80 void onDrawBatch(GrBatch*, const PipelineInfo&) override;
92 void onDrawRect(GrPipelineBuilder*, 81 void onDrawRect(GrPipelineBuilder*,
93 GrColor, 82 GrColor,
94 const SkMatrix& viewMatrix, 83 const SkMatrix& viewMatrix,
95 const SkRect& rect, 84 const SkRect& rect,
96 const SkRect* localRect, 85 const SkRect* localRect,
97 const SkMatrix* localMatrix) override; 86 const SkMatrix* localMatrix) override;
87
98 void onStencilPath(const GrPipelineBuilder&, 88 void onStencilPath(const GrPipelineBuilder&,
99 const GrPathProcessor*, 89 const GrPathProcessor*,
100 const GrPath*, 90 const GrPath*,
101 const GrScissorState&, 91 const GrScissorState&,
102 const GrStencilSettings&) override; 92 const GrStencilSettings&) override;
103 void onDrawPath(const GrPathProcessor*, 93 void onDrawPath(const GrPathProcessor*,
104 const GrPath*, 94 const GrPath*,
105 const GrStencilSettings&, 95 const GrStencilSettings&,
106 const PipelineInfo&) override; 96 const PipelineInfo&) override;
107 void onDrawPaths(const GrPathProcessor*, 97 void onDrawPaths(const GrPathProcessor*,
(...skipping 17 matching lines...) Expand all
125 // We lazily record clip changes in order to skip clips that have no effect. 115 // We lazily record clip changes in order to skip clips that have no effect.
126 void recordClipIfNecessary(); 116 void recordClipIfNecessary();
127 // Records any trace markers for a command 117 // Records any trace markers for a command
128 void recordTraceMarkersIfNecessary(GrTargetCommands::Cmd*); 118 void recordTraceMarkersIfNecessary(GrTargetCommands::Cmd*);
129 SkString getCmdString(int index) const { 119 SkString getCmdString(int index) const {
130 SkASSERT(index < fGpuCmdMarkers.count()); 120 SkASSERT(index < fGpuCmdMarkers.count());
131 return fGpuCmdMarkers[index].toString(); 121 return fGpuCmdMarkers[index].toString();
132 } 122 }
133 bool isIssued(uint32_t drawID) override { return drawID != fDrawID; } 123 bool isIssued(uint32_t drawID) override { return drawID != fDrawID; }
134 124
135 State* SK_WARN_UNUSED_RESULT setupPipelineAndShouldDraw(const GrPrimitivePro cessor*,
136 const GrDrawTarget:: PipelineInfo&);
137 State* SK_WARN_UNUSED_RESULT setupPipelineAndShouldDraw(GrBatch*,
138 const GrDrawTarget:: PipelineInfo&);
139
140 // TODO: Use a single allocator for commands and records 125 // TODO: Use a single allocator for commands and records
141 enum { 126 enum {
142 kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's 127 kPathIdxBufferMinReserve = 2 * 64, // 64 uint16_t's
143 kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms 128 kPathXformBufferMinReserve = 2 * 64, // 64 two-float transforms
144 kPipelineBufferMinReserve = 32 * sizeof(State),
145 }; 129 };
146 130
147 // every 100 flushes we should reset our fPipelineBuffer to prevent us from holding at a
148 // highwater mark
149 static const int kPipelineBufferHighWaterMark = 100;
150
151 GrTargetCommands fCommands; 131 GrTargetCommands fCommands;
152 SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; 132 SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers;
153 SkChunkAlloc fPathIndexBuffer; 133 SkChunkAlloc fPathIndexBuffer;
154 SkChunkAlloc fPathTransformBuffer; 134 SkChunkAlloc fPathTransformBuffer;
155 SkChunkAlloc fPipelineBuffer;
156 uint32_t fDrawID; 135 uint32_t fDrawID;
157 SkAutoTUnref<State> fPrevState;
158 136
159 typedef GrClipTarget INHERITED; 137 typedef GrClipTarget INHERITED;
160 }; 138 };
161 139
162 #endif 140 #endif
OLDNEW
« 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