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 12 matching lines...) Expand all Loading... |
23 class GrBatchFlushState; | 23 class GrBatchFlushState; |
24 | 24 |
25 // TODO: Convert all commands into GrBatch and remove this class. | 25 // TODO: Convert all commands into GrBatch and remove this class. |
26 class GrTargetCommands : ::SkNoncopyable { | 26 class GrTargetCommands : ::SkNoncopyable { |
27 public: | 27 public: |
28 GrTargetCommands() : fCmdBuffer(kCmdBufferInitialSizeInBytes), fLastFlushTok
en(0) {} | 28 GrTargetCommands() : fCmdBuffer(kCmdBufferInitialSizeInBytes), fLastFlushTok
en(0) {} |
29 | 29 |
30 class Cmd : ::SkNoncopyable { | 30 class Cmd : ::SkNoncopyable { |
31 public: | 31 public: |
32 enum CmdType { | 32 enum CmdType { |
33 kStencilPath_CmdType = 1, | |
34 kDrawPath_CmdType = 2, | 33 kDrawPath_CmdType = 2, |
35 kDrawPaths_CmdType = 3, | 34 kDrawPaths_CmdType = 3, |
36 kDrawBatch_CmdType = 4, | 35 kDrawBatch_CmdType = 4, |
37 }; | 36 }; |
38 | 37 |
39 Cmd(CmdType type) | 38 Cmd(CmdType type) |
40 : fType(type) | 39 : fType(type) |
41 #if GR_BATCH_SPEW | 40 #if GR_BATCH_SPEW |
42 , fUniqueID(GenID(&gUniqueID)) | 41 , fUniqueID(GenID(&gUniqueID)) |
43 #endif | 42 #endif |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimi
tiveProcessor; | 110 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimi
tiveProcessor; |
112 ProgramPrimitiveProcessor fPrimitiveProcessor; | 111 ProgramPrimitiveProcessor fPrimitiveProcessor; |
113 SkAlignedSStorage<sizeof(GrPipeline)> fPipeline; | 112 SkAlignedSStorage<sizeof(GrPipeline)> fPipeline; |
114 GrProgramDesc fDesc; | 113 GrProgramDesc fDesc; |
115 GrBatchTracker fBatchTracker; | 114 GrBatchTracker fBatchTracker; |
116 bool fCompiled; | 115 bool fCompiled; |
117 }; | 116 }; |
118 // TODO remove this when State is just a pipeline | 117 // TODO remove this when State is just a pipeline |
119 friend SkNVRefCnt<StateForPathDraw>; | 118 friend SkNVRefCnt<StateForPathDraw>; |
120 | 119 |
121 struct StencilPath : public Cmd { | |
122 StencilPath(const GrPath* path, GrRenderTarget* rt) | |
123 : Cmd(kStencilPath_CmdType) | |
124 , fRenderTarget(rt) | |
125 , fPath(path) {} | |
126 | |
127 const GrPath* path() const { return fPath.get(); } | |
128 | |
129 void execute(GrBatchFlushState*) override; | |
130 | |
131 SkMatrix fViewMatrix; | |
132 bool fUseHWAA; | |
133 GrStencilSettings fStencil; | |
134 GrScissorState fScissor; | |
135 private: | |
136 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | |
137 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; | |
138 }; | |
139 | |
140 struct DrawPath : public Cmd { | 120 struct DrawPath : public Cmd { |
141 DrawPath(StateForPathDraw* state, const GrPath* path) | 121 DrawPath(StateForPathDraw* state, const GrPath* path) |
142 : Cmd(kDrawPath_CmdType) | 122 : Cmd(kDrawPath_CmdType) |
143 , fState(SkRef(state)) | 123 , fState(SkRef(state)) |
144 , fPath(path) {} | 124 , fPath(path) {} |
145 | 125 |
146 const GrPath* path() const { return fPath.get(); } | 126 const GrPath* path() const { return fPath.get(); } |
147 | 127 |
148 void execute(GrBatchFlushState*) override; | 128 void execute(GrBatchFlushState*) override; |
149 | 129 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. | 174 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. |
195 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; | 175 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; |
196 | 176 |
197 CmdBuffer* cmdBuffer() { return &fCmdBuffer; } | 177 CmdBuffer* cmdBuffer() { return &fCmdBuffer; } |
198 | 178 |
199 CmdBuffer fCmdBuffer; | 179 CmdBuffer fCmdBuffer; |
200 GrBatchToken fLastFlushToken; | 180 GrBatchToken fLastFlushToken; |
201 }; | 181 }; |
202 | 182 |
203 #endif | 183 #endif |
OLD | NEW |