Disable deferred gpu resources for Chrome branch

Chrome's branch is coming up and it seems unlikely that I will be able to push instantiation all the way to flush time (where failure will be easier to deal with) before then. This CL should silence the P1 bug but could introduce layout test diffs.

Ideally this wouldn't land until after: https://codereview.chromium.org/2718353004/ (Add flag for upcoming Skia change) so the layout test differences will be visible on the DEPS roll

BUG=688811

Change-Id: I86c42ee02e6672834353aa7126b00ed4f3521948
Reviewed-on: https://skia-review.googlesource.com/9064
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2017-02-28 16:30:28 -05:00 committed by Skia Commit-Bot
parent c61abeed89
commit 7928e76872
7 changed files with 46 additions and 15 deletions

View File

@ -22,6 +22,8 @@ class GrTextureOpList;
class GrTextureProvider;
class GrTextureProxy;
//#define SK_DISABLE_DEFERRED_PROXIES 1
// This class replicates the functionality GrIORef<GrSurface> but tracks the
// utilitization for later resource allocation (for the deferred case) and
// forwards on the utilization in the wrapped case
@ -170,8 +172,9 @@ public:
static sk_sp<GrSurfaceProxy> MakeWrapped(sk_sp<GrSurface>);
static sk_sp<GrTextureProxy> MakeWrapped(sk_sp<GrTexture>);
static sk_sp<GrSurfaceProxy> MakeDeferred(const GrCaps&, const GrSurfaceDesc&,
SkBackingFit, SkBudgeted, uint32_t flags = 0);
static sk_sp<GrSurfaceProxy> MakeDeferred(GrTextureProvider*, const GrCaps&,
const GrSurfaceDesc&, SkBackingFit,
SkBudgeted, uint32_t flags = 0);
// TODO: need to refine ownership semantics of 'srcData' if we're in completely
// deferred mode

View File

@ -296,7 +296,8 @@ bool GrContext::writeSurfacePixels(GrSurface* surface, SkColorSpace* dstColorSpa
sk_sp<GrTextureProxy> tempTextureProxy;
if (GrGpu::kNoDraw_DrawPreference != drawPreference) {
sk_sp<GrSurfaceProxy> temp = GrSurfaceProxy::MakeDeferred(*this->caps(),
sk_sp<GrSurfaceProxy> temp = GrSurfaceProxy::MakeDeferred(this->textureProvider(),
*this->caps(),
tempDrawInfo.fTempSurfaceDesc,
SkBackingFit::kApprox,
SkBudgeted::kYes);
@ -631,7 +632,8 @@ sk_sp<GrSurfaceContext> GrContextPriv::makeDeferredSurfaceContext(const GrSurfac
SkBackingFit fit,
SkBudgeted isDstBudgeted) {
sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(*fContext->caps(), dstDesc,
sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(fContext->textureProvider(),
*fContext->caps(), dstDesc,
fit, isDstBudgeted);
if (!proxy) {
return nullptr;
@ -830,7 +832,8 @@ sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContext(
desc.fConfig = config;
desc.fSampleCnt = sampleCnt;
sk_sp<GrSurfaceProxy> rtp = GrSurfaceProxy::MakeDeferred(*this->caps(), desc, fit, budgeted);
sk_sp<GrSurfaceProxy> rtp = GrSurfaceProxy::MakeDeferred(this->textureProvider(),
*this->caps(), desc, fit, budgeted);
if (!rtp) {
return nullptr;
}

View File

@ -146,7 +146,8 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrTexture> tex) {
#include "GrResourceProvider.h"
sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps,
sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(GrTextureProvider* texProvider,
const GrCaps& caps,
const GrSurfaceDesc& desc,
SkBackingFit fit,
SkBudgeted budgeted,
@ -194,6 +195,21 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps,
GrSurfaceDesc copyDesc = desc;
copyDesc.fSampleCnt = SkTMin(desc.fSampleCnt, caps.maxSampleCount());
#ifdef SK_DISABLE_DEFERRED_PROXIES
sk_sp<GrSurface> surf;
if (SkBackingFit::kApprox == fit) {
surf.reset(texProvider->createApproxTexture(copyDesc));
} else {
surf.reset(texProvider->createTexture(copyDesc, budgeted));
}
if (!surf) {
return nullptr;
}
return GrSurfaceProxy::MakeWrapped(std::move(surf));
#else
if (willBeRT) {
// We know anything we instantiate later from this deferred path will be
// both texturable and renderable
@ -202,6 +218,7 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps,
}
return sk_sp<GrSurfaceProxy>(new GrTextureProxy(copyDesc, fit, budgeted, nullptr, 0, flags));
#endif
}
sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps,
@ -216,7 +233,7 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps,
return GrSurfaceProxy::MakeWrapped(std::move(tex));
}
return GrSurfaceProxy::MakeDeferred(caps, desc, SkBackingFit::kExact, budgeted);
return GrSurfaceProxy::MakeDeferred(texProvider, caps, desc, SkBackingFit::kExact, budgeted);
}
sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeWrappedBackend(GrContext* context,

View File

@ -138,7 +138,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
{
bool texelBufferSupport = context->caps()->shaderCaps()->texelBufferSupport();
bool imageLoadStoreSupport = context->caps()->shaderCaps()->imageLoadStoreSupport();
sk_sp<GrSurfaceProxy> proxy1(GrSurfaceProxy::MakeDeferred(*context->caps(), desc,
sk_sp<GrSurfaceProxy> proxy1(GrSurfaceProxy::MakeDeferred(context->textureProvider(),
*context->caps(), desc,
SkBackingFit::kExact,
SkBudgeted::kYes));
sk_sp<GrTexture> texture2(

View File

@ -118,6 +118,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyConversionTest, reporter, ctxInfo
// Proxies
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxInfo) {
const GrCaps& caps = *ctxInfo.grContext()->caps();
GrTextureProvider* texProvider = ctxInfo.grContext()->textureProvider();
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
@ -126,7 +127,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
desc.fConfig = kRGBA_8888_GrPixelConfig;
{
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(caps, desc,
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(texProvider, caps, desc,
SkBackingFit::kApprox,
SkBudgeted::kYes));
@ -140,7 +141,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
}
{
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(caps, desc,
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(texProvider, caps, desc,
SkBackingFit::kApprox,
SkBudgeted::kYes));
@ -156,7 +157,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
{
desc.fFlags = kNone_GrSurfaceFlags; // force no-RT
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(caps, desc,
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(texProvider, caps, desc,
SkBackingFit::kApprox,
SkBudgeted::kYes));

View File

@ -15,8 +15,6 @@
#include "GrRenderTargetPriv.h"
#include "GrRenderTargetProxy.h"
static const int kWidthHeight = 128;
int32_t GrIORefProxy::getProxyRefCnt_TestOnly() const {
return fRefCnt;
}
@ -47,6 +45,10 @@ int32_t GrIORefProxy::getPendingWriteCnt_TestOnly() const {
return fPendingWrites;
}
#ifndef SK_DISABLE_DEFERRED_PROXIES
static const int kWidthHeight = 128;
static void check_refs(skiatest::Reporter* reporter,
GrSurfaceProxy* proxy,
int32_t expectedProxyRefs,
@ -71,7 +73,8 @@ static sk_sp<GrSurfaceProxy> make_deferred(const GrCaps& caps, GrTextureProvider
desc.fHeight = kWidthHeight;
desc.fConfig = kRGBA_8888_GrPixelConfig;
return GrSurfaceProxy::MakeDeferred(caps, desc, SkBackingFit::kApprox, SkBudgeted::kYes);
return GrSurfaceProxy::MakeDeferred(provider, caps, desc,
SkBackingFit::kApprox, SkBudgeted::kYes);
}
static sk_sp<GrSurfaceProxy> make_wrapped(const GrCaps& caps, GrTextureProvider* provider) {
@ -203,5 +206,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
}
}
}
#endif
#endif

View File

@ -140,6 +140,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
}
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(
provider,
caps, desc,
fit, budgeted));
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(sProxy));
@ -172,7 +173,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
tex.reset(provider->createTexture(desc, budgeted));
}
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(caps,
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(provider,
caps,
desc,
fit,
budgeted));