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