Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: src/gpu/GrPipeline.h

Issue 862823004: Revert of GrBatchPrototype (Closed) Base URL: https://skia.googlesource.com/skia.git@lc2
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/GrPipeline.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "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 GrBatch;
21 class GrDeviceCoordTexture; 20 class GrDeviceCoordTexture;
21 class GrPathProcessor;
22 class GrPipelineBuilder; 22 class GrPipelineBuilder;
23 23
24 /** 24 /**
25 * Class that holds an optimized version of a GrPipelineBuilder. It is meant to be an immutable 25 * Class that holds an optimized version of a GrPipelineBuilder. It is meant to be an immutable
26 * class, and contains all data needed to set the state for a gpu draw. 26 * class, and contains all data needed to set the state for a gpu draw.
27 */ 27 */
28 class GrPipeline { 28 class GrPipeline {
29 public: 29 public:
30 SK_DECLARE_INST_COUNT(GrPipeline) 30 SK_DECLARE_INST_COUNT(GrPipeline)
31 31
32 // TODO get rid of this version of the constructor when we use batch everywh ere
33 GrPipeline(const GrPipelineBuilder& pipelineBuilder, const GrPrimitiveProces sor*, 32 GrPipeline(const GrPipelineBuilder& pipelineBuilder, const GrPrimitiveProces sor*,
34 const GrDrawTargetCaps&, const GrScissorState&, 33 const GrDrawTargetCaps&, const GrScissorState&,
35 const GrDeviceCoordTexture* dstCopy); 34 const GrDeviceCoordTexture* dstCopy);
36 35
37 GrPipeline(GrBatch*, const GrPipelineBuilder&, const GrDrawTargetCaps&,
38 const GrScissorState&, const GrDeviceCoordTexture* dstCopy);
39
40 /* 36 /*
41 * Returns true if it is possible to combine the two GrPipelines and it will update 'this' 37 * Returns true if it is possible to combine the two GrPipelines and it will update 'this'
42 * to subsume 'that''s draw. 38 * to subsume 'that''s draw.
43 */ 39 */
44 bool isEqual(const GrPipeline& that) const; 40 bool isEqual(const GrPipeline& that) const;
45 41
46 /// @} 42 /// @}
47 43
48 /////////////////////////////////////////////////////////////////////////// 44 ///////////////////////////////////////////////////////////////////////////
49 /// @name Effect Stages 45 /// @name Effect Stages
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; } 125 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; }
130 126
131 /// @} 127 /// @}
132 128
133 /////////////////////////////////////////////////////////////////////////// 129 ///////////////////////////////////////////////////////////////////////////
134 130
135 const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; } 131 const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; }
136 132
137 const GrProgramDesc::DescInfo& descInfo() const { return fDescInfo; } 133 const GrProgramDesc::DescInfo& descInfo() const { return fDescInfo; }
138 134
139 const GrPipelineInfo& getInitBatchTracker() const { return fInitBT; } 135 const GrGeometryProcessor::InitBT& getInitBatchTracker() const { return fIni tBT; }
140 136
141 private: 137 private:
142 // TODO we can have one constructor once GrBatch is complete
143 void internalConstructor(const GrPipelineBuilder&,
144 const GrProcOptInfo& colorPOI,
145 const GrProcOptInfo& coveragePOI,
146 const GrDrawTargetCaps&,
147 const GrScissorState&,
148 const GrDeviceCoordTexture* dstCopy);
149
150 /** 138 /**
151 * Alter the program desc and inputs (attribs and processors) based on the b lend optimization. 139 * Alter the program desc and inputs (attribs and processors) based on the b lend optimization.
152 */ 140 */
153 void adjustProgramFromOptimizations(const GrPipelineBuilder& ds, 141 void adjustProgramFromOptimizations(const GrPipelineBuilder& ds,
154 GrXferProcessor::OptFlags, 142 GrXferProcessor::OptFlags,
155 const GrProcOptInfo& colorPOI, 143 const GrProcOptInfo& colorPOI,
156 const GrProcOptInfo& coveragePOI, 144 const GrProcOptInfo& coveragePOI,
157 int* firstColorStageIdx, 145 int* firstColorStageIdx,
158 int* firstCoverageStageIdx); 146 int* firstCoverageStageIdx);
159 147
160 /** 148 /**
161 * Calculates the primary and secondary output types of the shader. For cert ain output types 149 * 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 150 * 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. 151 * blend coeffs will represent those used by backend API.
164 */ 152 */
165 void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFla gs, 153 void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFla gs,
166 const GrDrawTargetCaps&); 154 const GrDrawTargetCaps&);
167 155
168 enum Flags { 156 enum Flags {
169 kDither_Flag = 0x1, 157 kDither_Flag = 0x1,
170 kHWAA_Flag = 0x2, 158 kHWAA_Flag = 0x2,
171 }; 159 };
172 160
173 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; 161 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget;
174 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; 162 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray;
175 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; 163 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor;
176 RenderTarget fRenderTarget; 164 RenderTarget fRenderTarget;
177 GrScissorState fScissorState; 165 GrScissorState fScissorState;
178 GrStencilSettings fStencilSettings; 166 GrStencilSettings fStencilSettings;
179 GrPipelineBuilder::DrawFace fDrawFace; 167 GrPipelineBuilder::DrawFace fDrawFace;
180 GrDeviceCoordTexture fDstCopy; 168 GrDeviceCoordTexture fDstCopy;
181 uint32_t fFlags; 169 uint32_t fFlags;
182 ProgramXferProcessor fXferProcessor; 170 ProgramXferProcessor fXferProcessor;
183 FragmentStageArray fFragmentStages; 171 FragmentStageArray fFragmentStages;
184 GrProgramDesc::DescInfo fDescInfo; 172 GrProgramDesc::DescInfo fDescInfo;
185 GrPipelineInfo fInitBT; 173 GrGeometryProcessor::InitBT fInitBT;
186 174
187 // This function is equivalent to the offset into fFragmentStages where cove rage stages begin. 175 // This function is equivalent to the offset into fFragmentStages where cove rage stages begin.
188 int fNumColorStages; 176 int fNumColorStages;
189 177
190 GrProgramDesc fDesc; 178 GrProgramDesc fDesc;
191 179
192 typedef SkRefCnt INHERITED; 180 typedef SkRefCnt INHERITED;
193 }; 181 };
194 182
195 #endif 183 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/GrPipeline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698