| 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 GrInOrderDrawBuffer; |
| 23 class GrVertexBufferAllocPool; | 23 class GrVertexBufferAllocPool; |
| 24 class GrIndexBufferAllocPool; | 24 class GrIndexBufferAllocPool; |
| 25 | 25 |
| 26 class GrTargetCommands : ::SkNoncopyable { | 26 class GrTargetCommands : ::SkNoncopyable { |
| 27 struct State; | |
| 28 struct SetState; | |
| 29 | |
| 30 public: | 27 public: |
| 31 GrTargetCommands(GrGpu* gpu, | 28 GrTargetCommands(GrGpu* gpu, |
| 32 GrVertexBufferAllocPool* vertexPool, | 29 GrVertexBufferAllocPool* vertexPool, |
| 33 GrIndexBufferAllocPool* indexPool) | 30 GrIndexBufferAllocPool* indexPool) |
| 34 : fCmdBuffer(kCmdBufferInitialSizeInBytes) | 31 : fCmdBuffer(kCmdBufferInitialSizeInBytes) |
| 35 , fBatchTarget(gpu, vertexPool, indexPool) { | 32 , fBatchTarget(gpu, vertexPool, indexPool) { |
| 36 } | 33 } |
| 37 | 34 |
| 38 class Cmd : ::SkNoncopyable { | 35 class Cmd : ::SkNoncopyable { |
| 39 public: | 36 public: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 61 int markerID() const { return fMarkerID; } | 58 int markerID() const { return fMarkerID; } |
| 62 | 59 |
| 63 private: | 60 private: |
| 64 int fMarkerID; | 61 int fMarkerID; |
| 65 CmdType fType; | 62 CmdType fType; |
| 66 }; | 63 }; |
| 67 | 64 |
| 68 void reset(); | 65 void reset(); |
| 69 void flush(GrInOrderDrawBuffer*); | 66 void flush(GrInOrderDrawBuffer*); |
| 70 | 67 |
| 71 Cmd* recordClearStencilClip(const SkIRect& rect, | |
| 72 bool insideClip, | |
| 73 GrRenderTarget* renderTarget); | |
| 74 | |
| 75 Cmd* recordDiscard(GrRenderTarget*); | |
| 76 Cmd* recordDrawBatch(State*, GrBatch*); | |
| 77 Cmd* recordStencilPath(const GrPipelineBuilder&, | |
| 78 const GrPathProcessor*, | |
| 79 const GrPath*, | |
| 80 const GrScissorState&, | |
| 81 const GrStencilSettings&); | |
| 82 Cmd* recordDrawPath(State*, | |
| 83 const GrPathProcessor*, | |
| 84 const GrPath*, | |
| 85 const GrStencilSettings&); | |
| 86 Cmd* recordDrawPaths(State*, | |
| 87 GrInOrderDrawBuffer*, | |
| 88 const GrPathProcessor*, | |
| 89 const GrPathRange*, | |
| 90 const void*, | |
| 91 GrDrawTarget::PathIndexType, | |
| 92 const float transformValues[], | |
| 93 GrDrawTarget::PathTransformType , | |
| 94 int, | |
| 95 const GrStencilSettings&, | |
| 96 const GrDrawTarget::PipelineInfo&); | |
| 97 Cmd* recordClear(const SkIRect* rect, | |
| 98 GrColor, | |
| 99 bool canIgnoreRect, | |
| 100 GrRenderTarget*); | |
| 101 Cmd* recordCopySurface(GrSurface* dst, | |
| 102 GrSurface* src, | |
| 103 const SkIRect& srcRect, | |
| 104 const SkIPoint& dstPoint); | |
| 105 | |
| 106 private: | 68 private: |
| 107 friend class GrInOrderDrawBuffer; | 69 friend class GrCommandBuilder; |
| 70 friend class GrInOrderDrawBuffer; // This goes away when State becomes just
a pipeline |
| 108 | 71 |
| 109 typedef GrGpu::DrawArgs DrawArgs; | 72 typedef GrGpu::DrawArgs DrawArgs; |
| 110 | 73 |
| 111 void recordXferBarrierIfNecessary(const GrPipeline&, GrInOrderDrawBuffer*); | 74 void recordXferBarrierIfNecessary(const GrPipeline&, GrInOrderDrawBuffer*); |
| 112 | 75 |
| 113 // TODO: This can be just a pipeline once paths are in batch, and it should
live elsewhere | 76 // TODO: This can be just a pipeline once paths are in batch, and it should
live elsewhere |
| 114 struct State : public SkNVRefCnt<State> { | 77 struct State : public SkNVRefCnt<State> { |
| 115 // TODO get rid of the prim proc parameter when we use batch everywhere | 78 // TODO get rid of the prim proc parameter when we use batch everywhere |
| 116 State(const GrPrimitiveProcessor* primProc = NULL) | 79 State(const GrPrimitiveProcessor* primProc = NULL) |
| 117 : fPrimitiveProcessor(primProc) | 80 : fPrimitiveProcessor(primProc) |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 void execute(GrGpu*) override; | 249 void execute(GrGpu*) override; |
| 287 | 250 |
| 288 GrXferBarrierType fBarrierType; | 251 GrXferBarrierType fBarrierType; |
| 289 }; | 252 }; |
| 290 | 253 |
| 291 static const int kCmdBufferInitialSizeInBytes = 8 * 1024; | 254 static const int kCmdBufferInitialSizeInBytes = 8 * 1024; |
| 292 | 255 |
| 293 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. | 256 typedef void* TCmdAlign; // This wouldn't be enough align if a command used
long double. |
| 294 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; | 257 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; |
| 295 | 258 |
| 259 CmdBuffer* cmdBuffer() { return &fCmdBuffer; } |
| 260 GrBatchTarget* batchTarget() { return &fBatchTarget; } |
| 261 |
| 296 CmdBuffer fCmdBuffer; | 262 CmdBuffer fCmdBuffer; |
| 297 GrBatchTarget fBatchTarget; | 263 GrBatchTarget fBatchTarget; |
| 298 }; | 264 }; |
| 299 | 265 |
| 300 #endif | 266 #endif |
| 301 | 267 |
| OLD | NEW |