1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2019 Google LLC
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci */
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci#include "include/gpu/GrDirectContext.h"
9cb93a386Sopenharmony_ci#include "src/core/SkBlendModePriv.h"
10cb93a386Sopenharmony_ci#include "src/gpu/GrDirectContextPriv.h"
11cb93a386Sopenharmony_ci#include "src/gpu/GrOpsTypes.h"
12cb93a386Sopenharmony_ci#include "src/gpu/GrProxyProvider.h"
13cb93a386Sopenharmony_ci#include "src/gpu/GrResourceProvider.h"
14cb93a386Sopenharmony_ci#include "src/gpu/ops/FillRectOp.h"
15cb93a386Sopenharmony_ci#include "src/gpu/ops/TextureOp.h"
16cb93a386Sopenharmony_ci#include "src/gpu/v1/SurfaceDrawContext_v1.h"
17cb93a386Sopenharmony_ci#include "tests/Test.h"
18cb93a386Sopenharmony_ci
19cb93a386Sopenharmony_cistatic std::unique_ptr<skgpu::v1::SurfaceDrawContext> new_SDC(GrRecordingContext* rContext) {
20cb93a386Sopenharmony_ci    return skgpu::v1::SurfaceDrawContext::Make(
21cb93a386Sopenharmony_ci            rContext, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact, {128, 128},
22cb93a386Sopenharmony_ci            SkSurfaceProps());
23cb93a386Sopenharmony_ci}
24cb93a386Sopenharmony_ci
25cb93a386Sopenharmony_cistatic sk_sp<GrSurfaceProxy> create_proxy(GrRecordingContext* rContext) {
26cb93a386Sopenharmony_ci    static constexpr SkISize kDimensions = {128, 128};
27cb93a386Sopenharmony_ci
28cb93a386Sopenharmony_ci    const GrBackendFormat format = rContext->priv().caps()->getDefaultBackendFormat(
29cb93a386Sopenharmony_ci                                                                           GrColorType::kRGBA_8888,
30cb93a386Sopenharmony_ci                                                                           GrRenderable::kYes);
31cb93a386Sopenharmony_ci    return rContext->priv().proxyProvider()->createProxy(
32cb93a386Sopenharmony_ci            format, kDimensions, GrRenderable::kYes, 1, GrMipmapped::kNo, SkBackingFit::kExact,
33cb93a386Sopenharmony_ci            SkBudgeted::kNo, GrProtected::kNo, GrInternalSurfaceFlags::kNone);
34cb93a386Sopenharmony_ci}
35cb93a386Sopenharmony_ci
36cb93a386Sopenharmony_citypedef GrQuadAAFlags (*PerQuadAAFunc)(int i);
37cb93a386Sopenharmony_ci
38cb93a386Sopenharmony_citypedef void (*BulkRectTest)(skiatest::Reporter*,
39cb93a386Sopenharmony_ci                             GrDirectContext*,
40cb93a386Sopenharmony_ci                             PerQuadAAFunc,
41cb93a386Sopenharmony_ci                             GrAAType overallAA,
42cb93a386Sopenharmony_ci                             SkBlendMode,
43cb93a386Sopenharmony_ci                             bool addOneByOne,
44cb93a386Sopenharmony_ci                             bool allUniqueProxies,
45cb93a386Sopenharmony_ci                             int requestedTotNumQuads,
46cb93a386Sopenharmony_ci                             int expectedNumOps);
47cb93a386Sopenharmony_ci
48cb93a386Sopenharmony_ci//-------------------------------------------------------------------------------------------------
49cb93a386Sopenharmony_cistatic void fillrectop_creation_test(skiatest::Reporter* reporter, GrDirectContext* dContext,
50cb93a386Sopenharmony_ci                                     PerQuadAAFunc perQuadAA, GrAAType overallAA,
51cb93a386Sopenharmony_ci                                     SkBlendMode blendMode, bool addOneByOne,
52cb93a386Sopenharmony_ci                                     bool allUniqueProxies,
53cb93a386Sopenharmony_ci                                     int requestedTotNumQuads, int expectedNumOps) {
54cb93a386Sopenharmony_ci
55cb93a386Sopenharmony_ci    if (addOneByOne || allUniqueProxies) {
56cb93a386Sopenharmony_ci        return;
57cb93a386Sopenharmony_ci    }
58cb93a386Sopenharmony_ci
59cb93a386Sopenharmony_ci    std::unique_ptr<skgpu::v1::SurfaceDrawContext> sdc = new_SDC(dContext);
60cb93a386Sopenharmony_ci
61cb93a386Sopenharmony_ci    auto quads = new GrQuadSetEntry[requestedTotNumQuads];
62cb93a386Sopenharmony_ci
63cb93a386Sopenharmony_ci    for (int i = 0; i < requestedTotNumQuads; ++i) {
64cb93a386Sopenharmony_ci        quads[i].fRect = SkRect::MakeWH(100.5f, 100.5f); // prevent the int non-AA optimization
65cb93a386Sopenharmony_ci        quads[i].fColor = SK_PMColor4fWHITE;
66cb93a386Sopenharmony_ci        quads[i].fLocalMatrix = SkMatrix::I();
67cb93a386Sopenharmony_ci        quads[i].fAAFlags = perQuadAA(i);
68cb93a386Sopenharmony_ci    }
69cb93a386Sopenharmony_ci
70cb93a386Sopenharmony_ci    GrPaint paint;
71cb93a386Sopenharmony_ci    paint.setXPFactory(SkBlendMode_AsXPFactory(blendMode));
72cb93a386Sopenharmony_ci
73cb93a386Sopenharmony_ci    skgpu::v1::FillRectOp::AddFillRectOps(sdc.get(), nullptr, dContext, std::move(paint), overallAA,
74cb93a386Sopenharmony_ci                                          SkMatrix::I(), quads, requestedTotNumQuads);
75cb93a386Sopenharmony_ci
76cb93a386Sopenharmony_ci    auto opsTask = sdc->testingOnly_PeekLastOpsTask();
77cb93a386Sopenharmony_ci    int actualNumOps = opsTask->numOpChains();
78cb93a386Sopenharmony_ci
79cb93a386Sopenharmony_ci    int actualTotNumQuads = 0;
80cb93a386Sopenharmony_ci
81cb93a386Sopenharmony_ci    for (int i = 0; i < actualNumOps; ++i) {
82cb93a386Sopenharmony_ci        const GrOp* tmp = opsTask->getChain(i);
83cb93a386Sopenharmony_ci        REPORTER_ASSERT(reporter, tmp->classID() == skgpu::v1::FillRectOp::ClassID());
84cb93a386Sopenharmony_ci        REPORTER_ASSERT(reporter, tmp->isChainTail());
85cb93a386Sopenharmony_ci        actualTotNumQuads += ((GrDrawOp*) tmp)->numQuads();
86cb93a386Sopenharmony_ci    }
87cb93a386Sopenharmony_ci
88cb93a386Sopenharmony_ci    REPORTER_ASSERT(reporter, expectedNumOps == actualNumOps);
89cb93a386Sopenharmony_ci    REPORTER_ASSERT(reporter, requestedTotNumQuads == actualTotNumQuads);
90cb93a386Sopenharmony_ci
91cb93a386Sopenharmony_ci    dContext->flushAndSubmit();
92cb93a386Sopenharmony_ci
93cb93a386Sopenharmony_ci    delete[] quads;
94cb93a386Sopenharmony_ci}
95cb93a386Sopenharmony_ci
96cb93a386Sopenharmony_ci//-------------------------------------------------------------------------------------------------
97cb93a386Sopenharmony_cistatic void textureop_creation_test(skiatest::Reporter* reporter, GrDirectContext* dContext,
98cb93a386Sopenharmony_ci                                    PerQuadAAFunc perQuadAA, GrAAType overallAA,
99cb93a386Sopenharmony_ci                                    SkBlendMode blendMode, bool addOneByOne,
100cb93a386Sopenharmony_ci                                    bool allUniqueProxies,
101cb93a386Sopenharmony_ci                                    int requestedTotNumQuads, int expectedNumOps) {
102cb93a386Sopenharmony_ci
103cb93a386Sopenharmony_ci    std::unique_ptr<skgpu::v1::SurfaceDrawContext> sdc = new_SDC(dContext);
104cb93a386Sopenharmony_ci
105cb93a386Sopenharmony_ci    GrSurfaceProxyView proxyViewA, proxyViewB;
106cb93a386Sopenharmony_ci
107cb93a386Sopenharmony_ci    if (!allUniqueProxies) {
108cb93a386Sopenharmony_ci        sk_sp<GrSurfaceProxy> proxyA = create_proxy(dContext);
109cb93a386Sopenharmony_ci        sk_sp<GrSurfaceProxy> proxyB = create_proxy(dContext);
110cb93a386Sopenharmony_ci        proxyViewA = GrSurfaceProxyView(std::move(proxyA),
111cb93a386Sopenharmony_ci                                        kTopLeft_GrSurfaceOrigin,
112cb93a386Sopenharmony_ci                                        GrSwizzle::RGBA());
113cb93a386Sopenharmony_ci        proxyViewB = GrSurfaceProxyView(std::move(proxyB),
114cb93a386Sopenharmony_ci                                        kTopLeft_GrSurfaceOrigin,
115cb93a386Sopenharmony_ci                                        GrSwizzle::RGBA());
116cb93a386Sopenharmony_ci    }
117cb93a386Sopenharmony_ci
118cb93a386Sopenharmony_ci    auto set = new GrTextureSetEntry[requestedTotNumQuads];
119cb93a386Sopenharmony_ci
120cb93a386Sopenharmony_ci    for (int i = 0; i < requestedTotNumQuads; ++i) {
121cb93a386Sopenharmony_ci        if (!allUniqueProxies) {
122cb93a386Sopenharmony_ci            // Alternate between two proxies to prevent op merging if the batch API was forced to
123cb93a386Sopenharmony_ci            // submit one op at a time (to work, this does require that all fDstRects overlap).
124cb93a386Sopenharmony_ci            set[i].fProxyView = i % 2 == 0 ? proxyViewA : proxyViewB;
125cb93a386Sopenharmony_ci        } else {
126cb93a386Sopenharmony_ci            // Each op gets its own proxy to force chaining only
127cb93a386Sopenharmony_ci            sk_sp<GrSurfaceProxy> proxyA = create_proxy(dContext);
128cb93a386Sopenharmony_ci            set[i].fProxyView = GrSurfaceProxyView(std::move(proxyA),
129cb93a386Sopenharmony_ci                                                   kTopLeft_GrSurfaceOrigin,
130cb93a386Sopenharmony_ci                                                   GrSwizzle::RGBA());
131cb93a386Sopenharmony_ci        }
132cb93a386Sopenharmony_ci
133cb93a386Sopenharmony_ci        set[i].fSrcAlphaType = kPremul_SkAlphaType;
134cb93a386Sopenharmony_ci        set[i].fSrcRect = SkRect::MakeWH(100.0f, 100.0f);
135cb93a386Sopenharmony_ci        set[i].fDstRect = SkRect::MakeWH(100.5f, 100.5f); // prevent the int non-AA optimization
136cb93a386Sopenharmony_ci        set[i].fDstClipQuad = nullptr;
137cb93a386Sopenharmony_ci        set[i].fPreViewMatrix = nullptr;
138cb93a386Sopenharmony_ci        set[i].fColor = {1.f, 1.f, 1.f, 1.f};
139cb93a386Sopenharmony_ci        set[i].fAAFlags = perQuadAA(i);
140cb93a386Sopenharmony_ci    }
141cb93a386Sopenharmony_ci
142cb93a386Sopenharmony_ci    if (addOneByOne) {
143cb93a386Sopenharmony_ci        for (int i = 0; i < requestedTotNumQuads; ++i) {
144cb93a386Sopenharmony_ci            DrawQuad quad;
145cb93a386Sopenharmony_ci
146cb93a386Sopenharmony_ci            quad.fDevice = GrQuad::MakeFromRect(set[i].fDstRect,  SkMatrix::I());
147cb93a386Sopenharmony_ci            quad.fLocal = GrQuad(set[i].fSrcRect);
148cb93a386Sopenharmony_ci            quad.fEdgeFlags = set[i].fAAFlags;
149cb93a386Sopenharmony_ci
150cb93a386Sopenharmony_ci            GrOp::Owner op = skgpu::v1::TextureOp::Make(dContext,
151cb93a386Sopenharmony_ci                                                        set[i].fProxyView,
152cb93a386Sopenharmony_ci                                                        set[i].fSrcAlphaType,
153cb93a386Sopenharmony_ci                                                        nullptr,
154cb93a386Sopenharmony_ci                                                        GrSamplerState::Filter::kNearest,
155cb93a386Sopenharmony_ci                                                        GrSamplerState::MipmapMode::kNone,
156cb93a386Sopenharmony_ci                                                        set[i].fColor,
157cb93a386Sopenharmony_ci                                                        skgpu::v1::TextureOp::Saturate::kYes,
158cb93a386Sopenharmony_ci                                                        blendMode,
159cb93a386Sopenharmony_ci                                                        overallAA,
160cb93a386Sopenharmony_ci                                                        &quad,
161cb93a386Sopenharmony_ci                                                        nullptr);
162cb93a386Sopenharmony_ci            sdc->addDrawOp(nullptr, std::move(op));
163cb93a386Sopenharmony_ci        }
164cb93a386Sopenharmony_ci    } else {
165cb93a386Sopenharmony_ci        skgpu::v1::TextureOp::AddTextureSetOps(sdc.get(),
166cb93a386Sopenharmony_ci                                               nullptr,
167cb93a386Sopenharmony_ci                                               dContext,
168cb93a386Sopenharmony_ci                                               set,
169cb93a386Sopenharmony_ci                                               requestedTotNumQuads,
170cb93a386Sopenharmony_ci                                               requestedTotNumQuads,  // We alternate so proxyCnt == cnt
171cb93a386Sopenharmony_ci                                               GrSamplerState::Filter::kNearest,
172cb93a386Sopenharmony_ci                                               GrSamplerState::MipmapMode::kNone,
173cb93a386Sopenharmony_ci                                               skgpu::v1::TextureOp::Saturate::kYes,
174cb93a386Sopenharmony_ci                                               blendMode,
175cb93a386Sopenharmony_ci                                               overallAA,
176cb93a386Sopenharmony_ci                                               SkCanvas::kStrict_SrcRectConstraint,
177cb93a386Sopenharmony_ci                                               SkMatrix::I(),
178cb93a386Sopenharmony_ci                                               nullptr);
179cb93a386Sopenharmony_ci    }
180cb93a386Sopenharmony_ci
181cb93a386Sopenharmony_ci    auto opsTask = sdc->testingOnly_PeekLastOpsTask();
182cb93a386Sopenharmony_ci    int actualNumOps = opsTask->numOpChains();
183cb93a386Sopenharmony_ci
184cb93a386Sopenharmony_ci    int actualTotNumQuads = 0;
185cb93a386Sopenharmony_ci
186cb93a386Sopenharmony_ci    if (blendMode != SkBlendMode::kSrcOver ||
187cb93a386Sopenharmony_ci        !dContext->priv().caps()->dynamicStateArrayGeometryProcessorTextureSupport()) {
188cb93a386Sopenharmony_ci        // In either of these two cases, TextureOp creates one op per quad instead. Since
189cb93a386Sopenharmony_ci        // each entry alternates proxies but overlaps geometrically, this will prevent the ops
190cb93a386Sopenharmony_ci        // from being merged back into fewer ops.
191cb93a386Sopenharmony_ci        expectedNumOps = requestedTotNumQuads;
192cb93a386Sopenharmony_ci    }
193cb93a386Sopenharmony_ci    uint32_t expectedOpID = blendMode == SkBlendMode::kSrcOver ? skgpu::v1::TextureOp::ClassID()
194cb93a386Sopenharmony_ci                                                               : skgpu::v1::FillRectOp::ClassID();
195cb93a386Sopenharmony_ci    for (int i = 0; i < actualNumOps; ++i) {
196cb93a386Sopenharmony_ci        const GrOp* tmp = opsTask->getChain(i);
197cb93a386Sopenharmony_ci        REPORTER_ASSERT(reporter, allUniqueProxies || tmp->isChainTail());
198cb93a386Sopenharmony_ci        while (tmp) {
199cb93a386Sopenharmony_ci            REPORTER_ASSERT(reporter, tmp->classID() == expectedOpID);
200cb93a386Sopenharmony_ci            actualTotNumQuads += ((GrDrawOp*) tmp)->numQuads();
201cb93a386Sopenharmony_ci            tmp = tmp->nextInChain();
202cb93a386Sopenharmony_ci        }
203cb93a386Sopenharmony_ci    }
204cb93a386Sopenharmony_ci
205cb93a386Sopenharmony_ci    REPORTER_ASSERT(reporter, expectedNumOps == actualNumOps);
206cb93a386Sopenharmony_ci    REPORTER_ASSERT(reporter, requestedTotNumQuads == actualTotNumQuads);
207cb93a386Sopenharmony_ci
208cb93a386Sopenharmony_ci    dContext->flushAndSubmit();
209cb93a386Sopenharmony_ci
210cb93a386Sopenharmony_ci    delete[] set;
211cb93a386Sopenharmony_ci}
212cb93a386Sopenharmony_ci
213cb93a386Sopenharmony_ci//-------------------------------------------------------------------------------------------------
214cb93a386Sopenharmony_cistatic void run_test(GrDirectContext* dContext, skiatest::Reporter* reporter, BulkRectTest test) {
215cb93a386Sopenharmony_ci
216cb93a386Sopenharmony_ci    // This is the simple case where there is no AA at all. We expect 2 non-AA clumps of quads.
217cb93a386Sopenharmony_ci    {
218cb93a386Sopenharmony_ci        auto noAA = [](int i) -> GrQuadAAFlags {
219cb93a386Sopenharmony_ci            return GrQuadAAFlags::kNone;
220cb93a386Sopenharmony_ci        };
221cb93a386Sopenharmony_ci
222cb93a386Sopenharmony_ci        static const int kNumExpectedOps = 2;
223cb93a386Sopenharmony_ci
224cb93a386Sopenharmony_ci        test(reporter, dContext, noAA, GrAAType::kNone, SkBlendMode::kSrcOver,
225cb93a386Sopenharmony_ci             false, false, 2*GrResourceProvider::MaxNumNonAAQuads(), kNumExpectedOps);
226cb93a386Sopenharmony_ci    }
227cb93a386Sopenharmony_ci
228cb93a386Sopenharmony_ci    // This is the same as the above case except the overall AA is kCoverage. However, since
229cb93a386Sopenharmony_ci    // the per-quad AA is still none, all the quads should be downgraded to non-AA.
230cb93a386Sopenharmony_ci    {
231cb93a386Sopenharmony_ci        auto noAA = [](int i) -> GrQuadAAFlags {
232cb93a386Sopenharmony_ci            return GrQuadAAFlags::kNone;
233cb93a386Sopenharmony_ci        };
234cb93a386Sopenharmony_ci
235cb93a386Sopenharmony_ci        static const int kNumExpectedOps = 2;
236cb93a386Sopenharmony_ci
237cb93a386Sopenharmony_ci        test(reporter, dContext, noAA, GrAAType::kCoverage, SkBlendMode::kSrcOver,
238cb93a386Sopenharmony_ci             false, false, 2*GrResourceProvider::MaxNumNonAAQuads(), kNumExpectedOps);
239cb93a386Sopenharmony_ci    }
240cb93a386Sopenharmony_ci
241cb93a386Sopenharmony_ci    // This case has an overall AA of kCoverage but the per-quad AA alternates.
242cb93a386Sopenharmony_ci    // We should end up with several aa-sized clumps
243cb93a386Sopenharmony_ci    {
244cb93a386Sopenharmony_ci        auto alternateAA = [](int i) -> GrQuadAAFlags {
245cb93a386Sopenharmony_ci            return (i % 2) ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
246cb93a386Sopenharmony_ci        };
247cb93a386Sopenharmony_ci
248cb93a386Sopenharmony_ci        int numExpectedOps = 2*GrResourceProvider::MaxNumNonAAQuads() /
249cb93a386Sopenharmony_ci                                                 GrResourceProvider::MaxNumAAQuads();
250cb93a386Sopenharmony_ci
251cb93a386Sopenharmony_ci        test(reporter, dContext, alternateAA, GrAAType::kCoverage, SkBlendMode::kSrcOver,
252cb93a386Sopenharmony_ci             false, false, 2*GrResourceProvider::MaxNumNonAAQuads(), numExpectedOps);
253cb93a386Sopenharmony_ci    }
254cb93a386Sopenharmony_ci
255cb93a386Sopenharmony_ci    // In this case we have a run of MaxNumAAQuads non-AA quads and then AA quads. This
256cb93a386Sopenharmony_ci    // exercises the case where we have a clump of quads that can't be upgraded to AA bc of
257cb93a386Sopenharmony_ci    // its size. We expect one clump of non-AA quads followed by one clump of AA quads.
258cb93a386Sopenharmony_ci    {
259cb93a386Sopenharmony_ci        auto runOfNonAA = [](int i) -> GrQuadAAFlags {
260cb93a386Sopenharmony_ci            return (i < GrResourceProvider::MaxNumAAQuads()) ? GrQuadAAFlags::kNone
261cb93a386Sopenharmony_ci                                                             : GrQuadAAFlags::kAll;
262cb93a386Sopenharmony_ci        };
263cb93a386Sopenharmony_ci
264cb93a386Sopenharmony_ci        static const int kNumExpectedOps = 2;
265cb93a386Sopenharmony_ci
266cb93a386Sopenharmony_ci        test(reporter, dContext, runOfNonAA, GrAAType::kCoverage, SkBlendMode::kSrcOver,
267cb93a386Sopenharmony_ci             false, false, 2*GrResourceProvider::MaxNumAAQuads(), kNumExpectedOps);
268cb93a386Sopenharmony_ci    }
269cb93a386Sopenharmony_ci
270cb93a386Sopenharmony_ci    // In this case we use a blend mode other than src-over, which hits the FillRectOp fallback
271cb93a386Sopenharmony_ci    // code path for TextureOp. We pass in the expected results if batching was successful, to
272cb93a386Sopenharmony_ci    // that bulk_fill_rect_create_test batches on all modes; bulk_texture_rect_create_test is
273cb93a386Sopenharmony_ci    // responsible for revising its expectations.
274cb93a386Sopenharmony_ci    {
275cb93a386Sopenharmony_ci        auto fixedAA = [](int i) -> GrQuadAAFlags {
276cb93a386Sopenharmony_ci            return GrQuadAAFlags::kAll;
277cb93a386Sopenharmony_ci        };
278cb93a386Sopenharmony_ci
279cb93a386Sopenharmony_ci        static const int kNumExpectedOps = 2;
280cb93a386Sopenharmony_ci
281cb93a386Sopenharmony_ci        test(reporter, dContext, fixedAA, GrAAType::kCoverage, SkBlendMode::kSrcATop,
282cb93a386Sopenharmony_ci             false, false, 2*GrResourceProvider::MaxNumAAQuads(), kNumExpectedOps);
283cb93a386Sopenharmony_ci    }
284cb93a386Sopenharmony_ci
285cb93a386Sopenharmony_ci    // This repros crbug.com/1108475, where we create 1024 non-AA texture ops w/ one coverage-AA
286cb93a386Sopenharmony_ci    // texture op in the middle. Because each op has its own texture, all the texture ops
287cb93a386Sopenharmony_ci    // get chained together so the quad count can exceed the AA maximum.
288cb93a386Sopenharmony_ci    {
289cb93a386Sopenharmony_ci        auto onlyOneAA = [](int i) -> GrQuadAAFlags {
290cb93a386Sopenharmony_ci            return i == 256 ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
291cb93a386Sopenharmony_ci        };
292cb93a386Sopenharmony_ci
293cb93a386Sopenharmony_ci        static const int kNumExpectedOps = 3;
294cb93a386Sopenharmony_ci
295cb93a386Sopenharmony_ci        test(reporter, dContext, onlyOneAA, GrAAType::kCoverage, SkBlendMode::kSrcOver,
296cb93a386Sopenharmony_ci             true, true, 1024, kNumExpectedOps);
297cb93a386Sopenharmony_ci    }
298cb93a386Sopenharmony_ci
299cb93a386Sopenharmony_ci    // This repros a problem related to crbug.com/1108475. In this case, the bulk creation
300cb93a386Sopenharmony_ci    // method had no way to break up the set of texture ops at the AA quad limit.
301cb93a386Sopenharmony_ci    {
302cb93a386Sopenharmony_ci        auto onlyOneAA = [](int i) -> GrQuadAAFlags {
303cb93a386Sopenharmony_ci            return i == 256 ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone;
304cb93a386Sopenharmony_ci        };
305cb93a386Sopenharmony_ci
306cb93a386Sopenharmony_ci        static const int kNumExpectedOps = 2;
307cb93a386Sopenharmony_ci
308cb93a386Sopenharmony_ci        test(reporter, dContext, onlyOneAA, GrAAType::kCoverage, SkBlendMode::kSrcOver,
309cb93a386Sopenharmony_ci             false, true, 1024, kNumExpectedOps);
310cb93a386Sopenharmony_ci    }
311cb93a386Sopenharmony_ci
312cb93a386Sopenharmony_ci}
313cb93a386Sopenharmony_ci
314cb93a386Sopenharmony_ciDEF_GPUTEST_FOR_RENDERING_CONTEXTS(BulkFillRectTest, reporter, ctxInfo) {
315cb93a386Sopenharmony_ci    run_test(ctxInfo.directContext(), reporter, fillrectop_creation_test);
316cb93a386Sopenharmony_ci}
317cb93a386Sopenharmony_ci
318cb93a386Sopenharmony_ciDEF_GPUTEST_FOR_RENDERING_CONTEXTS(BulkTextureRectTest, reporter, ctxInfo) {
319cb93a386Sopenharmony_ci    run_test(ctxInfo.directContext(), reporter, textureop_creation_test);
320cb93a386Sopenharmony_ci}
321