blob: ab24b0064334bbb524b07006f03e8c4d976b7180 [file] [log] [blame]
Robert Phillips5af44de2017-07-18 14:49:38 -04001/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Robert Phillips5af44de2017-07-18 14:49:38 -04008#include "SkTypes.h"
9
Robert Phillips5af44de2017-07-18 14:49:38 -040010#include "Test.h"
11
Robert Phillips57aa3672017-07-21 11:38:13 -040012#include "GrContextPriv.h"
Brian Salomon967df202018-12-07 11:15:53 -050013#include "GrDeinstantiateProxyTracker.h"
Robert Phillips57aa3672017-07-21 11:38:13 -040014#include "GrGpu.h"
Robert Phillips0bd24dc2018-01-16 08:06:32 -050015#include "GrProxyProvider.h"
Robert Phillips5af44de2017-07-18 14:49:38 -040016#include "GrResourceAllocator.h"
Robert Phillips57aa3672017-07-21 11:38:13 -040017#include "GrResourceProvider.h"
Robert Phillips5af44de2017-07-18 14:49:38 -040018#include "GrSurfaceProxyPriv.h"
Robert Phillips57aa3672017-07-21 11:38:13 -040019#include "GrTexture.h"
Robert Phillips5af44de2017-07-18 14:49:38 -040020#include "GrTextureProxy.h"
21
Robert Phillips1734dd32018-08-21 13:52:09 -040022#include "SkSurface.h"
23
Robert Phillips57aa3672017-07-21 11:38:13 -040024struct ProxyParams {
25 int fSize;
26 bool fIsRT;
Robert Phillips646f6372018-09-25 09:31:10 -040027 SkColorType fColorType;
Robert Phillips57aa3672017-07-21 11:38:13 -040028 SkBackingFit fFit;
29 int fSampleCnt;
30 GrSurfaceOrigin fOrigin;
31 // TODO: do we care about mipmapping
32};
33
Greg Daniel4065d452018-11-16 15:43:41 -050034static GrSurfaceProxy* make_deferred(GrProxyProvider* proxyProvider, const GrCaps* caps,
35 const ProxyParams& p) {
Robert Phillips646f6372018-09-25 09:31:10 -040036 GrColorType grCT = SkColorTypeToGrColorType(p.fColorType);
37 GrPixelConfig config = GrColorTypeToPixelConfig(grCT, GrSRGBEncoded::kNo);
38
Robert Phillips57aa3672017-07-21 11:38:13 -040039 GrSurfaceDesc desc;
40 desc.fFlags = p.fIsRT ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
Robert Phillips57aa3672017-07-21 11:38:13 -040041 desc.fWidth = p.fSize;
42 desc.fHeight = p.fSize;
Robert Phillips646f6372018-09-25 09:31:10 -040043 desc.fConfig = config;
Robert Phillips57aa3672017-07-21 11:38:13 -040044 desc.fSampleCnt = p.fSampleCnt;
45
Greg Daniel4065d452018-11-16 15:43:41 -050046 const GrBackendFormat format = caps->getBackendFormatFromColorType(p.fColorType);
47
48 auto tmp = proxyProvider->createProxy(format, desc, p.fOrigin, p.fFit, SkBudgeted::kNo);
Robert Phillips715d08c2018-07-18 13:56:48 -040049 if (!tmp) {
50 return nullptr;
51 }
52 GrSurfaceProxy* ret = tmp.release();
53
54 // Add a read to keep the proxy around but unref it so its backing surfaces can be recycled
55 ret->addPendingRead();
56 ret->unref();
57 return ret;
Robert Phillips57aa3672017-07-21 11:38:13 -040058}
59
Robert Phillips715d08c2018-07-18 13:56:48 -040060static GrSurfaceProxy* make_backend(GrContext* context, const ProxyParams& p,
61 GrBackendTexture* backendTex) {
Robert Phillips0bd24dc2018-01-16 08:06:32 -050062 GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
Robert Phillipsf35fd8d2018-01-22 10:48:15 -050063 GrGpu* gpu = context->contextPriv().getGpu();
Robert Phillips0bd24dc2018-01-16 08:06:32 -050064
Robert Phillipsf35fd8d2018-01-22 10:48:15 -050065 *backendTex = gpu->createTestingOnlyBackendTexture(nullptr, p.fSize, p.fSize,
Robert Phillips646f6372018-09-25 09:31:10 -040066 p.fColorType, false,
Robert Phillipsf35fd8d2018-01-22 10:48:15 -050067 GrMipMapped::kNo);
Robert Phillips646f6372018-09-25 09:31:10 -040068 if (!backendTex->isValid()) {
69 return nullptr;
70 }
Robert Phillips57aa3672017-07-21 11:38:13 -040071
Brian Salomonc67c31c2018-12-06 10:00:03 -050072 auto tmp = proxyProvider->wrapBackendTexture(*backendTex, p.fOrigin, kBorrow_GrWrapOwnership,
73 kRead_GrIOType);
Robert Phillips715d08c2018-07-18 13:56:48 -040074 if (!tmp) {
75 return nullptr;
76 }
77 GrSurfaceProxy* ret = tmp.release();
78
79 // Add a read to keep the proxy around but unref it so its backing surfaces can be recycled
80 ret->addPendingRead();
81 ret->unref();
82 return ret;
Robert Phillips57aa3672017-07-21 11:38:13 -040083}
84
Brian Salomon26102cb2018-03-09 09:33:19 -050085static void cleanup_backend(GrContext* context, const GrBackendTexture& backendTex) {
Robert Phillipsf35fd8d2018-01-22 10:48:15 -050086 context->contextPriv().getGpu()->deleteTestingOnlyBackendTexture(backendTex);
Robert Phillips57aa3672017-07-21 11:38:13 -040087}
88
Robert Phillips5af44de2017-07-18 14:49:38 -040089// Basic test that two proxies with overlapping intervals and compatible descriptors are
90// assigned different GrSurfaces.
Robert Phillips57aa3672017-07-21 11:38:13 -040091static void overlap_test(skiatest::Reporter* reporter, GrResourceProvider* resourceProvider,
Robert Phillips715d08c2018-07-18 13:56:48 -040092 GrSurfaceProxy* p1, GrSurfaceProxy* p2, bool expectedResult) {
Brian Salomon967df202018-12-07 11:15:53 -050093 GrDeinstantiateProxyTracker deinstantiateTracker;
94 GrResourceAllocator alloc(resourceProvider, &deinstantiateTracker);
Robert Phillips5af44de2017-07-18 14:49:38 -040095
Robert Phillips715d08c2018-07-18 13:56:48 -040096 alloc.addInterval(p1, 0, 4);
97 alloc.addInterval(p2, 1, 2);
Robert Phillipseafd48a2017-11-16 07:52:08 -050098 alloc.markEndOfOpList(0);
Robert Phillips5af44de2017-07-18 14:49:38 -040099
Robert Phillipseafd48a2017-11-16 07:52:08 -0500100 int startIndex, stopIndex;
Greg Danielaa3dfbe2018-01-29 10:34:25 -0500101 GrResourceAllocator::AssignError error;
Brian Salomon577aa0f2018-11-30 13:32:23 -0500102 alloc.assign(&startIndex, &stopIndex, &error);
Greg Danielaa3dfbe2018-01-29 10:34:25 -0500103 REPORTER_ASSERT(reporter, GrResourceAllocator::AssignError::kNoError == error);
Robert Phillips5af44de2017-07-18 14:49:38 -0400104
Brian Salomonfd98c2c2018-07-31 17:25:29 -0400105 REPORTER_ASSERT(reporter, p1->peekSurface());
106 REPORTER_ASSERT(reporter, p2->peekSurface());
Robert Phillips57aa3672017-07-21 11:38:13 -0400107 bool doTheBackingStoresMatch = p1->underlyingUniqueID() == p2->underlyingUniqueID();
108 REPORTER_ASSERT(reporter, expectedResult == doTheBackingStoresMatch);
Robert Phillips5af44de2017-07-18 14:49:38 -0400109}
110
Robert Phillips57aa3672017-07-21 11:38:13 -0400111// Test various cases when two proxies do not have overlapping intervals.
112// This mainly acts as a test of the ResourceAllocator's free pool.
113static void non_overlap_test(skiatest::Reporter* reporter, GrResourceProvider* resourceProvider,
Robert Phillips715d08c2018-07-18 13:56:48 -0400114 GrSurfaceProxy* p1, GrSurfaceProxy* p2,
Robert Phillips57aa3672017-07-21 11:38:13 -0400115 bool expectedResult) {
Brian Salomon967df202018-12-07 11:15:53 -0500116 GrDeinstantiateProxyTracker deinstantiateTracker;
117 GrResourceAllocator alloc(resourceProvider, &deinstantiateTracker);
Robert Phillips57aa3672017-07-21 11:38:13 -0400118
Robert Phillips715d08c2018-07-18 13:56:48 -0400119 alloc.addInterval(p1, 0, 2);
120 alloc.addInterval(p2, 3, 5);
Robert Phillipseafd48a2017-11-16 07:52:08 -0500121 alloc.markEndOfOpList(0);
Robert Phillips57aa3672017-07-21 11:38:13 -0400122
Robert Phillipseafd48a2017-11-16 07:52:08 -0500123 int startIndex, stopIndex;
Greg Danielaa3dfbe2018-01-29 10:34:25 -0500124 GrResourceAllocator::AssignError error;
Brian Salomon577aa0f2018-11-30 13:32:23 -0500125 alloc.assign(&startIndex, &stopIndex, &error);
Greg Danielaa3dfbe2018-01-29 10:34:25 -0500126 REPORTER_ASSERT(reporter, GrResourceAllocator::AssignError::kNoError == error);
Robert Phillips57aa3672017-07-21 11:38:13 -0400127
Brian Salomonfd98c2c2018-07-31 17:25:29 -0400128 REPORTER_ASSERT(reporter, p1->peekSurface());
129 REPORTER_ASSERT(reporter, p2->peekSurface());
Robert Phillips57aa3672017-07-21 11:38:13 -0400130 bool doTheBackingStoresMatch = p1->underlyingUniqueID() == p2->underlyingUniqueID();
131 REPORTER_ASSERT(reporter, expectedResult == doTheBackingStoresMatch);
132}
133
Robert Phillips4150eea2018-02-07 17:08:21 -0500134bool GrResourceProvider::testingOnly_setExplicitlyAllocateGPUResources(bool newValue) {
135 bool oldValue = fExplicitlyAllocateGPUResources;
136 fExplicitlyAllocateGPUResources = newValue;
137 return oldValue;
138}
139
Robert Phillips57aa3672017-07-21 11:38:13 -0400140DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) {
Greg Daniel4065d452018-11-16 15:43:41 -0500141 const GrCaps* caps = ctxInfo.grContext()->contextPriv().caps();
Robert Phillips1afd4cd2018-01-08 13:40:32 -0500142 GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider();
Robert Phillips6be756b2018-01-16 15:07:54 -0500143 GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
Robert Phillips5af44de2017-07-18 14:49:38 -0400144
Robert Phillips4150eea2018-02-07 17:08:21 -0500145 bool orig = resourceProvider->testingOnly_setExplicitlyAllocateGPUResources(true);
146
Robert Phillips57aa3672017-07-21 11:38:13 -0400147 struct TestCase {
148 ProxyParams fP1;
149 ProxyParams fP2;
150 bool fExpectation;
151 };
152
153 constexpr bool kRT = true;
154 constexpr bool kNotRT = false;
155
156 constexpr bool kShare = true;
157 constexpr bool kDontShare = false;
158 // Non-RT GrSurfaces are never recycled on some platforms.
159 bool kConditionallyShare = resourceProvider->caps()->reuseScratchTextures();
160
Robert Phillips646f6372018-09-25 09:31:10 -0400161 const SkColorType kRGBA = kRGBA_8888_SkColorType;
162 const SkColorType kBGRA = kBGRA_8888_SkColorType;
Robert Phillips57aa3672017-07-21 11:38:13 -0400163
164 const SkBackingFit kE = SkBackingFit::kExact;
165 const SkBackingFit kA = SkBackingFit::kApprox;
166
167 const GrSurfaceOrigin kTL = kTopLeft_GrSurfaceOrigin;
168 const GrSurfaceOrigin kBL = kBottomLeft_GrSurfaceOrigin;
169
170 //--------------------------------------------------------------------------------------------
171 TestCase gOverlappingTests[] = {
172 //----------------------------------------------------------------------------------------
173 // Two proxies with overlapping intervals and compatible descriptors should never share
174 // RT version
175 { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kTL }, kDontShare },
176 // non-RT version
177 { { 64, kNotRT, kRGBA, kA, 0, kTL }, { 64, kNotRT, kRGBA, kA, 0, kTL }, kDontShare },
178 };
179
180 for (auto test : gOverlappingTests) {
Greg Daniel4065d452018-11-16 15:43:41 -0500181 GrSurfaceProxy* p1 = make_deferred(proxyProvider, caps, test.fP1);
182 GrSurfaceProxy* p2 = make_deferred(proxyProvider, caps, test.fP2);
Robert Phillips715d08c2018-07-18 13:56:48 -0400183 overlap_test(reporter, resourceProvider, p1, p2, test.fExpectation);
184 p1->completedRead();
185 p2->completedRead();
Robert Phillips57aa3672017-07-21 11:38:13 -0400186 }
187
Robert Phillips646f6372018-09-25 09:31:10 -0400188 int k2 = ctxInfo.grContext()->contextPriv().caps()->getRenderTargetSampleCount(
189 2, kRGBA_8888_GrPixelConfig);
190 int k4 = ctxInfo.grContext()->contextPriv().caps()->getRenderTargetSampleCount(
191 4, kRGBA_8888_GrPixelConfig);
Robert Phillips57aa3672017-07-21 11:38:13 -0400192
193 //--------------------------------------------------------------------------------------------
194 TestCase gNonOverlappingTests[] = {
195 //----------------------------------------------------------------------------------------
196 // Two non-overlapping intervals w/ compatible proxies should share
197 // both same size & approx
198 { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kTL }, kShare },
199 { { 64, kNotRT, kRGBA, kA, 0, kTL }, { 64, kNotRT, kRGBA, kA, 0, kTL }, kConditionallyShare },
200 // diffs sizes but still approx
201 { { 64, kRT, kRGBA, kA, 0, kTL }, { 50, kRT, kRGBA, kA, 0, kTL }, kShare },
202 { { 64, kNotRT, kRGBA, kA, 0, kTL }, { 50, kNotRT, kRGBA, kA, 0, kTL }, kConditionallyShare },
203 // sames sizes but exact
204 { { 64, kRT, kRGBA, kE, 0, kTL }, { 64, kRT, kRGBA, kE, 0, kTL }, kShare },
205 { { 64, kNotRT, kRGBA, kE, 0, kTL }, { 64, kNotRT, kRGBA, kE, 0, kTL }, kConditionallyShare },
206 //----------------------------------------------------------------------------------------
207 // Two non-overlapping intervals w/ different exact sizes should not share
208 { { 56, kRT, kRGBA, kE, 0, kTL }, { 54, kRT, kRGBA, kE, 0, kTL }, kDontShare },
209 // Two non-overlapping intervals w/ _very different_ approx sizes should not share
210 { { 255, kRT, kRGBA, kA, 0, kTL }, { 127, kRT, kRGBA, kA, 0, kTL }, kDontShare },
211 // Two non-overlapping intervals w/ different MSAA sample counts should not share
212 { { 64, kRT, kRGBA, kA, k2, kTL },{ 64, kRT, kRGBA, kA, k4, kTL}, k2 == k4 },
213 // Two non-overlapping intervals w/ different configs should not share
214 { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kRT, kBGRA, kA, 0, kTL }, kDontShare },
215 // Two non-overlapping intervals w/ different RT classifications should never share
216 { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kNotRT, kRGBA, kA, 0, kTL }, kDontShare },
217 { { 64, kNotRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kTL }, kDontShare },
Robert Phillipsb0e93a22017-08-29 08:26:54 -0400218 // Two non-overlapping intervals w/ different origins should share
219 { { 64, kRT, kRGBA, kA, 0, kTL }, { 64, kRT, kRGBA, kA, 0, kBL }, kShare },
Robert Phillips57aa3672017-07-21 11:38:13 -0400220 };
221
222 for (auto test : gNonOverlappingTests) {
Greg Daniel4065d452018-11-16 15:43:41 -0500223 GrSurfaceProxy* p1 = make_deferred(proxyProvider, caps, test.fP1);
224 GrSurfaceProxy* p2 = make_deferred(proxyProvider, caps, test.fP2);
Robert Phillips715d08c2018-07-18 13:56:48 -0400225
Robert Phillips57aa3672017-07-21 11:38:13 -0400226 if (!p1 || !p2) {
227 continue; // creation can fail (i.e., for msaa4 on iOS)
228 }
Robert Phillips715d08c2018-07-18 13:56:48 -0400229
230 non_overlap_test(reporter, resourceProvider, p1, p2, test.fExpectation);
231
232 p1->completedRead();
233 p2->completedRead();
Robert Phillips57aa3672017-07-21 11:38:13 -0400234 }
235
236 {
237 // Wrapped backend textures should never be reused
238 TestCase t[1] = {
239 { { 64, kNotRT, kRGBA, kE, 0, kTL }, { 64, kNotRT, kRGBA, kE, 0, kTL }, kDontShare }
240 };
241
Robert Phillipsd21b2a52017-12-12 13:01:25 -0500242 GrBackendTexture backEndTex;
Robert Phillips715d08c2018-07-18 13:56:48 -0400243 GrSurfaceProxy* p1 = make_backend(ctxInfo.grContext(), t[0].fP1, &backEndTex);
Greg Daniel4065d452018-11-16 15:43:41 -0500244 GrSurfaceProxy* p2 = make_deferred(proxyProvider, caps, t[0].fP2);
Robert Phillips715d08c2018-07-18 13:56:48 -0400245
246 non_overlap_test(reporter, resourceProvider, p1, p2, t[0].fExpectation);
247
248 p1->completedRead();
249 p2->completedRead();
250
Brian Salomon26102cb2018-03-09 09:33:19 -0500251 cleanup_backend(ctxInfo.grContext(), backEndTex);
Robert Phillips57aa3672017-07-21 11:38:13 -0400252 }
Robert Phillips4150eea2018-02-07 17:08:21 -0500253
254 resourceProvider->testingOnly_setExplicitlyAllocateGPUResources(orig);
Robert Phillips5af44de2017-07-18 14:49:38 -0400255}
Robert Phillips1734dd32018-08-21 13:52:09 -0400256
257static void draw(GrContext* context) {
258 SkImageInfo ii = SkImageInfo::Make(1024, 1024, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
259
260 sk_sp<SkSurface> s = SkSurface::MakeRenderTarget(context, SkBudgeted::kYes,
261 ii, 1, kTopLeft_GrSurfaceOrigin, nullptr);
262
263 SkCanvas* c = s->getCanvas();
264
265 c->clear(SK_ColorBLACK);
266}
267
268
269DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorStressTest, reporter, ctxInfo) {
270 GrContext* context = ctxInfo.grContext();
271 GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
272
273 int maxNum;
274 size_t maxBytes;
275 context->getResourceCacheLimits(&maxNum, &maxBytes);
276
277 bool orig = resourceProvider->testingOnly_setExplicitlyAllocateGPUResources(true);
278 context->setResourceCacheLimits(0, 0); // We'll always be overbudget
279
280 draw(context);
281 draw(context);
282 draw(context);
283 draw(context);
284 context->flush();
285
286 context->setResourceCacheLimits(maxNum, maxBytes);
287 resourceProvider->testingOnly_setExplicitlyAllocateGPUResources(orig);
288}
Brian Salomon577aa0f2018-11-30 13:32:23 -0500289
290sk_sp<GrSurfaceProxy> make_lazy(GrProxyProvider* proxyProvider, const GrCaps* caps,
291 const ProxyParams& p, bool deinstantiate) {
292 GrColorType grCT = SkColorTypeToGrColorType(p.fColorType);
293 GrPixelConfig config = GrColorTypeToPixelConfig(grCT, GrSRGBEncoded::kNo);
294
295 GrSurfaceDesc desc;
296 desc.fFlags = p.fIsRT ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
297 desc.fWidth = p.fSize;
298 desc.fHeight = p.fSize;
299 desc.fConfig = config;
300 desc.fSampleCnt = p.fSampleCnt;
301
302 SkBackingFit fit = p.fFit;
303 auto callback = [fit, desc](GrResourceProvider* resourceProvider) -> sk_sp<GrSurface> {
304 if (!resourceProvider) {
305 return nullptr;
306 }
307 if (fit == SkBackingFit::kApprox) {
308 return resourceProvider->createApproxTexture(desc, GrResourceProvider::Flags::kNone);
309 } else {
310 return resourceProvider->createTexture(desc, SkBudgeted::kNo);
311 }
312 };
313 const GrBackendFormat format = caps->getBackendFormatFromColorType(p.fColorType);
Brian Salomon967df202018-12-07 11:15:53 -0500314 auto lazyType = deinstantiate ? GrSurfaceProxy::LazyInstantiationType ::kDeinstantiate
Brian Salomon577aa0f2018-11-30 13:32:23 -0500315 : GrSurfaceProxy::LazyInstantiationType ::kSingleUse;
316 GrInternalSurfaceFlags flags = GrInternalSurfaceFlags::kNone;
Brian Salomon577aa0f2018-11-30 13:32:23 -0500317 return proxyProvider->createLazyProxy(callback, format, desc, p.fOrigin, GrMipMapped::kNo,
318 flags, p.fFit, SkBudgeted::kNo, lazyType);
319}
320
321DEF_GPUTEST_FOR_RENDERING_CONTEXTS(LazyDeinstantiation, reporter, ctxInfo) {
322 GrContext* context = ctxInfo.grContext();
323 GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider();
324 for (auto explicitlyAllocating : {false, true}) {
325 resourceProvider->testingOnly_setExplicitlyAllocateGPUResources(explicitlyAllocating);
326 ProxyParams texParams;
327 texParams.fFit = SkBackingFit::kExact;
328 texParams.fOrigin = kTopLeft_GrSurfaceOrigin;
329 texParams.fColorType = kRGBA_8888_SkColorType;
330 texParams.fIsRT = false;
331 texParams.fSampleCnt = 1;
332 texParams.fSize = 100;
333 ProxyParams rtParams = texParams;
334 rtParams.fIsRT = true;
335 auto proxyProvider = context->contextPriv().proxyProvider();
336 auto caps = context->contextPriv().caps();
337 auto p0 = make_lazy(proxyProvider, caps, texParams, true);
338 auto p1 = make_lazy(proxyProvider, caps, texParams, false);
339 texParams.fFit = rtParams.fFit = SkBackingFit::kApprox;
340 auto p2 = make_lazy(proxyProvider, caps, rtParams, true);
341 auto p3 = make_lazy(proxyProvider, caps, rtParams, false);
342
Brian Salomon967df202018-12-07 11:15:53 -0500343 GrDeinstantiateProxyTracker deinstantiateTracker;
Brian Salomon577aa0f2018-11-30 13:32:23 -0500344 {
Brian Salomon967df202018-12-07 11:15:53 -0500345 GrResourceAllocator alloc(resourceProvider, &deinstantiateTracker);
Brian Salomon577aa0f2018-11-30 13:32:23 -0500346 alloc.addInterval(p0.get(), 0, 1);
347 alloc.addInterval(p1.get(), 0, 1);
348 alloc.addInterval(p2.get(), 0, 1);
349 alloc.addInterval(p3.get(), 0, 1);
350 alloc.markEndOfOpList(0);
351 int startIndex, stopIndex;
352 GrResourceAllocator::AssignError error;
353 alloc.assign(&startIndex, &stopIndex, &error);
354 }
Brian Salomon967df202018-12-07 11:15:53 -0500355 deinstantiateTracker.deinstantiateAllProxies();
Brian Salomon577aa0f2018-11-30 13:32:23 -0500356 REPORTER_ASSERT(reporter, !p0->isInstantiated());
357 REPORTER_ASSERT(reporter, p1->isInstantiated());
358 REPORTER_ASSERT(reporter, !p2->isInstantiated());
359 REPORTER_ASSERT(reporter, p3->isInstantiated());
360 }
361}