blob: 1eb76c052cab20e0ae7d0b72783ce181bba35e44 [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
Herb Derbyc76d4092020-10-07 16:46:15 -0400222 static GrOp::Owner Make(
Chris Daltond7291ba2019-03-07 14:17:03 -0700223 GrRecordingContext* ctx, const SkMatrix& viewMatrix, GradType gradType) {
Herb Derbyc76d4092020-10-07 16:46:15 -0400224 return GrOp::Make<SampleLocationsTestOp>(ctx, gradType);
Chris Daltond7291ba2019-03-07 14:17:03 -0700225 }
226
227private:
228 SampleLocationsTestOp(GradType gradType) : GrDrawOp(ClassID()), fGradType(gradType) {
Greg Daniel5faf4742019-10-01 15:14:44 -0400229 this->setBounds(SkRect::MakeIWH(200, 200), HasAABloat::kNo, IsHairline::kNo);
Chris Daltond7291ba2019-03-07 14:17:03 -0700230 }
231
232 const char* name() const override { return "SampleLocationsTestOp"; }
233 FixedFunctionFlags fixedFunctionFlags() const override {
234 return FixedFunctionFlags::kUsesHWAA | FixedFunctionFlags::kUsesStencil;
235 }
Chris Dalton6ce447a2019-06-23 18:07:38 -0600236 GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*,
237 bool hasMixedSampledCoverage, GrClampType) override {
Chris Daltond7291ba2019-03-07 14:17:03 -0700238 return GrProcessorSet::EmptySetAnalysis();
239 }
Chris Daltond7291ba2019-03-07 14:17:03 -0700240
Robert Phillipsac6156c2020-02-28 16:02:40 -0500241
242 GrProgramInfo* createProgramInfo(const GrCaps* caps,
243 SkArenaAlloc* arena,
Adlai Hollere2296f72020-11-19 13:41:26 -0500244 const GrSurfaceProxyView& writeView,
Robert Phillipsac6156c2020-02-28 16:02:40 -0500245 GrAppliedClip&& appliedClip,
Greg Danield358cbe2020-09-11 09:33:54 -0400246 const GrXferProcessor::DstProxyView& dstProxyView,
247 GrXferBarrierFlags renderPassXferBarriers) const {
Robert Phillipsac6156c2020-02-28 16:02:40 -0500248 GrGeometryProcessor* geomProc = SampleLocationsTestProcessor::Make(arena, fGradType);
249
250 GrPipeline::InputFlags flags = GrPipeline::InputFlags::kHWAntialias;
251
Brian Salomon8afde5f2020-04-01 16:22:00 -0400252 return sk_gpu_test::CreateProgramInfo(caps, arena, writeView,
Robert Phillipsac6156c2020-02-28 16:02:40 -0500253 std::move(appliedClip), dstProxyView,
254 geomProc, SkBlendMode::kSrcOver,
255 GrPrimitiveType::kTriangleStrip,
Greg Danield358cbe2020-09-11 09:33:54 -0400256 renderPassXferBarriers,
Robert Phillipsac6156c2020-02-28 16:02:40 -0500257 flags, &gStencilWrite);
258 }
259
260 GrProgramInfo* createProgramInfo(GrOpFlushState* flushState) const {
261 return this->createProgramInfo(&flushState->caps(),
262 flushState->allocator(),
Brian Salomon8afde5f2020-04-01 16:22:00 -0400263 flushState->writeView(),
Robert Phillipsac6156c2020-02-28 16:02:40 -0500264 flushState->detachAppliedClip(),
Greg Danield358cbe2020-09-11 09:33:54 -0400265 flushState->dstProxyView(),
266 flushState->renderPassBarriers());
Robert Phillipsac6156c2020-02-28 16:02:40 -0500267 }
268
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500269 void onPrePrepare(GrRecordingContext* context,
Adlai Hollere2296f72020-11-19 13:41:26 -0500270 const GrSurfaceProxyView& writeView,
Robert Phillips34cea002019-11-21 16:02:34 -0500271 GrAppliedClip* clip,
Greg Danield358cbe2020-09-11 09:33:54 -0400272 const GrXferProcessor::DstProxyView& dstProxyView,
273 GrXferBarrierFlags renderPassXferBarriers) final {
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500274 // We're going to create the GrProgramInfo (and the GrPipeline and geometry processor
275 // it relies on) in the DDL-record-time arena.
276 SkArenaAlloc* arena = context->priv().recordTimeAllocator();
Chris Daltonbaa1b352019-04-03 12:03:00 -0600277
Robert Phillips34cea002019-11-21 16:02:34 -0500278 // This is equivalent to a GrOpFlushState::detachAppliedClip
Michael Ludwigd1d997e2020-06-04 15:52:44 -0400279 GrAppliedClip appliedClip = clip ? std::move(*clip) : GrAppliedClip::Disabled();
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500280
Brian Salomon8afde5f2020-04-01 16:22:00 -0400281 fProgramInfo = this->createProgramInfo(context->priv().caps(), arena, writeView,
Greg Danield358cbe2020-09-11 09:33:54 -0400282 std::move(appliedClip), dstProxyView,
283 renderPassXferBarriers);
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500284
Robert Phillipsac6156c2020-02-28 16:02:40 -0500285 context->priv().recordProgramInfo(fProgramInfo);
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500286 }
287
288 void onPrepare(GrOpFlushState*) final {}
289
290 void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) final {
Robert Phillips34cea002019-11-21 16:02:34 -0500291 if (!fProgramInfo) {
Robert Phillipsac6156c2020-02-28 16:02:40 -0500292 fProgramInfo = this->createProgramInfo(flushState);
Robert Phillips34cea002019-11-21 16:02:34 -0500293 }
294
Chris Daltonaa0e45c2020-03-16 10:05:11 -0600295 flushState->bindPipelineAndScissorClip(*fProgramInfo, SkRect::MakeIWH(200, 200));
296 flushState->bindBuffers(nullptr, nullptr, nullptr);
297 flushState->drawInstanced(200*200, 0, 4, 0);
Chris Daltond7291ba2019-03-07 14:17:03 -0700298 }
299
300 const GradType fGradType;
301
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500302 // The program info (and both the GrPipeline and GrPrimitiveProcessor it relies on), when
Robert Phillips34cea002019-11-21 16:02:34 -0500303 // allocated, are allocated in either the ddl-record-time or flush-time arena. It is the
304 // arena's job to free up their memory so we just have a bare programInfo pointer here. We
305 // don't even store the GrPipeline and GrPrimitiveProcessor pointers here bc they are
306 // guaranteed to have the same lifetime as the program info.
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500307 GrProgramInfo* fProgramInfo = nullptr;
308
Herb Derbyc76d4092020-10-07 16:46:15 -0400309 friend class ::GrOp; // for ctor
Robert Phillipsfbfc3552019-11-18 11:50:54 -0500310
John Stiles7571f9e2020-09-02 22:42:33 -0400311 using INHERITED = GrDrawOp;
Chris Daltond7291ba2019-03-07 14:17:03 -0700312};
313
314////////////////////////////////////////////////////////////////////////////////////////////////////
315// Test.
316
Robert Phillips95c250c2020-06-29 15:36:12 -0400317DrawResult SampleLocationsGM::onDraw(GrRecordingContext* ctx, GrRenderTargetContext* rtc,
318 SkCanvas* canvas, SkString* errorMsg) {
Chris Daltond7291ba2019-03-07 14:17:03 -0700319 if (!ctx->priv().caps()->sampleLocationsSupport()) {
320 *errorMsg = "Requires support for sample locations.";
321 return DrawResult::kSkip;
322 }
Chris Dalton8a64a442019-10-29 18:54:58 -0600323 if (!ctx->priv().caps()->shaderCaps()->sampleMaskSupport()) {
324 *errorMsg = "Requires support for sample mask.";
Chris Daltond7291ba2019-03-07 14:17:03 -0700325 return DrawResult::kSkip;
326 }
Chris Dalton03fdf6a2020-04-07 12:31:59 -0600327 if (!ctx->priv().caps()->drawInstancedSupport()) {
328 *errorMsg = "Requires support for instanced rendering.";
329 return DrawResult::kSkip;
330 }
Chris Daltoneffee202019-07-01 22:28:03 -0600331 if (rtc->numSamples() <= 1 && !ctx->priv().caps()->mixedSamplesSupport()) {
332 *errorMsg = "MSAA and mixed samples only.";
333 return DrawResult::kSkip;
334 }
335
Greg Daniele20fcad2020-01-08 11:52:34 -0500336 auto offscreenRTC = GrRenderTargetContext::Make(
337 ctx, rtc->colorInfo().colorType(), nullptr, SkBackingFit::kExact, {200, 200},
Brian Salomon7e67dca2020-07-21 09:27:25 -0400338 rtc->numSamples(), GrMipmapped::kNo, GrProtected::kNo, fOrigin);
Chris Daltoneffee202019-07-01 22:28:03 -0600339 if (!offscreenRTC) {
340 *errorMsg = "Failed to create offscreen render target.";
341 return DrawResult::kFail;
342 }
343 if (offscreenRTC->numSamples() <= 1 &&
Greg Daniel46e366a2019-12-16 14:38:36 -0500344 !offscreenRTC->asRenderTargetProxy()->canUseMixedSamples(*ctx->priv().caps())) {
Chris Daltoneffee202019-07-01 22:28:03 -0600345 *errorMsg = "MSAA and mixed samples only.";
346 return DrawResult::kSkip;
347 }
Chris Daltond7291ba2019-03-07 14:17:03 -0700348
349 static constexpr GrUserStencilSettings kStencilCover(
350 GrUserStencilSettings::StaticInit<
351 0x0000,
352 GrUserStencilTest::kNotEqual,
353 0xffff,
354 GrUserStencilOp::kZero,
355 GrUserStencilOp::kKeep,
356 0xffff>()
357 );
358
Michael Ludwig81d41722020-05-26 16:57:38 -0400359 offscreenRTC->clear({0,1,0,1});
Chris Daltond7291ba2019-03-07 14:17:03 -0700360
Chris Daltoneffee202019-07-01 22:28:03 -0600361 // Stencil.
362 offscreenRTC->priv().testingOnly_addDrawOp(
363 SampleLocationsTestOp::Make(ctx, canvas->getTotalMatrix(), fGradType));
Chris Dalton6ce447a2019-06-23 18:07:38 -0600364
Chris Daltoneffee202019-07-01 22:28:03 -0600365 // Cover.
366 GrPaint coverPaint;
367 coverPaint.setColor4f({1,0,0,1});
368 coverPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver));
Michael Ludwig7c12e282020-05-29 09:54:07 -0400369 rtc->priv().stencilRect(nullptr, &kStencilCover, std::move(coverPaint), GrAA::kNo,
Chris Daltoneffee202019-07-01 22:28:03 -0600370 SkMatrix::I(), SkRect::MakeWH(200, 200));
Chris Daltond7291ba2019-03-07 14:17:03 -0700371
Chris Daltoneffee202019-07-01 22:28:03 -0600372 // Copy offscreen texture to canvas.
Brian Salomone69b9ef2020-07-22 11:18:06 -0400373 rtc->drawTexture(nullptr,
374 offscreenRTC->readSurfaceView(),
Greg Daniel40903af2020-01-30 14:55:05 -0500375 offscreenRTC->colorInfo().alphaType(),
Brian Salomone69b9ef2020-07-22 11:18:06 -0400376 GrSamplerState::Filter::kNearest,
377 GrSamplerState::MipmapMode::kNone,
378 SkBlendMode::kSrc,
379 SK_PMColor4fWHITE,
380 {0, 0, 200, 200},
381 {0, 0, 200, 200},
382 GrAA::kNo,
383 GrQuadAAFlags::kNone,
384 SkCanvas::SrcRectConstraint::kStrict_SrcRectConstraint,
385 SkMatrix::I(),
Brian Salomonfc118442019-11-22 19:09:27 -0500386 nullptr);
Chris Daltond7291ba2019-03-07 14:17:03 -0700387
388 return skiagm::DrawResult::kOk;
389}
390
391DEF_GM( return new SampleLocationsGM(GradType::kHW, kTopLeft_GrSurfaceOrigin); )
392DEF_GM( return new SampleLocationsGM(GradType::kHW, kBottomLeft_GrSurfaceOrigin); )
393DEF_GM( return new SampleLocationsGM(GradType::kSW, kTopLeft_GrSurfaceOrigin); )
394DEF_GM( return new SampleLocationsGM(GradType::kSW, kBottomLeft_GrSurfaceOrigin); )
395
John Stilesa6841be2020-08-06 14:11:56 -0400396} // namespace skiagm