blob: 00e8e82c8eba4dad51b0cbe46596ff427cc0329f [file] [log] [blame]
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +00001/*
2 * Copyright 2012 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
8#include "GrTextureDomain.h"
egdaniel605dd0f2014-11-12 08:35:25 -08009#include "GrInvariantOutput.h"
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000010#include "GrSimpleTextureEffect.h"
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000011#include "SkFloatingPoint.h"
egdaniel64c47282015-11-13 06:54:19 -080012#include "glsl/GrGLSLFragmentProcessor.h"
egdaniel7ea439b2015-12-03 09:20:44 -080013#include "glsl/GrGLSLFragmentShaderBuilder.h"
egdaniel018fb622015-10-28 07:26:40 -070014#include "glsl/GrGLSLProgramDataManager.h"
egdaniel7ea439b2015-12-03 09:20:44 -080015#include "glsl/GrGLSLShaderBuilder.h"
egdaniel7dc4bd02015-10-29 07:57:01 -070016#include "glsl/GrGLSLTextureSampler.h"
egdaniel7ea439b2015-12-03 09:20:44 -080017#include "glsl/GrGLSLUniformHandler.h"
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000018
19GrTextureDomain::GrTextureDomain(const SkRect& domain, Mode mode, int index)
20 : fIndex(index) {
21
22 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1};
commit-bot@chromium.org26632632014-03-25 15:13:18 +000023 if (domain.contains(kFullRect) && kClamp_Mode == mode) {
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000024 fMode = kIgnore_Mode;
25 } else {
26 fMode = mode;
27 }
28
29 if (fMode != kIgnore_Mode) {
30 // We don't currently handle domains that are empty or don't intersect the texture.
31 // It is OK if the domain rect is a line or point, but it should not be inverted. We do not
32 // handle rects that do not intersect the [0..1]x[0..1] rect.
33 SkASSERT(domain.fLeft <= domain.fRight);
34 SkASSERT(domain.fTop <= domain.fBottom);
senorblancod0d37ca2015-04-02 04:54:56 -070035 fDomain.fLeft = SkScalarPin(domain.fLeft, kFullRect.fLeft, kFullRect.fRight);
36 fDomain.fRight = SkScalarPin(domain.fRight, kFullRect.fLeft, kFullRect.fRight);
37 fDomain.fTop = SkScalarPin(domain.fTop, kFullRect.fTop, kFullRect.fBottom);
38 fDomain.fBottom = SkScalarPin(domain.fBottom, kFullRect.fTop, kFullRect.fBottom);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000039 SkASSERT(fDomain.fLeft <= fDomain.fRight);
40 SkASSERT(fDomain.fTop <= fDomain.fBottom);
41 }
42}
43
44//////////////////////////////////////////////////////////////////////////////
45
egdaniel2d721d32015-11-11 13:06:05 -080046void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
egdaniel7ea439b2015-12-03 09:20:44 -080047 GrGLSLUniformHandler* uniformHandler,
egdaniela2e3e0f2015-11-19 07:23:45 -080048 const GrGLSLCaps* glslCaps,
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000049 const GrTextureDomain& textureDomain,
50 const char* outColor,
51 const SkString& inCoords,
egdaniel7dc4bd02015-10-29 07:57:01 -070052 const GrGLSLTextureSampler& sampler,
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000053 const char* inModulateColor) {
reed@google.comd7b1af62013-12-09 20:31:50 +000054 SkASSERT((Mode)-1 == fMode || textureDomain.mode() == fMode);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000055 SkDEBUGCODE(fMode = textureDomain.mode();)
56
joshualitt5ae5fc52014-07-29 12:59:27 -070057 if (textureDomain.mode() != kIgnore_Mode && !fDomainUni.isValid()) {
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000058 const char* name;
59 SkString uniName("TexDom");
60 if (textureDomain.fIndex >= 0) {
61 uniName.appendS32(textureDomain.fIndex);
62 }
egdaniel7ea439b2015-12-03 09:20:44 -080063 fDomainUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_Visibility,
64 kVec4f_GrSLType, kDefault_GrSLPrecision,
65 uniName.c_str(), &name);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000066 fDomainName = name;
67 }
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000068
joshualitt5ae5fc52014-07-29 12:59:27 -070069 switch (textureDomain.mode()) {
70 case kIgnore_Mode: {
jvanverth3fc65602015-07-22 08:41:51 -070071 builder->codeAppendf("%s = ", outColor);
joshualitt30ba4362014-08-21 20:18:45 -070072 builder->appendTextureLookupAndModulate(inModulateColor, sampler,
joshualitt5ae5fc52014-07-29 12:59:27 -070073 inCoords.c_str());
jvanverth3fc65602015-07-22 08:41:51 -070074 builder->codeAppend(";");
joshualitt5ae5fc52014-07-29 12:59:27 -070075 break;
76 }
77 case kClamp_Mode: {
78 SkString clampedCoords;
jvanverth3fc65602015-07-22 08:41:51 -070079 clampedCoords.appendf("clamp(%s, %s.xy, %s.zw)",
joshualitt5ae5fc52014-07-29 12:59:27 -070080 inCoords.c_str(), fDomainName.c_str(), fDomainName.c_str());
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +000081
jvanverth3fc65602015-07-22 08:41:51 -070082 builder->codeAppendf("%s = ", outColor);
joshualitt30ba4362014-08-21 20:18:45 -070083 builder->appendTextureLookupAndModulate(inModulateColor, sampler,
joshualitt5ae5fc52014-07-29 12:59:27 -070084 clampedCoords.c_str());
jvanverth3fc65602015-07-22 08:41:51 -070085 builder->codeAppend(";");
joshualitt5ae5fc52014-07-29 12:59:27 -070086 break;
87 }
88 case kDecal_Mode: {
89 // Add a block since we're going to declare variables.
egdaniel2d721d32015-11-11 13:06:05 -080090 GrGLSLShaderBuilder::ShaderBlock block(builder);
joshualitt5ae5fc52014-07-29 12:59:27 -070091
92 const char* domain = fDomainName.c_str();
egdaniela2e3e0f2015-11-19 07:23:45 -080093 if (!glslCaps->canUseAnyFunctionInShader()) {
joshualitt5ae5fc52014-07-29 12:59:27 -070094 // On the NexusS and GalaxyNexus, the other path (with the 'any'
95 // call) causes the compilation error "Calls to any function that
96 // may require a gradient calculation inside a conditional block
97 // may return undefined results". This appears to be an issue with
98 // the 'any' call since even the simple "result=black; if (any())
99 // result=white;" code fails to compile.
jvanverth3fc65602015-07-22 08:41:51 -0700100 builder->codeAppend("vec4 outside = vec4(0.0, 0.0, 0.0, 0.0);");
101 builder->codeAppend("vec4 inside = ");
joshualitt30ba4362014-08-21 20:18:45 -0700102 builder->appendTextureLookupAndModulate(inModulateColor, sampler,
joshualitt5ae5fc52014-07-29 12:59:27 -0700103 inCoords.c_str());
jvanverth3fc65602015-07-22 08:41:51 -0700104 builder->codeAppend(";");
105
egdaniela2e3e0f2015-11-19 07:23:45 -0800106 builder->codeAppend(GrGLSLShaderVar::PrecisionString(glslCaps,
egdaniel0d3f0612015-10-21 10:45:48 -0700107 kHigh_GrSLPrecision));
jvanverth3fc65602015-07-22 08:41:51 -0700108 builder->codeAppendf("float x = (%s).x;", inCoords.c_str());
egdaniela2e3e0f2015-11-19 07:23:45 -0800109 builder->codeAppend(GrGLSLShaderVar::PrecisionString(glslCaps,
egdaniel0d3f0612015-10-21 10:45:48 -0700110 kHigh_GrSLPrecision));
jvanverth3fc65602015-07-22 08:41:51 -0700111 builder->codeAppendf("float y = (%s).y;", inCoords.c_str());
joshualitt5ae5fc52014-07-29 12:59:27 -0700112
jvanverth3fc65602015-07-22 08:41:51 -0700113 builder->codeAppendf("x = abs(2.0*(x - %s.x)/(%s.z - %s.x) - 1.0);",
114 domain, domain, domain);
115 builder->codeAppendf("y = abs(2.0*(y - %s.y)/(%s.w - %s.y) - 1.0);",
116 domain, domain, domain);
117 builder->codeAppend("float blend = step(1.0, max(x, y));");
118 builder->codeAppendf("%s = mix(inside, outside, blend);", outColor);
joshualitt5ae5fc52014-07-29 12:59:27 -0700119 } else {
jvanverth3fc65602015-07-22 08:41:51 -0700120 builder->codeAppend("bvec4 outside;\n");
121 builder->codeAppendf("outside.xy = lessThan(%s, %s.xy);", inCoords.c_str(),
joshualitt5ae5fc52014-07-29 12:59:27 -0700122 domain);
jvanverth3fc65602015-07-22 08:41:51 -0700123 builder->codeAppendf("outside.zw = greaterThan(%s, %s.zw);", inCoords.c_str(),
joshualitt5ae5fc52014-07-29 12:59:27 -0700124 domain);
jvanverth3fc65602015-07-22 08:41:51 -0700125 builder->codeAppendf("%s = any(outside) ? vec4(0.0, 0.0, 0.0, 0.0) : ",
joshualitt5ae5fc52014-07-29 12:59:27 -0700126 outColor);
joshualitt30ba4362014-08-21 20:18:45 -0700127 builder->appendTextureLookupAndModulate(inModulateColor, sampler,
joshualitt5ae5fc52014-07-29 12:59:27 -0700128 inCoords.c_str());
jvanverth3fc65602015-07-22 08:41:51 -0700129 builder->codeAppend(";");
joshualitt5ae5fc52014-07-29 12:59:27 -0700130 }
131 break;
132 }
133 case kRepeat_Mode: {
134 SkString clampedCoords;
jvanverth3fc65602015-07-22 08:41:51 -0700135 clampedCoords.printf("mod(%s - %s.xy, %s.zw - %s.xy) + %s.xy",
joshualitt5ae5fc52014-07-29 12:59:27 -0700136 inCoords.c_str(), fDomainName.c_str(), fDomainName.c_str(),
137 fDomainName.c_str(), fDomainName.c_str());
138
jvanverth3fc65602015-07-22 08:41:51 -0700139 builder->codeAppendf("%s = ", outColor);
joshualitt30ba4362014-08-21 20:18:45 -0700140 builder->appendTextureLookupAndModulate(inModulateColor, sampler,
joshualitt5ae5fc52014-07-29 12:59:27 -0700141 clampedCoords.c_str());
jvanverth3fc65602015-07-22 08:41:51 -0700142 builder->codeAppend(";");
joshualitt5ae5fc52014-07-29 12:59:27 -0700143 break;
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000144 }
145 }
146}
147
egdaniel018fb622015-10-28 07:26:40 -0700148void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000149 const GrTextureDomain& textureDomain,
150 GrSurfaceOrigin textureOrigin) {
151 SkASSERT(textureDomain.mode() == fMode);
152 if (kIgnore_Mode != textureDomain.mode()) {
egdaniel018fb622015-10-28 07:26:40 -0700153 float values[kPrevDomainCount] = {
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000154 SkScalarToFloat(textureDomain.domain().left()),
155 SkScalarToFloat(textureDomain.domain().top()),
156 SkScalarToFloat(textureDomain.domain().right()),
157 SkScalarToFloat(textureDomain.domain().bottom())
158 };
159 // vertical flip if necessary
160 if (kBottomLeft_GrSurfaceOrigin == textureOrigin) {
161 values[1] = 1.0f - values[1];
162 values[3] = 1.0f - values[3];
163 // The top and bottom were just flipped, so correct the ordering
164 // of elements so that values = (l, t, r, b).
165 SkTSwap(values[1], values[3]);
166 }
egdaniel018fb622015-10-28 07:26:40 -0700167 if (0 != memcmp(values, fPrevDomain, kPrevDomainCount * sizeof(float))) {
kkinnunen7510b222014-07-30 00:04:16 -0700168 pdman.set4fv(fDomainUni, 1, values);
egdaniel018fb622015-10-28 07:26:40 -0700169 memcpy(fPrevDomain, values, kPrevDomainCount * sizeof(float));
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000170 }
171 }
172}
173
174
175//////////////////////////////////////////////////////////////////////////////
176
egdaniel64c47282015-11-13 06:54:19 -0800177class GrGLTextureDomainEffect : public GrGLSLFragmentProcessor {
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000178public:
joshualitteb2a6762014-12-04 11:35:33 -0800179 GrGLTextureDomainEffect(const GrProcessor&);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000180
wangyix7c157a92015-07-22 15:08:53 -0700181 virtual void emitCode(EmitArgs&) override;
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000182
jvanverthcfc18862015-04-28 08:48:20 -0700183 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000184
wangyixb1daa862015-08-18 11:29:31 -0700185protected:
egdaniel018fb622015-10-28 07:26:40 -0700186 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override;
wangyixb1daa862015-08-18 11:29:31 -0700187
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000188private:
189 GrTextureDomain::GLDomain fGLDomain;
egdaniel64c47282015-11-13 06:54:19 -0800190 typedef GrGLSLFragmentProcessor INHERITED;
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000191};
192
joshualitteb2a6762014-12-04 11:35:33 -0800193GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) {
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000194}
195
wangyix7c157a92015-07-22 15:08:53 -0700196void GrGLTextureDomainEffect::emitCode(EmitArgs& args) {
197 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDomainEffect>();
joshualitt49586be2014-09-16 08:21:41 -0700198 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000199
egdaniel4ca2e602015-11-18 08:01:26 -0800200 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
201 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
egdaniela2e3e0f2015-11-19 07:23:45 -0800202 fGLDomain.sampleTexture(fragBuilder,
egdaniel7ea439b2015-12-03 09:20:44 -0800203 args.fUniformHandler,
egdaniela2e3e0f2015-11-19 07:23:45 -0800204 args.fGLSLCaps,
205 domain,
206 args.fOutputColor,
207 coords2D,
208 args.fSamplers[0],
wangyix7c157a92015-07-22 15:08:53 -0700209 args.fInputColor);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000210}
211
egdaniel018fb622015-10-28 07:26:40 -0700212void GrGLTextureDomainEffect::onSetData(const GrGLSLProgramDataManager& pdman,
213 const GrProcessor& processor) {
joshualittb0a8a372014-09-23 09:50:21 -0700214 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureDomainEffect>();
joshualitt49586be2014-09-16 08:21:41 -0700215 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
joshualittb0a8a372014-09-23 09:50:21 -0700216 fGLDomain.setData(pdman, domain, processor.texture(0)->origin());
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000217}
218
jvanverthcfc18862015-04-28 08:48:20 -0700219void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLCaps&,
joshualittb0a8a372014-09-23 09:50:21 -0700220 GrProcessorKeyBuilder* b) {
221 const GrTextureDomain& domain = processor.cast<GrTextureDomainEffect>().textureDomain();
bsalomon63e99f72014-07-21 08:03:14 -0700222 b->add32(GrTextureDomain::GLDomain::DomainKey(domain));
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000223}
224
225
226///////////////////////////////////////////////////////////////////////////////
227
bsalomon0ba8c242015-10-07 09:20:28 -0700228const GrFragmentProcessor* GrTextureDomainEffect::Create(GrTexture* texture,
229 const SkMatrix& matrix,
230 const SkRect& domain,
231 GrTextureDomain::Mode mode,
232 GrTextureParams::FilterMode filterMode,
233 GrCoordSet coordSet) {
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000234 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1};
235 if (GrTextureDomain::kIgnore_Mode == mode ||
236 (GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) {
bsalomon4a339522015-10-06 08:40:50 -0700237 return GrSimpleTextureEffect::Create(texture, matrix, filterMode);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000238 } else {
bsalomon4a339522015-10-06 08:40:50 -0700239 return new GrTextureDomainEffect(texture, matrix, domain, mode, filterMode, coordSet);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000240 }
241}
242
bsalomon4a339522015-10-06 08:40:50 -0700243GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture,
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000244 const SkMatrix& matrix,
245 const SkRect& domain,
246 GrTextureDomain::Mode mode,
247 GrTextureParams::FilterMode filterMode,
248 GrCoordSet coordSet)
bsalomon4a339522015-10-06 08:40:50 -0700249 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet)
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000250 , fTextureDomain(domain, mode) {
joshualitt5ae5fc52014-07-29 12:59:27 -0700251 SkASSERT(mode != GrTextureDomain::kRepeat_Mode ||
252 filterMode == GrTextureParams::kNone_FilterMode);
joshualitteb2a6762014-12-04 11:35:33 -0800253 this->initClassID<GrTextureDomainEffect>();
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000254}
255
bsalomon0ba8c242015-10-07 09:20:28 -0700256GrTextureDomainEffect::~GrTextureDomainEffect() {}
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000257
egdaniel57d3b032015-11-13 11:57:27 -0800258void GrTextureDomainEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps,
259 GrProcessorKeyBuilder* b) const {
joshualitteb2a6762014-12-04 11:35:33 -0800260 GrGLTextureDomainEffect::GenKey(*this, caps, b);
261}
262
egdaniel57d3b032015-11-13 11:57:27 -0800263GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLSLInstance() const {
halcanary385fe4d2015-08-26 13:07:48 -0700264 return new GrGLTextureDomainEffect(*this);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000265}
266
bsalomon0e08fc12014-10-15 08:19:04 -0700267bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
joshualitt49586be2014-09-16 08:21:41 -0700268 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>();
bsalomon420d7e92014-10-16 09:18:09 -0700269 return this->fTextureDomain == s.fTextureDomain;
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000270}
271
egdaniel605dd0f2014-11-12 08:35:25 -0800272void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000273 if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper
egdanielf8449ba2014-11-25 10:24:56 -0800274 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
joshualitt56995b52014-12-11 15:44:02 -0800275 inout->mulByUnknownSingleComponent();
egdanielf8449ba2014-11-25 10:24:56 -0800276 } else {
joshualitt56995b52014-12-11 15:44:02 -0800277 inout->mulByUnknownFourComponents();
egdanielf8449ba2014-11-25 10:24:56 -0800278 }
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000279 } else {
egdaniel1a8ecdf2014-10-03 06:24:12 -0700280 this->updateInvariantOutputForModulation(inout);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000281 }
282}
283
284///////////////////////////////////////////////////////////////////////////////
285
joshualittb0a8a372014-09-23 09:50:21 -0700286GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000287
bsalomonc21b09e2015-08-28 18:46:56 -0700288const GrFragmentProcessor* GrTextureDomainEffect::TestCreate(GrProcessorTestData* d) {
joshualitt0067ff52015-07-08 14:26:19 -0700289 int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
290 GrProcessorUnitTest::kAlphaTextureIdx;
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000291 SkRect domain;
joshualitt0067ff52015-07-08 14:26:19 -0700292 domain.fLeft = d->fRandom->nextUScalar1();
293 domain.fRight = d->fRandom->nextRangeScalar(domain.fLeft, SK_Scalar1);
294 domain.fTop = d->fRandom->nextUScalar1();
295 domain.fBottom = d->fRandom->nextRangeScalar(domain.fTop, SK_Scalar1);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000296 GrTextureDomain::Mode mode =
joshualitt0067ff52015-07-08 14:26:19 -0700297 (GrTextureDomain::Mode) d->fRandom->nextULessThan(GrTextureDomain::kModeCount);
298 const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
299 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
300 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoordSet;
bsalomon0ba8c242015-10-07 09:20:28 -0700301 return GrTextureDomainEffect::Create(
302 d->fTextures[texIdx],
303 matrix,
304 domain,
305 mode,
306 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_FilterMode,
307 coords);
commit-bot@chromium.org907fbd52013-12-09 17:03:02 +0000308}