blob: d1ed6205b817838893d82bc1863ca0b3518efb6d [file] [log] [blame]
commit-bot@chromium.org78a10782013-08-21 19:27:48 +00001/*
2 * Copyright 2013 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
Greg Daniel7ef28f32017-04-20 16:41:55 +00008#include "GrBackendSurface.h"
bsalomon682c2692015-05-22 14:01:46 -07009#include "GrContextOptions.h"
Chris Daltonfe199b72017-05-05 11:26:15 -040010#include "GrContextPriv.h"
Brian Salomon2ee084e2016-12-16 18:59:19 -050011#include "GrDrawOpAtlas.h"
robertphillips77a2e522015-10-17 07:43:27 -070012#include "GrDrawingManager.h"
Robert Phillipsfbcef6e2017-06-15 12:07:18 -040013#include "GrGpu.h"
bsalomon3582d3e2015-02-13 14:20:05 -080014#include "GrGpuResourceCacheAccess.h"
Robert Phillipsc994a932018-06-19 13:09:54 -040015#include "GrMemoryPool.h"
Brian Salomon17726632017-05-12 14:09:46 -040016#include "GrRenderTargetContext.h"
Brian Salomon2ee084e2016-12-16 18:59:19 -050017#include "GrRenderTargetContextPriv.h"
csmartdaltonf9635992016-08-10 11:09:07 -070018#include "GrRenderTargetProxy.h"
bsalomon0ea80f42015-02-11 10:49:59 -080019#include "GrResourceCache.h"
Greg Daniel6be35232017-03-01 17:01:09 -050020#include "GrSemaphore.h"
Brian Salomon17726632017-05-12 14:09:46 -040021#include "GrSurfaceContextPriv.h"
Robert Phillips646e4292017-06-13 12:44:56 -040022#include "GrTexture.h"
Brian Osman3b655982017-03-07 16:58:08 -050023#include "SkGr.h"
Robert Phillips22f4a1f2016-12-20 08:57:26 -050024#include "SkImage_Gpu.h"
halcanary4dbbd042016-06-07 17:21:10 -070025#include "SkMathPriv.h"
mtkleinb9eb4ac2015-02-02 18:26:03 -080026#include "SkString.h"
Hal Canaryc640d0d2018-06-13 09:59:02 -040027#include "SkTo.h"
Chris Dalton4da70192018-06-18 09:51:36 -060028#include "ccpr/GrCoverageCountingPathRenderer.h"
Brian Salomon17726632017-05-12 14:09:46 -040029#include "ops/GrMeshDrawOp.h"
Robert Phillipsc4039ea2018-03-01 11:36:45 -050030#include "text/GrGlyphCache.h"
joshualitte8042922015-12-11 06:11:21 -080031#include "text/GrTextBlobCache.h"
Hal Canaryc640d0d2018-06-13 09:59:02 -040032#include <algorithm>
joshualitte8042922015-12-11 06:11:21 -080033
Robert Phillipseaa86252016-11-08 13:49:39 +000034bool GrSurfaceProxy::isWrapped_ForTesting() const {
35 return SkToBool(fTarget);
36}
37
38bool GrRenderTargetContext::isWrapped_ForTesting() const {
39 return fRenderTargetProxy->isWrapped_ForTesting();
40}
41
Robert Phillips0c4b7b12018-03-06 08:20:37 -050042void GrContextPriv::setTextBlobCacheLimit_ForTesting(size_t bytes) {
43 fContext->fTextBlobCache->setBudget(bytes);
joshualitt17d833b2015-08-03 10:17:44 -070044}
45
commit-bot@chromium.org78a10782013-08-21 19:27:48 +000046///////////////////////////////////////////////////////////////////////////////
47
Robert Phillips0c4b7b12018-03-06 08:20:37 -050048void GrContextPriv::purgeAllUnlockedResources_ForTesting() {
49 fContext->fResourceCache->purgeAllUnlocked();
robertphillips@google.com94d8f1e2013-12-18 17:25:33 +000050}
bsalomon33435572014-11-05 14:47:41 -080051
Robert Phillips0c4b7b12018-03-06 08:20:37 -050052void GrContextPriv::resetGpuStats() const {
joshualitte45c81c2015-12-02 09:05:37 -080053#if GR_GPU_STATS
Robert Phillips0c4b7b12018-03-06 08:20:37 -050054 fContext->fGpu->stats()->reset();
joshualitte45c81c2015-12-02 09:05:37 -080055#endif
56}
57
Robert Phillips0c4b7b12018-03-06 08:20:37 -050058void GrContextPriv::dumpCacheStats(SkString* out) const {
mtkleinb9eb4ac2015-02-02 18:26:03 -080059#if GR_CACHE_STATS
Robert Phillips0c4b7b12018-03-06 08:20:37 -050060 fContext->fResourceCache->dumpStats(out);
mtkleinb9eb4ac2015-02-02 18:26:03 -080061#endif
62}
63
Robert Phillips0c4b7b12018-03-06 08:20:37 -050064void GrContextPriv::dumpCacheStatsKeyValuePairs(SkTArray<SkString>* keys,
65 SkTArray<double>* values) const {
joshualittdc5685a2015-12-02 14:08:25 -080066#if GR_CACHE_STATS
Robert Phillips0c4b7b12018-03-06 08:20:37 -050067 fContext->fResourceCache->dumpStatsKeyValuePairs(keys, values);
joshualittdc5685a2015-12-02 14:08:25 -080068#endif
69}
70
Robert Phillips0c4b7b12018-03-06 08:20:37 -050071void GrContextPriv::printCacheStats() const {
mtkleinb9eb4ac2015-02-02 18:26:03 -080072 SkString out;
73 this->dumpCacheStats(&out);
kkinnunen297aaf92015-02-19 06:32:12 -080074 SkDebugf("%s", out.c_str());
mtkleinb9eb4ac2015-02-02 18:26:03 -080075}
76
Robert Phillips0c4b7b12018-03-06 08:20:37 -050077void GrContextPriv::dumpGpuStats(SkString* out) const {
mtkleinb9eb4ac2015-02-02 18:26:03 -080078#if GR_GPU_STATS
Robert Phillips0c4b7b12018-03-06 08:20:37 -050079 return fContext->fGpu->stats()->dump(out);
mtkleinb9eb4ac2015-02-02 18:26:03 -080080#endif
81}
82
Robert Phillips0c4b7b12018-03-06 08:20:37 -050083void GrContextPriv::dumpGpuStatsKeyValuePairs(SkTArray<SkString>* keys,
84 SkTArray<double>* values) const {
joshualitte45c81c2015-12-02 09:05:37 -080085#if GR_GPU_STATS
Robert Phillips0c4b7b12018-03-06 08:20:37 -050086 return fContext->fGpu->stats()->dumpKeyValuePairs(keys, values);
joshualitte45c81c2015-12-02 09:05:37 -080087#endif
88}
89
Robert Phillips0c4b7b12018-03-06 08:20:37 -050090void GrContextPriv::printGpuStats() const {
mtkleinb9eb4ac2015-02-02 18:26:03 -080091 SkString out;
92 this->dumpGpuStats(&out);
kkinnunen297aaf92015-02-19 06:32:12 -080093 SkDebugf("%s", out.c_str());
mtkleinb9eb4ac2015-02-02 18:26:03 -080094}
95
Robert Phillips0c4b7b12018-03-06 08:20:37 -050096sk_sp<SkImage> GrContextPriv::getFontAtlasImage_ForTesting(GrMaskFormat format, unsigned int index) {
Robert Phillips5a66efb2018-03-07 15:13:18 -050097 auto atlasManager = this->getAtlasManager();
98 if (!atlasManager) {
99 return nullptr;
100 }
jvanverth629162d2015-11-08 08:07:24 -0800101
Jim Van Verthcbeae032018-05-16 14:54:41 -0400102 unsigned int numActiveProxies;
103 const sk_sp<GrTextureProxy>* proxies = atlasManager->getProxies(format, &numActiveProxies);
104 if (index >= numActiveProxies || !proxies || !proxies[index]) {
Robert Phillips32f28182017-02-28 16:20:03 -0500105 return nullptr;
106 }
107
Jim Van Verth87d18ce2018-01-22 12:45:47 -0500108 SkASSERT(proxies[index]->priv().isExact());
Brian Salomon8a8dd332018-05-24 14:08:31 -0400109 sk_sp<SkImage> image(new SkImage_Gpu(sk_ref_sp(fContext), kNeedNewImageUniqueID,
110 kPremul_SkAlphaType, proxies[index], nullptr,
111 SkBudgeted::kNo));
Robert Phillips22f4a1f2016-12-20 08:57:26 -0500112 return image;
jvanverth0671b962015-12-08 18:53:44 -0800113}
jvanverth629162d2015-11-08 08:07:24 -0800114
mtkleinb9eb4ac2015-02-02 18:26:03 -0800115#if GR_GPU_STATS
116void GrGpu::Stats::dump(SkString* out) {
117 out->appendf("Render Target Binds: %d\n", fRenderTargetBinds);
118 out->appendf("Shader Compilations: %d\n", fShaderCompilations);
bsalomonb12ea412015-02-02 21:19:50 -0800119 out->appendf("Textures Created: %d\n", fTextureCreates);
120 out->appendf("Texture Uploads: %d\n", fTextureUploads);
jvanverth17aa0472016-01-05 10:41:27 -0800121 out->appendf("Transfers to Texture: %d\n", fTransfersToTexture);
egdaniel8dc7c3a2015-04-16 11:22:42 -0700122 out->appendf("Stencil Buffer Creates: %d\n", fStencilAttachmentCreates);
joshualitt87a5c9f2015-09-08 13:42:05 -0700123 out->appendf("Number of draws: %d\n", fNumDraws);
mtkleinb9eb4ac2015-02-02 18:26:03 -0800124}
joshualitte45c81c2015-12-02 09:05:37 -0800125
126void GrGpu::Stats::dumpKeyValuePairs(SkTArray<SkString>* keys, SkTArray<double>* values) {
127 keys->push_back(SkString("render_target_binds")); values->push_back(fRenderTargetBinds);
128 keys->push_back(SkString("shader_compilations")); values->push_back(fShaderCompilations);
joshualitte45c81c2015-12-02 09:05:37 -0800129 keys->push_back(SkString("texture_uploads")); values->push_back(fTextureUploads);
joshualitte45c81c2015-12-02 09:05:37 -0800130 keys->push_back(SkString("number_of_draws")); values->push_back(fNumDraws);
bsalomon1d417a82016-03-23 11:50:26 -0700131 keys->push_back(SkString("number_of_failed_draws")); values->push_back(fNumFailedDraws);
joshualitte45c81c2015-12-02 09:05:37 -0800132}
133
mtkleinb9eb4ac2015-02-02 18:26:03 -0800134#endif
135
Brian Salomon52e943a2018-03-13 09:32:39 -0400136GrBackendTexture GrGpu::createTestingOnlyBackendTexture(const void* pixels, int w, int h,
Brian Osman2b23c4b2018-06-01 12:25:08 -0400137 SkColorType colorType, bool isRenderTarget,
Brian Salomonbdecacf2018-02-02 20:32:49 -0500138 GrMipMapped mipMapped) {
Brian Osman2b23c4b2018-06-01 12:25:08 -0400139 GrPixelConfig config = SkColorType2GrPixelConfig(colorType);
Greg Daniel0a7aa142018-02-21 13:02:32 -0500140 if (kUnknown_GrPixelConfig == config) {
141 return GrBackendTexture();
142 }
Brian Salomonbdecacf2018-02-02 20:32:49 -0500143 return this->createTestingOnlyBackendTexture(pixels, w, h, config, isRenderTarget, mipMapped);
144}
145
mtkleinb9eb4ac2015-02-02 18:26:03 -0800146#if GR_CACHE_STATS
robertphillips60029a52015-11-09 13:51:06 -0800147void GrResourceCache::getStats(Stats* stats) const {
148 stats->reset();
149
150 stats->fTotal = this->getResourceCount();
151 stats->fNumNonPurgeable = fNonpurgeableResources.count();
152 stats->fNumPurgeable = fPurgeableQueue.count();
153
154 for (int i = 0; i < fNonpurgeableResources.count(); ++i) {
155 stats->update(fNonpurgeableResources[i]);
156 }
157 for (int i = 0; i < fPurgeableQueue.count(); ++i) {
158 stats->update(fPurgeableQueue.at(i));
159 }
160}
161
bsalomon0ea80f42015-02-11 10:49:59 -0800162void GrResourceCache::dumpStats(SkString* out) const {
mtkleinb9eb4ac2015-02-02 18:26:03 -0800163 this->validate();
164
bsalomonf320e042015-02-17 15:09:34 -0800165 Stats stats;
166
robertphillips60029a52015-11-09 13:51:06 -0800167 this->getStats(&stats);
mtkleinb9eb4ac2015-02-02 18:26:03 -0800168
169 float countUtilization = (100.f * fBudgetedCount) / fMaxCount;
170 float byteUtilization = (100.f * fBudgetedBytes) / fMaxBytes;
171
172 out->appendf("Budget: %d items %d bytes\n", fMaxCount, (int)fMaxBytes);
173 out->appendf("\t\tEntry Count: current %d"
kkinnunen2e6055b2016-04-22 01:48:29 -0700174 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), high %d\n",
175 stats.fTotal, fBudgetedCount, stats.fWrapped, stats.fNumNonPurgeable,
176 stats.fScratch, countUtilization, fHighWaterCount);
mtkleinb9eb4ac2015-02-02 18:26:03 -0800177 out->appendf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudgeted) high %d\n",
bsalomonf320e042015-02-17 15:09:34 -0800178 SkToInt(fBytes), SkToInt(fBudgetedBytes), byteUtilization,
179 SkToInt(stats.fUnbudgetedSize), SkToInt(fHighWaterBytes));
mtkleinb9eb4ac2015-02-02 18:26:03 -0800180}
181
joshualittdc5685a2015-12-02 14:08:25 -0800182void GrResourceCache::dumpStatsKeyValuePairs(SkTArray<SkString>* keys,
183 SkTArray<double>* values) const {
184 this->validate();
185
186 Stats stats;
187 this->getStats(&stats);
188
joshualittdc5685a2015-12-02 14:08:25 -0800189 keys->push_back(SkString("gpu_cache_purgable_entries")); values->push_back(stats.fNumPurgeable);
joshualittdc5685a2015-12-02 14:08:25 -0800190}
191
mtkleinb9eb4ac2015-02-02 18:26:03 -0800192#endif
193
bsalomonddf30e62015-02-19 11:38:44 -0800194///////////////////////////////////////////////////////////////////////////////
195
196void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newTimestamp; }
mtkleinb9eb4ac2015-02-02 18:26:03 -0800197
Brian Salomon1090da62017-01-06 12:04:19 -0500198#ifdef SK_DEBUG
199int GrResourceCache::countUniqueKeysWithTag(const char* tag) const {
200 int count = 0;
201 UniqueHash::ConstIter iter(&fUniqueHash);
202 while (!iter.done()) {
203 if (0 == strcmp(tag, (*iter).getUniqueKey().tag())) {
204 ++count;
205 }
206 ++iter;
207 }
208 return count;
209}
210#endif
211
bsalomon33435572014-11-05 14:47:41 -0800212///////////////////////////////////////////////////////////////////////////////
joshualittf5883a62016-01-13 07:47:38 -0800213
214#define ASSERT_SINGLE_OWNER \
Robert Phillipsa90aa2b2017-04-10 08:19:26 -0400215 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fRenderTargetContext->singleOwner());)
joshualittf5883a62016-01-13 07:47:38 -0800216
Chris Dalton706a6ff2017-11-29 22:01:06 -0700217
Chris Daltona32a3c32017-12-05 10:05:21 -0700218uint32_t GrRenderTargetContextPriv::testingOnly_getOpListID() {
219 return fRenderTargetContext->getOpList()->uniqueID();
220}
221
Brian Salomonac70f842017-05-08 10:43:33 -0400222uint32_t GrRenderTargetContextPriv::testingOnly_addDrawOp(std::unique_ptr<GrDrawOp> op) {
Chris Dalton706a6ff2017-11-29 22:01:06 -0700223 return this->testingOnly_addDrawOp(GrNoClip(), std::move(op));
224}
225
226uint32_t GrRenderTargetContextPriv::testingOnly_addDrawOp(const GrClip& clip,
227 std::unique_ptr<GrDrawOp> op) {
Brian Salomonac70f842017-05-08 10:43:33 -0400228 ASSERT_SINGLE_OWNER
229 if (fRenderTargetContext->drawingManager()->wasAbandoned()) {
Robert Phillipsc994a932018-06-19 13:09:54 -0400230 fRenderTargetContext->fContext->contextPriv().opMemoryPool()->release(std::move(op));
Brian Salomonac70f842017-05-08 10:43:33 -0400231 return SK_InvalidUniqueID;
232 }
233 SkDEBUGCODE(fRenderTargetContext->validate());
234 GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail,
235 "GrRenderTargetContext::testingOnly_addDrawOp");
Chris Dalton706a6ff2017-11-29 22:01:06 -0700236 return fRenderTargetContext->addDrawOp(clip, std::move(op));
Brian Salomonac70f842017-05-08 10:43:33 -0400237}
238
joshualittf5883a62016-01-13 07:47:38 -0800239#undef ASSERT_SINGLE_OWNER
joshualittf5883a62016-01-13 07:47:38 -0800240
241///////////////////////////////////////////////////////////////////////////////
csmartdaltonf9635992016-08-10 11:09:07 -0700242
Robert Phillipsfe0253f2018-03-16 16:47:25 -0400243GrInternalSurfaceFlags GrSurfaceProxy::testingOnly_getFlags() const {
244 return fSurfaceFlags;
csmartdaltonf9635992016-08-10 11:09:07 -0700245}
246
Brian Salomon17726632017-05-12 14:09:46 -0400247//////////////////////////////////////////////////////////////////////////////
248
Chris Daltonfe199b72017-05-05 11:26:15 -0400249void GrContextPriv::testingOnly_flushAndRemoveOnFlushCallbackObject(GrOnFlushCallbackObject* cb) {
250 fContext->flush();
251 fContext->fDrawingManager->testingOnly_removeOnFlushCallbackObject(cb);
252}
253
254void GrDrawingManager::testingOnly_removeOnFlushCallbackObject(GrOnFlushCallbackObject* cb) {
255 int n = std::find(fOnFlushCBObjects.begin(), fOnFlushCBObjects.end(), cb) -
256 fOnFlushCBObjects.begin();
257 SkASSERT(n < fOnFlushCBObjects.count());
258 fOnFlushCBObjects.removeShuffle(n);
259}
Brian Salomon17726632017-05-12 14:09:46 -0400260
261//////////////////////////////////////////////////////////////////////////////
262
Chris Daltona2b5b642018-06-24 13:08:57 -0600263void GrCoverageCountingPathRenderer::testingOnly_drawPathDirectly(const DrawPathArgs& args) {
264 // Call onDrawPath() directly: We want to test paths that might fail onCanDrawPath() simply for
265 // performance reasons, and GrPathRenderer::drawPath() assert that this call returns true.
266 // The test is responsible to not draw any paths that CCPR is not actually capable of.
267 this->onDrawPath(args);
268}
269
Chris Dalton4da70192018-06-18 09:51:36 -0600270const GrUniqueKey& GrCoverageCountingPathRenderer::testingOnly_getStashedAtlasKey() const {
271 return fStashedAtlasKey;
272}
273
274//////////////////////////////////////////////////////////////////////////////
275
Brian Salomon17726632017-05-12 14:09:46 -0400276#define DRAW_OP_TEST_EXTERN(Op) \
Brian Salomon815486c2017-07-11 08:52:13 -0400277 extern std::unique_ptr<GrDrawOp> Op##__Test(GrPaint&&, SkRandom*, GrContext*, GrFSAAType)
Brian Salomon17726632017-05-12 14:09:46 -0400278#define DRAW_OP_TEST_ENTRY(Op) Op##__Test
279
Brian Salomon10978a62017-06-15 16:21:49 -0400280DRAW_OP_TEST_EXTERN(AAConvexPathOp);
Brian Salomon815486c2017-07-11 08:52:13 -0400281DRAW_OP_TEST_EXTERN(AAFillRectOp);
Brian Salomonb2955732017-07-13 16:42:55 -0400282DRAW_OP_TEST_EXTERN(AAFlatteningConvexPathOp);
Brian Salomona531f252017-07-07 13:29:28 -0400283DRAW_OP_TEST_EXTERN(AAHairlineOp);
Brian Salomonbaaf4392017-06-15 09:59:23 -0400284DRAW_OP_TEST_EXTERN(AAStrokeRectOp);
Brian Salomon815486c2017-07-11 08:52:13 -0400285DRAW_OP_TEST_EXTERN(CircleOp);
Brian Salomon98222ac2017-07-12 15:27:54 -0400286DRAW_OP_TEST_EXTERN(DashOp);
Brian Salomonee3e0ba2017-07-13 16:40:46 -0400287DRAW_OP_TEST_EXTERN(DefaultPathOp);
Brian Salomon05441c42017-05-15 16:45:49 -0400288DRAW_OP_TEST_EXTERN(DIEllipseOp);
289DRAW_OP_TEST_EXTERN(EllipseOp);
Brian Salomon44acb5b2017-07-18 19:59:24 -0400290DRAW_OP_TEST_EXTERN(GrAtlasTextOp);
Brian Salomon0088f942017-07-12 11:51:27 -0400291DRAW_OP_TEST_EXTERN(GrDrawAtlasOp);
Brian Salomonc2f42542017-07-12 14:11:22 -0400292DRAW_OP_TEST_EXTERN(GrDrawVerticesOp);
Brian Salomon815486c2017-07-11 08:52:13 -0400293DRAW_OP_TEST_EXTERN(NonAAFillRectOp);
294DRAW_OP_TEST_EXTERN(NonAALatticeOp);
Brian Salomonbaaf4392017-06-15 09:59:23 -0400295DRAW_OP_TEST_EXTERN(NonAAStrokeRectOp);
Brian Salomon05969092017-07-13 11:20:51 -0400296DRAW_OP_TEST_EXTERN(ShadowRRectOp);
Brian Salomonfebbd232017-07-11 15:52:02 -0400297DRAW_OP_TEST_EXTERN(SmallPathOp);
Brian Salomonf0366322017-07-11 15:53:05 -0400298DRAW_OP_TEST_EXTERN(RegionOp);
Brian Salomon05441c42017-05-15 16:45:49 -0400299DRAW_OP_TEST_EXTERN(RRectOp);
Brian Salomon9530f7e2017-07-11 09:03:10 -0400300DRAW_OP_TEST_EXTERN(TesselatingPathOp);
Brian Salomon34169692017-08-28 15:32:01 -0400301DRAW_OP_TEST_EXTERN(TextureOp);
Brian Salomon17726632017-05-12 14:09:46 -0400302
303void GrDrawRandomOp(SkRandom* random, GrRenderTargetContext* renderTargetContext, GrPaint&& paint) {
304 GrContext* context = renderTargetContext->surfPriv().getContext();
Brian Salomon17726632017-05-12 14:09:46 -0400305 using MakeDrawOpFn = std::unique_ptr<GrDrawOp>(GrPaint&&, SkRandom*, GrContext*, GrFSAAType);
306 static constexpr MakeDrawOpFn* gFactories[] = {
Brian Salomon34169692017-08-28 15:32:01 -0400307 DRAW_OP_TEST_ENTRY(AAConvexPathOp),
308 DRAW_OP_TEST_ENTRY(AAFillRectOp),
309 DRAW_OP_TEST_ENTRY(AAFlatteningConvexPathOp),
310 DRAW_OP_TEST_ENTRY(AAHairlineOp),
311 DRAW_OP_TEST_ENTRY(AAStrokeRectOp),
312 DRAW_OP_TEST_ENTRY(CircleOp),
313 DRAW_OP_TEST_ENTRY(DashOp),
314 DRAW_OP_TEST_ENTRY(DefaultPathOp),
315 DRAW_OP_TEST_ENTRY(DIEllipseOp),
316 DRAW_OP_TEST_ENTRY(EllipseOp),
317 DRAW_OP_TEST_ENTRY(GrAtlasTextOp),
318 DRAW_OP_TEST_ENTRY(GrDrawAtlasOp),
319 DRAW_OP_TEST_ENTRY(GrDrawVerticesOp),
320 DRAW_OP_TEST_ENTRY(NonAAFillRectOp),
321 DRAW_OP_TEST_ENTRY(NonAALatticeOp),
322 DRAW_OP_TEST_ENTRY(NonAAStrokeRectOp),
323 DRAW_OP_TEST_ENTRY(ShadowRRectOp),
324 DRAW_OP_TEST_ENTRY(SmallPathOp),
325 DRAW_OP_TEST_ENTRY(RegionOp),
326 DRAW_OP_TEST_ENTRY(RRectOp),
327 DRAW_OP_TEST_ENTRY(TesselatingPathOp),
328 DRAW_OP_TEST_ENTRY(TextureOp),
Brian Salomon17726632017-05-12 14:09:46 -0400329 };
330
Brian Salomonfc26f3c2017-07-14 15:27:56 -0400331 static constexpr size_t kTotal = SK_ARRAY_COUNT(gFactories);
Brian Salomon17726632017-05-12 14:09:46 -0400332 uint32_t index = random->nextULessThan(static_cast<uint32_t>(kTotal));
Brian Salomonfc26f3c2017-07-14 15:27:56 -0400333 auto op = gFactories[index](
334 std::move(paint), random, context, renderTargetContext->fsaaType());
335 SkASSERT(op);
336 renderTargetContext->priv().testingOnly_addDrawOp(std::move(op));
Brian Salomon17726632017-05-12 14:09:46 -0400337}