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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 GrUniqueKey::Builder builder(&key, kDomain, 2); | 167 GrUniqueKey::Builder builder(&key, kDomain, 2); |
168 builder[0] = texDesc.fOrigin; | 168 builder[0] = texDesc.fOrigin; |
169 builder[1] = texDesc.fSampleCnt; | 169 builder[1] = texDesc.fSampleCnt; |
170 builder.finish(); | 170 builder.finish(); |
171 | 171 |
172 GrTexture* texture = textureProvider->findAndRefTextureByUniqueKey(key); | 172 GrTexture* texture = textureProvider->findAndRefTextureByUniqueKey(key); |
173 if (!texture) { | 173 if (!texture) { |
174 texture = textureProvider->createTexture(texDesc, true); | 174 texture = textureProvider->createTexture(texDesc, true); |
175 if (texture) { | 175 if (texture) { |
176 textureProvider->assignUniqueKeyToTexture(key, texture); | 176 textureProvider->assignUniqueKeyToTexture(key, texture); |
| 177 texture->setFromRawPixels(true); |
177 } | 178 } |
178 } | 179 } |
179 return texture ? texture->asRenderTarget() : nullptr; | 180 return texture ? texture->asRenderTarget() : nullptr; |
180 } | 181 } |
181 | 182 |
182 static void set_random_xpf(GrPipelineBuilder* pipelineBuilder, GrProcessorTestDa
ta* d) { | 183 static void set_random_xpf(GrPipelineBuilder* pipelineBuilder, GrProcessorTestDa
ta* d) { |
183 SkAutoTUnref<const GrXPFactory> xpf(GrProcessorTestFactory<GrXPFactory>::Cre
ate(d)); | 184 SkAutoTUnref<const GrXPFactory> xpf(GrProcessorTestFactory<GrXPFactory>::Cre
ate(d)); |
184 SkASSERT(xpf); | 185 SkASSERT(xpf); |
185 pipelineBuilder->setXPFactory(xpf.get()); | 186 pipelineBuilder->setXPFactory(xpf.get()); |
186 } | 187 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 GrDrawingManager* drawingManager = context->drawingManager(); | 308 GrDrawingManager* drawingManager = context->drawingManager(); |
308 | 309 |
309 // setup dummy textures | 310 // setup dummy textures |
310 GrSurfaceDesc dummyDesc; | 311 GrSurfaceDesc dummyDesc; |
311 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 312 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
312 dummyDesc.fConfig = kSkia8888_GrPixelConfig; | 313 dummyDesc.fConfig = kSkia8888_GrPixelConfig; |
313 dummyDesc.fWidth = 34; | 314 dummyDesc.fWidth = 34; |
314 dummyDesc.fHeight = 18; | 315 dummyDesc.fHeight = 18; |
315 SkAutoTUnref<GrTexture> dummyTexture1( | 316 SkAutoTUnref<GrTexture> dummyTexture1( |
316 context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0))
; | 317 context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0))
; |
| 318 dummyTexture1->setFromRawPixels(true); |
| 319 dummyTexture1->setException(true); |
| 320 |
317 dummyDesc.fFlags = kNone_GrSurfaceFlags; | 321 dummyDesc.fFlags = kNone_GrSurfaceFlags; |
318 dummyDesc.fConfig = kAlpha_8_GrPixelConfig; | 322 dummyDesc.fConfig = kAlpha_8_GrPixelConfig; |
319 dummyDesc.fWidth = 16; | 323 dummyDesc.fWidth = 16; |
320 dummyDesc.fHeight = 22; | 324 dummyDesc.fHeight = 22; |
321 SkAutoTUnref<GrTexture> dummyTexture2( | 325 SkAutoTUnref<GrTexture> dummyTexture2( |
322 context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0))
; | 326 context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0))
; |
323 | 327 |
324 if (!dummyTexture1 || ! dummyTexture2) { | 328 if (!dummyTexture1 || ! dummyTexture2) { |
325 SkDebugf("Could not allocate dummy textures"); | 329 SkDebugf("Could not allocate dummy textures"); |
326 return false; | 330 return false; |
327 } | 331 } |
| 332 dummyTexture2->setFromRawPixels(true); |
| 333 dummyTexture2->setException(true); |
328 | 334 |
329 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()}; | 335 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()}; |
330 | 336 |
331 // dummy scissor state | 337 // dummy scissor state |
332 GrScissorState scissor; | 338 GrScissorState scissor; |
333 | 339 |
334 // wide open clip | 340 // wide open clip |
335 GrClip clip; | 341 GrClip clip; |
336 | 342 |
337 SkRandom random; | 343 SkRandom random; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 builder.addColorFragmentProcessor(blockFP); | 396 builder.addColorFragmentProcessor(blockFP); |
391 | 397 |
392 drawTarget->drawBatch(builder, batch); | 398 drawTarget->drawBatch(builder, batch); |
393 drawingManager->flush(); | 399 drawingManager->flush(); |
394 } | 400 } |
395 } | 401 } |
396 | 402 |
397 return true; | 403 return true; |
398 } | 404 } |
399 | 405 |
| 406 #if 0 |
400 DEF_GPUTEST(GLPrograms, reporter, factory) { | 407 DEF_GPUTEST(GLPrograms, reporter, factory) { |
401 // Set a locale that would cause shader compilation to fail because of , as
decimal separator. | 408 // Set a locale that would cause shader compilation to fail because of , as
decimal separator. |
402 // skbug 3330 | 409 // skbug 3330 |
403 #ifdef SK_BUILD_FOR_WIN | 410 #ifdef SK_BUILD_FOR_WIN |
404 GrAutoLocaleSetter als("sv-SE"); | 411 GrAutoLocaleSetter als("sv-SE"); |
405 #else | 412 #else |
406 GrAutoLocaleSetter als("sv_SE.UTF-8"); | 413 GrAutoLocaleSetter als("sv_SE.UTF-8"); |
407 #endif | 414 #endif |
408 | 415 |
409 // We suppress prints to avoid spew | 416 // We suppress prints to avoid spew |
410 GrContextOptions opts; | 417 GrContextOptions opts; |
411 opts.fSuppressPrints = true; | 418 opts.fSuppressPrints = true; |
412 GrContextFactory debugFactory(opts); | 419 GrContextFactory debugFactory(opts); |
413 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { | 420 for (int type = 2; type < GrContextFactory::kLastGLContextType; ++type) { |
414 GrContext* context = debugFactory.get(static_cast<GrContextFactory::GLCo
ntextType>(type)); | 421 GrContext* context = debugFactory.get(static_cast<GrContextFactory::GLCo
ntextType>(type)); |
415 if (context) { | 422 if (context) { |
416 GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu()); | 423 GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu()); |
417 | 424 |
418 /* | 425 /* |
419 * For the time being, we only support the test with desktop GL or f
or android on | 426 * For the time being, we only support the test with desktop GL or f
or android on |
420 * ARM platforms | 427 * ARM platforms |
421 * TODO When we run ES 3.00 GLSL in more places, test again | 428 * TODO When we run ES 3.00 GLSL in more places, test again |
422 */ | 429 */ |
423 int maxStages; | 430 int maxStages; |
(...skipping 21 matching lines...) Expand all Loading... |
445 #endif | 452 #endif |
446 GrTestTarget testTarget; | 453 GrTestTarget testTarget; |
447 context->getTestTarget(&testTarget); | 454 context->getTestTarget(&testTarget); |
448 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest( | 455 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest( |
449 context, testTarget.target(), maxSta
ges)); | 456 context, testTarget.target(), maxSta
ges)); |
450 } | 457 } |
451 } | 458 } |
452 } | 459 } |
453 | 460 |
454 #endif | 461 #endif |
| 462 #endif |
OLD | NEW |