| 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 |
| 11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
| 12 | 12 |
| 13 #if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 13 #if SK_SUPPORT_GPU && SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
| 14 | 14 |
| 15 #include "GrAutoLocaleSetter.h" | 15 #include "GrAutoLocaleSetter.h" |
| 16 #include "GrBatchTest.h" | 16 #include "GrBatchTest.h" |
| 17 #include "GrContextFactory.h" | 17 #include "GrContextFactory.h" |
| 18 #include "GrDrawContext.h" | 18 #include "GrDrawContextPriv.h" |
| 19 #include "GrDrawingManager.h" | 19 #include "GrDrawingManager.h" |
| 20 #include "GrInvariantOutput.h" | 20 #include "GrInvariantOutput.h" |
| 21 #include "GrPipeline.h" | 21 #include "GrPipeline.h" |
| 22 #include "GrResourceProvider.h" | 22 #include "GrResourceProvider.h" |
| 23 #include "GrTest.h" | 23 #include "GrTest.h" |
| 24 #include "GrXferProcessor.h" | 24 #include "GrXferProcessor.h" |
| 25 #include "SkChecksum.h" | 25 #include "SkChecksum.h" |
| 26 #include "SkRandom.h" | 26 #include "SkRandom.h" |
| 27 #include "Test.h" | 27 #include "Test.h" |
| 28 | 28 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 set_random_xpf(&pipelineBuilder, &ptd); | 354 set_random_xpf(&pipelineBuilder, &ptd); |
| 355 set_random_state(&pipelineBuilder, &random); | 355 set_random_state(&pipelineBuilder, &random); |
| 356 set_random_stencil(&pipelineBuilder, &random); | 356 set_random_stencil(&pipelineBuilder, &random); |
| 357 | 357 |
| 358 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt)); | 358 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt)); |
| 359 if (!drawContext) { | 359 if (!drawContext) { |
| 360 SkDebugf("Could not allocate drawContext"); | 360 SkDebugf("Could not allocate drawContext"); |
| 361 return false; | 361 return false; |
| 362 } | 362 } |
| 363 | 363 |
| 364 drawContext->internal_drawBatch(pipelineBuilder, batch); | 364 drawContext->drawContextPriv().testingOnly_drawBatch(pipelineBuilder, ba
tch); |
| 365 } | 365 } |
| 366 // Flush everything, test passes if flush is successful(ie, no asserts are h
it, no crashes) | 366 // Flush everything, test passes if flush is successful(ie, no asserts are h
it, no crashes) |
| 367 drawingManager->flush(); | 367 drawingManager->flush(); |
| 368 | 368 |
| 369 // Validate that GrFPs work correctly without an input. | 369 // Validate that GrFPs work correctly without an input. |
| 370 GrSurfaceDesc rtDesc; | 370 GrSurfaceDesc rtDesc; |
| 371 rtDesc.fWidth = kRenderTargetWidth; | 371 rtDesc.fWidth = kRenderTargetWidth; |
| 372 rtDesc.fHeight = kRenderTargetHeight; | 372 rtDesc.fHeight = kRenderTargetHeight; |
| 373 rtDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 373 rtDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 374 rtDesc.fConfig = kRGBA_8888_GrPixelConfig; | 374 rtDesc.fConfig = kRGBA_8888_GrPixelConfig; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 391 SkAutoTUnref<const GrFragmentProcessor> blockFP( | 391 SkAutoTUnref<const GrFragmentProcessor> blockFP( |
| 392 BlockInputFragmentProcessor::Create(fp)); | 392 BlockInputFragmentProcessor::Create(fp)); |
| 393 builder.addColorFragmentProcessor(blockFP); | 393 builder.addColorFragmentProcessor(blockFP); |
| 394 | 394 |
| 395 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt)); | 395 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(rt)); |
| 396 if (!drawContext) { | 396 if (!drawContext) { |
| 397 SkDebugf("Could not allocate a drawcontext"); | 397 SkDebugf("Could not allocate a drawcontext"); |
| 398 return false; | 398 return false; |
| 399 } | 399 } |
| 400 | 400 |
| 401 drawContext->internal_drawBatch(builder, batch); | 401 drawContext->drawContextPriv().testingOnly_drawBatch(builder, batch)
; |
| 402 drawingManager->flush(); | 402 drawingManager->flush(); |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 | 405 |
| 406 return true; | 406 return true; |
| 407 } | 407 } |
| 408 | 408 |
| 409 static int get_glprograms_max_stages(GrContext* context) { | 409 static int get_glprograms_max_stages(GrContext* context) { |
| 410 GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu()); | 410 GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu()); |
| 411 /* | 411 /* |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 GrContextOptions opts; | 457 GrContextOptions opts; |
| 458 opts.fSuppressPrints = true; | 458 opts.fSuppressPrints = true; |
| 459 GrContextFactory debugFactory(opts); | 459 GrContextFactory debugFactory(opts); |
| 460 skiatest::RunWithGPUTestContexts(test_glprograms_native, skiatest::kNative_G
PUTestContexts, | 460 skiatest::RunWithGPUTestContexts(test_glprograms_native, skiatest::kNative_G
PUTestContexts, |
| 461 reporter, &debugFactory); | 461 reporter, &debugFactory); |
| 462 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts, | 462 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts, |
| 463 skiatest::kOther_GPUTestContexts, reporter,
&debugFactory); | 463 skiatest::kOther_GPUTestContexts, reporter,
&debugFactory); |
| 464 } | 464 } |
| 465 | 465 |
| 466 #endif | 466 #endif |
| OLD | NEW |