| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 449 |
| 450 // create optimized draw state, setup readDst texture if required, and b
uild a descriptor | 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 | 451 // and program. ODS creation can fail, so we have to check |
| 452 SkAutoTUnref<GrOptDrawState> ods(GrOptDrawState::Create(this->getDrawSta
te(), | 452 SkAutoTUnref<GrOptDrawState> ods(GrOptDrawState::Create(this->getDrawSta
te(), |
| 453 *this->caps(), | 453 *this->caps(), |
| 454 drawType)); | 454 drawType)); |
| 455 if (!ods.get()) { | 455 if (!ods.get()) { |
| 456 ds->reset(); | 456 ds->reset(); |
| 457 continue; | 457 continue; |
| 458 } | 458 } |
| 459 const GrGeometryStage* geometryProcessor = NULL; | |
| 460 SkSTArray<8, const GrFragmentStage*, true> colorStages; | |
| 461 SkSTArray<8, const GrFragmentStage*, true> coverageStages; | |
| 462 GrGLProgramDesc desc; | 459 GrGLProgramDesc desc; |
| 463 GrDeviceCoordTexture dstCopy; | 460 GrDeviceCoordTexture dstCopy; |
| 464 | 461 |
| 465 if (!this->setupDstReadIfNecessary(&dstCopy, NULL)) { | 462 if (!this->setupDstReadIfNecessary(&dstCopy, NULL)) { |
| 466 SkDebugf("Couldn't setup dst read texture"); | 463 SkDebugf("Couldn't setup dst read texture"); |
| 467 return false; | 464 return false; |
| 468 } | 465 } |
| 469 if (!GrGLProgramDesc::Build(*ods, | 466 if (!GrGLProgramDesc::Build(*ods, |
| 470 drawType, | 467 drawType, |
| 471 ods->getSrcBlendCoeff(), | |
| 472 ods->getDstBlendCoeff(), | |
| 473 this, | 468 this, |
| 474 dstCopy.texture() ? &dstCopy : NULL, | 469 dstCopy.texture() ? &dstCopy : NULL, |
| 475 &geometryProcessor, | |
| 476 &colorStages, | |
| 477 &coverageStages, | |
| 478 &desc)) { | 470 &desc)) { |
| 479 SkDebugf("Failed to generate GL program descriptor"); | 471 SkDebugf("Failed to generate GL program descriptor"); |
| 480 return false; | 472 return false; |
| 481 } | 473 } |
| 482 SkAutoTUnref<GrGLProgram> program(GrGLProgramBuilder::CreateProgram(*ods
, | 474 SkAutoTUnref<GrGLProgram> program( |
| 483 desc
, | 475 GrGLProgramBuilder::CreateProgram(*ods, desc, drawType, this)); |
| 484 draw
Type, | |
| 485 geom
etryProcessor, | |
| 486 colo
rStages.begin(), | |
| 487 cove
rageStages.begin(), | |
| 488 this
)); | |
| 489 if (NULL == program.get()) { | 476 if (NULL == program.get()) { |
| 490 SkDebugf("Failed to create program!"); | 477 SkDebugf("Failed to create program!"); |
| 491 return false; | 478 return false; |
| 492 } | 479 } |
| 493 | 480 |
| 494 // We have to reset the drawstate because we might have added a gp | 481 // We have to reset the drawstate because we might have added a gp |
| 495 ds->reset(); | 482 ds->reset(); |
| 496 | 483 |
| 497 // because occasionally optimized drawstate creation will fail for valid
reasons, we only | 484 // because occasionally optimized drawstate creation will fail for valid
reasons, we only |
| 498 // want to increment on success | 485 // want to increment on success |
| (...skipping 28 matching lines...) Expand all Loading... |
| 527 if (type == GrContextFactory::kANGLE_GLContextType) { | 514 if (type == GrContextFactory::kANGLE_GLContextType) { |
| 528 maxStages = 3; | 515 maxStages = 3; |
| 529 } | 516 } |
| 530 #endif | 517 #endif |
| 531 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages)); | 518 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages)); |
| 532 } | 519 } |
| 533 } | 520 } |
| 534 } | 521 } |
| 535 | 522 |
| 536 #endif | 523 #endif |
| OLD | NEW |