| 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 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // Nonzero ID that uniquely identifies these multisample specs. | 348 // Nonzero ID that uniquely identifies these multisample specs. |
| 349 uint8_t fUniqueID; | 349 uint8_t fUniqueID; |
| 350 // The actual number of samples the GPU will run. NOTE: this value can b
e greater than the | 350 // The actual number of samples the GPU will run. NOTE: this value can b
e greater than the |
| 351 // the render target's sample count. | 351 // the render target's sample count. |
| 352 int fEffectiveSampleCnt; | 352 int fEffectiveSampleCnt; |
| 353 // If sample locations are supported, points to the subpixel locations a
t which the GPU will | 353 // If sample locations are supported, points to the subpixel locations a
t which the GPU will |
| 354 // sample. Pixel center is at (.5, .5), and (0, 0) indicates the top lef
t corner. | 354 // sample. Pixel center is at (.5, .5), and (0, 0) indicates the top lef
t corner. |
| 355 const SkPoint* fSampleLocations; | 355 const SkPoint* fSampleLocations; |
| 356 }; | 356 }; |
| 357 | 357 |
| 358 // Finds a render target's multisample specs. The stencil settings are only
needed to flush the | 358 // Finds a render target's multisample specs. The stencil settings are only
needed in case we |
| 359 // draw state prior to querying multisample information; they should not hav
e any effect on the | 359 // need to flush the draw state prior to querying multisample info. They are
not expected to |
| 360 // multisample information itself. | 360 // affect the multisample information itself. |
| 361 const MultisampleSpecs& getMultisampleSpecs(GrRenderTarget*, const GrStencil
Settings&); | 361 const MultisampleSpecs& queryMultisampleSpecs(GrRenderTarget*, const GrStenc
ilSettings&); |
| 362 |
| 363 // Finds the multisample specs with a given unique id. |
| 364 const MultisampleSpecs& getMultisampleSpecs(uint8_t uniqueID) { |
| 365 SkASSERT(uniqueID > 0 && uniqueID < fMultisampleSpecs.count()); |
| 366 return fMultisampleSpecs[uniqueID]; |
| 367 } |
| 362 | 368 |
| 363 // Creates a GrGpuCommandBuffer in which the GrOpList can send draw commands
to instead of | 369 // Creates a GrGpuCommandBuffer in which the GrOpList can send draw commands
to instead of |
| 364 // directly to the Gpu object. | 370 // directly to the Gpu object. |
| 365 virtual GrGpuCommandBuffer* createCommandBuffer( | 371 virtual GrGpuCommandBuffer* createCommandBuffer( |
| 366 GrRenderTarget* target, | 372 GrRenderTarget* target, |
| 367 const GrGpuCommandBuffer::LoadAndStoreInfo& colorInfo, | 373 const GrGpuCommandBuffer::LoadAndStoreInfo& colorInfo, |
| 368 const GrGpuCommandBuffer::LoadAndStoreInfo& stencilInfo) = 0; | 374 const GrGpuCommandBuffer::LoadAndStoreInfo& stencilInfo) = 0; |
| 369 | 375 |
| 370 // Called by GrOpList when flushing. | 376 // Called by GrOpList when flushing. |
| 371 // Provides a hook for post-flush actions (e.g. PLS reset and Vulkan command
buffer submits). | 377 // Provides a hook for post-flush actions (e.g. PLS reset and Vulkan command
buffer submits). |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 // overridden by backend-specific derived class to perform the resolve | 580 // overridden by backend-specific derived class to perform the resolve |
| 575 virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; | 581 virtual void onResolveRenderTarget(GrRenderTarget* target) = 0; |
| 576 | 582 |
| 577 // overridden by backend specific derived class to perform the copy surface | 583 // overridden by backend specific derived class to perform the copy surface |
| 578 virtual bool onCopySurface(GrSurface* dst, | 584 virtual bool onCopySurface(GrSurface* dst, |
| 579 GrSurface* src, | 585 GrSurface* src, |
| 580 const SkIRect& srcRect, | 586 const SkIRect& srcRect, |
| 581 const SkIPoint& dstPoint) = 0; | 587 const SkIPoint& dstPoint) = 0; |
| 582 | 588 |
| 583 // overridden by backend specific derived class to perform the multisample q
ueries | 589 // overridden by backend specific derived class to perform the multisample q
ueries |
| 584 virtual void onGetMultisampleSpecs(GrRenderTarget*, const GrStencilSettings&
, | 590 virtual void onQueryMultisampleSpecs(GrRenderTarget*, const GrStencilSetting
s&, |
| 585 int* effectiveSampleCnt, SamplePattern*)
= 0; | 591 int* effectiveSampleCnt, SamplePattern*
) = 0; |
| 586 | 592 |
| 587 void resetContext() { | 593 void resetContext() { |
| 588 this->onResetContext(fResetBits); | 594 this->onResetContext(fResetBits); |
| 589 fResetBits = 0; | 595 fResetBits = 0; |
| 590 ++fResetTimestamp; | 596 ++fResetTimestamp; |
| 591 } | 597 } |
| 592 | 598 |
| 593 struct SamplePatternComparator { | 599 struct SamplePatternComparator { |
| 594 bool operator()(const SamplePattern&, const SamplePattern&) const; | 600 bool operator()(const SamplePattern&, const SamplePattern&) const; |
| 595 }; | 601 }; |
| 596 | 602 |
| 597 typedef std::map<SamplePattern, uint8_t, SamplePatternComparator> Multisampl
eSpecsIdMap; | 603 typedef std::map<SamplePattern, uint8_t, SamplePatternComparator> Multisampl
eSpecsIdMap; |
| 598 | 604 |
| 599 ResetTimestamp fResetTimestamp; | 605 ResetTimestamp fResetTimestamp; |
| 600 uint32_t fResetBits; | 606 uint32_t fResetBits; |
| 601 MultisampleSpecsIdMap fMultisampleSpecsIdMap; | 607 MultisampleSpecsIdMap fMultisampleSpecsIdMap; |
| 602 SkSTArray<1, MultisampleSpecs, true> fMultisampleSpecs; | 608 SkSTArray<1, MultisampleSpecs, true> fMultisampleSpecs; |
| 603 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 609 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
| 604 GrContext* fContext; | 610 GrContext* fContext; |
| 605 | 611 |
| 606 friend class GrPathRendering; | 612 friend class GrPathRendering; |
| 607 friend class gr_instanced::InstancedRendering; | 613 friend class gr_instanced::InstancedRendering; |
| 608 typedef SkRefCnt INHERITED; | 614 typedef SkRefCnt INHERITED; |
| 609 }; | 615 }; |
| 610 | 616 |
| 611 #endif | 617 #endif |
| OLD | NEW |