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 |
11 #include "GrColor.h" | 11 #include "GrColor.h" |
12 #include "GrFragmentProcessor.h" | 12 #include "GrFragmentProcessor.h" |
13 #include "GrGpu.h" | 13 #include "GrGpu.h" |
14 #include "GrNonAtomicRef.h" | 14 #include "GrNonAtomicRef.h" |
15 #include "GrPendingProgramElement.h" | 15 #include "GrPendingProgramElement.h" |
16 #include "GrPrimitiveProcessor.h" | 16 #include "GrPrimitiveProcessor.h" |
17 #include "GrProgramDesc.h" | 17 #include "GrProgramDesc.h" |
18 #include "GrStencil.h" | 18 #include "GrStencil.h" |
19 #include "GrTypesPriv.h" | 19 #include "GrTypesPriv.h" |
20 #include "SkMatrix.h" | 20 #include "SkMatrix.h" |
21 #include "SkRefCnt.h" | 21 #include "SkRefCnt.h" |
22 | 22 |
| 23 class GrAppliedClip; |
23 class GrBatch; | 24 class GrBatch; |
24 class GrDeviceCoordTexture; | 25 class GrDeviceCoordTexture; |
25 class GrPipelineBuilder; | 26 class GrPipelineBuilder; |
26 | 27 |
27 /** | 28 /** |
28 * Class that holds an optimized version of a GrPipelineBuilder. It is meant to
be an immutable | 29 * 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. | 30 * class, and contains all data needed to set the state for a gpu draw. |
30 */ | 31 */ |
31 class GrPipeline : public GrNonAtomicRef { | 32 class GrPipeline : public GrNonAtomicRef { |
32 public: | 33 public: |
33 /////////////////////////////////////////////////////////////////////////// | 34 /////////////////////////////////////////////////////////////////////////// |
34 /// @name Creation | 35 /// @name Creation |
35 | 36 |
36 struct CreateArgs { | 37 struct CreateArgs { |
37 const GrPipelineBuilder* fPipelineBuilder; | 38 const GrPipelineBuilder* fPipelineBuilder; |
38 const GrCaps* fCaps; | 39 const GrCaps* fCaps; |
39 GrProcOptInfo fColorPOI; | 40 GrProcOptInfo fColorPOI; |
40 GrProcOptInfo fCoveragePOI; | 41 GrProcOptInfo fCoveragePOI; |
41 const GrScissorState* fScissor; | 42 const GrAppliedClip* fClip; |
42 GrXferProcessor::DstTexture fDstTexture; | 43 GrXferProcessor::DstTexture fDstTexture; |
43 }; | 44 }; |
44 | 45 |
45 /** Creates a pipeline into a pre-allocated buffer */ | 46 /** Creates a pipeline into a pre-allocated buffer */ |
46 static GrPipeline* CreateAt(void* memory, const CreateArgs&, GrPipelineOptim
izations*); | 47 static GrPipeline* CreateAt(void* memory, const CreateArgs&, GrPipelineOptim
izations*); |
47 | 48 |
48 /// @} | 49 /// @} |
49 | 50 |
50 /////////////////////////////////////////////////////////////////////////// | 51 /////////////////////////////////////////////////////////////////////////// |
51 /// @name Comparisons | 52 /// @name Comparisons |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 * @return The currently set render target. | 119 * @return The currently set render target. |
119 */ | 120 */ |
120 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } | 121 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } |
121 | 122 |
122 const GrStencilSettings& getStencil() const { return fStencilSettings; } | 123 const GrStencilSettings& getStencil() const { return fStencilSettings; } |
123 | 124 |
124 const GrScissorState& getScissorState() const { return fScissorState; } | 125 const GrScissorState& getScissorState() const { return fScissorState; } |
125 | 126 |
126 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } | 127 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } |
127 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert
ices_Flag); } | 128 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert
ices_Flag); } |
| 129 bool hasCoCenteredSamples() const { return SkToBool(fFlags & kCoCenteredSamp
les_Flag); } |
128 | 130 |
129 GrXferBarrierType xferBarrierType(const GrCaps& caps) const { | 131 GrXferBarrierType xferBarrierType(const GrCaps& caps) const { |
130 return fXferProcessor->xferBarrierType(fRenderTarget.get(), caps); | 132 return fXferProcessor->xferBarrierType(fRenderTarget.get(), caps); |
131 } | 133 } |
132 | 134 |
133 /** | 135 /** |
134 * Gets whether the target is drawing clockwise, counterclockwise, | 136 * Gets whether the target is drawing clockwise, counterclockwise, |
135 * or both faces. | 137 * or both faces. |
136 * @return the current draw face(s). | 138 * @return the current draw face(s). |
137 */ | 139 */ |
(...skipping 21 matching lines...) Expand all Loading... |
159 * Calculates the primary and secondary output types of the shader. For cert
ain output types | 161 * 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 | 162 * 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. | 163 * blend coeffs will represent those used by backend API. |
162 */ | 164 */ |
163 void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFla
gs, | 165 void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFla
gs, |
164 const GrCaps&); | 166 const GrCaps&); |
165 | 167 |
166 enum Flags { | 168 enum Flags { |
167 kHWAA_Flag = 0x1, | 169 kHWAA_Flag = 0x1, |
168 kSnapVertices_Flag = 0x2, | 170 kSnapVertices_Flag = 0x2, |
| 171 kCoCenteredSamples_Flag = 0x4 |
169 }; | 172 }; |
170 | 173 |
171 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; | 174 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; |
172 typedef GrPendingProgramElement<const GrFragmentProcessor> PendingFragmentPr
ocessor; | 175 typedef GrPendingProgramElement<const GrFragmentProcessor> PendingFragmentPr
ocessor; |
173 typedef SkAutoSTArray<8, PendingFragmentProcessor> FragmentProcessorArray; | 176 typedef SkAutoSTArray<8, PendingFragmentProcessor> FragmentProcessorArray; |
174 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; | 177 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; |
175 RenderTarget fRenderTarget; | 178 RenderTarget fRenderTarget; |
176 GrScissorState fScissorState; | 179 GrScissorState fScissorState; |
177 GrStencilSettings fStencilSettings; | 180 GrStencilSettings fStencilSettings; |
178 GrPipelineBuilder::DrawFace fDrawFace; | 181 GrPipelineBuilder::DrawFace fDrawFace; |
179 uint32_t fFlags; | 182 uint32_t fFlags; |
180 ProgramXferProcessor fXferProcessor; | 183 ProgramXferProcessor fXferProcessor; |
181 FragmentProcessorArray fFragmentProcessors; | 184 FragmentProcessorArray fFragmentProcessors; |
182 bool fReadsFragPosition; | 185 bool fReadsFragPosition; |
183 | 186 |
184 // This value is also the index in fFragmentProcessors where coverage proces
sors begin. | 187 // This value is also the index in fFragmentProcessors where coverage proces
sors begin. |
185 int fNumColorProcessors; | 188 int fNumColorProcessors; |
186 | 189 |
187 typedef SkRefCnt INHERITED; | 190 typedef SkRefCnt INHERITED; |
188 }; | 191 }; |
189 | 192 |
190 #endif | 193 #endif |
OLD | NEW |