| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 builder[1] = texDesc.fSampleCnt; | 120 builder[1] = texDesc.fSampleCnt; |
| 121 builder.finish(); | 121 builder.finish(); |
| 122 | 122 |
| 123 GrTexture* texture = textureProvider->findAndRefTextureByUniqueKey(key); | 123 GrTexture* texture = textureProvider->findAndRefTextureByUniqueKey(key); |
| 124 if (!texture) { | 124 if (!texture) { |
| 125 texture = textureProvider->createTexture(texDesc, true); | 125 texture = textureProvider->createTexture(texDesc, true); |
| 126 if (texture) { | 126 if (texture) { |
| 127 textureProvider->assignUniqueKeyToTexture(key, texture); | 127 textureProvider->assignUniqueKeyToTexture(key, texture); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 return texture ? texture->asRenderTarget() : NULL; | 130 return texture ? texture->asRenderTarget() : nullptr; |
| 131 } | 131 } |
| 132 | 132 |
| 133 static void set_random_xpf(GrPipelineBuilder* pipelineBuilder, GrProcessorTestDa
ta* d) { | 133 static void set_random_xpf(GrPipelineBuilder* pipelineBuilder, GrProcessorTestDa
ta* d) { |
| 134 SkAutoTUnref<const GrXPFactory> xpf(GrProcessorTestFactory<GrXPFactory>::Cre
ateStage(d)); | 134 SkAutoTUnref<const GrXPFactory> xpf(GrProcessorTestFactory<GrXPFactory>::Cre
ateStage(d)); |
| 135 SkASSERT(xpf); | 135 SkASSERT(xpf); |
| 136 pipelineBuilder->setXPFactory(xpf.get()); | 136 pipelineBuilder->setXPFactory(xpf.get()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 static void set_random_color_coverage_stages(GrPipelineBuilder* pipelineBuilder, | 139 static void set_random_color_coverage_stages(GrPipelineBuilder* pipelineBuilder, |
| 140 GrProcessorTestData* d, int maxStag
es) { | 140 GrProcessorTestData* d, int maxStag
es) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 195 } |
| 196 | 196 |
| 197 bool GrDrawTarget::programUnitTest(GrContext* context, int maxStages) { | 197 bool GrDrawTarget::programUnitTest(GrContext* context, int maxStages) { |
| 198 // setup dummy textures | 198 // setup dummy textures |
| 199 GrSurfaceDesc dummyDesc; | 199 GrSurfaceDesc dummyDesc; |
| 200 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 200 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 201 dummyDesc.fConfig = kSkia8888_GrPixelConfig; | 201 dummyDesc.fConfig = kSkia8888_GrPixelConfig; |
| 202 dummyDesc.fWidth = 34; | 202 dummyDesc.fWidth = 34; |
| 203 dummyDesc.fHeight = 18; | 203 dummyDesc.fHeight = 18; |
| 204 SkAutoTUnref<GrTexture> dummyTexture1( | 204 SkAutoTUnref<GrTexture> dummyTexture1( |
| 205 context->textureProvider()->createTexture(dummyDesc, false, NULL, 0)); | 205 context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0))
; |
| 206 dummyDesc.fFlags = kNone_GrSurfaceFlags; | 206 dummyDesc.fFlags = kNone_GrSurfaceFlags; |
| 207 dummyDesc.fConfig = kAlpha_8_GrPixelConfig; | 207 dummyDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 208 dummyDesc.fWidth = 16; | 208 dummyDesc.fWidth = 16; |
| 209 dummyDesc.fHeight = 22; | 209 dummyDesc.fHeight = 22; |
| 210 SkAutoTUnref<GrTexture> dummyTexture2( | 210 SkAutoTUnref<GrTexture> dummyTexture2( |
| 211 context->textureProvider()->createTexture(dummyDesc, false, NULL, 0)); | 211 context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0))
; |
| 212 | 212 |
| 213 if (!dummyTexture1 || ! dummyTexture2) { | 213 if (!dummyTexture1 || ! dummyTexture2) { |
| 214 SkDebugf("Could not allocate dummy textures"); | 214 SkDebugf("Could not allocate dummy textures"); |
| 215 return false; | 215 return false; |
| 216 } | 216 } |
| 217 | 217 |
| 218 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()}; | 218 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()}; |
| 219 | 219 |
| 220 // dummy scissor state | 220 // dummy scissor state |
| 221 GrScissorState scissor; | 221 GrScissorState scissor; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 } | 296 } |
| 297 #endif | 297 #endif |
| 298 GrTestTarget target; | 298 GrTestTarget target; |
| 299 context->getTestTarget(&target); | 299 context->getTestTarget(&target); |
| 300 REPORTER_ASSERT(reporter, target.target()->programUnitTest(context,
maxStages)); | 300 REPORTER_ASSERT(reporter, target.target()->programUnitTest(context,
maxStages)); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 #endif | 305 #endif |
| OLD | NEW |