const GrGpuResource::UniqueID kInvalidResourceID = GrGpuResource::UniqueID::InvalidID();
for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) {
- for (auto widthHeight : { 100, 128 }) {
+ for (auto widthHeight : { 100, 128, 1048576 }) {
for (auto config : { kAlpha_8_GrPixelConfig, kRGBA_8888_GrPixelConfig }) {
for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) {
for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) {
for (auto numSamples : { 0, 4}) {
- bool renderable = ctxInfo.grContext()->caps()->isConfigRenderable(
- config, numSamples > 0) &&
- numSamples <= ctxInfo.grContext()->caps()->maxColorSampleCount();
+ bool renderable = caps.isConfigRenderable(config, numSamples > 0) &&
+ numSamples <= caps.maxColorSampleCount();
+ bool allocable = widthHeight <= caps.maxTextureSize();
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
if (renderable) {
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(
- caps, desc,
+ caps, desc,
fit, budgeted));
- // This forces the proxy to compute and cache its pre-instantiation\r
- // size guess. Later, when it is actually instantiated, it checks\r
- // that the instantiated size is <= to the pre-computation. \r
- // If the proxy never computed its pre-instantiation size then the\r
- // check is skipped.\r
- sProxy->gpuMemorySize();
-
- check_surface(reporter, sProxy.get(), origin,
- widthHeight, widthHeight, config,
- kInvalidResourceID, budgeted);
- check_rendertarget(reporter, caps, provider,
- sProxy->asRenderTargetProxy(), numSamples,
- fit, caps.maxWindowRectangles(), false);
+ REPORTER_ASSERT(reporter, allocable == SkToBool(sProxy));
+ if (sProxy) {
+ REPORTER_ASSERT(reporter, sProxy->asRenderTargetProxy());
+ // This forces the proxy to compute and cache its
+ // pre-instantiation size guess. Later, when it is actually
+ // instantiated, it checks that the instantiated size is <= to
+ // the pre-computation. If the proxy never computed its
+ // pre-instantiation size then the check is skipped.
+ sProxy->gpuMemorySize();
+
+ check_surface(reporter, sProxy.get(), origin,
+ widthHeight, widthHeight, config,
+ kInvalidResourceID, budgeted);
+ check_rendertarget(reporter, caps, provider,
+ sProxy->asRenderTargetProxy(), numSamples,
+ fit, caps.maxWindowRectangles(), false);
+ }
}
desc.fFlags = kNone_GrSurfaceFlags;
desc,
fit,
budgeted));
- // This forces the proxy to compute and cache its pre-instantiation\r
- // size guess. Later, when it is actually instantiated, it checks\r
- // that the instantiated size is <= to the pre-computation. \r
- // If the proxy never computed its pre-instantiation size then the\r
- // check is skipped.
- sProxy->gpuMemorySize();
-
- check_surface(reporter, sProxy.get(), origin,
- widthHeight, widthHeight, config,
- kInvalidResourceID, budgeted);
- check_texture(reporter, provider, sProxy->asTextureProxy(), fit, false);
+ REPORTER_ASSERT(reporter, allocable == SkToBool(sProxy));
+ if (sProxy) {
+ // This forces the proxy to compute and cache its pre-instantiation
+ // size guess. Later, when it is actually instantiated, it checks
+ // that the instantiated size is <= to the pre-computation.
+ // If the proxy never computed its pre-instantiation size then the
+ // check is skipped.
+ sProxy->gpuMemorySize();
+
+ check_surface(reporter, sProxy.get(), origin,
+ widthHeight, widthHeight, config,
+ kInvalidResourceID, budgeted);
+ check_texture(reporter, provider, sProxy->asTextureProxy(),
+ fit, false);
+ }
}
}
}