Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 virtual ~Cmd() {} | 111 virtual ~Cmd() {} |
| 112 | 112 |
| 113 virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) = 0; | 113 virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) = 0; |
| 114 | 114 |
| 115 uint8_t fType; | 115 uint8_t fType; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 struct Draw : public Cmd { | 118 struct Draw : public Cmd { |
| 119 Draw(const DrawInfo& info) : Cmd(kDraw_Cmd), fInfo(info) {} | 119 Draw(const DrawInfo& info) : Cmd(kDraw_Cmd), fInfo(info) {} |
| 120 | 120 |
| 121 virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); | 121 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
| 122 | 122 |
| 123 DrawInfo fInfo; | 123 DrawInfo fInfo; |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 struct StencilPath : public Cmd { | 126 struct StencilPath : public Cmd { |
| 127 StencilPath(const GrPath* path) : Cmd(kStencilPath_Cmd), fPath(path) {} | 127 StencilPath(const GrPath* path) : Cmd(kStencilPath_Cmd), fPath(path) {} |
| 128 | 128 |
| 129 const GrPath* path() const { return fPath.get(); } | 129 const GrPath* path() const { return fPath.get(); } |
| 130 | 130 |
| 131 virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); | 131 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
| 132 | 132 |
| 133 GrStencilSettings fStencilSettings; | 133 GrStencilSettings fStencilSettings; |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; | 136 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 struct DrawPath : public Cmd { | 139 struct DrawPath : public Cmd { |
| 140 DrawPath(const GrPath* path) : Cmd(kDrawPath_Cmd), fPath(path) {} | 140 DrawPath(const GrPath* path) : Cmd(kDrawPath_Cmd), fPath(path) {} |
| 141 | 141 |
| 142 const GrPath* path() const { return fPath.get(); } | 142 const GrPath* path() const { return fPath.get(); } |
| 143 | 143 |
| 144 virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); | 144 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
| 145 | 145 |
| 146 GrStencilSettings fStencilSettings; | 146 GrStencilSettings fStencilSettings; |
| 147 | 147 |
| 148 private: | 148 private: |
| 149 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; | 149 GrPendingIOResource<const GrPath, kRead_GrIOType> fPath; |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 struct DrawPaths : public Cmd { | 152 struct DrawPaths : public Cmd { |
| 153 DrawPaths(const GrPathRange* pathRange) : Cmd(kDrawPaths_Cmd), fPathRang e(pathRange) {} | 153 DrawPaths(const GrPathRange* pathRange) : Cmd(kDrawPaths_Cmd), fPathRang e(pathRange) {} |
| 154 | 154 |
| 155 const GrPathRange* pathRange() const { return fPathRange.get(); } | 155 const GrPathRange* pathRange() const { return fPathRange.get(); } |
| 156 | 156 |
| 157 virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); | 157 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
| 158 | 158 |
| 159 int fIndicesLocation; | 159 int fIndicesLocation; |
| 160 size_t fCount; | 160 size_t fCount; |
| 161 int fTransformsLocation; | 161 int fTransformsLocation; |
| 162 PathTransformType fTransformsType; | 162 PathTransformType fTransformsType; |
| 163 GrStencilSettings fStencilSettings; | 163 GrStencilSettings fStencilSettings; |
| 164 | 164 |
| 165 private: | 165 private: |
| 166 GrPendingIOResource<const GrPathRange, kRead_GrIOType> fPathRange; | 166 GrPendingIOResource<const GrPathRange, kRead_GrIOType> fPathRange; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 // This is also used to record a discard by setting the color to GrColor_ILL EGAL | 169 // This is also used to record a discard by setting the color to GrColor_ILL EGAL |
| 170 struct Clear : public Cmd { | 170 struct Clear : public Cmd { |
| 171 Clear(GrRenderTarget* rt) : Cmd(kClear_Cmd), fRenderTarget(rt) {} | 171 Clear(GrRenderTarget* rt) : Cmd(kClear_Cmd), fRenderTarget(rt) {} |
| 172 | 172 |
| 173 GrRenderTarget* renderTarget() const { return fRenderTarget.get(); } | 173 GrRenderTarget* renderTarget() const { return fRenderTarget.get(); } |
| 174 | 174 |
| 175 virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); | 175 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
| 176 | 176 |
| 177 SkIRect fRect; | 177 SkIRect fRect; |
| 178 GrColor fColor; | 178 GrColor fColor; |
| 179 bool fCanIgnoreRect; | 179 bool fCanIgnoreRect; |
| 180 | 180 |
| 181 private: | 181 private: |
| 182 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 182 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 // This command is ONLY used by the clip mask manager to clear the stencil c lip bits | 185 // This command is ONLY used by the clip mask manager to clear the stencil c lip bits |
| 186 struct ClearStencilClip : public Cmd { | 186 struct ClearStencilClip : public Cmd { |
| 187 ClearStencilClip(GrRenderTarget* rt) : Cmd(kClear_Cmd), fRenderTarget(rt ) {} | 187 ClearStencilClip(GrRenderTarget* rt) : Cmd(kClear_Cmd), fRenderTarget(rt ) {} |
| 188 | 188 |
| 189 GrRenderTarget* renderTarget() const { return fRenderTarget.get(); } | 189 GrRenderTarget* renderTarget() const { return fRenderTarget.get(); } |
| 190 | 190 |
| 191 virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); | 191 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
| 192 | 192 |
| 193 SkIRect fRect; | 193 SkIRect fRect; |
| 194 bool fInsideClip; | 194 bool fInsideClip; |
| 195 | 195 |
| 196 private: | 196 private: |
| 197 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; | 197 GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> fRenderTarget; |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 struct CopySurface : public Cmd { | 200 struct CopySurface : public Cmd { |
| 201 CopySurface(GrSurface* dst, GrSurface* src) : Cmd(kCopySurface_Cmd), fDs t(dst), fSrc(src) {} | 201 CopySurface(GrSurface* dst, GrSurface* src) : Cmd(kCopySurface_Cmd), fDs t(dst), fSrc(src) {} |
| 202 | 202 |
| 203 GrSurface* dst() const { return fDst.get(); } | 203 GrSurface* dst() const { return fDst.get(); } |
| 204 GrSurface* src() const { return fSrc.get(); } | 204 GrSurface* src() const { return fSrc.get(); } |
| 205 | 205 |
| 206 virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); | 206 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
| 207 | 207 |
| 208 SkIPoint fDstPoint; | 208 SkIPoint fDstPoint; |
| 209 SkIRect fSrcRect; | 209 SkIRect fSrcRect; |
| 210 | 210 |
| 211 private: | 211 private: |
| 212 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; | 212 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; |
| 213 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; | 213 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 struct SetState : public Cmd { | 216 struct SetState : public Cmd { |
| 217 SetState(const GrOptDrawState* state) : Cmd(kSetState_Cmd), fState(SkRef (state)) {} | 217 SetState(const GrDrawState& drawState, GrGpu* gpu, const ScissorState& s cissor, |
| 218 const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType drawType) | |
| 219 : Cmd(kSetState_Cmd) | |
| 220 , fState(drawState, gpu, scissor, dstCopy, drawType) { } | |
|
egdaniel
2014/11/21 22:26:24
no space :)
bsalomon
2014/11/24 14:36:57
Done.
| |
| 218 | 221 |
| 219 virtual void execute(GrInOrderDrawBuffer*, const GrOptDrawState*); | 222 void execute(GrInOrderDrawBuffer*, const GrOptDrawState*) SK_OVERRIDE; |
| 220 | 223 |
| 221 SkAutoTUnref<const GrOptDrawState> fState; | 224 const GrOptDrawState fState; |
| 222 GrGpu::DrawType fDrawType; | 225 GrGpu::DrawType fDrawType; |
| 223 }; | 226 }; |
| 224 | 227 |
| 225 typedef void* TCmdAlign; // This wouldn't be enough align if a command used long double. | 228 typedef void* TCmdAlign; // This wouldn't be enough align if a command used long double. |
| 226 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; | 229 typedef GrTRecorder<Cmd, TCmdAlign> CmdBuffer; |
| 227 | 230 |
| 228 // overrides from GrDrawTarget | 231 // overrides from GrDrawTarget |
| 229 void onDraw(const GrDrawState&, | 232 void onDraw(const GrDrawState&, |
| 230 const DrawInfo&, | 233 const DrawInfo&, |
| 231 const ScissorState&, | 234 const ScissorState&, |
| 232 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 235 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 // caller may conservatively over reserve vertices / indices. | 306 // caller may conservatively over reserve vertices / indices. |
| 304 // we release unused space back to allocator if possible | 307 // we release unused space back to allocator if possible |
| 305 // can only do this if there isn't an intervening pushGeometrySource() | 308 // can only do this if there isn't an intervening pushGeometrySource() |
| 306 size_t fUsedPoolVertexBytes; | 309 size_t fUsedPoolVertexBytes; |
| 307 size_t fUsedPoolIndexBytes; | 310 size_t fUsedPoolIndexBytes; |
| 308 }; | 311 }; |
| 309 | 312 |
| 310 typedef SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> GeoPoolStateS tack; | 313 typedef SkSTArray<kGeoPoolStatePreAllocCnt, GeometryPoolState> GeoPoolStateS tack; |
| 311 | 314 |
| 312 CmdBuffer fCmdBuffer; | 315 CmdBuffer fCmdBuffer; |
| 313 SkAutoTUnref<const GrOptDrawState> fLastState; | 316 const GrOptDrawState* fLastState; |
|
egdaniel
2014/11/21 22:26:24
personally I like the name fPreviousState or even
bsalomon
2014/11/24 14:36:57
fPrevState
| |
| 314 SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; | 317 SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers; |
| 315 GrGpu* fDstGpu; | 318 GrGpu* fDstGpu; |
| 316 GrVertexBufferAllocPool& fVertexPool; | 319 GrVertexBufferAllocPool& fVertexPool; |
| 317 GrIndexBufferAllocPool& fIndexPool; | 320 GrIndexBufferAllocPool& fIndexPool; |
| 318 SkTDArray<uint32_t> fPathIndexBuffer; | 321 SkTDArray<uint32_t> fPathIndexBuffer; |
| 319 SkTDArray<float> fPathTransformBuffer; | 322 SkTDArray<float> fPathTransformBuffer; |
| 320 GeoPoolStateStack fGeoPoolStateStack; | 323 GeoPoolStateStack fGeoPoolStateStack; |
| 321 bool fFlushing; | 324 bool fFlushing; |
| 322 uint32_t fDrawID; | 325 uint32_t fDrawID; |
| 323 | 326 |
| 324 typedef GrClipTarget INHERITED; | 327 typedef GrClipTarget INHERITED; |
| 325 }; | 328 }; |
| 326 | 329 |
| 327 #endif | 330 #endif |
| OLD | NEW |