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

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

Issue 1225363002: Move GrProcessorDataManager to GrMemoryPool (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 5 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/GrPaint.cpp ('k') | src/gpu/GrPipelineBuilder.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 GrPipelineBuilder_DEFINED 8 #ifndef GrPipelineBuilder_DEFINED
9 #define GrPipelineBuilder_DEFINED 9 #define GrPipelineBuilder_DEFINED
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 SkASSERT(effect); 77 SkASSERT(effect);
78 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrFragmentStage, (effect)); 78 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrFragmentStage, (effect));
79 fCoverageProcInfoValid = false; 79 fCoverageProcInfoValid = false;
80 return effect; 80 return effect;
81 } 81 }
82 82
83 /** 83 /**
84 * Creates a GrSimpleTextureEffect that uses local coords as texture coordin ates. 84 * Creates a GrSimpleTextureEffect that uses local coords as texture coordin ates.
85 */ 85 */
86 void addColorTextureProcessor(GrTexture* texture, const SkMatrix& matrix) { 86 void addColorTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
87 this->addColorProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, texture, 87 this->addColorProcessor(GrSimpleTextureEffect::Create(fProcDataManager, texture,
88 matrix))->unref(); 88 matrix))->unref();
89 } 89 }
90 90
91 void addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& matrix) { 91 void addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
92 this->addCoverageProcessor(GrSimpleTextureEffect::Create(&fProcDataManag er, texture, 92 this->addCoverageProcessor(GrSimpleTextureEffect::Create(fProcDataManage r, texture,
93 matrix))->unref (); 93 matrix))->unref ();
94 } 94 }
95 95
96 void addColorTextureProcessor(GrTexture* texture, 96 void addColorTextureProcessor(GrTexture* texture,
97 const SkMatrix& matrix, 97 const SkMatrix& matrix,
98 const GrTextureParams& params) { 98 const GrTextureParams& params) {
99 this->addColorProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, texture, matrix, 99 this->addColorProcessor(GrSimpleTextureEffect::Create(fProcDataManager, texture, matrix,
100 params))->unref(); 100 params))->unref();
101 } 101 }
102 102
103 void addCoverageTextureProcessor(GrTexture* texture, 103 void addCoverageTextureProcessor(GrTexture* texture,
104 const SkMatrix& matrix, 104 const SkMatrix& matrix,
105 const GrTextureParams& params) { 105 const GrTextureParams& params) {
106 this->addCoverageProcessor(GrSimpleTextureEffect::Create(&fProcDataManag er, texture, matrix, 106 this->addCoverageProcessor(GrSimpleTextureEffect::Create(fProcDataManage r, texture, matrix,
107 params))->unref (); 107 params))->unref ();
108 } 108 }
109 109
110 /** 110 /**
111 * When this object is destroyed it will remove any color/coverage FPs from the pipeline builder 111 * When this object is destroyed it will remove any color/coverage FPs from the pipeline builder
112 * that were added after its constructor. 112 * that were added after its constructor.
113 */ 113 */
114 class AutoRestoreFragmentProcessors : public ::SkNoncopyable { 114 class AutoRestoreFragmentProcessors : public ::SkNoncopyable {
115 public: 115 public:
116 AutoRestoreFragmentProcessors() 116 AutoRestoreFragmentProcessors()
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 389 }
390 390
391 const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const { 391 const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const {
392 this->calcCoverageInvariantOutput(batch); 392 this->calcCoverageInvariantOutput(batch);
393 return fCoverageProcInfo; 393 return fCoverageProcInfo;
394 } 394 }
395 395
396 void setClip(const GrClip& clip) { fClip = clip; } 396 void setClip(const GrClip& clip) { fClip = clip; }
397 const GrClip& clip() const { return fClip; } 397 const GrClip& clip() const { return fClip; }
398 398
399 GrProcessorDataManager* getProcessorDataManager() { return &fProcDataManager ; } 399 GrProcessorDataManager* getProcessorDataManager() { return fProcDataManager. get(); }
400 const GrProcessorDataManager* processorDataManager() const { return fProcDat aManager.get(); }
400 401
401 private: 402 private:
402 // Calculating invariant color / coverage information is expensive, so we pa rtially cache the 403 // Calculating invariant color / coverage information is expensive, so we pa rtially cache the
403 // results. 404 // results.
404 // 405 //
405 // canUseFracCoveragePrimProc() - Called in regular skia draw, caches result s but only for a 406 // canUseFracCoveragePrimProc() - Called in regular skia draw, caches result s but only for a
406 // specific color and coverage. May be calle d multiple times 407 // specific color and coverage. May be calle d multiple times
407 // willColorBlendWithDst() - only called by Nvpr, does not cache results 408 // willColorBlendWithDst() - only called by Nvpr, does not cache results
408 // GrOptDrawState constructor - never caches results 409 // GrOptDrawState constructor - never caches results
409 410
(...skipping 21 matching lines...) Expand all
431 * processors and results are stored in fCoverageProcInfo. 432 * processors and results are stored in fCoverageProcInfo.
432 */ 433 */
433 void calcCoverageInvariantOutput(GrColor) const; 434 void calcCoverageInvariantOutput(GrColor) const;
434 435
435 // Some of the auto restore objects assume that no effects are removed durin g their lifetime. 436 // Some of the auto restore objects assume that no effects are removed durin g their lifetime.
436 // This is used to assert that this condition holds. 437 // This is used to assert that this condition holds.
437 SkDEBUGCODE(int fBlockEffectRemovalCnt;) 438 SkDEBUGCODE(int fBlockEffectRemovalCnt;)
438 439
439 typedef SkSTArray<4, GrFragmentStage> FragmentStageArray; 440 typedef SkSTArray<4, GrFragmentStage> FragmentStageArray;
440 441
441 GrProcessorDataManager fProcDataManager; 442 SkAutoTUnref<GrProcessorDataManager> fProcDataManager;
442 SkAutoTUnref<GrRenderTarget> fRenderTarget; 443 SkAutoTUnref<GrRenderTarget> fRenderTarget;
443 uint32_t fFlags; 444 uint32_t fFlags;
444 GrStencilSettings fStencilSettings; 445 GrStencilSettings fStencilSettings;
445 DrawFace fDrawFace; 446 DrawFace fDrawFace;
446 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; 447 mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
447 FragmentStageArray fColorStages; 448 FragmentStageArray fColorStages;
448 FragmentStageArray fCoverageStages; 449 FragmentStageArray fCoverageStages;
449 GrClip fClip; 450 GrClip fClip;
450 451
451 mutable GrProcOptInfo fColorProcInfo; 452 mutable GrProcOptInfo fColorProcInfo;
452 mutable GrProcOptInfo fCoverageProcInfo; 453 mutable GrProcOptInfo fCoverageProcInfo;
453 mutable bool fColorProcInfoValid; 454 mutable bool fColorProcInfoValid;
454 mutable bool fCoverageProcInfoValid; 455 mutable bool fCoverageProcInfoValid;
455 mutable GrColor fColorCache; 456 mutable GrColor fColorCache;
456 mutable GrColor fCoverageCache; 457 mutable GrColor fCoverageCache;
457 458
458 friend class GrPipeline; 459 friend class GrPipeline;
459 }; 460 };
460 461
461 #endif 462 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPaint.cpp ('k') | src/gpu/GrPipelineBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698