OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
10 | 10 |
11 #include "GrPipelineBuilder.h" | 11 #include "GrPipelineBuilder.h" |
12 #include "GrProgramDesc.h" | 12 #include "GrProgramDesc.h" |
13 #include "GrRenderTargetPriv.h" | |
13 #include "GrStencil.h" | 14 #include "GrStencil.h" |
14 #include "GrSwizzle.h" | 15 #include "GrSwizzle.h" |
15 #include "GrTextureParamsAdjuster.h" | 16 #include "GrTextureParamsAdjuster.h" |
16 #include "GrXferProcessor.h" | 17 #include "GrXferProcessor.h" |
17 #include "SkPath.h" | 18 #include "SkPath.h" |
19 #include <map> | |
18 | 20 |
19 class GrBatchTracker; | 21 class GrBatchTracker; |
20 class GrContext; | 22 class GrContext; |
21 class GrGLContext; | 23 class GrGLContext; |
22 class GrIndexBuffer; | 24 class GrIndexBuffer; |
23 class GrNonInstancedVertices; | 25 class GrNonInstancedVertices; |
24 class GrPath; | 26 class GrPath; |
25 class GrPathRange; | 27 class GrPathRange; |
26 class GrPathRenderer; | 28 class GrPathRenderer; |
27 class GrPathRendererChain; | 29 class GrPathRendererChain; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 | 328 |
327 // Called to perform a surface to surface copy. Fallbacks to issuing a draw from the src to dst | 329 // Called to perform a surface to surface copy. Fallbacks to issuing a draw from the src to dst |
328 // take place at the GrDrawTarget level and this function implement faster c opy paths. The rect | 330 // take place at the GrDrawTarget level and this function implement faster c opy paths. The rect |
329 // and point are pre-clipped. The src rect and implied dst rect are guarante ed to be within the | 331 // and point are pre-clipped. The src rect and implied dst rect are guarante ed to be within the |
330 // src/dst bounds and non-empty. | 332 // src/dst bounds and non-empty. |
331 bool copySurface(GrSurface* dst, | 333 bool copySurface(GrSurface* dst, |
332 GrSurface* src, | 334 GrSurface* src, |
333 const SkIRect& srcRect, | 335 const SkIRect& srcRect, |
334 const SkIPoint& dstPoint); | 336 const SkIPoint& dstPoint); |
335 | 337 |
338 typedef GrRenderTargetPriv::MultisampleSpecs MultisampleSpecs; | |
339 | |
340 const MultisampleSpecs& getMultisampleSpecs(GrRenderTarget*, const GrStencil Settings&); | |
341 | |
336 struct DrawArgs { | 342 struct DrawArgs { |
337 DrawArgs(const GrPrimitiveProcessor* primProc, | 343 DrawArgs(const GrPrimitiveProcessor* primProc, |
338 const GrPipeline* pipeline, | 344 const GrPipeline* pipeline, |
339 const GrProgramDesc* desc) | 345 const GrProgramDesc* desc) |
340 : fPrimitiveProcessor(primProc) | 346 : fPrimitiveProcessor(primProc) |
341 , fPipeline(pipeline) | 347 , fPipeline(pipeline) |
342 , fDesc(desc) { | 348 , fDesc(desc) { |
343 SkASSERT(primProc && pipeline && desc); | 349 SkASSERT(primProc && pipeline && desc); |
344 } | 350 } |
345 const GrPrimitiveProcessor* fPrimitiveProcessor; | 351 const GrPrimitiveProcessor* fPrimitiveProcessor; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 GrGpu::kGpuPrefersDraw_DrawPreference); | 486 GrGpu::kGpuPrefersDraw_DrawPreference); |
481 *preference = SkTMax(*preference, elevation); | 487 *preference = SkTMax(*preference, elevation); |
482 } | 488 } |
483 | 489 |
484 void handleDirtyContext() { | 490 void handleDirtyContext() { |
485 if (fResetBits) { | 491 if (fResetBits) { |
486 this->resetContext(); | 492 this->resetContext(); |
487 } | 493 } |
488 } | 494 } |
489 | 495 |
496 class SamplePattern : public SkTArray<SkPoint, true> { | |
bsalomon
2016/02/22 20:28:25
It seems a little odd to me for this to be a point
Chris Dalton
2016/02/22 21:19:11
Yeah, that felt a little weird. The only reason th
Chris Dalton
2016/02/22 22:17:55
Done.
| |
497 public: | |
498 bool operator <(const SamplePattern&) const; | |
499 }; | |
500 | |
490 Stats fStats; | 501 Stats fStats; |
491 SkAutoTDelete<GrPathRendering> fPathRendering; | 502 SkAutoTDelete<GrPathRendering> fPathRendering; |
492 // Subclass must initialize this in its constructor. | 503 // Subclass must initialize this in its constructor. |
493 SkAutoTUnref<const GrCaps> fCaps; | 504 SkAutoTUnref<const GrCaps> fCaps; |
494 | 505 |
495 private: | 506 private: |
496 // called when the 3D context state is unknown. Subclass should emit any | 507 // called when the 3D context state is unknown. Subclass should emit any |
497 // assumed 3D context state and dirty any state cache. | 508 // assumed 3D context state and dirty any state cache. |
498 virtual void onResetContext(uint32_t resetBits) = 0; | 509 virtual void onResetContext(uint32_t resetBits) = 0; |
499 | 510 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
559 | 570 |
560 // overridden by backend-specific derived class to perform the resolve | 571 // overridden by backend-specific derived class to perform the resolve |
561 virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; | 572 virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; |
562 | 573 |
563 // overridden by backend specific derived class to perform the copy surface | 574 // overridden by backend specific derived class to perform the copy surface |
564 virtual bool onCopySurface(GrSurface* dst, | 575 virtual bool onCopySurface(GrSurface* dst, |
565 GrSurface* src, | 576 GrSurface* src, |
566 const SkIRect& srcRect, | 577 const SkIRect& srcRect, |
567 const SkIPoint& dstPoint) = 0; | 578 const SkIPoint& dstPoint) = 0; |
568 | 579 |
580 // overridden by backend specific derived class to perform the multisample q ueries | |
581 virtual void onGetMultisampleSpecs(GrRenderTarget*, | |
582 const GrStencilSettings&, | |
583 int* effectiveSampleCnt, | |
584 SamplePattern*) = 0; | |
585 | |
569 void resetContext() { | 586 void resetContext() { |
570 this->onResetContext(fResetBits); | 587 this->onResetContext(fResetBits); |
571 fResetBits = 0; | 588 fResetBits = 0; |
572 ++fResetTimestamp; | 589 ++fResetTimestamp; |
573 } | 590 } |
574 | 591 |
575 ResetTimestamp fResetTi mestamp; | 592 ResetTimestamp fResetTi mestamp; |
576 uint32_t fResetBi ts; | 593 uint32_t fResetBi ts; |
594 SkTArray<skstd::unique_ptr<MultisampleSpecs> > fRasterM ultisampleSpecs; | |
595 std::map<SamplePattern, uint16_t> fKnownSa mplePatterns; | |
596 uint16_t fNextSam plePatternID; | |
577 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 597 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
578 GrContext* fContext ; | 598 GrContext* fContext ; |
579 | 599 |
580 friend class GrPathRendering; | 600 friend class GrPathRendering; |
581 typedef SkRefCnt INHERITED; | 601 typedef SkRefCnt INHERITED; |
582 }; | 602 }; |
583 | 603 |
584 #endif | 604 #endif |
OLD | NEW |