| 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 11 matching lines...) Expand all Loading... |
| 22 class GrPathProcessor; | 22 class GrPathProcessor; |
| 23 | 23 |
| 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 GrGeometryProcessor*, con
st GrPathProcessor*, | 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, GrGpu::DrawType); |
| 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 combineIfPossible(const GrOptDrawState& that); | 40 bool combineIfPossible(const GrOptDrawState& that); |
| 41 | 41 |
| 42 /// @} | 42 /// @} |
| (...skipping 12 matching lines...) Expand all Loading... |
| 55 /// | 55 /// |
| 56 /// The input color to the first color-stage is either the constant color or
interpolated | 56 /// The input color to the first color-stage is either the constant color or
interpolated |
| 57 /// per-vertex colors. The input to the first coverage stage is either a con
stant coverage | 57 /// per-vertex colors. The input to the first coverage stage is either a con
stant coverage |
| 58 /// (usually full-coverage) or interpolated per-vertex coverage. | 58 /// (usually full-coverage) or interpolated per-vertex coverage. |
| 59 //// | 59 //// |
| 60 | 60 |
| 61 int numColorStages() const { return fNumColorStages; } | 61 int numColorStages() const { return fNumColorStages; } |
| 62 int numCoverageStages() const { return fFragmentStages.count() - fNumColorSt
ages; } | 62 int numCoverageStages() const { return fFragmentStages.count() - fNumColorSt
ages; } |
| 63 int numFragmentStages() const { return fFragmentStages.count(); } | 63 int numFragmentStages() const { return fFragmentStages.count(); } |
| 64 | 64 |
| 65 // TODO remove the GP specific calls when the PathProc can provide the same
interface | |
| 66 bool hasGeometryProcessor() const { return SkToBool(fGeometryProcessor.get()
); } | |
| 67 const GrGeometryProcessor* getGeometryProcessor() const { return fGeometryPr
ocessor.get(); } | |
| 68 const GrPrimitiveProcessor* getPrimitiveProcessor() const { return fPrimitiv
eProcessor.get(); } | 65 const GrPrimitiveProcessor* getPrimitiveProcessor() const { return fPrimitiv
eProcessor.get(); } |
| 69 const GrBatchTracker& getBatchTracker() const { return fBatchTracker; } | 66 const GrBatchTracker& getBatchTracker() const { return fBatchTracker; } |
| 70 | 67 |
| 71 const GrXferProcessor* getXferProcessor() const { return fXferProcessor.get(
); } | 68 const GrXferProcessor* getXferProcessor() const { return fXferProcessor.get(
); } |
| 72 | 69 |
| 73 const GrPendingFragmentStage& getColorStage(int idx) const { | 70 const GrPendingFragmentStage& getColorStage(int idx) const { |
| 74 SkASSERT(idx < this->numColorStages()); | 71 SkASSERT(idx < this->numColorStages()); |
| 75 return fFragmentStages[idx]; | 72 return fFragmentStages[idx]; |
| 76 } | 73 } |
| 77 const GrPendingFragmentStage& getCoverageStage(int idx) const { | 74 const GrPendingFragmentStage& getCoverageStage(int idx) const { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; | 168 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; |
| 172 typedef GrPendingProgramElement<const GrGeometryProcessor> ProgramGeometryPr
ocessor; | 169 typedef GrPendingProgramElement<const GrGeometryProcessor> ProgramGeometryPr
ocessor; |
| 173 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimitive
Processor; | 170 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimitive
Processor; |
| 174 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; | 171 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; |
| 175 RenderTarget fRenderTarget; | 172 RenderTarget fRenderTarget; |
| 176 GrScissorState fScissorState; | 173 GrScissorState fScissorState; |
| 177 GrStencilSettings fStencilSettings; | 174 GrStencilSettings fStencilSettings; |
| 178 GrDrawState::DrawFace fDrawFace; | 175 GrDrawState::DrawFace fDrawFace; |
| 179 GrDeviceCoordTexture fDstCopy; | 176 GrDeviceCoordTexture fDstCopy; |
| 180 uint32_t fFlags; | 177 uint32_t fFlags; |
| 181 ProgramGeometryProcessor fGeometryProcessor; | |
| 182 ProgramPrimitiveProcessor fPrimitiveProcessor; | 178 ProgramPrimitiveProcessor fPrimitiveProcessor; |
| 183 GrBatchTracker fBatchTracker; | 179 GrBatchTracker fBatchTracker; |
| 184 ProgramXferProcessor fXferProcessor; | 180 ProgramXferProcessor fXferProcessor; |
| 185 FragmentStageArray fFragmentStages; | 181 FragmentStageArray fFragmentStages; |
| 186 GrGpu::DrawType fDrawType; | 182 GrGpu::DrawType fDrawType; |
| 187 GrProgramDesc::DescInfo fDescInfo; | 183 GrProgramDesc::DescInfo fDescInfo; |
| 188 bool fFinalized; | 184 bool fFinalized; |
| 189 | 185 |
| 190 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. | 186 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. |
| 191 int fNumColorStages; | 187 int fNumColorStages; |
| 192 | 188 |
| 193 GrProgramDesc fDesc; | 189 GrProgramDesc fDesc; |
| 194 | 190 |
| 195 typedef SkRefCnt INHERITED; | 191 typedef SkRefCnt INHERITED; |
| 196 }; | 192 }; |
| 197 | 193 |
| 198 #endif | 194 #endif |
| OLD | NEW |