| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 dummyDesc.fHeight = 22; | 392 dummyDesc.fHeight = 22; |
| 393 SkAutoTUnref<GrTexture> dummyTexture2(gpu->createTexture(dummyDesc, NULL, 0)
); | 393 SkAutoTUnref<GrTexture> dummyTexture2(gpu->createTexture(dummyDesc, NULL, 0)
); |
| 394 | 394 |
| 395 if (!dummyTexture1 || ! dummyTexture2) { | 395 if (!dummyTexture1 || ! dummyTexture2) { |
| 396 SkDebugf("Could not allocate dummy textures"); | 396 SkDebugf("Could not allocate dummy textures"); |
| 397 return false; | 397 return false; |
| 398 } | 398 } |
| 399 | 399 |
| 400 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()}; | 400 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()}; |
| 401 | 401 |
| 402 // dummy scissor state |
| 403 GrClipMaskManager::ScissorState scissor; |
| 404 |
| 402 // Setup texture cache id key | 405 // Setup texture cache id key |
| 403 const GrCacheID::Domain glProgramsDomain = GrCacheID::GenerateDomain(); | 406 const GrCacheID::Domain glProgramsDomain = GrCacheID::GenerateDomain(); |
| 404 GrCacheID::Key key; | 407 GrCacheID::Key key; |
| 405 memset(&key, 0, sizeof(key)); | 408 memset(&key, 0, sizeof(key)); |
| 406 key.fData32[0] = kRenderTargetWidth; | 409 key.fData32[0] = kRenderTargetWidth; |
| 407 key.fData32[1] = kRenderTargetHeight; | 410 key.fData32[1] = kRenderTargetHeight; |
| 408 GrCacheID glProgramsCacheID(glProgramsDomain, key); | 411 GrCacheID glProgramsCacheID(glProgramsDomain, key); |
| 409 | 412 |
| 410 // setup clip | 413 // setup clip |
| 411 SkRect screen = SkRect::MakeWH(SkIntToScalar(kRenderTargetWidth), | 414 SkRect screen = SkRect::MakeWH(SkIntToScalar(kRenderTargetWidth), |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 463 |
| 461 if (!this->setupDstReadIfNecessary(&ds, &dstCopy, NULL)) { | 464 if (!this->setupDstReadIfNecessary(&ds, &dstCopy, NULL)) { |
| 462 SkDebugf("Couldn't setup dst read texture"); | 465 SkDebugf("Couldn't setup dst read texture"); |
| 463 return false; | 466 return false; |
| 464 } | 467 } |
| 465 | 468 |
| 466 // create optimized draw state, setup readDst texture if required, and b
uild a descriptor | 469 // create optimized draw state, setup readDst texture if required, and b
uild a descriptor |
| 467 // and program. ODS creation can fail, so we have to check | 470 // and program. ODS creation can fail, so we have to check |
| 468 SkAutoTUnref<GrOptDrawState> ods(GrOptDrawState::Create(ds, | 471 SkAutoTUnref<GrOptDrawState> ods(GrOptDrawState::Create(ds, |
| 469 gpu, | 472 gpu, |
| 473 scissor, |
| 470 &dstCopy, | 474 &dstCopy, |
| 471 drawType)); | 475 drawType)); |
| 472 if (!ods.get()) { | 476 if (!ods.get()) { |
| 473 continue; | 477 continue; |
| 474 } | 478 } |
| 475 SkAutoTUnref<GrGLProgram> program(GrGLProgramBuilder::CreateProgram(*ods
, drawType, gpu)); | 479 SkAutoTUnref<GrGLProgram> program(GrGLProgramBuilder::CreateProgram(*ods
, drawType, gpu)); |
| 476 if (NULL == program.get()) { | 480 if (NULL == program.get()) { |
| 477 SkDebugf("Failed to create program!"); | 481 SkDebugf("Failed to create program!"); |
| 478 return false; | 482 return false; |
| 479 } | 483 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 } | 517 } |
| 514 #endif | 518 #endif |
| 515 GrTestTarget target; | 519 GrTestTarget target; |
| 516 context->getTestTarget(&target); | 520 context->getTestTarget(&target); |
| 517 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); | 521 REPORTER_ASSERT(reporter, target.target()->programUnitTest(maxStages
)); |
| 518 } | 522 } |
| 519 } | 523 } |
| 520 } | 524 } |
| 521 | 525 |
| 522 #endif | 526 #endif |
| OLD | NEW |