OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrTargetCommands_DEFINED | 8 #ifndef GrTargetCommands_DEFINED |
9 #define GrTargetCommands_DEFINED | 9 #define GrTargetCommands_DEFINED |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 public: | 40 public: |
41 enum CmdType { | 41 enum CmdType { |
42 kDraw_CmdType = 1, | 42 kDraw_CmdType = 1, |
43 kStencilPath_CmdType = 2, | 43 kStencilPath_CmdType = 2, |
44 kSetState_CmdType = 3, | 44 kSetState_CmdType = 3, |
45 kClear_CmdType = 4, | 45 kClear_CmdType = 4, |
46 kCopySurface_CmdType = 5, | 46 kCopySurface_CmdType = 5, |
47 kDrawPath_CmdType = 6, | 47 kDrawPath_CmdType = 6, |
48 kDrawPaths_CmdType = 7, | 48 kDrawPaths_CmdType = 7, |
49 kDrawBatch_CmdType = 8, | 49 kDrawBatch_CmdType = 8, |
| 50 kBlendBarrier_CmdType = 9, |
50 }; | 51 }; |
51 | 52 |
52 Cmd(CmdType type) : fMarkerID(-1), fType(type) {} | 53 Cmd(CmdType type) : fMarkerID(-1), fType(type) {} |
53 virtual ~Cmd() {} | 54 virtual ~Cmd() {} |
54 | 55 |
55 virtual void execute(GrGpu*, const SetState*) = 0; | 56 virtual void execute(GrGpu*, const SetState*) = 0; |
56 | 57 |
57 CmdType type() const { return fType; } | 58 CmdType type() const { return fType; } |
58 | 59 |
59 // trace markers | 60 // trace markers |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 Cmd* recordClear(GrInOrderDrawBuffer*, | 115 Cmd* recordClear(GrInOrderDrawBuffer*, |
115 const SkIRect* rect, | 116 const SkIRect* rect, |
116 GrColor, | 117 GrColor, |
117 bool canIgnoreRect, | 118 bool canIgnoreRect, |
118 GrRenderTarget*); | 119 GrRenderTarget*); |
119 Cmd* recordCopySurface(GrInOrderDrawBuffer*, | 120 Cmd* recordCopySurface(GrInOrderDrawBuffer*, |
120 GrSurface* dst, | 121 GrSurface* dst, |
121 GrSurface* src, | 122 GrSurface* src, |
122 const SkIRect& srcRect, | 123 const SkIRect& srcRect, |
123 const SkIPoint& dstPoint); | 124 const SkIPoint& dstPoint); |
| 125 Cmd* recordBlendBarrier(GrInOrderDrawBuffer*); |
124 | 126 |
125 protected: | 127 protected: |
126 void willReserveVertexAndIndexSpace(int vertexCount, | 128 void willReserveVertexAndIndexSpace(int vertexCount, |
127 size_t vertexStride, | 129 size_t vertexStride, |
128 int indexCount); | 130 int indexCount); |
129 | 131 |
130 private: | 132 private: |
131 friend class GrInOrderDrawBuffer; | 133 friend class GrInOrderDrawBuffer; |
132 | 134 |
133 typedef GrGpu::DrawArgs DrawArgs; | 135 typedef GrGpu::DrawArgs DrawArgs; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 290 |
289 void execute(GrGpu*, const SetState*) override; | 291 void execute(GrGpu*, const SetState*) override; |
290 | 292 |
291 // TODO it wouldn't be too hard to let batches allocate in the cmd buffe
r | 293 // TODO it wouldn't be too hard to let batches allocate in the cmd buffe
r |
292 SkAutoTUnref<GrBatch> fBatch; | 294 SkAutoTUnref<GrBatch> fBatch; |
293 | 295 |
294 private: | 296 private: |
295 GrBatchTarget* fBatchTarget; | 297 GrBatchTarget* fBatchTarget; |
296 }; | 298 }; |
297 | 299 |
| 300 struct BlendBarrier : public Cmd { |
| 301 BlendBarrier() : Cmd(kBlendBarrier_CmdType) {} |
| 302 void execute(GrGpu*, const SetState*) override; |
| 303 }; |
| 304 |
298 static const int kCmdBufferInitialSizeInBytes = 8 * 1024; | 305 static const int kCmdBufferInitialSizeInBytes = 8 * 1024; |
299 | 306 |
300 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. | 307 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. |
301 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; | 308 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; |
302 | 309 |
303 CmdBuffer fCmdBuffer; | 310 CmdBuffer fCmdBuffer; |
304 SetState* fPrevState; | 311 SetState* fPrevState; |
305 GrBatchTarget fBatchTarget; | 312 GrBatchTarget fBatchTarget; |
306 // TODO hack until batch is everywhere | 313 // TODO hack until batch is everywhere |
307 GrTargetCommands::DrawBatch* fDrawBatch; | 314 GrTargetCommands::DrawBatch* fDrawBatch; |
308 | 315 |
309 // This will go away when everything uses batch. However, in the short ter
m anything which | 316 // This will go away when everything uses batch. However, in the short ter
m anything which |
310 // might be put into the GrInOrderDrawBuffer needs to make sure it closes t
he last batch | 317 // might be put into the GrInOrderDrawBuffer needs to make sure it closes t
he last batch |
311 void closeBatch(); | 318 void closeBatch(); |
312 }; | 319 }; |
313 | 320 |
314 #endif | 321 #endif |
315 | 322 |
OLD | NEW |