| 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; | |
| 23 | 22 |
| 24 /** | 23 /** |
| 25 * Class that holds an optimized version of a GrDrawState. It is meant to be an
immutable class, | 24 * 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. | 25 * and contains all data needed to set the state for a gpu draw. |
| 27 */ | 26 */ |
| 28 class GrOptDrawState { | 27 class GrOptDrawState { |
| 29 public: | 28 public: |
| 30 SK_DECLARE_INST_COUNT(GrOptDrawState) | 29 SK_DECLARE_INST_COUNT(GrOptDrawState) |
| 31 | 30 |
| 32 typedef GrClipMaskManager::ScissorState ScissorState; | 31 typedef GrClipMaskManager::ScissorState ScissorState; |
| 33 | 32 |
| 34 GrOptDrawState(const GrDrawState& drawState, const GrGeometryProcessor*, con
st GrPathProcessor*, | 33 GrOptDrawState(const GrDrawState& drawState, GrColor, uint8_t coverage, cons
t GrDrawTargetCaps&, |
| 35 const GrDrawTargetCaps&, const ScissorState&, | 34 const ScissorState&, const GrDeviceCoordTexture* dstCopy, GrG
pu::DrawType); |
| 36 const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType); | |
| 37 | 35 |
| 38 bool operator== (const GrOptDrawState& that) const; | 36 bool operator== (const GrOptDrawState& that) const; |
| 39 bool operator!= (const GrOptDrawState& that) const { return !(*this == that)
; } | 37 bool operator!= (const GrOptDrawState& that) const { return !(*this == that)
; } |
| 40 | 38 |
| 41 /// @} | 39 /// @} |
| 42 | 40 |
| 43 /////////////////////////////////////////////////////////////////////////// | 41 /////////////////////////////////////////////////////////////////////////// |
| 44 /// @name Color | 42 /// @name Color |
| 45 //// | 43 //// |
| 46 | 44 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 const GrProcOptInfo& colorPOI, | 200 const GrProcOptInfo& colorPOI, |
| 203 const GrProcOptInfo& coveragePOI, | 201 const GrProcOptInfo& coveragePOI, |
| 204 int* firstColorStageIdx, | 202 int* firstColorStageIdx, |
| 205 int* firstCoverageStageIdx); | 203 int* firstCoverageStageIdx); |
| 206 | 204 |
| 207 /** | 205 /** |
| 208 * Calculates the primary and secondary output types of the shader. For cert
ain output types | 206 * Calculates the primary and secondary output types of the shader. For cert
ain output types |
| 209 * the function may adjust the blend coefficients. After this function is ca
lled the src and dst | 207 * the function may adjust the blend coefficients. After this function is ca
lled the src and dst |
| 210 * blend coeffs will represent those used by backend API. | 208 * blend coeffs will represent those used by backend API. |
| 211 */ | 209 */ |
| 212 void setOutputStateInfo(const GrDrawState& ds, GrXferProcessor::OptFlags, | 210 void setOutputStateInfo(const GrDrawState& ds, GrColor coverage, GrXferProce
ssor::OptFlags, |
| 213 const GrDrawTargetCaps&); | 211 const GrDrawTargetCaps&); |
| 214 | 212 |
| 215 enum Flags { | 213 enum Flags { |
| 216 kDither_Flag = 0x1, | 214 kDither_Flag = 0x1, |
| 217 kHWAA_Flag = 0x2, | 215 kHWAA_Flag = 0x2, |
| 218 kDisableColorWrite_Flag = 0x4, | 216 kDisableColorWrite_Flag = 0x4, |
| 219 }; | 217 }; |
| 220 | 218 |
| 221 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; | 219 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; |
| 222 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; | 220 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; |
| 223 typedef GrPendingProgramElement<const GrGeometryProcessor> ProgramGeometryPr
ocessor; | 221 typedef GrPendingProgramElement<const GrGeometryProcessor> ProgramGeometryPr
ocessor; |
| 224 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimitive
Processor; | |
| 225 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; | 222 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; |
| 226 RenderTarget fRenderTarget; | 223 RenderTarget fRenderTarget; |
| 227 ScissorState fScissorState; | 224 ScissorState fScissorState; |
| 228 GrColor fColor; | 225 GrColor fColor; |
| 229 SkMatrix fViewMatrix; | 226 SkMatrix fViewMatrix; |
| 230 GrColor fBlendConstant; | 227 GrColor fBlendConstant; |
| 231 GrStencilSettings fStencilSettings; | 228 GrStencilSettings fStencilSettings; |
| 232 uint8_t fCoverage; | 229 uint8_t fCoverage; |
| 233 GrDrawState::DrawFace fDrawFace; | 230 GrDrawState::DrawFace fDrawFace; |
| 234 GrDeviceCoordTexture fDstCopy; | 231 GrDeviceCoordTexture fDstCopy; |
| 235 GrBlendCoeff fSrcBlend; | 232 GrBlendCoeff fSrcBlend; |
| 236 GrBlendCoeff fDstBlend; | 233 GrBlendCoeff fDstBlend; |
| 237 uint32_t fFlags; | 234 uint32_t fFlags; |
| 238 ProgramGeometryProcessor fGeometryProcessor; | 235 ProgramGeometryProcessor fGeometryProcessor; |
| 239 ProgramPrimitiveProcessor fPrimitiveProcessor; | |
| 240 GrBatchTracker fBatchTracker; | 236 GrBatchTracker fBatchTracker; |
| 241 ProgramXferProcessor fXferProcessor; | 237 ProgramXferProcessor fXferProcessor; |
| 242 FragmentStageArray fFragmentStages; | 238 FragmentStageArray fFragmentStages; |
| 243 GrGpu::DrawType fDrawType; | 239 GrGpu::DrawType fDrawType; |
| 244 GrProgramDesc::DescInfo fDescInfo; | 240 GrProgramDesc::DescInfo fDescInfo; |
| 245 bool fFinalized; | 241 bool fFinalized; |
| 246 | 242 |
| 247 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. | 243 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. |
| 248 int fNumColorStages; | 244 int fNumColorStages; |
| 249 | 245 |
| 250 GrProgramDesc fDesc; | 246 GrProgramDesc fDesc; |
| 251 | 247 |
| 252 typedef SkRefCnt INHERITED; | 248 typedef SkRefCnt INHERITED; |
| 253 }; | 249 }; |
| 254 | 250 |
| 255 #endif | 251 #endif |
| OLD | NEW |