Index: src/gpu/GrPipeline.h |
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h |
index 4f81ae40d0276223f2de88d4edd3238ea3576ebf..d9a15483e364a4b0d0b0709be0edf8c6d120c0f0 100644 |
--- a/src/gpu/GrPipeline.h |
+++ b/src/gpu/GrPipeline.h |
@@ -145,6 +145,7 @@ public: |
bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } |
bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVertices_Flag); } |
+ bool hasSampleLocations() const { return SkToBool(fFlags & kSampleLocations_Flag); } |
GrXferBarrierType xferBarrierType(const GrCaps& caps) const { |
return this->getXferProcessor().xferBarrierType(fRenderTarget.get(), caps); |
@@ -163,6 +164,28 @@ public: |
bool readsFragPosition() const { return fReadsFragPosition; } |
bool ignoresCoverage() const { return fIgnoresCoverage; } |
+ /////////////////////////////////////////////////////////////////////////// |
+ |
+ /** |
+ * Returns the actual number of samples the hardware will run when using this pipeline. |
+ * NOTE: this can be greater than the sample count in the render target's surface descriptor. |
+ */ |
+ int effectiveSampleCount() const { return this->getMultisampleSpecs().fEffectiveSampleCnt; } |
+ |
+ /** |
+ * Returns a unique ID that identifies this pipeline's sample pattern, or 0 if sample locations |
+ * are not supported. |
+ */ |
+ uint16_t getSamplePatternID() const { return this->getMultisampleSpecs().fSamplePatternID; } |
+ |
+ /** |
+ * Returns this pipeline's sample locations, or nullptr if sample locations are not supported. |
+ * The locations are stored as offsets in device space from the center of the pixel. |
+ */ |
+ const SkPoint* getSampleLocations() const { |
+ return this->getMultisampleSpecs().fSampleLocations; |
+ } |
+ |
private: |
GrPipeline() { /** Initialized in factory function*/ } |
@@ -184,9 +207,15 @@ private: |
void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFlags, |
const GrCaps&); |
+ const GrRenderTargetPriv::MultisampleSpecs& getMultisampleSpecs() const { |
bsalomon
2016/02/22 20:28:25
We anticipate render target being removed from pip
Chris Dalton
2016/02/22 21:19:11
I imagine it would be straightforward, but I can o
|
+ SkASSERT(this->isHWAntialiasState()); |
+ return this->getRenderTarget()->renderTargetPriv().getMultisampleSpecs(fStencilSettings); |
+ } |
+ |
enum Flags { |
kHWAA_Flag = 0x1, |
kSnapVertices_Flag = 0x2, |
+ kSampleLocations_Flag = 0x4, |
}; |
typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; |