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