OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 // This is a GPU-backend specific test. It relies on static intializers to work | 9 // This is a GPU-backend specific test. It relies on static intializers to work |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 static const GrGeometryProcessor* get_random_gp(GrContext* context, | 132 static const GrGeometryProcessor* get_random_gp(GrContext* context, |
133 const GrDrawTargetCaps& caps, | 133 const GrDrawTargetCaps& caps, |
134 SkRandom* random, | 134 SkRandom* random, |
135 GrTexture* dummyTextures[]) { | 135 GrTexture* dummyTextures[]) { |
136 return GrProcessorTestFactory<GrGeometryProcessor>::CreateStage(random, | 136 return GrProcessorTestFactory<GrGeometryProcessor>::CreateStage(random, |
137 context, | 137 context, |
138 caps, | 138 caps, |
139 dummyTexture
s); | 139 dummyTexture
s); |
140 } | 140 } |
141 | 141 |
142 static void set_random_color_coverage_stages(GrGpuGL* gpu, | 142 static void set_random_color_coverage_stages(GrGLGpu* gpu, |
143 GrDrawState* ds, | 143 GrDrawState* ds, |
144 int maxStages, | 144 int maxStages, |
145 bool usePathRendering, | 145 bool usePathRendering, |
146 SkRandom* random, | 146 SkRandom* random, |
147 GrTexture* dummyTextures[]) { | 147 GrTexture* dummyTextures[]) { |
148 int numProcs = random->nextULessThan(maxStages + 1); | 148 int numProcs = random->nextULessThan(maxStages + 1); |
149 int numColorProcs = random->nextULessThan(numProcs + 1); | 149 int numColorProcs = random->nextULessThan(numProcs + 1); |
150 | 150 |
151 int currTextureCoordSet = 0; | 151 int currTextureCoordSet = 0; |
152 for (int s = 0; s < numProcs;) { | 152 for (int s = 0; s < numProcs;) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 0xffff); | 210 0xffff); |
211 | 211 |
212 if (random->nextBool()) { | 212 if (random->nextBool()) { |
213 ds->setStencil(kDoesWriteStencil); | 213 ds->setStencil(kDoesWriteStencil); |
214 } else { | 214 } else { |
215 ds->setStencil(kDoesNotWriteStencil); | 215 ds->setStencil(kDoesNotWriteStencil); |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
219 bool GrDrawTarget::programUnitTest(int maxStages) { | 219 bool GrDrawTarget::programUnitTest(int maxStages) { |
220 GrGpuGL* gpu = static_cast<GrGpuGL*>(fContext->getGpu()); | 220 GrGLGpu* gpu = static_cast<GrGLGpu*>(fContext->getGpu()); |
221 // setup dummy textures | 221 // setup dummy textures |
222 GrSurfaceDesc dummyDesc; | 222 GrSurfaceDesc dummyDesc; |
223 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 223 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
224 dummyDesc.fConfig = kSkia8888_GrPixelConfig; | 224 dummyDesc.fConfig = kSkia8888_GrPixelConfig; |
225 dummyDesc.fWidth = 34; | 225 dummyDesc.fWidth = 34; |
226 dummyDesc.fHeight = 18; | 226 dummyDesc.fHeight = 18; |
227 SkAutoTUnref<GrTexture> dummyTexture1(gpu->createTexture(dummyDesc, NULL, 0)
); | 227 SkAutoTUnref<GrTexture> dummyTexture1(gpu->createTexture(dummyDesc, NULL, 0)
); |
228 dummyDesc.fFlags = kNone_GrSurfaceFlags; | 228 dummyDesc.fFlags = kNone_GrSurfaceFlags; |
229 dummyDesc.fConfig = kAlpha_8_GrPixelConfig; | 229 dummyDesc.fConfig = kAlpha_8_GrPixelConfig; |
230 dummyDesc.fWidth = 16; | 230 dummyDesc.fWidth = 16; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // want to increment on success | 332 // want to increment on success |
333 ++t; | 333 ++t; |
334 } | 334 } |
335 return true; | 335 return true; |
336 } | 336 } |
337 | 337 |
338 DEF_GPUTEST(GLPrograms, reporter, factory) { | 338 DEF_GPUTEST(GLPrograms, reporter, factory) { |
339 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { | 339 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { |
340 GrContext* context = factory->get(static_cast<GrContextFactory::GLContex
tType>(type)); | 340 GrContext* context = factory->get(static_cast<GrContextFactory::GLContex
tType>(type)); |
341 if (context) { | 341 if (context) { |
342 GrGpuGL* gpu = static_cast<GrGpuGL*>(context->getGpu()); | 342 GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu()); |
343 | 343 |
344 /* | 344 /* |
345 * For the time being, we only support the test with desktop GL or f
or android on | 345 * For the time being, we only support the test with desktop GL or f
or android on |
346 * ARM platforms | 346 * ARM platforms |
347 * TODO When we run ES 3.00 GLSL in more places, test again | 347 * TODO When we run ES 3.00 GLSL in more places, test again |
348 */ | 348 */ |
349 int maxStages; | 349 int maxStages; |
350 if (kGL_GrGLStandard == gpu->glStandard() || | 350 if (kGL_GrGLStandard == gpu->glStandard() || |
351 kARM_GrGLVendor == gpu->ctxInfo().vendor()) { | 351 kARM_GrGLVendor == gpu->ctxInfo().vendor()) { |
352 maxStages = 6; | 352 maxStages = 6; |
(...skipping 10 matching lines...) Expand all Loading... |
363 } | 363 } |
364 #endif | 364 #endif |
365 GrTestTarget target; | 365 GrTestTarget target; |
366 context->getTestTarget(&target); | 366 context->getTestTarget(&target); |
367 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); | 367 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); |
368 } | 368 } |
369 } | 369 } |
370 } | 370 } |
371 | 371 |
372 #endif | 372 #endif |
OLD | NEW |