33 std::unique_ptr<Recorder> recorder = context->makeRecorder();
34 ProxyCache* proxyCache = recorder->priv().proxyCache();
46 "ProxyCacheTestTexture");
52 proxyCache->forceProcessInvalidKeyMsgs();
60 std::unique_ptr<Recorder> recorder1 = context->makeRecorder();
61 ProxyCache* proxyCache1 = recorder1->priv().proxyCache();
62 std::unique_ptr<Recorder> recorder2 = context->makeRecorder();
63 ProxyCache* proxyCache2 = recorder2->priv().proxyCache();
76 "ProxyCacheTestTexture");
78 "ProxyCacheTestTexture");
85 proxyCache1->forceProcessInvalidKeyMsgs();
86 proxyCache2->forceProcessInvalidKeyMsgs();
94struct ProxyCacheSetup {
108ProxyCacheSetup setup_test(
Context* context,
114 ProxyCacheSetup
setup;
118 if (!success1 || !success2) {
124 setup.fProxy1 = proxyCache->findOrCreateCachedProxy(recorder,
setup.fBitmap1,
125 "ProxyCacheTestTexture");
130 auto recording = recorder->
snap();
131 context->insertRecording({ recording.get() });
135 std::this_thread::sleep_for(std::chrono::milliseconds(2));
136 setup.fTimeBetweenProxyCreation = skgpu::StdSteadyClock::now();
137 std::this_thread::sleep_for(std::chrono::milliseconds(2));
139 setup.fProxy2 = proxyCache->findOrCreateCachedProxy(recorder,
setup.fBitmap2,
140 "ProxyCacheTestTexture");
145 auto recording = recorder->
snap();
146 context->insertRecording({ recording.get() });
150 std::this_thread::sleep_for(std::chrono::milliseconds(2));
151 setup.fTimeAfterAllProxyCreation = skgpu::StdSteadyClock::now();
152 std::this_thread::sleep_for(std::chrono::milliseconds(2));
166 std::unique_ptr<Recorder> recorder = context->makeRecorder();
167 ProxyCache* proxyCache = recorder->priv().proxyCache();
169 ProxyCacheSetup
setup = setup_test(context, testContext, recorder.get(), r);
171 if (!
setup.valid()) {
175 proxyCache->forceFreeUniquelyHeld();
178 setup.fProxy1.reset();
179 proxyCache->forceFreeUniquelyHeld();
182 setup.fProxy2.reset();
183 proxyCache->forceFreeUniquelyHeld();
194 std::unique_ptr<Recorder> recorder = context->makeRecorder();
195 ProxyCache* proxyCache = recorder->priv().proxyCache();
197 ProxyCacheSetup
setup = setup_test(context, testContext, recorder.get(), r);
199 if (!
setup.valid()) {
206 proxyCache->forcePurgeProxiesNotUsedSince(
setup.fTimeBetweenProxyCreation);
214 proxyCache->forcePurgeProxiesNotUsedSince(
setup.fTimeAfterAllProxyCreation);
228 std::unique_ptr<Recorder> recorder = context->makeRecorder();
229 ProxyCache* proxyCache = recorder->priv().proxyCache();
231 ProxyCacheSetup
setup = setup_test(context, testContext, recorder.get(), r);
233 if (!
setup.valid()) {
242 "ProxyCacheTestTexture");
245 std::this_thread::sleep_for(std::chrono::milliseconds(2));
246 auto timeAfterProxy1Update = skgpu::StdSteadyClock::now();
248 proxyCache->forcePurgeProxiesNotUsedSince(
setup.fTimeBetweenProxyCreation);
253 proxyCache->forcePurgeProxiesNotUsedSince(
setup.fTimeAfterAllProxyCreation);
261 proxyCache->forcePurgeProxiesNotUsedSince(timeAfterProxy1Update);
274 std::unique_ptr<Recorder> recorder = context->makeRecorder();
275 ProxyCache* proxyCache = recorder->priv().proxyCache();
277 ProxyCacheSetup
setup = setup_test(context, testContext, recorder.get(), r);
279 if (!
setup.valid()) {
286 proxyCache->forcePurgeProxiesNotUsedSince(
setup.fTimeAfterAllProxyCreation);
299 std::unique_ptr<Recorder> recorder = context->makeRecorder();
300 ResourceCache* resourceCache = recorder->priv().resourceCache();
301 ProxyCache* proxyCache = recorder->priv().proxyCache();
303 resourceCache->setMaxBudget(0);
305 ProxyCacheSetup
setup = setup_test(context, testContext, recorder.get(), r);
307 if (!
setup.valid()) {
311 resourceCache->forcePurgeAsNeeded();
315 setup.fProxy1.reset();
316 proxyCache->forceProcessInvalidKeyMsgs();
323 resourceCache->forcePurgeAsNeeded();
329 setup.fProxy2.reset();
330 proxyCache->forceProcessInvalidKeyMsgs();
337 resourceCache->forcePurgeAsNeeded();
350 std::unique_ptr<Recorder> recorder = context->makeRecorder();
351 ResourceCache* resourceCache = recorder->priv().resourceCache();
352 ProxyCache* proxyCache = recorder->priv().proxyCache();
354 ProxyCacheSetup
setup = setup_test(context, testContext, recorder.get(), r);
356 if (!
setup.valid()) {
363 if (!
setup.fProxy1->texture() || !
setup.fProxy2->texture()) {
368 resourceCache->setMaxBudget(0);
369 resourceCache->setMaxBudget(256 * (1 << 20));
374 if (context->priv().caps()->bufferMapsAreAsync()) {
381 setup.fProxy2->texture()->refCommandBuffer();
385 setup.fProxy1.reset();
386 setup.fProxy2.reset();
389 auto timeAfterProxyCreation = skgpu::StdSteadyClock::now();
405 resourceCache->forceProcessReturnedResources();
413 *regenerated =
false;
429 [](
const void* context) {
431 *
params->regenerated =
true;
452 std::unique_ptr<Recorder> recorder = context->makeRecorder();
453 ProxyCache* proxyCache = recorder->priv().proxyCache();
469 proxyCache->forceFreeUniquelyHeld();
480 (void) recorder->snap();
483 proxyCache->forceFreeUniquelyHeld();
sk_sp< TextureProxy > fProxy2
skgpu::StdSteadyClock::time_point fTimeAfterAllProxyCreation
skgpu::StdSteadyClock::time_point fTimeBetweenProxyCreation
sk_sp< TextureProxy > fProxy1
constexpr SkColor SK_ColorBLACK
#define REPORTER_ASSERT(r, cond,...)
void reset(T *ptr=nullptr)
static Domain GenerateDomain()
sk_sp< TextureProxy > findOrCreateCachedProxy(Recorder *, const SkBitmap &, std::string_view label)
ProxyCache * proxyCache()
std::unique_ptr< Recording > snap()
void purgeResourcesNotUsedSince(StdSteadyClock::time_point purgeTime)
int getResourceCount() const
void unrefCommandBuffer() const
void syncedSubmit(skgpu::graphite::Context *)
const EmbeddedViewParams * params
static sk_sp< TextureProxy > find_or_create_by_key(Recorder *recorder, int id, bool *regenerated)
DEF_CONDITIONAL_GRAPHITE_TEST_FOR_ALL_CONTEXTS(GraphiteBudgetedResourcesTest, reporter, context, testContext, true, CtsEnforcement::kNextRelease)
DEF_GRAPHITE_TEST_FOR_ALL_CONTEXTS(DeviceTestVertexTransparency, reporter, context, CtsEnforcement::kNextRelease)
static void setup(SkCanvas *canvas, SkPaint *paint, const SkBitmap &bm, SkFilterMode fm, SkTileMode tmx, SkTileMode tmy)