Index: src/gpu/GrRenderTargetProxy.cpp |
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp |
index 6c422c09cdec5b78dc362e32865fc6ddd8c07025..3d6587fefe398505dc69d570104b1935b97c001f 100644 |
--- a/src/gpu/GrRenderTargetProxy.cpp |
+++ b/src/gpu/GrRenderTargetProxy.cpp |
@@ -7,14 +7,34 @@ |
#include "GrRenderTargetProxy.h" |
+#include "GrCaps.h" |
#include "GrDrawTarget.h" |
#include "GrGpuResourcePriv.h" |
-#include "GrRenderTargetPriv.h" |
-GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrRenderTarget> rt) |
+// Deferred version |
+// TODO: we can probably munge the 'desc' in both the wrapped and deferred |
+// cases to make the sampleConfig/numSamples stuff more rational. |
+GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, const GrSurfaceDesc& desc, |
+ SkBackingFit fit, SkBudgeted budgeted) |
+ : INHERITED(desc, fit, budgeted) |
+ , fTarget(nullptr) |
+ , fFlags(GrRenderTargetPriv::Flags::kNone) |
+ , fLastDrawTarget(nullptr) { |
+ // Since we know the newly created render target will be internal, we are able to precompute |
+ // what the flags will ultimately end up being. |
+ if (caps.usesMixedSamples() && fDesc.fSampleCnt > 0) { |
+ fFlags |= GrRenderTargetPriv::Flags::kMixedSampled; |
+ } |
+ if (caps.maxWindowRectangles() > 0) { |
+ fFlags |= GrRenderTargetPriv::Flags::kWindowRectsSupport; |
+ } |
+} |
+ |
+// Wrapped version |
+GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, sk_sp<GrRenderTarget> rt) |
: INHERITED(rt->desc(), SkBackingFit::kExact, rt->resourcePriv().isBudgeted()) |
, fTarget(std::move(rt)) |
- , fSampleConfig(fTarget->renderTargetPriv().sampleConfig()) |
+ , fFlags(fTarget->renderTargetPriv().flags()) |
, fLastDrawTarget(nullptr) { |
} |
@@ -47,7 +67,7 @@ GrRenderTarget* GrRenderTargetProxy::instantiate(GrTextureProvider* texProvider) |
fTarget = sk_ref_sp(tex->asRenderTarget()); |
// Check that our a priori computation matched the ultimate reality |
- SkASSERT(fSampleConfig == fTarget->renderTargetPriv().sampleConfig()); |
+ SkASSERT(fFlags == fTarget->renderTargetPriv().flags()); |
return fTarget.get(); |
} |
@@ -71,7 +91,7 @@ sk_sp<GrRenderTargetProxy> GrRenderTargetProxy::Make(const GrCaps& caps, |
return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(caps, desc, fit, budgeted)); |
} |
-sk_sp<GrRenderTargetProxy> GrRenderTargetProxy::Make(sk_sp<GrRenderTarget> rt) { |
- return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(rt)); |
+sk_sp<GrRenderTargetProxy> GrRenderTargetProxy::Make(const GrCaps& caps, sk_sp<GrRenderTarget> rt) { |
+ return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(caps, rt)); |
} |