blob: aa17327e54f8672edeea904deb1f9be417086222 [file] [log] [blame]
Chris Daltond7291ba2019-03-07 14:17:03 -07001/*
2 * Copyright 2019 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
Mike Kleinc0bd9f92019-04-23 12:05:21 -05008#include "gm/gm.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -04009#include "include/core/SkBlendMode.h"
10#include "include/core/SkCanvas.h"
11#include "include/core/SkColorSpace.h"
12#include "include/core/SkMatrix.h"
13#include "include/core/SkRect.h"
14#include "include/core/SkRefCnt.h"
15#include "include/core/SkSize.h"
16#include "include/core/SkString.h"
17#include "include/core/SkTypes.h"
Robert Phillipsb7bfbc22020-07-01 12:55:01 -040018#include "include/gpu/GrRecordingContext.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040019#include "include/gpu/GrTypes.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040020#include "include/private/GrTypesPriv.h"
21#include "include/private/SkColorData.h"
22#include "src/gpu/GrBuffer.h"
23#include "src/gpu/GrCaps.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040024#include "src/gpu/GrColorSpaceXform.h"
Adlai Hollera0693042020-10-14 11:23:11 -040025#include "src/gpu/GrDirectContextPriv.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040026#include "src/gpu/GrGeometryProcessor.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050027#include "src/gpu/GrMemoryPool.h"
28#include "src/gpu/GrOpFlushState.h"
Greg Daniel2d41d0d2019-08-26 11:08:51 -040029#include "src/gpu/GrOpsRenderPass.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040030#include "src/gpu/GrPaint.h"
31#include "src/gpu/GrPipeline.h"
32#include "src/gpu/GrPrimitiveProcessor.h"
33#include "src/gpu/GrProcessor.h"
34#include "src/gpu/GrProcessorSet.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050035#include "src/gpu/GrRecordingContextPriv.h"
36#include "src/gpu/GrRenderTargetContext.h"
37#include "src/gpu/GrRenderTargetContextPriv.h"
Brian Salomon201cdbb2019-08-14 17:00:30 -040038#include "src/gpu/GrSamplerState.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040039#include "src/gpu/GrShaderCaps.h"
40#include "src/gpu/GrShaderVar.h"
Greg Danielf91aeb22019-06-18 09:58:02 -040041#include "src/gpu/GrSurfaceProxy.h"
42#include "src/gpu/GrTextureProxy.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040043#include "src/gpu/GrUserStencilSettings.h"
44#include "src/gpu/effects/GrPorterDuffXferProcessor.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050045#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
46#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040047#include "src/gpu/glsl/GrGLSLPrimitiveProcessor.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050048#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
49#include "src/gpu/glsl/GrGLSLVarying.h"
50#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040051#include "src/gpu/ops/GrDrawOp.h"
52#include "src/gpu/ops/GrOp.h"
Robert Phillips34cea002019-11-21 16:02:34 -050053#include "tools/gpu/ProxyUtils.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -040054
55#include <memory>
56#include <utility>
57
58class GrAppliedClip;
59class GrGLSLProgramDataManager;
Chris Daltond7291ba2019-03-07 14:17:03 -070060
61namespace skiagm {
62
63enum class GradType : bool {
64 kHW,
65 kSW
66};
67
68/**
69 * This test ensures that the shaderBuilder's sample offsets and sample mask are correlated with
70 * actual HW sample locations. It does so by drawing pseudo-random subpixel boxes, and only turning
71 * off the samples whose locations fall inside the boxes.
72 */
73class SampleLocationsGM : public GpuGM {
74public:
75 SampleLocationsGM(GradType gradType, GrSurfaceOrigin origin)
76 : fGradType(gradType)
77 , fOrigin(origin) {}
78
79private:
Hal Canaryfa3305a2019-07-18 12:36:54 -040080 SkString onShortName() override {
81 return SkStringPrintf("samplelocations%s%s",
82 (GradType::kHW == fGradType) ? "_hwgrad" : "_swgrad",
83 (kTopLeft_GrSurfaceOrigin == fOrigin) ? "_topleft" : "_botleft");
84 }
85
Chris Daltond7291ba2019-03-07 14:17:03 -070086 SkISize onISize() override { return SkISize::Make(200, 200); }
Robert Phillips95c250c2020-06-29 15:36:12 -040087 DrawResult onDraw(GrRecordingContext*, GrRenderTargetContext*,
88 SkCanvas*, SkString* errorMsg) override;
Chris Daltond7291ba2019-03-07 14:17:03 -070089
90 const GradType fGradType;
91 const GrSurfaceOrigin fOrigin;
92};
93
94////////////////////////////////////////////////////////////////////////////////////////////////////
95// SkSL code.
96
97class SampleLocationsTestProcessor : public GrGeometryProcessor {
98public:
Robert Phillipsfbfc3552019-11-18 11:50:54 -050099 static GrGeometryProcessor* Make(SkArenaAlloc* arena, GradType gradType) {
100 return arena->make<SampleLocationsTestProcessor>(gradType);
101 }
102
103 const char* name() const override { return "SampleLocationsTestProcessor"; }
104
105 void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const final {
106 b->add32((uint32_t)fGradType);
107 }
108
109 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const final;
110
111private:
112 friend class ::SkArenaAlloc; // for access to ctor
113
Chris Daltond7291ba2019-03-07 14:17:03 -0700114 SampleLocationsTestProcessor(GradType gradType)
115 : GrGeometryProcessor(kSampleLocationsTestProcessor_ClassID)
116 , fGradType(gradType) {
117 this->setWillUseCustomFeature(CustomFeatures::kSampleLocations);
118 }
Chris Daltond7291ba2019-03-07 14:17:03 -0700119
Chris Daltond7291ba2019-03-07 14:17:03 -0700120 const GradType fGradType;
121
122 class Impl;
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500123
John Stiles7571f9e2020-09-02 22:42:33 -0400124 using INHERITED = GrGeometryProcessor;
Chris Daltond7291ba2019-03-07 14:17:03 -0700125};
126
127class SampleLocationsTestProcessor::Impl : public GrGLSLGeometryProcessor {
128 void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
129 const auto& proc = args.fGP.cast<SampleLocationsTestProcessor>();
130 auto* v = args.fVertBuilder;
131 auto* f = args.fFragBuilder;
132
133 GrGLSLVarying coord(kFloat2_GrSLType);
134 GrGLSLVarying grad(kFloat2_GrSLType);
135 args.fVaryingHandler->addVarying("coord", &coord);
136 if (GradType::kSW == proc.fGradType) {
137 args.fVaryingHandler->addVarying("grad", &grad);
138 }
139
140 // Pixel grid.
141 v->codeAppendf("int x = sk_InstanceID %% 200;");
142 v->codeAppendf("int y = sk_InstanceID / 200;");
143
144 // Create pseudo-random rectangles inside a 16x16 subpixel grid. This works out nicely
145 // because there are 17 positions on the grid (including both edges), and 17 is a great
146 // prime number for generating pseudo-random numbers.
147 v->codeAppendf("int ileft = (sk_InstanceID*929) %% 17;");
148 v->codeAppendf("int iright = ileft + 1 + ((sk_InstanceID*1637) %% (17 - ileft));");
149 v->codeAppendf("int itop = (sk_InstanceID*313) %% 17;");
150 v->codeAppendf("int ibot = itop + 1 + ((sk_InstanceID*1901) %% (17 - itop));");
151
152 // Outset (or inset) the rectangle, for the very likely scenario that samples fall on exact
153 // 16ths of a pixel. GL_SUBPIXEL_BITS is allowed to be as low as 4, so try not to let the
154 // outset value to get too small.
155 v->codeAppendf("float outset = 1/32.0;");
156 v->codeAppendf("outset = (0 == (x + y) %% 2) ? -outset : +outset;");
157 v->codeAppendf("float l = ileft/16.0 - outset;");
158 v->codeAppendf("float r = iright/16.0 + outset;");
159 v->codeAppendf("float t = itop/16.0 - outset;");
160 v->codeAppendf("float b = ibot/16.0 + outset;");
161
162 v->codeAppendf("float2 vertexpos;");
163 v->codeAppendf("vertexpos.x = float(x) + ((0 == (sk_VertexID %% 2)) ? l : r);");
164 v->codeAppendf("vertexpos.y = float(y) + ((0 == (sk_VertexID / 2)) ? t : b);");
165 gpArgs->fPositionVar.set(kFloat2_GrSLType, "vertexpos");
166
167 v->codeAppendf("%s.x = (0 == (sk_VertexID %% 2)) ? -1 : +1;", coord.vsOut());
168 v->codeAppendf("%s.y = (0 == (sk_VertexID / 2)) ? -1 : +1;", coord.vsOut());
169 if (GradType::kSW == proc.fGradType) {
170 v->codeAppendf("%s = 2/float2(r - l, b - t);", grad.vsOut());
171 }
172
173 // Fragment shader: Output RED.
174 f->codeAppendf("%s = half4(1,0,0,1);", args.fOutputColor);
175 f->codeAppendf("%s = half4(1);", args.fOutputCoverage);
176
177 // Now turn off all the samples inside our sub-rectangle. As long as the shaderBuilder's
178 // sample offsets and sample mask are correlated with actual HW sample locations, no red
179 // will bleed through.
180 f->codeAppendf("for (int i = 0; i < %i; ++i) {",
181 f->getProgramBuilder()->effectiveSampleCnt());
182 if (GradType::kHW == proc.fGradType) {
183 f->codeAppendf("float2x2 grad = float2x2(dFdx(%s), dFdy(%s));",
184 coord.fsIn(), coord.fsIn());
185 } else {
186 f->codeAppendf("float2x2 grad = float2x2(%s.x, 0, 0, %s.y);", grad.fsIn(), grad.fsIn());
187 }
188 f->codeAppendf( "float2 samplecoord = %s[i] * grad + %s;",
189 f->sampleOffsets(), coord.fsIn());
190 f->codeAppendf( "if (all(lessThanEqual(abs(samplecoord), float2(1)))) {");
191 f->maskOffMultisampleCoverage(
Chris Dalton0dffbab2019-03-27 13:08:50 -0600192 "~(1 << i)", GrGLSLFPFragmentBuilder::ScopeFlags::kInsideLoop);
Chris Daltond7291ba2019-03-07 14:17:03 -0700193 f->codeAppendf( "}");
194 f->codeAppendf("}");
195 }
196
Brian Osman609f1592020-07-01 15:14:39 -0400197 void setData(const GrGLSLProgramDataManager&, const GrPrimitiveProcessor&) override {}
Chris Daltond7291ba2019-03-07 14:17:03 -0700198};
199
200GrGLSLPrimitiveProcessor* SampleLocationsTestProcessor::createGLSLInstance(
201 const GrShaderCaps&) const {
202 return new Impl();
203}
204
205////////////////////////////////////////////////////////////////////////////////////////////////////
206// Draw Op.
207
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500208static constexpr GrUserStencilSettings gStencilWrite(
209 GrUserStencilSettings::StaticInit<
210 0x0001,
211 GrUserStencilTest::kAlways,
212 0xffff,
213 GrUserStencilOp::kReplace,
214 GrUserStencilOp::kKeep,
215 0xffff>()
216);
217
Chris Daltond7291ba2019-03-07 14:17:03 -0700218class SampleLocationsTestOp : public GrDrawOp {
219public:
220 DEFINE_OP_CLASS_ID
221
222 static std::unique_ptr<GrDrawOp> Make(
223 GrRecordingContext* ctx, const SkMatrix& viewMatrix, GradType gradType) {
224 GrOpMemoryPool* pool = ctx->priv().opMemoryPool();
225 return pool->allocate<SampleLocationsTestOp>(gradType);
226 }
227
228private:
229 SampleLocationsTestOp(GradType gradType) : GrDrawOp(ClassID()), fGradType(gradType) {
Greg Daniel5faf4742019-10-01 15:14:44 -0400230 this->setBounds(SkRect::MakeIWH(200, 200), HasAABloat::kNo, IsHairline::kNo);
Chris Daltond7291ba2019-03-07 14:17:03 -0700231 }
232
233 const char* name() const override { return "SampleLocationsTestOp"; }
234 FixedFunctionFlags fixedFunctionFlags() const override {
235 return FixedFunctionFlags::kUsesHWAA | FixedFunctionFlags::kUsesStencil;
236 }
Chris Dalton6ce447a2019-06-23 18:07:38 -0600237 GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*,
238 bool hasMixedSampledCoverage, GrClampType) override {
Chris Daltond7291ba2019-03-07 14:17:03 -0700239 return GrProcessorSet::EmptySetAnalysis();
240 }
Chris Daltond7291ba2019-03-07 14:17:03 -0700241
Robert Phillipsac6156c2020-02-28 16:02:40 -0500242
243 GrProgramInfo* createProgramInfo(const GrCaps* caps,
244 SkArenaAlloc* arena,
Brian Salomon8afde5f2020-04-01 16:22:00 -0400245 const GrSurfaceProxyView* writeView,
Robert Phillipsac6156c2020-02-28 16:02:40 -0500246 GrAppliedClip&& appliedClip,
Greg Danield358cbe2020-09-11 09:33:54 -0400247 const GrXferProcessor::DstProxyView& dstProxyView,
248 GrXferBarrierFlags renderPassXferBarriers) const {
Robert Phillipsac6156c2020-02-28 16:02:40 -0500249 GrGeometryProcessor* geomProc = SampleLocationsTestProcessor::Make(arena, fGradType);
250
251 GrPipeline::InputFlags flags = GrPipeline::InputFlags::kHWAntialias;
252
Brian Salomon8afde5f2020-04-01 16:22:00 -0400253 return sk_gpu_test::CreateProgramInfo(caps, arena, writeView,
Robert Phillipsac6156c2020-02-28 16:02:40 -0500254 std::move(appliedClip), dstProxyView,
255 geomProc, SkBlendMode::kSrcOver,
256 GrPrimitiveType::kTriangleStrip,
Greg Danield358cbe2020-09-11 09:33:54 -0400257 renderPassXferBarriers,
Robert Phillipsac6156c2020-02-28 16:02:40 -0500258 flags, &gStencilWrite);
259 }
260
261 GrProgramInfo* createProgramInfo(GrOpFlushState* flushState) const {
262 return this->createProgramInfo(&flushState->caps(),
263 flushState->allocator(),
Brian Salomon8afde5f2020-04-01 16:22:00 -0400264 flushState->writeView(),
Robert Phillipsac6156c2020-02-28 16:02:40 -0500265 flushState->detachAppliedClip(),
Greg Danield358cbe2020-09-11 09:33:54 -0400266 flushState->dstProxyView(),
267 flushState->renderPassBarriers());
Robert Phillipsac6156c2020-02-28 16:02:40 -0500268 }
269
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500270 void onPrePrepare(GrRecordingContext* context,
Brian Salomon8afde5f2020-04-01 16:22:00 -0400271 const GrSurfaceProxyView* writeView,
Robert Phillips34cea002019-11-21 16:02:34 -0500272 GrAppliedClip* clip,
Greg Danield358cbe2020-09-11 09:33:54 -0400273 const GrXferProcessor::DstProxyView& dstProxyView,
274 GrXferBarrierFlags renderPassXferBarriers) final {
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500275 // We're going to create the GrProgramInfo (and the GrPipeline and geometry processor
276 // it relies on) in the DDL-record-time arena.
277 SkArenaAlloc* arena = context->priv().recordTimeAllocator();
Chris Daltonbaa1b352019-04-03 12:03:00 -0600278
Robert Phillips34cea002019-11-21 16:02:34 -0500279 // This is equivalent to a GrOpFlushState::detachAppliedClip
Michael Ludwigd1d997e2020-06-04 15:52:44 -0400280 GrAppliedClip appliedClip = clip ? std::move(*clip) : GrAppliedClip::Disabled();
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500281
Brian Salomon8afde5f2020-04-01 16:22:00 -0400282 fProgramInfo = this->createProgramInfo(context->priv().caps(), arena, writeView,
Greg Danield358cbe2020-09-11 09:33:54 -0400283 std::move(appliedClip), dstProxyView,
284 renderPassXferBarriers);
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500285
Robert Phillipsac6156c2020-02-28 16:02:40 -0500286 context->priv().recordProgramInfo(fProgramInfo);
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500287 }
288
289 void onPrepare(GrOpFlushState*) final {}
290
291 void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) final {
Robert Phillips34cea002019-11-21 16:02:34 -0500292 if (!fProgramInfo) {
Robert Phillipsac6156c2020-02-28 16:02:40 -0500293 fProgramInfo = this->createProgramInfo(flushState);
Robert Phillips34cea002019-11-21 16:02:34 -0500294 }
295
Chris Daltonaa0e45c2020-03-16 10:05:11 -0600296 flushState->bindPipelineAndScissorClip(*fProgramInfo, SkRect::MakeIWH(200, 200));
297 flushState->bindBuffers(nullptr, nullptr, nullptr);
298 flushState->drawInstanced(200*200, 0, 4, 0);
Chris Daltond7291ba2019-03-07 14:17:03 -0700299 }
300
301 const GradType fGradType;
302
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500303 // The program info (and both the GrPipeline and GrPrimitiveProcessor it relies on), when
Robert Phillips34cea002019-11-21 16:02:34 -0500304 // allocated, are allocated in either the ddl-record-time or flush-time arena. It is the
305 // arena's job to free up their memory so we just have a bare programInfo pointer here. We
306 // don't even store the GrPipeline and GrPrimitiveProcessor pointers here bc they are
307 // guaranteed to have the same lifetime as the program info.
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500308 GrProgramInfo* fProgramInfo = nullptr;
309
Chris Daltond7291ba2019-03-07 14:17:03 -0700310 friend class ::GrOpMemoryPool; // for ctor
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500311
John Stiles7571f9e2020-09-02 22:42:33 -0400312 using INHERITED = GrDrawOp;
Chris Daltond7291ba2019-03-07 14:17:03 -0700313};
314
315////////////////////////////////////////////////////////////////////////////////////////////////////
316// Test.
317
Robert Phillips95c250c2020-06-29 15:36:12 -0400318DrawResult SampleLocationsGM::onDraw(GrRecordingContext* ctx, GrRenderTargetContext* rtc,
319 SkCanvas* canvas, SkString* errorMsg) {
Chris Daltond7291ba2019-03-07 14:17:03 -0700320 if (!ctx->priv().caps()->sampleLocationsSupport()) {
321 *errorMsg = "Requires support for sample locations.";
322 return DrawResult::kSkip;
323 }
Chris Dalton8a64a442019-10-29 18:54:58 -0600324 if (!ctx->priv().caps()->shaderCaps()->sampleMaskSupport()) {
325 *errorMsg = "Requires support for sample mask.";
Chris Daltond7291ba2019-03-07 14:17:03 -0700326 return DrawResult::kSkip;
327 }
Chris Dalton03fdf6a2020-04-07 12:31:59 -0600328 if (!ctx->priv().caps()->drawInstancedSupport()) {
329 *errorMsg = "Requires support for instanced rendering.";
330 return DrawResult::kSkip;
331 }
Chris Daltoneffee202019-07-01 22:28:03 -0600332 if (rtc->numSamples() <= 1 && !ctx->priv().caps()->mixedSamplesSupport()) {
333 *errorMsg = "MSAA and mixed samples only.";
334 return DrawResult::kSkip;
335 }
336
Greg Daniele20fcad2020-01-08 11:52:34 -0500337 auto offscreenRTC = GrRenderTargetContext::Make(
338 ctx, rtc->colorInfo().colorType(), nullptr, SkBackingFit::kExact, {200, 200},
Brian Salomon7e67dca2020-07-21 09:27:25 -0400339 rtc->numSamples(), GrMipmapped::kNo, GrProtected::kNo, fOrigin);
Chris Daltoneffee202019-07-01 22:28:03 -0600340 if (!offscreenRTC) {
341 *errorMsg = "Failed to create offscreen render target.";
342 return DrawResult::kFail;
343 }
344 if (offscreenRTC->numSamples() <= 1 &&
Greg Daniel46e366a2019-12-16 14:38:36 -0500345 !offscreenRTC->asRenderTargetProxy()->canUseMixedSamples(*ctx->priv().caps())) {
Chris Daltoneffee202019-07-01 22:28:03 -0600346 *errorMsg = "MSAA and mixed samples only.";
347 return DrawResult::kSkip;
348 }
Chris Daltond7291ba2019-03-07 14:17:03 -0700349
350 static constexpr GrUserStencilSettings kStencilCover(
351 GrUserStencilSettings::StaticInit<
352 0x0000,
353 GrUserStencilTest::kNotEqual,
354 0xffff,
355 GrUserStencilOp::kZero,
356 GrUserStencilOp::kKeep,
357 0xffff>()
358 );
359
Michael Ludwig81d41722020-05-26 16:57:38 -0400360 offscreenRTC->clear({0,1,0,1});
Chris Daltond7291ba2019-03-07 14:17:03 -0700361
Chris Daltoneffee202019-07-01 22:28:03 -0600362 // Stencil.
363 offscreenRTC->priv().testingOnly_addDrawOp(
364 SampleLocationsTestOp::Make(ctx, canvas->getTotalMatrix(), fGradType));
Chris Dalton6ce447a2019-06-23 18:07:38 -0600365
Chris Daltoneffee202019-07-01 22:28:03 -0600366 // Cover.
367 GrPaint coverPaint;
368 coverPaint.setColor4f({1,0,0,1});
369 coverPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver));
Michael Ludwig7c12e282020-05-29 09:54:07 -0400370 rtc->priv().stencilRect(nullptr, &kStencilCover, std::move(coverPaint), GrAA::kNo,
Chris Daltoneffee202019-07-01 22:28:03 -0600371 SkMatrix::I(), SkRect::MakeWH(200, 200));
Chris Daltond7291ba2019-03-07 14:17:03 -0700372
Chris Daltoneffee202019-07-01 22:28:03 -0600373 // Copy offscreen texture to canvas.
Brian Salomone69b9ef2020-07-22 11:18:06 -0400374 rtc->drawTexture(nullptr,
375 offscreenRTC->readSurfaceView(),
Greg Daniel40903af2020-01-30 14:55:05 -0500376 offscreenRTC->colorInfo().alphaType(),
Brian Salomone69b9ef2020-07-22 11:18:06 -0400377 GrSamplerState::Filter::kNearest,
378 GrSamplerState::MipmapMode::kNone,
379 SkBlendMode::kSrc,
380 SK_PMColor4fWHITE,
381 {0, 0, 200, 200},
382 {0, 0, 200, 200},
383 GrAA::kNo,
384 GrQuadAAFlags::kNone,
385 SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint,
386 SkMatrix::I(),
Brian Salomonfc118442019-11-22 19:09:27 -0500387 nullptr);
Chris Daltond7291ba2019-03-07 14:17:03 -0700388
389 return skiagm::DrawResult::kOk;
390}
391
392DEF_GM( return new SampleLocationsGM(GradType::kHW, kTopLeft_GrSurfaceOrigin); )
393DEF_GM( return new SampleLocationsGM(GradType::kHW, kBottomLeft_GrSurfaceOrigin); )
394DEF_GM( return new SampleLocationsGM(GradType::kSW, kTopLeft_GrSurfaceOrigin); )
395DEF_GM( return new SampleLocationsGM(GradType::kSW, kBottomLeft_GrSurfaceOrigin); )
396
John Stilesa6841be2020-08-06 14:11:56 -0400397} // namespace skiagm