Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrPipeline_DEFINED | 8 #ifndef GrPipeline_DEFINED |
| 9 #define GrPipeline_DEFINED | 9 #define GrPipeline_DEFINED |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * Class that holds an optimized version of a GrPipelineBuilder. It is meant to be an immutable | 28 * Class that holds an optimized version of a GrPipelineBuilder. It is meant to be an immutable |
| 29 * class, and contains all data needed to set the state for a gpu draw. | 29 * class, and contains all data needed to set the state for a gpu draw. |
| 30 */ | 30 */ |
| 31 class GrPipeline : public GrNonAtomicRef { | 31 class GrPipeline : public GrNonAtomicRef { |
| 32 public: | 32 public: |
| 33 /////////////////////////////////////////////////////////////////////////// | 33 /////////////////////////////////////////////////////////////////////////// |
| 34 /// @name Creation | 34 /// @name Creation |
| 35 | 35 |
| 36 enum Flags { | |
| 37 kHWAA_Flag = 0x1, | |
| 38 kSnapVertices_Flag = 0x2, | |
| 39 kCoCenterSamples_Flag = 0x4 | |
| 40 }; | |
| 41 | |
| 36 struct CreateArgs { | 42 struct CreateArgs { |
|
bsalomon
2015/11/09 19:26:46
Perhaps CreateArgs should take an GrAppliedClip ra
Chris Dalton
2015/11/09 19:49:36
Ok, that's a good idea. And GrAppliedClip doesn't
| |
| 37 const GrPipelineBuilder* fPipelineBuilder; | 43 const GrPipelineBuilder* fPipelineBuilder; |
| 38 const GrCaps* fCaps; | 44 const GrCaps* fCaps; |
| 39 GrProcOptInfo fColorPOI; | 45 GrProcOptInfo fColorPOI; |
| 40 GrProcOptInfo fCoveragePOI; | 46 GrProcOptInfo fCoveragePOI; |
| 41 const GrScissorState* fScissor; | 47 const GrScissorState* fScissor; |
| 42 GrXferProcessor::DstTexture fDstTexture; | 48 GrXferProcessor::DstTexture fDstTexture; |
| 49 uint32_t fAdditionalFlags; | |
| 50 uint32_t fBlockedFlags; | |
| 43 }; | 51 }; |
| 44 | 52 |
| 45 /** Creates a pipeline into a pre-allocated buffer */ | 53 /** Creates a pipeline into a pre-allocated buffer */ |
| 46 static GrPipeline* CreateAt(void* memory, const CreateArgs&, GrPipelineOptim izations*); | 54 static GrPipeline* CreateAt(void* memory, const CreateArgs&, GrPipelineOptim izations*); |
| 47 | 55 |
| 48 /// @} | 56 /// @} |
| 49 | 57 |
| 50 /////////////////////////////////////////////////////////////////////////// | 58 /////////////////////////////////////////////////////////////////////////// |
| 51 /// @name Comparisons | 59 /// @name Comparisons |
| 52 | 60 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 * @return The currently set render target. | 126 * @return The currently set render target. |
| 119 */ | 127 */ |
| 120 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } | 128 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } |
| 121 | 129 |
| 122 const GrStencilSettings& getStencil() const { return fStencilSettings; } | 130 const GrStencilSettings& getStencil() const { return fStencilSettings; } |
| 123 | 131 |
| 124 const GrScissorState& getScissorState() const { return fScissorState; } | 132 const GrScissorState& getScissorState() const { return fScissorState; } |
| 125 | 133 |
| 126 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } | 134 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } |
| 127 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert ices_Flag); } | 135 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert ices_Flag); } |
| 136 bool hasCoCenteredSamples() const { return SkToBool(fFlags & kCoCenterSample s_Flag); } | |
| 128 | 137 |
| 129 GrXferBarrierType xferBarrierType(const GrCaps& caps) const { | 138 GrXferBarrierType xferBarrierType(const GrCaps& caps) const { |
| 130 return fXferProcessor->xferBarrierType(fRenderTarget.get(), caps); | 139 return fXferProcessor->xferBarrierType(fRenderTarget.get(), caps); |
| 131 } | 140 } |
| 132 | 141 |
| 133 /** | 142 /** |
| 134 * Gets whether the target is drawing clockwise, counterclockwise, | 143 * Gets whether the target is drawing clockwise, counterclockwise, |
| 135 * or both faces. | 144 * or both faces. |
| 136 * @return the current draw face(s). | 145 * @return the current draw face(s). |
| 137 */ | 146 */ |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 156 int* firstCoverageProcessorIdx); | 165 int* firstCoverageProcessorIdx); |
| 157 | 166 |
| 158 /** | 167 /** |
| 159 * Calculates the primary and secondary output types of the shader. For cert ain output types | 168 * Calculates the primary and secondary output types of the shader. For cert ain output types |
| 160 * the function may adjust the blend coefficients. After this function is ca lled the src and dst | 169 * the function may adjust the blend coefficients. After this function is ca lled the src and dst |
| 161 * blend coeffs will represent those used by backend API. | 170 * blend coeffs will represent those used by backend API. |
| 162 */ | 171 */ |
| 163 void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFla gs, | 172 void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFla gs, |
| 164 const GrCaps&); | 173 const GrCaps&); |
| 165 | 174 |
| 166 enum Flags { | |
| 167 kHWAA_Flag = 0x1, | |
| 168 kSnapVertices_Flag = 0x2, | |
| 169 }; | |
| 170 | |
| 171 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; | 175 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; |
| 172 typedef GrPendingProgramElement<const GrFragmentProcessor> PendingFragmentPr ocessor; | 176 typedef GrPendingProgramElement<const GrFragmentProcessor> PendingFragmentPr ocessor; |
| 173 typedef SkAutoSTArray<8, PendingFragmentProcessor> FragmentProcessorArray; | 177 typedef SkAutoSTArray<8, PendingFragmentProcessor> FragmentProcessorArray; |
| 174 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; | 178 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; |
| 175 RenderTarget fRenderTarget; | 179 RenderTarget fRenderTarget; |
| 176 GrScissorState fScissorState; | 180 GrScissorState fScissorState; |
| 177 GrStencilSettings fStencilSettings; | 181 GrStencilSettings fStencilSettings; |
| 178 GrPipelineBuilder::DrawFace fDrawFace; | 182 GrPipelineBuilder::DrawFace fDrawFace; |
| 179 uint32_t fFlags; | 183 uint32_t fFlags; |
| 180 ProgramXferProcessor fXferProcessor; | 184 ProgramXferProcessor fXferProcessor; |
| 181 FragmentProcessorArray fFragmentProcessors; | 185 FragmentProcessorArray fFragmentProcessors; |
| 182 bool fReadsFragPosition; | 186 bool fReadsFragPosition; |
| 183 | 187 |
| 184 // This value is also the index in fFragmentProcessors where coverage proces sors begin. | 188 // This value is also the index in fFragmentProcessors where coverage proces sors begin. |
| 185 int fNumColorProcessors; | 189 int fNumColorProcessors; |
| 186 | 190 |
| 187 typedef SkRefCnt INHERITED; | 191 typedef SkRefCnt INHERITED; |
| 188 }; | 192 }; |
| 189 | 193 |
| 190 #endif | 194 #endif |
| OLD | NEW |