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

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

Issue 634073002: Delay copying effects from DS or ODS till end of creating ODS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 6 years, 2 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 | « no previous file | 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 * Constructs and optimized drawState out of a GrRODrawState. 368 * Constructs and optimized drawState out of a GrRODrawState.
369 */ 369 */
370 GrOptDrawState(const GrDrawState& drawState, BlendOptFlags blendOptFlags, 370 GrOptDrawState(const GrDrawState& drawState, BlendOptFlags blendOptFlags,
371 GrBlendCoeff optSrcCoeff, GrBlendCoeff optDstCoeff, 371 GrBlendCoeff optSrcCoeff, GrBlendCoeff optDstCoeff,
372 const GrDrawTargetCaps& caps); 372 const GrDrawTargetCaps& caps);
373 373
374 /** 374 /**
375 * Loops through all the color stage effects to check if the stage will igno re color input or 375 * Loops through all the color stage effects to check if the stage will igno re color input or
376 * always output a constant color. In the ignore color input case we can ign ore all previous 376 * always output a constant color. In the ignore color input case we can ign ore all previous
377 * stages. In the constant color case, we can ignore all previous stages and 377 * stages. In the constant color case, we can ignore all previous stages and
378 * the current one and set the state color to the constant color. Once we de termine the so 378 * the current one and set the state color to the constant color.
379 * called first effective stage, we copy all the effective stages into our o ptimized
380 * state.
381 */ 379 */
382 void copyEffectiveColorStages(const GrDrawState& ds); 380 void computeEffectiveColorStages(const GrDrawState& ds, int* firstColorStage Idx,
381 uint8_t* fixFunctionVAToRemove);
383 382
384 /** 383 /**
385 * Loops through all the coverage stage effects to check if the stage will i gnore color input. 384 * Loops through all the coverage stage effects to check if the stage will i gnore color input.
386 * If a coverage stage will ignore input, then we can ignore all coverage st ages before it. We 385 * If a coverage stage will ignore input, then we can ignore all coverage st ages before it. We
387 * loop to determine the first effective coverage stage, and then copy all o f our effective 386 * loop to determine the first effective coverage stage.
388 * coverage stages into our optimized state.
389 */ 387 */
390 void copyEffectiveCoverageStages(const GrDrawState& ds); 388 void computeEffectiveCoverageStages(const GrDrawState& ds, int* firstCoverag eStageIdx);
391 389
392 /** 390 /**
393 * This function takes in a flag and removes the corresponding fixed functio n vertex attributes. 391 * This function takes in a flag and removes the corresponding fixed functio n vertex attributes.
394 * The flags are in the same order as GrVertexAttribBinding array. If bit i of removeVAFlags is 392 * The flags are in the same order as GrVertexAttribBinding array. If bit i of removeVAFlags is
395 * set, then vertex attributes with binding (GrVertexAttribute)i will be rem oved. 393 * set, then vertex attributes with binding (GrVertexAttribute)i will be rem oved.
396 */ 394 */
397 void removeFixedFunctionVertexAttribs(uint8_t removeVAFlags); 395 void removeFixedFunctionVertexAttribs(uint8_t removeVAFlags);
398 396
399 /** 397 /**
400 * Alter the OptDrawState (adjusting stages, vertex attribs, flags, etc.) ba sed on the 398 * Alter the OptDrawState (adjusting stages, vertex attribs, flags, etc.) ba sed on the
401 * BlendOptFlags. 399 * BlendOptFlags.
402 */ 400 */
403 void adjustFromBlendOpts(); 401 void adjustFromBlendOpts(const GrDrawState& ds, int* firstColorStageIdx,
402 int* firstCoverageStageIdx, uint8_t* fixedFunctionV AToRemove);
404 403
405 /** 404 /**
406 * Loop over the effect stages to determine various info like what data they will read and what 405 * Loop over the effect stages to determine various info like what data they will read and what
407 * shaders they require. 406 * shaders they require.
408 */ 407 */
409 void getStageStats(); 408 void getStageStats(const GrDrawState& ds, int firstColorStageIdx, int firstC overageStageIdx);
410 409
411 /** 410 /**
412 * Calculates the primary and secondary output types of the shader. For cert ain output types 411 * Calculates the primary and secondary output types of the shader. For cert ain output types
413 * the function may adjust the blend coefficients. After this function is ca lled the src and dst 412 * the function may adjust the blend coefficients. After this function is ca lled the src and dst
414 * blend coeffs will represent those used by backend API. 413 * blend coeffs will represent those used by backend API.
415 */ 414 */
416 void setOutputStateInfo(const GrDrawTargetCaps&); 415 void setOutputStateInfo(const GrDrawState& ds, const GrDrawTargetCaps&,
416 int firstCoverageStageIdx, bool* separateCoverageFro mColor);
417 417
418 bool isEqual(const GrOptDrawState& that) const; 418 bool isEqual(const GrOptDrawState& that) const;
419 419
420 // These fields are roughly sorted by decreasing likelihood of being differe nt in op== 420 // These fields are roughly sorted by decreasing likelihood of being differe nt in op==
421 typedef GrTGpuResourceRef<GrRenderTarget> ProgramRenderTarget; 421 typedef GrTGpuResourceRef<GrRenderTarget> ProgramRenderTarget;
422 ProgramRenderTarget fRenderTarget; 422 ProgramRenderTarget fRenderTarget;
423 GrColor fColor; 423 GrColor fColor;
424 SkMatrix fViewMatrix; 424 SkMatrix fViewMatrix;
425 GrColor fBlendConstant; 425 GrColor fBlendConstant;
426 uint32_t fFlagBits; 426 uint32_t fFlagBits;
427 const GrVertexAttrib* fVAPtr; 427 const GrVertexAttrib* fVAPtr;
428 int fVACount; 428 int fVACount;
429 size_t fVAStride; 429 size_t fVAStride;
430 GrStencilSettings fStencilSettings; 430 GrStencilSettings fStencilSettings;
431 uint8_t fCoverage; 431 uint8_t fCoverage;
432 DrawFace fDrawFace; 432 DrawFace fDrawFace;
433 GrBlendCoeff fSrcBlend; 433 GrBlendCoeff fSrcBlend;
434 GrBlendCoeff fDstBlend; 434 GrBlendCoeff fDstBlend;
435 435
436 typedef SkSTArray<4, GrFragmentStage> FragmentStageArray; 436 typedef SkSTArray<8, GrFragmentStage> FragmentStageArray;
437 SkAutoTDelete<GrGeometryStage> fGeometryProcessor; 437 SkAutoTDelete<GrGeometryStage> fGeometryProcessor;
438 FragmentStageArray fColorStages; 438 FragmentStageArray fColorStages;
439 FragmentStageArray fCoverageStages; 439 FragmentStageArray fCoverageStages;
440 440
441 // This is simply a different representation of info in fVertexAttribs and t hus does 441 // This is simply a different representation of info in fVertexAttribs and t hus does
442 // not need to be compared in op==. 442 // not need to be compared in op==.
443 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt ]; 443 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt ];
444 444
445 // These flags are needed to protect the code from creating an unused unifor m color/coverage 445 // These flags are needed to protect the code from creating an unused unifor m color/coverage
446 // which will cause shader compiler errors. 446 // which will cause shader compiler errors.
(...skipping 13 matching lines...) Expand all
460 PrimaryOutputType fPrimaryOutputType : 8; 460 PrimaryOutputType fPrimaryOutputType : 8;
461 SecondaryOutputType fSecondaryOutputType : 8; 461 SecondaryOutputType fSecondaryOutputType : 8;
462 462
463 typedef SkRefCnt INHERITED; 463 typedef SkRefCnt INHERITED;
464 }; 464 };
465 465
466 GR_MAKE_BITFIELD_OPS(GrOptDrawState::BlendOptFlags); 466 GR_MAKE_BITFIELD_OPS(GrOptDrawState::BlendOptFlags);
467 467
468 #endif 468 #endif
469 469
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrOptDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698