Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 1490113005: Add config options to run different GPU APIs to dm and nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-03-context-factory-glcontext-type
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/gl/mesa/SkMesaGLContext.h ('k') | tests/GrContextFactoryTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 context->getTestTarget(&tt, rt); 394 context->getTestTarget(&tt, rt);
395 395
396 tt.target()->drawBatch(builder, batch); 396 tt.target()->drawBatch(builder, batch);
397 drawingManager->flush(); 397 drawingManager->flush();
398 } 398 }
399 } 399 }
400 400
401 return true; 401 return true;
402 } 402 }
403 403
404 DEF_GPUTEST(GLPrograms, reporter, factory) { 404 static int get_glprograms_max_stages(GrContext* context) {
405 GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu());
406 /*
407 * For the time being, we only support the test with desktop GL or for andro id on
408 * ARM platforms
409 * TODO When we run ES 3.00 GLSL in more places, test again
410 */
411 if (kGL_GrGLStandard == gpu->glStandard() ||
412 kARM_GrGLVendor == gpu->ctxInfo().vendor()) {
413 return 6;
414 } else if (kTegra3_GrGLRenderer == gpu->ctxInfo().renderer() ||
415 kOther_GrGLRenderer == gpu->ctxInfo().renderer()) {
416 return 1;
417 }
418 return 0;
419 }
420
421 static void test_glprograms_native(skiatest::Reporter* reporter, GrContext* cont ext) {
422 int maxStages = get_glprograms_max_stages(context);
423 if (maxStages == 0) {
424 return;
425 }
426 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(context, maxStag es));
427 }
428
429 static void test_glprograms_other_contexts(skiatest::Reporter* reporter, GrConte xt* context) {
430 int maxStages = get_glprograms_max_stages(context);
431 #ifdef SK_BUILD_FOR_WIN
432 // Some long shaders run out of temporary registers in the D3D compiler on A NGLE and
433 // command buffer.
434 maxStages = SkTMin(maxStages, 2);
435 #endif
436 if (maxStages == 0) {
437 return;
438 }
439 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(context, maxStag es));
440 }
441
442 DEF_GPUTEST(GLPrograms, reporter, /*factory*/) {
405 // Set a locale that would cause shader compilation to fail because of , as decimal separator. 443 // Set a locale that would cause shader compilation to fail because of , as decimal separator.
406 // skbug 3330 444 // skbug 3330
407 #ifdef SK_BUILD_FOR_WIN 445 #ifdef SK_BUILD_FOR_WIN
408 GrAutoLocaleSetter als("sv-SE"); 446 GrAutoLocaleSetter als("sv-SE");
409 #else 447 #else
410 GrAutoLocaleSetter als("sv_SE.UTF-8"); 448 GrAutoLocaleSetter als("sv_SE.UTF-8");
411 #endif 449 #endif
412 450
413 // We suppress prints to avoid spew 451 // We suppress prints to avoid spew
414 GrContextOptions opts; 452 GrContextOptions opts;
415 opts.fSuppressPrints = true; 453 opts.fSuppressPrints = true;
416 GrContextFactory debugFactory(opts); 454 GrContextFactory debugFactory(opts);
417 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { 455 skiatest::RunWithGPUTestContexts(test_glprograms_native, skiatest::kNative_G PUTestContexts,
418 GrContext* context = debugFactory.get(static_cast<GrContextFactory::GLCo ntextType>(type)); 456 reporter, &debugFactory);
419 if (context) { 457 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts,
420 GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu()); 458 skiatest::kOther_GPUTestContexts, reporter, &debugFactory);
421
422 /*
423 * For the time being, we only support the test with desktop GL or f or android on
424 * ARM platforms
425 * TODO When we run ES 3.00 GLSL in more places, test again
426 */
427 int maxStages;
428 if (kGL_GrGLStandard == gpu->glStandard() ||
429 kARM_GrGLVendor == gpu->ctxInfo().vendor()) {
430 maxStages = 6;
431 } else if (kTegra3_GrGLRenderer == gpu->ctxInfo().renderer() ||
432 kOther_GrGLRenderer == gpu->ctxInfo().renderer()) {
433 maxStages = 1;
434 } else {
435 return;
436 }
437 #if SK_ANGLE
438 // Some long shaders run out of temporary registers in the D3D compi ler on ANGLE.
439 if (type == GrContextFactory::kANGLE_GLContextType) {
440 maxStages = 2;
441 }
442 #endif
443 #if SK_COMMAND_BUFFER
444 // Some long shaders run out of temporary registers in the D3D compi ler on ANGLE.
445 // TODO(hendrikw): This only needs to happen with the ANGLE comand b uffer backend.
446 if (type == GrContextFactory::kCommandBuffer_GLContextType) {
447 maxStages = 2;
448 }
449 #endif
450 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(context, maxStages));
451 }
452 }
453 } 459 }
454 460
455 #endif 461 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/mesa/SkMesaGLContext.h ('k') | tests/GrContextFactoryTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698