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