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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 } | 440 } |
441 set_random_color_coverage_stages(this, maxStages - hasGeometryProcessor,
usePathRendering, | 441 set_random_color_coverage_stages(this, maxStages - hasGeometryProcessor,
usePathRendering, |
442 &random, dummyTextures); | 442 &random, dummyTextures); |
443 set_random_color(this, &random); | 443 set_random_color(this, &random); |
444 set_random_coverage(this, &random); | 444 set_random_coverage(this, &random); |
445 set_random_hints(this, &random); | 445 set_random_hints(this, &random); |
446 set_random_state(this, &random); | 446 set_random_state(this, &random); |
447 set_random_blend_func(this, &random); | 447 set_random_blend_func(this, &random); |
448 set_random_stencil(this, &random); | 448 set_random_stencil(this, &random); |
449 | 449 |
450 // create optimized draw state, setup readDst texture if required, and b
uild a descriptor | |
451 // and program. ODS creation can fail, so we have to check | |
452 SkAutoTUnref<GrOptDrawState> ods(GrOptDrawState::Create(this->getDrawSta
te(), | |
453 *this->caps(), | |
454 drawType)); | |
455 if (!ods.get()) { | |
456 ds->reset(); | |
457 continue; | |
458 } | |
459 GrGLProgramDesc desc; | |
460 GrDeviceCoordTexture dstCopy; | 450 GrDeviceCoordTexture dstCopy; |
461 | 451 |
462 if (!this->setupDstReadIfNecessary(&dstCopy, NULL)) { | 452 if (!this->setupDstReadIfNecessary(&dstCopy, NULL)) { |
463 SkDebugf("Couldn't setup dst read texture"); | 453 SkDebugf("Couldn't setup dst read texture"); |
464 return false; | 454 return false; |
465 } | 455 } |
466 if (!GrGLProgramDesc::Build(*ods, | 456 |
467 drawType, | 457 // create optimized draw state, setup readDst texture if required, and b
uild a descriptor |
468 this, | 458 // and program. ODS creation can fail, so we have to check |
469 dstCopy.texture() ? &dstCopy : NULL, | 459 SkAutoTUnref<GrOptDrawState> ods(GrOptDrawState::Create(this->getDrawSta
te(), |
470 &desc)) { | 460 this, |
471 SkDebugf("Failed to generate GL program descriptor"); | 461 &dstCopy, |
472 return false; | 462 drawType)); |
| 463 if (!ods.get()) { |
| 464 ds->reset(); |
| 465 continue; |
473 } | 466 } |
474 SkAutoTUnref<GrGLProgram> program( | 467 SkAutoTUnref<GrGLProgram> program(GrGLProgramBuilder::CreateProgram(*ods
, drawType, this)); |
475 GrGLProgramBuilder::CreateProgram(*ods, desc, drawType, this)); | |
476 if (NULL == program.get()) { | 468 if (NULL == program.get()) { |
477 SkDebugf("Failed to create program!"); | 469 SkDebugf("Failed to create program!"); |
478 return false; | 470 return false; |
479 } | 471 } |
480 | 472 |
481 // We have to reset the drawstate because we might have added a gp | 473 // We have to reset the drawstate because we might have added a gp |
482 ds->reset(); | 474 ds->reset(); |
483 | 475 |
484 // because occasionally optimized drawstate creation will fail for valid
reasons, we only | 476 // because occasionally optimized drawstate creation will fail for valid
reasons, we only |
485 // want to increment on success | 477 // want to increment on success |
(...skipping 28 matching lines...) Expand all Loading... |
514 if (type == GrContextFactory::kANGLE_GLContextType) { | 506 if (type == GrContextFactory::kANGLE_GLContextType) { |
515 maxStages = 3; | 507 maxStages = 3; |
516 } | 508 } |
517 #endif | 509 #endif |
518 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages)); | 510 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages)); |
519 } | 511 } |
520 } | 512 } |
521 } | 513 } |
522 | 514 |
523 #endif | 515 #endif |
OLD | NEW |