| 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 |
| 11 #include "GrColor.h" | 11 #include "GrColor.h" |
| 12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
| 13 #include "GrPendingFragmentStage.h" | 13 #include "GrPendingFragmentStage.h" |
| 14 #include "GrProgramDesc.h" | 14 #include "GrProgramDesc.h" |
| 15 #include "GrStencil.h" | 15 #include "GrStencil.h" |
| 16 #include "GrTypesPriv.h" | 16 #include "GrTypesPriv.h" |
| 17 #include "SkMatrix.h" | 17 #include "SkMatrix.h" |
| 18 #include "SkRefCnt.h" | 18 #include "SkRefCnt.h" |
| 19 | 19 |
| 20 class GrDeviceCoordTexture; | 20 class GrDeviceCoordTexture; |
| 21 class GrDrawState; | 21 class GrDrawState; |
| 22 class GrPathProcessor; |
| 22 | 23 |
| 23 /** | 24 /** |
| 24 * 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, |
| 25 * 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. |
| 26 */ | 27 */ |
| 27 class GrOptDrawState { | 28 class GrOptDrawState { |
| 28 public: | 29 public: |
| 29 SK_DECLARE_INST_COUNT(GrOptDrawState) | 30 SK_DECLARE_INST_COUNT(GrOptDrawState) |
| 30 | 31 |
| 31 typedef GrClipMaskManager::ScissorState ScissorState; | 32 typedef GrClipMaskManager::ScissorState ScissorState; |
| 32 | 33 |
| 33 GrOptDrawState(const GrDrawState& drawState, GrColor, uint8_t coverage, cons
t GrDrawTargetCaps&, | 34 GrOptDrawState(const GrDrawState& drawState, const GrGeometryProcessor*, con
st GrPathProcessor*, |
| 34 const ScissorState&, const GrDeviceCoordTexture* dstCopy, GrG
pu::DrawType); | 35 const GrDrawTargetCaps&, const ScissorState&, |
| 36 const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType); |
| 35 | 37 |
| 36 bool operator== (const GrOptDrawState& that) const; | 38 bool operator== (const GrOptDrawState& that) const; |
| 37 bool operator!= (const GrOptDrawState& that) const { return !(*this == that)
; } | 39 bool operator!= (const GrOptDrawState& that) const { return !(*this == that)
; } |
| 38 | 40 |
| 39 /// @} | 41 /// @} |
| 40 | 42 |
| 41 /////////////////////////////////////////////////////////////////////////// | 43 /////////////////////////////////////////////////////////////////////////// |
| 42 /// @name Color | 44 /// @name Color |
| 43 //// | 45 //// |
| 44 | 46 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 const GrProcOptInfo& colorPOI, | 187 const GrProcOptInfo& colorPOI, |
| 186 const GrProcOptInfo& coveragePOI, | 188 const GrProcOptInfo& coveragePOI, |
| 187 int* firstColorStageIdx, | 189 int* firstColorStageIdx, |
| 188 int* firstCoverageStageIdx); | 190 int* firstCoverageStageIdx); |
| 189 | 191 |
| 190 /** | 192 /** |
| 191 * Calculates the primary and secondary output types of the shader. For cert
ain output types | 193 * Calculates the primary and secondary output types of the shader. For cert
ain output types |
| 192 * the function may adjust the blend coefficients. After this function is ca
lled the src and dst | 194 * the function may adjust the blend coefficients. After this function is ca
lled the src and dst |
| 193 * blend coeffs will represent those used by backend API. | 195 * blend coeffs will represent those used by backend API. |
| 194 */ | 196 */ |
| 195 void setOutputStateInfo(const GrDrawState& ds, GrColor coverage, GrXferProce
ssor::OptFlags, | 197 void setOutputStateInfo(const GrDrawState& ds, GrXferProcessor::OptFlags, |
| 196 const GrDrawTargetCaps&); | 198 const GrDrawTargetCaps&); |
| 197 | 199 |
| 198 enum Flags { | 200 enum Flags { |
| 199 kDither_Flag = 0x1, | 201 kDither_Flag = 0x1, |
| 200 kHWAA_Flag = 0x2, | 202 kHWAA_Flag = 0x2, |
| 201 kDisableColorWrite_Flag = 0x4, | 203 kDisableColorWrite_Flag = 0x4, |
| 202 }; | 204 }; |
| 203 | 205 |
| 204 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; | 206 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; |
| 205 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; | 207 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; |
| 206 typedef GrPendingProgramElement<const GrGeometryProcessor> ProgramGeometryPr
ocessor; | 208 typedef GrPendingProgramElement<const GrGeometryProcessor> ProgramGeometryPr
ocessor; |
| 209 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimitive
Processor; |
| 207 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; | 210 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; |
| 208 RenderTarget fRenderTarget; | 211 RenderTarget fRenderTarget; |
| 209 ScissorState fScissorState; | 212 ScissorState fScissorState; |
| 210 GrColor fColor; | 213 GrColor fColor; |
| 211 SkMatrix fViewMatrix; | 214 SkMatrix fViewMatrix; |
| 212 GrStencilSettings fStencilSettings; | 215 GrStencilSettings fStencilSettings; |
| 213 uint8_t fCoverage; | 216 uint8_t fCoverage; |
| 214 GrDrawState::DrawFace fDrawFace; | 217 GrDrawState::DrawFace fDrawFace; |
| 215 GrDeviceCoordTexture fDstCopy; | 218 GrDeviceCoordTexture fDstCopy; |
| 216 uint32_t fFlags; | 219 uint32_t fFlags; |
| 217 ProgramGeometryProcessor fGeometryProcessor; | 220 ProgramGeometryProcessor fGeometryProcessor; |
| 221 ProgramPrimitiveProcessor fPrimitiveProcessor; |
| 218 GrBatchTracker fBatchTracker; | 222 GrBatchTracker fBatchTracker; |
| 219 ProgramXferProcessor fXferProcessor; | 223 ProgramXferProcessor fXferProcessor; |
| 220 FragmentStageArray fFragmentStages; | 224 FragmentStageArray fFragmentStages; |
| 221 GrGpu::DrawType fDrawType; | 225 GrGpu::DrawType fDrawType; |
| 222 GrProgramDesc::DescInfo fDescInfo; | 226 GrProgramDesc::DescInfo fDescInfo; |
| 223 bool fFinalized; | 227 bool fFinalized; |
| 224 | 228 |
| 225 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. | 229 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. |
| 226 int fNumColorStages; | 230 int fNumColorStages; |
| 227 | 231 |
| 228 GrProgramDesc fDesc; | 232 GrProgramDesc fDesc; |
| 229 | 233 |
| 230 typedef SkRefCnt INHERITED; | 234 typedef SkRefCnt INHERITED; |
| 231 }; | 235 }; |
| 232 | 236 |
| 233 #endif | 237 #endif |
| OLD | NEW |