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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 if (fResetBits) { | 491 if (fResetBits) { |
486 this->resetContext(); | 492 this->resetContext(); |
487 } | 493 } |
488 } | 494 } |
489 | 495 |
490 Stats fStats; | 496 Stats fStats; |
491 SkAutoTDelete<GrPathRendering> fPathRendering; | 497 SkAutoTDelete<GrPathRendering> fPathRendering; |
492 // Subclass must initialize this in its constructor. | 498 // Subclass must initialize this in its constructor. |
493 SkAutoTUnref<const GrCaps> fCaps; | 499 SkAutoTUnref<const GrCaps> fCaps; |
494 | 500 |
| 501 typedef SkTArray<SkPoint, true> SamplePattern; |
| 502 |
495 private: | 503 private: |
496 // called when the 3D context state is unknown. Subclass should emit any | 504 // called when the 3D context state is unknown. Subclass should emit any |
497 // assumed 3D context state and dirty any state cache. | 505 // assumed 3D context state and dirty any state cache. |
498 virtual void onResetContext(uint32_t resetBits) = 0; | 506 virtual void onResetContext(uint32_t resetBits) = 0; |
499 | 507 |
500 // Called before certain draws in order to guarantee coherent results from d
st reads. | 508 // Called before certain draws in order to guarantee coherent results from d
st reads. |
501 virtual void xferBarrier(GrRenderTarget*, GrXferBarrierType) = 0; | 509 virtual void xferBarrier(GrRenderTarget*, GrXferBarrierType) = 0; |
502 | 510 |
503 // overridden by backend-specific derived class to create objects. | 511 // overridden by backend-specific derived class to create objects. |
504 // Texture size and sample size will have already been validated in base cla
ss before | 512 // Texture size and sample size will have already been validated in base cla
ss before |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 | 567 |
560 // overridden by backend-specific derived class to perform the resolve | 568 // overridden by backend-specific derived class to perform the resolve |
561 virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; | 569 virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; |
562 | 570 |
563 // overridden by backend specific derived class to perform the copy surface | 571 // overridden by backend specific derived class to perform the copy surface |
564 virtual bool onCopySurface(GrSurface* dst, | 572 virtual bool onCopySurface(GrSurface* dst, |
565 GrSurface* src, | 573 GrSurface* src, |
566 const SkIRect& srcRect, | 574 const SkIRect& srcRect, |
567 const SkIPoint& dstPoint) = 0; | 575 const SkIPoint& dstPoint) = 0; |
568 | 576 |
| 577 // overridden by backend specific derived class to perform the multisample q
ueries |
| 578 virtual void onGetMultisampleSpecs(GrRenderTarget*, |
| 579 const GrStencilSettings&, |
| 580 int* effectiveSampleCnt, |
| 581 SamplePattern*) = 0; |
| 582 |
569 void resetContext() { | 583 void resetContext() { |
570 this->onResetContext(fResetBits); | 584 this->onResetContext(fResetBits); |
571 fResetBits = 0; | 585 fResetBits = 0; |
572 ++fResetTimestamp; | 586 ++fResetTimestamp; |
573 } | 587 } |
574 | 588 |
| 589 struct SamplePatternComparator { |
| 590 bool operator()(const SamplePattern&, const SamplePattern&) const; |
| 591 }; |
| 592 |
575 ResetTimestamp fResetTi
mestamp; | 593 ResetTimestamp fResetTi
mestamp; |
576 uint32_t fResetBi
ts; | 594 uint32_t fResetBi
ts; |
| 595 SkTArray<skstd::unique_ptr<MultisampleSpecs> > fRasterM
ultisampleSpecs; |
| 596 std::map<SamplePattern, uint16_t, SamplePatternComparator> fKnownSa
mplePatterns; |
| 597 uint16_t fNextSam
plePatternID; |
577 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 598 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
578 GrContext* fContext
; | 599 GrContext* fContext
; |
579 | 600 |
580 friend class GrPathRendering; | 601 friend class GrPathRendering; |
581 typedef SkRefCnt INHERITED; | 602 typedef SkRefCnt INHERITED; |
582 }; | 603 }; |
583 | 604 |
584 #endif | 605 #endif |
OLD | NEW |