| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrOptDrawState_DEFINED | 8 #ifndef GrOptDrawState_DEFINED |
| 9 #define GrOptDrawState_DEFINED | 9 #define GrOptDrawState_DEFINED |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 /** | 24 /** |
| 25 * Class that holds an optimized version of a GrDrawState. It is meant to be an
immutable class, | 25 * Class that holds an optimized version of a GrDrawState. It is meant to be an
immutable class, |
| 26 * and contains all data needed to set the state for a gpu draw. | 26 * and contains all data needed to set the state for a gpu draw. |
| 27 */ | 27 */ |
| 28 class GrOptDrawState { | 28 class GrOptDrawState { |
| 29 public: | 29 public: |
| 30 SK_DECLARE_INST_COUNT(GrOptDrawState) | 30 SK_DECLARE_INST_COUNT(GrOptDrawState) |
| 31 | 31 |
| 32 GrOptDrawState(const GrDrawState& drawState, const GrPrimitiveProcessor*, | 32 GrOptDrawState(const GrDrawState& drawState, const GrPrimitiveProcessor*, |
| 33 const GrDrawTargetCaps&, const GrScissorState&, | 33 const GrDrawTargetCaps&, const GrScissorState&, |
| 34 const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType); | 34 const GrDeviceCoordTexture* dstCopy); |
| 35 | 35 |
| 36 /* | 36 /* |
| 37 * Returns true if it is possible to combine the two GrOptDrawStates and it
will update 'this' | 37 * Returns true if it is possible to combine the two GrOptDrawStates and it
will update 'this' |
| 38 * to subsume 'that''s draw. | 38 * to subsume 'that''s draw. |
| 39 */ | 39 */ |
| 40 bool isEqual(const GrOptDrawState& that) const; | 40 bool isEqual(const GrOptDrawState& that) const; |
| 41 | 41 |
| 42 /// @} | 42 /// @} |
| 43 | 43 |
| 44 /////////////////////////////////////////////////////////////////////////// | 44 /////////////////////////////////////////////////////////////////////////// |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 * Gets whether the target is drawing clockwise, counterclockwise, | 121 * Gets whether the target is drawing clockwise, counterclockwise, |
| 122 * or both faces. | 122 * or both faces. |
| 123 * @return the current draw face(s). | 123 * @return the current draw face(s). |
| 124 */ | 124 */ |
| 125 GrDrawState::DrawFace getDrawFace() const { return fDrawFace; } | 125 GrDrawState::DrawFace getDrawFace() const { return fDrawFace; } |
| 126 | 126 |
| 127 /// @} | 127 /// @} |
| 128 | 128 |
| 129 /////////////////////////////////////////////////////////////////////////// | 129 /////////////////////////////////////////////////////////////////////////// |
| 130 | 130 |
| 131 GrGpu::DrawType drawType() const { return fDrawType; } | |
| 132 | |
| 133 const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ?
&fDstCopy : NULL; } | 131 const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ?
&fDstCopy : NULL; } |
| 134 | 132 |
| 135 const GrProgramDesc::DescInfo& descInfo() const { return fDescInfo; } | 133 const GrProgramDesc::DescInfo& descInfo() const { return fDescInfo; } |
| 136 | 134 |
| 137 const GrGeometryProcessor::InitBT& getInitBatchTracker() const { return fIni
tBT; } | 135 const GrGeometryProcessor::InitBT& getInitBatchTracker() const { return fIni
tBT; } |
| 138 | 136 |
| 139 private: | 137 private: |
| 140 /** | 138 /** |
| 141 * Alter the program desc and inputs (attribs and processors) based on the b
lend optimization. | 139 * Alter the program desc and inputs (attribs and processors) based on the b
lend optimization. |
| 142 */ | 140 */ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 164 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; | 162 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; |
| 165 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; | 163 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; |
| 166 RenderTarget fRenderTarget; | 164 RenderTarget fRenderTarget; |
| 167 GrScissorState fScissorState; | 165 GrScissorState fScissorState; |
| 168 GrStencilSettings fStencilSettings; | 166 GrStencilSettings fStencilSettings; |
| 169 GrDrawState::DrawFace fDrawFace; | 167 GrDrawState::DrawFace fDrawFace; |
| 170 GrDeviceCoordTexture fDstCopy; | 168 GrDeviceCoordTexture fDstCopy; |
| 171 uint32_t fFlags; | 169 uint32_t fFlags; |
| 172 ProgramXferProcessor fXferProcessor; | 170 ProgramXferProcessor fXferProcessor; |
| 173 FragmentStageArray fFragmentStages; | 171 FragmentStageArray fFragmentStages; |
| 174 GrGpu::DrawType fDrawType; | |
| 175 GrProgramDesc::DescInfo fDescInfo; | 172 GrProgramDesc::DescInfo fDescInfo; |
| 176 GrGeometryProcessor::InitBT fInitBT; | 173 GrGeometryProcessor::InitBT fInitBT; |
| 177 | 174 |
| 178 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. | 175 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. |
| 179 int fNumColorStages; | 176 int fNumColorStages; |
| 180 | 177 |
| 181 GrProgramDesc fDesc; | 178 GrProgramDesc fDesc; |
| 182 | 179 |
| 183 typedef SkRefCnt INHERITED; | 180 typedef SkRefCnt INHERITED; |
| 184 }; | 181 }; |
| 185 | 182 |
| 186 #endif | 183 #endif |
| OLD | NEW |