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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 * Begin test code | 96 * Begin test code |
97 */ | 97 */ |
98 static const int kRenderTargetHeight = 1; | 98 static const int kRenderTargetHeight = 1; |
99 static const int kRenderTargetWidth = 1; | 99 static const int kRenderTargetWidth = 1; |
100 | 100 |
101 static GrRenderTarget* random_render_target(GrGpuGL* gpu, | 101 static GrRenderTarget* random_render_target(GrGpuGL* gpu, |
102 const GrCacheID& cacheId, | 102 const GrCacheID& cacheId, |
103 SkRandom* random) { | 103 SkRandom* random) { |
104 // setup render target | 104 // setup render target |
105 GrTextureParams params; | 105 GrTextureParams params; |
106 GrTextureDesc texDesc; | 106 GrSurfaceDesc texDesc; |
107 texDesc.fWidth = kRenderTargetWidth; | 107 texDesc.fWidth = kRenderTargetWidth; |
108 texDesc.fHeight = kRenderTargetHeight; | 108 texDesc.fHeight = kRenderTargetHeight; |
109 texDesc.fFlags = kRenderTarget_GrTextureFlagBit; | 109 texDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
110 texDesc.fConfig = kRGBA_8888_GrPixelConfig; | 110 texDesc.fConfig = kRGBA_8888_GrPixelConfig; |
111 texDesc.fOrigin = random->nextBool() == true ? kTopLeft_GrSurfaceOrigin : | 111 texDesc.fOrigin = random->nextBool() == true ? kTopLeft_GrSurfaceOrigin : |
112 kBottomLeft_GrSurfaceOrigin; | 112 kBottomLeft_GrSurfaceOrigin; |
113 | 113 |
114 SkAutoTUnref<GrTexture> texture( | 114 SkAutoTUnref<GrTexture> texture( |
115 gpu->getContext()->findAndRefTexture(texDesc, cacheId, ¶ms)); | 115 gpu->getContext()->findAndRefTexture(texDesc, cacheId, ¶ms)); |
116 if (!texture) { | 116 if (!texture) { |
117 texture.reset(gpu->getContext()->createTexture(¶ms, texDesc, cacheId
, 0, 0)); | 117 texture.reset(gpu->getContext()->createTexture(¶ms, texDesc, cacheId
, 0, 0)); |
118 if (!texture) { | 118 if (!texture) { |
119 return NULL; | 119 return NULL; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 368 |
369 if (random->nextBool()) { | 369 if (random->nextBool()) { |
370 gpu->drawState()->setStencil(kDoesWriteStencil); | 370 gpu->drawState()->setStencil(kDoesWriteStencil); |
371 } else { | 371 } else { |
372 gpu->drawState()->setStencil(kDoesNotWriteStencil); | 372 gpu->drawState()->setStencil(kDoesNotWriteStencil); |
373 } | 373 } |
374 } | 374 } |
375 | 375 |
376 bool GrGpuGL::programUnitTest(int maxStages) { | 376 bool GrGpuGL::programUnitTest(int maxStages) { |
377 // setup dummy textures | 377 // setup dummy textures |
378 GrTextureDesc dummyDesc; | 378 GrSurfaceDesc dummyDesc; |
379 dummyDesc.fFlags = kRenderTarget_GrTextureFlagBit; | 379 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
380 dummyDesc.fConfig = kSkia8888_GrPixelConfig; | 380 dummyDesc.fConfig = kSkia8888_GrPixelConfig; |
381 dummyDesc.fWidth = 34; | 381 dummyDesc.fWidth = 34; |
382 dummyDesc.fHeight = 18; | 382 dummyDesc.fHeight = 18; |
383 SkAutoTUnref<GrTexture> dummyTexture1(this->createTexture(dummyDesc, NULL, 0
)); | 383 SkAutoTUnref<GrTexture> dummyTexture1(this->createTexture(dummyDesc, NULL, 0
)); |
384 dummyDesc.fFlags = kNone_GrTextureFlags; | 384 dummyDesc.fFlags = kNone_GrSurfaceFlags; |
385 dummyDesc.fConfig = kAlpha_8_GrPixelConfig; | 385 dummyDesc.fConfig = kAlpha_8_GrPixelConfig; |
386 dummyDesc.fWidth = 16; | 386 dummyDesc.fWidth = 16; |
387 dummyDesc.fHeight = 22; | 387 dummyDesc.fHeight = 22; |
388 SkAutoTUnref<GrTexture> dummyTexture2(this->createTexture(dummyDesc, NULL, 0
)); | 388 SkAutoTUnref<GrTexture> dummyTexture2(this->createTexture(dummyDesc, NULL, 0
)); |
389 | 389 |
390 if (!dummyTexture1 || ! dummyTexture2) { | 390 if (!dummyTexture1 || ! dummyTexture2) { |
391 SkDebugf("Could not allocate dummy textures"); | 391 SkDebugf("Could not allocate dummy textures"); |
392 return false; | 392 return false; |
393 } | 393 } |
394 | 394 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 if (type == GrContextFactory::kANGLE_GLContextType) { | 514 if (type == GrContextFactory::kANGLE_GLContextType) { |
515 maxStages = 3; | 515 maxStages = 3; |
516 } | 516 } |
517 #endif | 517 #endif |
518 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages)); | 518 REPORTER_ASSERT(reporter, gpu->programUnitTest(maxStages)); |
519 } | 519 } |
520 } | 520 } |
521 } | 521 } |
522 | 522 |
523 #endif | 523 #endif |
OLD | NEW |