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

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

Issue 845103005: GrBatchPrototype (Closed) Base URL: https://skia.googlesource.com/skia.git@lc2
Patch Set: removing dstread 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;
20 class GrDeviceCoordTexture; 21 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
32 GrPipeline(const GrPipelineBuilder& pipelineBuilder, const GrPrimitiveProces sor*, 33 GrPipeline(const GrPipelineBuilder& pipelineBuilder, const GrPrimitiveProces sor*,
33 const GrDrawTargetCaps&, const GrScissorState&, 34 const GrDrawTargetCaps&, const GrScissorState&,
34 const GrDeviceCoordTexture* dstCopy); 35 const GrDeviceCoordTexture* dstCopy);
35 36
37 GrPipeline(GrBatch*, const GrPipelineBuilder&, const GrDrawTargetCaps&,
38 const GrScissorState&, const GrDeviceCoordTexture* dstCopy);
39
36 /* 40 /*
37 * Returns true if it is possible to combine the two GrPipelines and it will update 'this' 41 * Returns true if it is possible to combine the two GrPipelines and it will update 'this'
38 * to subsume 'that''s draw. 42 * to subsume 'that''s draw.
39 */ 43 */
40 bool isEqual(const GrPipeline& that) const; 44 bool isEqual(const GrPipeline& that) const;
41 45
42 /// @} 46 /// @}
43 47
44 /////////////////////////////////////////////////////////////////////////// 48 ///////////////////////////////////////////////////////////////////////////
45 /// @name Effect Stages 49 /// @name Effect Stages
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; } 129 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; }
126 130
127 /// @} 131 /// @}
128 132
129 /////////////////////////////////////////////////////////////////////////// 133 ///////////////////////////////////////////////////////////////////////////
130 134
131 const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; } 135 const GrDeviceCoordTexture* getDstCopy() const { return fDstCopy.texture() ? &fDstCopy : NULL; }
132 136
133 const GrProgramDesc::DescInfo& descInfo() const { return fDescInfo; } 137 const GrProgramDesc::DescInfo& descInfo() const { return fDescInfo; }
134 138
135 const GrGeometryProcessor::InitBT& getInitBatchTracker() const { return fIni tBT; } 139 const GrPipelineInfo& getInitBatchTracker() const { return fInitBT; }
136 140
137 private: 141 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
138 /** 150 /**
139 * Alter the program desc and inputs (attribs and processors) based on the b lend optimization. 151 * Alter the program desc and inputs (attribs and processors) based on the b lend optimization.
140 */ 152 */
141 void adjustProgramFromOptimizations(const GrPipelineBuilder& ds, 153 void adjustProgramFromOptimizations(const GrPipelineBuilder& ds,
142 GrXferProcessor::OptFlags, 154 GrXferProcessor::OptFlags,
143 const GrProcOptInfo& colorPOI, 155 const GrProcOptInfo& colorPOI,
144 const GrProcOptInfo& coveragePOI, 156 const GrProcOptInfo& coveragePOI,
145 int* firstColorStageIdx, 157 int* firstColorStageIdx,
146 int* firstCoverageStageIdx); 158 int* firstCoverageStageIdx);
147 159
148 /** 160 /**
149 * 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
150 * 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
151 * blend coeffs will represent those used by backend API. 163 * blend coeffs will represent those used by backend API.
152 */ 164 */
153 void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFla gs, 165 void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFla gs,
154 const GrDrawTargetCaps&); 166 const GrDrawTargetCaps&);
155 167
156 enum Flags { 168 enum Flags {
157 kDither_Flag = 0x1, 169 kDither_Flag = 0x1,
158 kHWAA_Flag = 0x2, 170 kHWAA_Flag = 0x2,
159 }; 171 };
160 172
161 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; 173 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget;
162 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; 174 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray;
163 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; 175 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor;
164 RenderTarget fRenderTarget; 176 RenderTarget fRenderTarget;
165 GrScissorState fScissorState; 177 GrScissorState fScissorState;
166 GrStencilSettings fStencilSettings; 178 GrStencilSettings fStencilSettings;
167 GrPipelineBuilder::DrawFace fDrawFace; 179 GrPipelineBuilder::DrawFace fDrawFace;
168 GrDeviceCoordTexture fDstCopy; 180 GrDeviceCoordTexture fDstCopy;
169 uint32_t fFlags; 181 uint32_t fFlags;
170 ProgramXferProcessor fXferProcessor; 182 ProgramXferProcessor fXferProcessor;
171 FragmentStageArray fFragmentStages; 183 FragmentStageArray fFragmentStages;
172 GrProgramDesc::DescInfo fDescInfo; 184 GrProgramDesc::DescInfo fDescInfo;
173 GrGeometryProcessor::InitBT fInitBT; 185 GrPipelineInfo fInitBT;
174 186
175 // This function is equivalent to the offset into fFragmentStages where cove rage stages begin. 187 // This function is equivalent to the offset into fFragmentStages where cove rage stages begin.
176 int fNumColorStages; 188 int fNumColorStages;
177 189
178 GrProgramDesc fDesc; 190 GrProgramDesc fDesc;
179 191
180 typedef SkRefCnt INHERITED; 192 typedef SkRefCnt INHERITED;
181 }; 193 };
182 194
183 #endif 195 #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