blob: d96c56c5e235e282f7b8eb4b126069fcf9440ddf [file] [log] [blame]
bsalomon@google.coma8e686e2011-08-16 15:45:58 +00001
2/*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
bsalomon@google.comd4726202012-08-03 14:34:46 +00009// This is a GPU-backend specific test. It relies on static intializers to work
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000010
bsalomon@google.com2a48c3a2012-08-03 14:54:45 +000011#include "SkTypes.h"
12
13#if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
14
bsalomon@google.com67b915d2013-02-04 16:13:32 +000015#include "GrContextFactory.h"
egdaniel605dd0f2014-11-12 08:35:25 -080016#include "GrInvariantOutput.h"
egdaniel8dd688b2015-01-22 10:16:09 -080017#include "GrPipeline.h"
joshualitt2c93efe2014-11-06 12:57:13 -080018#include "GrTest.h"
egdaniel95131432014-12-09 11:15:43 -080019#include "GrXferProcessor.h"
bsalomon@google.com2db3ded2013-05-22 14:34:04 +000020#include "SkChecksum.h"
tfarina@chromium.org223137f2012-11-21 22:38:36 +000021#include "SkRandom.h"
bsalomon@google.comc3841b92012-08-02 18:11:43 +000022#include "Test.h"
joshualitt2c93efe2014-11-06 12:57:13 -080023#include "effects/GrConfigConversionEffect.h"
egdaniel95131432014-12-09 11:15:43 -080024#include "effects/GrPorterDuffXferProcessor.h"
jvanverth39edf762014-12-22 11:44:19 -080025#include "gl/GrGLGpu.h"
joshualitt2c93efe2014-11-06 12:57:13 -080026#include "gl/GrGLPathRendering.h"
joshualitt2c93efe2014-11-06 12:57:13 -080027#include "gl/builders/GrGLProgramBuilder.h"
bsalomon@google.comc3841b92012-08-02 18:11:43 +000028
joshualitt65171342014-10-09 07:25:36 -070029/*
bsalomon98b33eb2014-10-15 11:05:26 -070030 * A dummy processor which just tries to insert a massive key and verify that it can retrieve the
joshualitt65171342014-10-09 07:25:36 -070031 * whole thing correctly
32 */
33static const uint32_t kMaxKeySize = 1024;
34
joshualitt65171342014-10-09 07:25:36 -070035class GLBigKeyProcessor : public GrGLFragmentProcessor {
36public:
joshualitteb2a6762014-12-04 11:35:33 -080037 GLBigKeyProcessor(const GrProcessor&) {}
joshualittd9097592014-10-07 08:37:36 -070038
joshualitt15988992014-10-09 15:04:05 -070039 virtual void emitCode(GrGLFPBuilder* builder,
joshualitt65171342014-10-09 07:25:36 -070040 const GrFragmentProcessor& fp,
joshualitt65171342014-10-09 07:25:36 -070041 const char* outputColor,
42 const char* inputColor,
43 const TransformedCoordsArray&,
joshualitt267ce482014-11-25 14:52:21 -080044 const TextureSamplerArray&) {}
joshualitt65171342014-10-09 07:25:36 -070045
46 static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcessorKeyBuilder* b) {
47 for (uint32_t i = 0; i < kMaxKeySize; i++) {
48 b->add32(i);
joshualittd9097592014-10-07 08:37:36 -070049 }
joshualittd9097592014-10-07 08:37:36 -070050 }
51
joshualitt65171342014-10-09 07:25:36 -070052private:
53 typedef GrGLFragmentProcessor INHERITED;
54};
55
joshualitteb2a6762014-12-04 11:35:33 -080056class BigKeyProcessor : public GrFragmentProcessor {
57public:
58 static GrFragmentProcessor* Create() {
59 GR_CREATE_STATIC_PROCESSOR(gBigKeyProcessor, BigKeyProcessor, ())
60 return SkRef(gBigKeyProcessor);
61 }
62
mtklein72c9faa2015-01-09 10:06:39 -080063 const char* name() const SK_OVERRIDE { return "Big Ole Key"; }
joshualitteb2a6762014-12-04 11:35:33 -080064
65 virtual void getGLProcessorKey(const GrGLCaps& caps,
66 GrProcessorKeyBuilder* b) const SK_OVERRIDE {
67 GLBigKeyProcessor::GenKey(*this, caps, b);
68 }
69
mtklein72c9faa2015-01-09 10:06:39 -080070 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE {
joshualitteb2a6762014-12-04 11:35:33 -080071 return SkNEW_ARGS(GLBigKeyProcessor, (*this));
72 }
73
74private:
75 BigKeyProcessor() {
76 this->initClassID<BigKeyProcessor>();
77 }
mtklein72c9faa2015-01-09 10:06:39 -080078 bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE { return true; }
79 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE { }
joshualitteb2a6762014-12-04 11:35:33 -080080
81 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
82
83 typedef GrFragmentProcessor INHERITED;
84};
85
86GR_DEFINE_FRAGMENT_PROCESSOR_TEST(BigKeyProcessor);
87
88GrFragmentProcessor* BigKeyProcessor::TestCreate(SkRandom*,
89 GrContext*,
90 const GrDrawTargetCaps&,
91 GrTexture*[]) {
92 return BigKeyProcessor::Create();
93}
94
joshualitt65171342014-10-09 07:25:36 -070095/*
96 * Begin test code
97 */
98static const int kRenderTargetHeight = 1;
99static const int kRenderTargetWidth = 1;
100
bsalomon24db3b12015-01-23 04:24:04 -0800101static GrRenderTarget* random_render_target(GrContext* context, SkRandom* random) {
joshualitt65171342014-10-09 07:25:36 -0700102 // setup render target
103 GrTextureParams params;
bsalomonf2703d82014-10-28 14:33:06 -0700104 GrSurfaceDesc texDesc;
joshualitt65171342014-10-09 07:25:36 -0700105 texDesc.fWidth = kRenderTargetWidth;
106 texDesc.fHeight = kRenderTargetHeight;
bsalomonf2703d82014-10-28 14:33:06 -0700107 texDesc.fFlags = kRenderTarget_GrSurfaceFlag;
joshualitt65171342014-10-09 07:25:36 -0700108 texDesc.fConfig = kRGBA_8888_GrPixelConfig;
109 texDesc.fOrigin = random->nextBool() == true ? kTopLeft_GrSurfaceOrigin :
110 kBottomLeft_GrSurfaceOrigin;
bsalomon8718aaf2015-02-19 07:24:21 -0800111 GrUniqueKey key;
112 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
113 GrUniqueKey::Builder builder(&key, kDomain, 1);
bsalomon24db3b12015-01-23 04:24:04 -0800114 builder[0] = texDesc.fOrigin;
115 builder.finish();
joshualitt65171342014-10-09 07:25:36 -0700116
bsalomon37f9a262015-02-02 13:00:10 -0800117 GrTexture* texture = context->findAndRefCachedTexture(key);
bsalomond27726e2014-10-12 05:40:00 -0700118 if (!texture) {
bsalomond0423582015-02-06 08:49:24 -0800119 texture = context->createTexture(texDesc, true);
bsalomon37f9a262015-02-02 13:00:10 -0800120 if (texture) {
bsalomonf99e9612015-02-19 08:24:16 -0800121 context->addResourceToCache(key, texture);
joshualittd9097592014-10-07 08:37:36 -0700122 }
joshualittd9097592014-10-07 08:37:36 -0700123 }
bsalomon37f9a262015-02-02 13:00:10 -0800124 return texture ? texture->asRenderTarget() : NULL;
bsalomon@google.com91207482013-02-12 21:45:24 +0000125}
126
egdaniel8dd688b2015-01-22 10:16:09 -0800127static void set_random_xpf(GrContext* context, const GrDrawTargetCaps& caps,
128 GrPipelineBuilder* pipelineBuilder, SkRandom* random,
129 GrTexture* dummyTextures[]) {
egdanielc2304142014-12-11 13:15:13 -0800130 SkAutoTUnref<const GrXPFactory> xpf(
131 GrProcessorTestFactory<GrXPFactory>::CreateStage(random, context, caps, dummyTextures));
132 SkASSERT(xpf);
egdaniel8dd688b2015-01-22 10:16:09 -0800133 pipelineBuilder->setXPFactory(xpf.get());
egdanielc2304142014-12-11 13:15:13 -0800134}
135
joshualitt56995b52014-12-11 15:44:02 -0800136static const GrGeometryProcessor* get_random_gp(GrContext* context,
137 const GrDrawTargetCaps& caps,
138 SkRandom* random,
139 GrTexture* dummyTextures[]) {
140 return GrProcessorTestFactory<GrGeometryProcessor>::CreateStage(random,
141 context,
142 caps,
143 dummyTextures);
joshualitt65171342014-10-09 07:25:36 -0700144}
145
bsalomon861e1032014-12-16 07:33:49 -0800146static void set_random_color_coverage_stages(GrGLGpu* gpu,
egdaniel8dd688b2015-01-22 10:16:09 -0800147 GrPipelineBuilder* pipelineBuilder,
joshualitt65171342014-10-09 07:25:36 -0700148 int maxStages,
149 bool usePathRendering,
150 SkRandom* random,
151 GrTexture* dummyTextures[]) {
152 int numProcs = random->nextULessThan(maxStages + 1);
153 int numColorProcs = random->nextULessThan(numProcs + 1);
154
155 int currTextureCoordSet = 0;
156 for (int s = 0; s < numProcs;) {
bsalomonae59b772014-11-19 08:23:49 -0800157 SkAutoTUnref<const GrFragmentProcessor> fp(
joshualitt65171342014-10-09 07:25:36 -0700158 GrProcessorTestFactory<GrFragmentProcessor>::CreateStage(random,
159 gpu->getContext(),
160 *gpu->caps(),
161 dummyTextures));
162 SkASSERT(fp);
163
joshualitt65171342014-10-09 07:25:36 -0700164 // If adding this effect would exceed the max texture coord set count then generate a
165 // new random effect.
166 if (usePathRendering && gpu->glPathRendering()->texturingMode() ==
167 GrGLPathRendering::FixedFunction_TexturingMode) {;
168 int numTransforms = fp->numTransforms();
169 if (currTextureCoordSet + numTransforms >
170 gpu->glCaps().maxFixedFunctionTextureCoords()) {
171 continue;
172 }
173 currTextureCoordSet += numTransforms;
174 }
175
176 // finally add the stage to the correct pipeline in the drawstate
joshualitt65171342014-10-09 07:25:36 -0700177 if (s < numColorProcs) {
egdaniel8dd688b2015-01-22 10:16:09 -0800178 pipelineBuilder->addColorProcessor(fp);
joshualitt65171342014-10-09 07:25:36 -0700179 } else {
egdaniel8dd688b2015-01-22 10:16:09 -0800180 pipelineBuilder->addCoverageProcessor(fp);
joshualitt65171342014-10-09 07:25:36 -0700181 }
182 ++s;
183 }
184}
185
egdaniel8dd688b2015-01-22 10:16:09 -0800186static void set_random_state(GrPipelineBuilder* pipelineBuilder, SkRandom* random) {
joshualitt65171342014-10-09 07:25:36 -0700187 int state = 0;
egdaniel8dd688b2015-01-22 10:16:09 -0800188 for (int i = 1; i <= GrPipelineBuilder::kLast_StateBit; i <<= 1) {
joshualitt65171342014-10-09 07:25:36 -0700189 state |= random->nextBool() * i;
190 }
egdaniel8dd688b2015-01-22 10:16:09 -0800191 pipelineBuilder->enableState(state);
joshualitt65171342014-10-09 07:25:36 -0700192}
193
joshualitt65171342014-10-09 07:25:36 -0700194// right now, the only thing we seem to care about in drawState's stencil is 'doesWrite()'
egdaniel8dd688b2015-01-22 10:16:09 -0800195static void set_random_stencil(GrPipelineBuilder* pipelineBuilder, SkRandom* random) {
joshualitt65171342014-10-09 07:25:36 -0700196 GR_STATIC_CONST_SAME_STENCIL(kDoesWriteStencil,
197 kReplace_StencilOp,
198 kReplace_StencilOp,
199 kAlways_StencilFunc,
200 0xffff,
201 0xffff,
202 0xffff);
203 GR_STATIC_CONST_SAME_STENCIL(kDoesNotWriteStencil,
204 kKeep_StencilOp,
205 kKeep_StencilOp,
206 kNever_StencilFunc,
207 0xffff,
208 0xffff,
209 0xffff);
210
211 if (random->nextBool()) {
egdaniel8dd688b2015-01-22 10:16:09 -0800212 pipelineBuilder->setStencil(kDoesWriteStencil);
joshualitt65171342014-10-09 07:25:36 -0700213 } else {
egdaniel8dd688b2015-01-22 10:16:09 -0800214 pipelineBuilder->setStencil(kDoesNotWriteStencil);
joshualitt65171342014-10-09 07:25:36 -0700215 }
216}
joshualitt249af152014-09-15 11:41:13 -0700217
joshualitt2c93efe2014-11-06 12:57:13 -0800218bool GrDrawTarget::programUnitTest(int maxStages) {
bsalomon861e1032014-12-16 07:33:49 -0800219 GrGLGpu* gpu = static_cast<GrGLGpu*>(fContext->getGpu());
joshualitt65171342014-10-09 07:25:36 -0700220 // setup dummy textures
bsalomonf2703d82014-10-28 14:33:06 -0700221 GrSurfaceDesc dummyDesc;
222 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
bsalomon@google.comfec0bc32013-02-07 14:43:04 +0000223 dummyDesc.fConfig = kSkia8888_GrPixelConfig;
bsalomon@google.comd4726202012-08-03 14:34:46 +0000224 dummyDesc.fWidth = 34;
225 dummyDesc.fHeight = 18;
bsalomon5236cf42015-01-14 10:42:08 -0800226 SkAutoTUnref<GrTexture> dummyTexture1(gpu->createTexture(dummyDesc, false, NULL, 0));
bsalomonf2703d82014-10-28 14:33:06 -0700227 dummyDesc.fFlags = kNone_GrSurfaceFlags;
bsalomon@google.comd4726202012-08-03 14:34:46 +0000228 dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
229 dummyDesc.fWidth = 16;
230 dummyDesc.fHeight = 22;
bsalomon5236cf42015-01-14 10:42:08 -0800231 SkAutoTUnref<GrTexture> dummyTexture2(gpu->createTexture(dummyDesc, false, NULL, 0));
bsalomon@google.comd4726202012-08-03 14:34:46 +0000232
bsalomone904c092014-07-17 10:50:59 -0700233 if (!dummyTexture1 || ! dummyTexture2) {
joshualitt65171342014-10-09 07:25:36 -0700234 SkDebugf("Could not allocate dummy textures");
bsalomone904c092014-07-17 10:50:59 -0700235 return false;
236 }
237
joshualitt65171342014-10-09 07:25:36 -0700238 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()};
239
joshualitt54e0c122014-11-19 09:38:51 -0800240 // dummy scissor state
bsalomon3e791242014-12-17 13:43:13 -0800241 GrScissorState scissor;
joshualitt54e0c122014-11-19 09:38:51 -0800242
joshualitt65171342014-10-09 07:25:36 -0700243 // setup clip
joshualitt2c93efe2014-11-06 12:57:13 -0800244 SkRect screen = SkRect::MakeWH(SkIntToScalar(kRenderTargetWidth),
245 SkIntToScalar(kRenderTargetHeight));
joshualitt65171342014-10-09 07:25:36 -0700246
247 SkClipStack stack;
248 stack.clipDevRect(screen, SkRegion::kReplace_Op, false);
249
250 // wrap the SkClipStack in a GrClipData
joshualitt44701df2015-02-23 14:44:57 -0800251 GrClip clip;
252 clip.setClipStack(&stack);
bsalomon@google.comc3841b92012-08-02 18:11:43 +0000253
commit-bot@chromium.orge0e7cfe2013-09-09 20:09:12 +0000254 SkRandom random;
joshualitt65171342014-10-09 07:25:36 -0700255 static const int NUM_TESTS = 512;
256 for (int t = 0; t < NUM_TESTS;) {
257 // setup random render target(can fail)
bsalomon24db3b12015-01-23 04:24:04 -0800258 SkAutoTUnref<GrRenderTarget> rt(random_render_target(fContext, &random));
joshualitt2c93efe2014-11-06 12:57:13 -0800259 if (!rt.get()) {
joshualitt65171342014-10-09 07:25:36 -0700260 SkDebugf("Could not allocate render target");
261 return false;
bsalomon@google.comc3841b92012-08-02 18:11:43 +0000262 }
bsalomon@google.comc3841b92012-08-02 18:11:43 +0000263
egdaniel8dd688b2015-01-22 10:16:09 -0800264 GrPipelineBuilder pipelineBuilder;
265 pipelineBuilder.setRenderTarget(rt.get());
joshualitt44701df2015-02-23 14:44:57 -0800266 pipelineBuilder.setClip(clip);
bsalomon@google.comc3841b92012-08-02 18:11:43 +0000267
joshualitt65171342014-10-09 07:25:36 -0700268 // if path rendering we have to setup a couple of things like the draw type
joshualitt2c93efe2014-11-06 12:57:13 -0800269 bool usePathRendering = gpu->glCaps().pathRenderingSupport() && random.nextBool();
egdanielc0648242014-09-22 13:17:02 -0700270
joshualitt65171342014-10-09 07:25:36 -0700271 // twiddle drawstate knobs randomly
joshualitt5478d422014-11-14 16:00:38 -0800272 bool hasGeometryProcessor = !usePathRendering;
joshualitt43893e42014-12-13 06:46:13 -0800273 SkAutoTUnref<const GrGeometryProcessor> gp;
274 SkAutoTUnref<const GrPathProcessor> pathProc;
joshualittbd769d02014-09-04 08:56:46 -0700275 if (hasGeometryProcessor) {
joshualitt43893e42014-12-13 06:46:13 -0800276 gp.reset(get_random_gp(fContext, gpu->glCaps(), &random, dummyTextures));
joshualitt56995b52014-12-11 15:44:02 -0800277 } else {
joshualitt43893e42014-12-13 06:46:13 -0800278 pathProc.reset(GrPathProcessor::Create(GrColor_WHITE));
joshualittd9097592014-10-07 08:37:36 -0700279 }
joshualitt2c93efe2014-11-06 12:57:13 -0800280 set_random_color_coverage_stages(gpu,
egdaniel8dd688b2015-01-22 10:16:09 -0800281 &pipelineBuilder,
joshualitt2c93efe2014-11-06 12:57:13 -0800282 maxStages - hasGeometryProcessor,
283 usePathRendering,
284 &random,
285 dummyTextures);
egdanielc2304142014-12-11 13:15:13 -0800286
287 // creates a random xfer processor factory on the draw state
egdaniel8dd688b2015-01-22 10:16:09 -0800288 set_random_xpf(fContext, gpu->glCaps(), &pipelineBuilder, &random, dummyTextures);
egdanielc2304142014-12-11 13:15:13 -0800289
egdaniel8dd688b2015-01-22 10:16:09 -0800290 set_random_state(&pipelineBuilder, &random);
291 set_random_stencil(&pipelineBuilder, &random);
joshualittd9097592014-10-07 08:37:36 -0700292
joshualitt65171342014-10-09 07:25:36 -0700293 GrDeviceCoordTexture dstCopy;
294
joshualitt56995b52014-12-11 15:44:02 -0800295 const GrPrimitiveProcessor* primProc;
296 if (hasGeometryProcessor) {
joshualitt43893e42014-12-13 06:46:13 -0800297 primProc = gp.get();
joshualitt56995b52014-12-11 15:44:02 -0800298 } else {
joshualitt43893e42014-12-13 06:46:13 -0800299 primProc = pathProc.get();
joshualitt56995b52014-12-11 15:44:02 -0800300 }
egdaniele36914c2015-02-13 09:00:33 -0800301
302 const GrProcOptInfo& colorPOI = pipelineBuilder.colorProcInfo(primProc);
303 const GrProcOptInfo& coveragePOI = pipelineBuilder.coverageProcInfo(primProc);
304
305 if (!this->setupDstReadIfNecessary(pipelineBuilder, colorPOI, coveragePOI, &dstCopy,
306 NULL)) {
joshualitt65171342014-10-09 07:25:36 -0700307 SkDebugf("Couldn't setup dst read texture");
bsalomon848faf02014-07-11 10:01:02 -0700308 return false;
309 }
joshualitt79f8fae2014-10-28 17:59:26 -0700310
311 // create optimized draw state, setup readDst texture if required, and build a descriptor
312 // and program. ODS creation can fail, so we have to check
egdaniele36914c2015-02-13 09:00:33 -0800313 GrPipeline pipeline(pipelineBuilder, colorPOI, coveragePOI,
314 *gpu->caps(), scissor, &dstCopy);
egdaniel8dd688b2015-01-22 10:16:09 -0800315 if (pipeline.mustSkip()) {
joshualitt79f8fae2014-10-28 17:59:26 -0700316 continue;
joshualittd9097592014-10-07 08:37:36 -0700317 }
joshualitt873ad0e2015-01-20 09:08:51 -0800318 GrBatchTracker bt;
egdaniel8dd688b2015-01-22 10:16:09 -0800319 primProc->initBatchTracker(&bt, pipeline.getInitBatchTracker());
joshualitt873ad0e2015-01-20 09:08:51 -0800320
321 GrProgramDesc desc;
bsalomon50785a32015-02-06 07:02:37 -0800322 gpu->buildProgramDesc(&desc, *primProc, pipeline, bt);
joshualitt873ad0e2015-01-20 09:08:51 -0800323
egdaniel8dd688b2015-01-22 10:16:09 -0800324 GrGpu::DrawArgs args(primProc, &pipeline, &desc, &bt);
joshualitt873ad0e2015-01-20 09:08:51 -0800325 SkAutoTUnref<GrGLProgram> program(GrGLProgramBuilder::CreateProgram(args, gpu));
326
bsalomon@google.comc3841b92012-08-02 18:11:43 +0000327 if (NULL == program.get()) {
joshualitt65171342014-10-09 07:25:36 -0700328 SkDebugf("Failed to create program!");
bsalomon@google.comc3841b92012-08-02 18:11:43 +0000329 return false;
330 }
joshualitt249af152014-09-15 11:41:13 -0700331
joshualitt65171342014-10-09 07:25:36 -0700332 // because occasionally optimized drawstate creation will fail for valid reasons, we only
333 // want to increment on success
334 ++t;
bsalomon@google.comc3841b92012-08-02 18:11:43 +0000335 }
336 return true;
337}
bsalomon@google.coma8e686e2011-08-16 15:45:58 +0000338
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +0000339DEF_GPUTEST(GLPrograms, reporter, factory) {
bsalomon@google.com67b915d2013-02-04 16:13:32 +0000340 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
341 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextType>(type));
bsalomon49f085d2014-09-05 13:34:00 -0700342 if (context) {
bsalomon861e1032014-12-16 07:33:49 -0800343 GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu());
joshualitt9e87fa72014-10-09 13:12:35 -0700344
345 /*
346 * For the time being, we only support the test with desktop GL or for android on
347 * ARM platforms
348 * TODO When we run ES 3.00 GLSL in more places, test again
349 */
350 int maxStages;
351 if (kGL_GrGLStandard == gpu->glStandard() ||
352 kARM_GrGLVendor == gpu->ctxInfo().vendor()) {
353 maxStages = 6;
354 } else if (kTegra3_GrGLRenderer == gpu->ctxInfo().renderer() ||
355 kOther_GrGLRenderer == gpu->ctxInfo().renderer()) {
356 maxStages = 1;
357 } else {
358 return;
359 }
bsalomon@google.com042a2862013-02-04 18:39:24 +0000360#if SK_ANGLE
361 // Some long shaders run out of temporary registers in the D3D compiler on ANGLE.
362 if (type == GrContextFactory::kANGLE_GLContextType) {
egdaniel305a8892015-02-17 11:18:38 -0800363 maxStages = 2;
bsalomon@google.com042a2862013-02-04 18:39:24 +0000364 }
365#endif
joshualitt2c93efe2014-11-06 12:57:13 -0800366 GrTestTarget target;
367 context->getTestTarget(&target);
368 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages));
bsalomon@google.com67b915d2013-02-04 16:13:32 +0000369 }
370 }
bsalomon@google.coma8e686e2011-08-16 15:45:58 +0000371}
372
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +0000373#endif