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 |
11 #include "GrBatch.h" | 11 #include "GrBatch.h" |
12 #include "GrBatchTarget.h" | 12 #include "GrBatchTarget.h" |
13 #include "GrDrawTarget.h" | 13 #include "GrDrawTarget.h" |
14 #include "GrGpu.h" | 14 #include "GrGpu.h" |
15 #include "GrPath.h" | 15 #include "GrPath.h" |
16 #include "GrPendingProgramElement.h" | 16 #include "GrPendingProgramElement.h" |
17 #include "GrRenderTarget.h" | 17 #include "GrRenderTarget.h" |
18 #include "GrTRecorder.h" | 18 #include "GrTRecorder.h" |
19 #include "SkRect.h" | 19 #include "SkRect.h" |
20 #include "SkTypes.h" | 20 #include "SkTypes.h" |
21 | 21 |
22 class GrInOrderDrawBuffer; | 22 class GrBufferedDrawTarget; |
23 | 23 |
24 | 24 |
25 class GrTargetCommands : ::SkNoncopyable { | 25 class GrTargetCommands : ::SkNoncopyable { |
26 public: | 26 public: |
27 GrTargetCommands(GrGpu* gpu) | 27 GrTargetCommands(GrGpu* gpu) |
28 : fCmdBuffer(kCmdBufferInitialSizeInBytes) | 28 : fCmdBuffer(kCmdBufferInitialSizeInBytes) |
29 , fBatchTarget(gpu) { | 29 , fBatchTarget(gpu) { |
30 } | 30 } |
31 | 31 |
32 class Cmd : ::SkNoncopyable { | 32 class Cmd : ::SkNoncopyable { |
(...skipping 21 matching lines...) Expand all Loading... |
54 bool isTraced() const { return -1 != fMarkerID; } | 54 bool isTraced() const { return -1 != fMarkerID; } |
55 void setMarkerID(int markerID) { SkASSERT(-1 == fMarkerID); fMarkerID =
markerID; } | 55 void setMarkerID(int markerID) { SkASSERT(-1 == fMarkerID); fMarkerID =
markerID; } |
56 int markerID() const { return fMarkerID; } | 56 int markerID() const { return fMarkerID; } |
57 | 57 |
58 private: | 58 private: |
59 int fMarkerID; | 59 int fMarkerID; |
60 CmdType fType; | 60 CmdType fType; |
61 }; | 61 }; |
62 | 62 |
63 void reset(); | 63 void reset(); |
64 void flush(GrInOrderDrawBuffer*); | 64 void flush(GrBufferedDrawTarget*); |
65 | 65 |
66 private: | 66 private: |
67 friend class GrCommandBuilder; | 67 friend class GrCommandBuilder; |
68 friend class GrInOrderDrawBuffer; // This goes away when State becomes just
a pipeline | 68 friend class GrBufferedDrawTarget; // This goes away when State becomes just
a pipeline |
69 friend class GrReorderCommandBuilder; | 69 friend class GrReorderCommandBuilder; |
70 | 70 |
71 typedef GrGpu::DrawArgs DrawArgs; | 71 typedef GrGpu::DrawArgs DrawArgs; |
72 | 72 |
73 void recordXferBarrierIfNecessary(const GrPipeline&, GrInOrderDrawBuffer*); | 73 void recordXferBarrierIfNecessary(const GrPipeline&, GrBufferedDrawTarget*); |
74 | 74 |
75 // TODO: This can be just a pipeline once paths are in batch, and it should
live elsewhere | 75 // TODO: This can be just a pipeline once paths are in batch, and it should
live elsewhere |
76 struct State : public SkNVRefCnt<State> { | 76 struct State : public SkNVRefCnt<State> { |
77 // TODO get rid of the prim proc parameter when we use batch everywhere | 77 // TODO get rid of the prim proc parameter when we use batch everywhere |
78 State(const GrPrimitiveProcessor* primProc = NULL) | 78 State(const GrPrimitiveProcessor* primProc = NULL) |
79 : fPrimitiveProcessor(primProc) | 79 : fPrimitiveProcessor(primProc) |
80 , fCompiled(false) {} | 80 , fCompiled(false) {} |
81 | 81 |
82 ~State() { reinterpret_cast<GrPipeline*>(fPipeline.get())->~GrPipeline()
; } | 82 ~State() { reinterpret_cast<GrPipeline*>(fPipeline.get())->~GrPipeline()
; } |
83 | 83 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 263 |
264 CmdBuffer* cmdBuffer() { return &fCmdBuffer; } | 264 CmdBuffer* cmdBuffer() { return &fCmdBuffer; } |
265 GrBatchTarget* batchTarget() { return &fBatchTarget; } | 265 GrBatchTarget* batchTarget() { return &fBatchTarget; } |
266 | 266 |
267 CmdBuffer fCmdBuffer; | 267 CmdBuffer fCmdBuffer; |
268 GrBatchTarget fBatchTarget; | 268 GrBatchTarget fBatchTarget; |
269 }; | 269 }; |
270 | 270 |
271 #endif | 271 #endif |
272 | 272 |
OLD | NEW |