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

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

Issue 742763002: scissor state on optstate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 1 month 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/GrInOrderDrawBuffer.cpp ('k') | src/gpu/GrOptDrawState.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 2014 Google Inc. 2 * Copyright 2014 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 GrOptDrawState_DEFINED 8 #ifndef GrOptDrawState_DEFINED
9 #define GrOptDrawState_DEFINED 9 #define GrOptDrawState_DEFINED
10 10
(...skipping 10 matching lines...) Expand all
21 class GrDrawState; 21 class GrDrawState;
22 22
23 /** 23 /**
24 * Class that holds an optimized version of a GrDrawState. It is meant to be an immutable class, 24 * Class that holds an optimized version of a GrDrawState. It is meant to be an immutable class,
25 * and contains all data needed to set the state for a gpu draw. 25 * and contains all data needed to set the state for a gpu draw.
26 */ 26 */
27 class GrOptDrawState : public SkRefCnt { 27 class GrOptDrawState : public SkRefCnt {
28 public: 28 public:
29 SK_DECLARE_INST_COUNT(GrOptDrawState) 29 SK_DECLARE_INST_COUNT(GrOptDrawState)
30 30
31 typedef GrClipMaskManager::ScissorState ScissorState;
32
31 /** 33 /**
32 * Returns a snapshot of the current optimized state. The GrOptDrawState is reffed and ownership 34 * Returns a snapshot of the current optimized state. The GrOptDrawState is reffed and ownership
33 * is given to the caller. 35 * is given to the caller.
34 */ 36 */
35 static GrOptDrawState* Create(const GrDrawState& drawState, 37 static GrOptDrawState* Create(const GrDrawState& drawState,
36 GrGpu*, 38 GrGpu*,
39 const ScissorState&,
37 const GrDeviceCoordTexture* dstCopy, 40 const GrDeviceCoordTexture* dstCopy,
38 GrGpu::DrawType drawType); 41 GrGpu::DrawType drawType);
39 42
40 bool operator== (const GrOptDrawState& that) const; 43 bool operator== (const GrOptDrawState& that) const;
41 bool operator!= (const GrOptDrawState& that) const { return !(*this == that) ; } 44 bool operator!= (const GrOptDrawState& that) const { return !(*this == that) ; }
42 45
43 /////////////////////////////////////////////////////////////////////////// 46 ///////////////////////////////////////////////////////////////////////////
44 /// @name Vertex Attributes 47 /// @name Vertex Attributes
45 //// 48 ////
46 49
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 160
158 /////////////////////////////////////////////////////////////////////////// 161 ///////////////////////////////////////////////////////////////////////////
159 /// @name Stencil 162 /// @name Stencil
160 //// 163 ////
161 164
162 const GrStencilSettings& getStencil() const { return fStencilSettings; } 165 const GrStencilSettings& getStencil() const { return fStencilSettings; }
163 166
164 /// @} 167 /// @}
165 168
166 /////////////////////////////////////////////////////////////////////////// 169 ///////////////////////////////////////////////////////////////////////////
170 /// @name ScissorState
171 ////
172
173 const ScissorState& getScissorState() const { return fScissorState; }
174
175 /// @}
176
177
178 ///////////////////////////////////////////////////////////////////////////
167 /// @name State Flags 179 /// @name State Flags
168 //// 180 ////
169 181
170 bool isDitherState() const { return 0 != (fFlagBits & kDither_StateBit); } 182 bool isDitherState() const { return 0 != (fFlagBits & kDither_StateBit); }
171 bool isHWAntialiasState() const { return 0 != (fFlagBits & kHWAntialias_Stat eBit); } 183 bool isHWAntialiasState() const { return 0 != (fFlagBits & kHWAntialias_Stat eBit); }
172 bool isColorWriteDisabled() const { return 0 != (fFlagBits & kNoColorWrites_ StateBit); } 184 bool isColorWriteDisabled() const { return 0 != (fFlagBits & kNoColorWrites_ StateBit); }
173 bool isCoverageDrawing() const { return 0 != (fFlagBits & kCoverageDrawing_S tateBit); } 185 bool isCoverageDrawing() const { return 0 != (fFlagBits & kCoverageDrawing_S tateBit); }
174 186
175 /// @} 187 /// @}
176 188
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 */ 273 */
262 kEmitTransBlack_BlendOptFlag = 0x8, 274 kEmitTransBlack_BlendOptFlag = 0x8,
263 }; 275 };
264 GR_DECL_BITFIELD_OPS_FRIENDS(BlendOptFlags); 276 GR_DECL_BITFIELD_OPS_FRIENDS(BlendOptFlags);
265 277
266 /** 278 /**
267 * Constructs and optimized drawState out of a GrRODrawState. 279 * Constructs and optimized drawState out of a GrRODrawState.
268 */ 280 */
269 GrOptDrawState(const GrDrawState& drawState, BlendOptFlags blendOptFlags, 281 GrOptDrawState(const GrDrawState& drawState, BlendOptFlags blendOptFlags,
270 GrBlendCoeff optSrcCoeff, GrBlendCoeff optDstCoeff, 282 GrBlendCoeff optSrcCoeff, GrBlendCoeff optDstCoeff,
271 GrGpu*, const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType) ; 283 GrGpu*, const ScissorState&, const GrDeviceCoordTexture* dstC opy,
284 GrGpu::DrawType);
272 285
273 /** 286 /**
274 * Loops through all the color stage effects to check if the stage will igno re color input or 287 * Loops through all the color stage effects to check if the stage will igno re color input or
275 * always output a constant color. In the ignore color input case we can ign ore all previous 288 * always output a constant color. In the ignore color input case we can ign ore all previous
276 * stages. In the constant color case, we can ignore all previous stages and 289 * stages. In the constant color case, we can ignore all previous stages and
277 * the current one and set the state color to the constant color. 290 * the current one and set the state color to the constant color.
278 */ 291 */
279 void computeEffectiveColorStages(const GrDrawState& ds, GrProgramDesc::DescI nfo*, 292 void computeEffectiveColorStages(const GrDrawState& ds, GrProgramDesc::DescI nfo*,
280 int* firstColorStageIdx, uint8_t* fixFuncti onVAToRemove); 293 int* firstColorStageIdx, uint8_t* fixFuncti onVAToRemove);
281 294
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 * the function may adjust the blend coefficients. After this function is ca lled the src and dst 327 * the function may adjust the blend coefficients. After this function is ca lled the src and dst
315 * blend coeffs will represent those used by backend API. 328 * blend coeffs will represent those used by backend API.
316 */ 329 */
317 void setOutputStateInfo(const GrDrawState& ds, const GrDrawTargetCaps&, 330 void setOutputStateInfo(const GrDrawState& ds, const GrDrawTargetCaps&,
318 GrProgramDesc::DescInfo*); 331 GrProgramDesc::DescInfo*);
319 332
320 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; 333 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget;
321 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; 334 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray;
322 typedef GrPendingProgramElement<const GrGeometryProcessor> ProgramGeometryPr ocessor; 335 typedef GrPendingProgramElement<const GrGeometryProcessor> ProgramGeometryPr ocessor;
323 RenderTarget fRenderTarget; 336 RenderTarget fRenderTarget;
337 ScissorState fScissorState;
324 GrColor fColor; 338 GrColor fColor;
325 SkMatrix fViewMatrix; 339 SkMatrix fViewMatrix;
326 GrColor fBlendConstant; 340 GrColor fBlendConstant;
327 uint32_t fFlagBits; 341 uint32_t fFlagBits;
328 const GrVertexAttrib* fVAPtr; 342 const GrVertexAttrib* fVAPtr;
329 int fVACount; 343 int fVACount;
330 size_t fVAStride; 344 size_t fVAStride;
331 GrStencilSettings fStencilSettings; 345 GrStencilSettings fStencilSettings;
332 uint8_t fCoverage; 346 uint8_t fCoverage;
333 DrawFace fDrawFace; 347 DrawFace fDrawFace;
(...skipping 12 matching lines...) Expand all
346 360
347 GrProgramDesc fDesc; 361 GrProgramDesc fDesc;
348 362
349 typedef SkRefCnt INHERITED; 363 typedef SkRefCnt INHERITED;
350 }; 364 };
351 365
352 GR_MAKE_BITFIELD_OPS(GrOptDrawState::BlendOptFlags); 366 GR_MAKE_BITFIELD_OPS(GrOptDrawState::BlendOptFlags);
353 367
354 #endif 368 #endif
355 369
OLDNEW
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.cpp ('k') | src/gpu/GrOptDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698