| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  340             return false; |  340             return false; | 
|  341         } |  341         } | 
|  342  |  342  | 
|  343         GrPipelineBuilder pipelineBuilder; |  343         GrPipelineBuilder pipelineBuilder; | 
|  344         pipelineBuilder.setRenderTarget(rt.get()); |  344         pipelineBuilder.setRenderTarget(rt.get()); | 
|  345         pipelineBuilder.setClip(clip); |  345         pipelineBuilder.setClip(clip); | 
|  346  |  346  | 
|  347         SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)); |  347         SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)); | 
|  348         SkASSERT(batch); |  348         SkASSERT(batch); | 
|  349  |  349  | 
|  350         GrProcessorDataManager procDataManager; |  350         GrProcessorTestData ptd(&random, context, fGpu->caps(), dummyTextures); | 
|  351         GrProcessorTestData ptd(&random, context, &procDataManager, fGpu->caps()
     , dummyTextures); |  | 
|  352         set_random_color_coverage_stages(&pipelineBuilder, &ptd, maxStages); |  351         set_random_color_coverage_stages(&pipelineBuilder, &ptd, maxStages); | 
|  353         set_random_xpf(&pipelineBuilder, &ptd); |  352         set_random_xpf(&pipelineBuilder, &ptd); | 
|  354         set_random_state(&pipelineBuilder, &random); |  353         set_random_state(&pipelineBuilder, &random); | 
|  355         set_random_stencil(&pipelineBuilder, &random); |  354         set_random_stencil(&pipelineBuilder, &random); | 
|  356  |  355  | 
|  357         this->drawBatch(pipelineBuilder, batch); |  356         this->drawBatch(pipelineBuilder, batch); | 
|  358     } |  357     } | 
|  359     // Flush everything, test passes if flush is successful(ie, no asserts are h
     it, no crashes) |  358     // Flush everything, test passes if flush is successful(ie, no asserts are h
     it, no crashes) | 
|  360     this->flush(); |  359     this->flush(); | 
|  361  |  360  | 
|  362     // Validate that GrFPs work correctly without an input. |  361     // Validate that GrFPs work correctly without an input. | 
|  363     GrSurfaceDesc rtDesc; |  362     GrSurfaceDesc rtDesc; | 
|  364     rtDesc.fWidth = kRenderTargetWidth; |  363     rtDesc.fWidth = kRenderTargetWidth; | 
|  365     rtDesc.fHeight = kRenderTargetHeight; |  364     rtDesc.fHeight = kRenderTargetHeight; | 
|  366     rtDesc.fFlags = kRenderTarget_GrSurfaceFlag; |  365     rtDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 
|  367     rtDesc.fConfig = kRGBA_8888_GrPixelConfig; |  366     rtDesc.fConfig = kRGBA_8888_GrPixelConfig; | 
|  368     SkAutoTUnref<GrRenderTarget> rt( |  367     SkAutoTUnref<GrRenderTarget> rt( | 
|  369         fContext->textureProvider()->createTexture(rtDesc, false)->asRenderTarge
     t()); |  368         fContext->textureProvider()->createTexture(rtDesc, false)->asRenderTarge
     t()); | 
|  370     int fpFactoryCnt = GrProcessorTestFactory<GrFragmentProcessor>::Count(); |  369     int fpFactoryCnt = GrProcessorTestFactory<GrFragmentProcessor>::Count(); | 
|  371     for (int i = 0; i < fpFactoryCnt; ++i) { |  370     for (int i = 0; i < fpFactoryCnt; ++i) { | 
|  372         // Since FP factories internally randomize, call each 10 times. |  371         // Since FP factories internally randomize, call each 10 times. | 
|  373         for (int j = 0; j < 10; ++j) { |  372         for (int j = 0; j < 10; ++j) { | 
|  374             SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context))
     ; |  373             SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context))
     ; | 
|  375             SkASSERT(batch); |  374             SkASSERT(batch); | 
|  376             GrProcessorDataManager procDataManager; |  375             GrProcessorTestData ptd(&random, context, this->caps(), dummyTexture
     s); | 
|  377             GrProcessorTestData ptd(&random, context, &procDataManager, this->ca
     ps(), |  | 
|  378                                     dummyTextures); |  | 
|  379             GrPipelineBuilder builder; |  376             GrPipelineBuilder builder; | 
|  380             builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_
     Mode))->unref(); |  377             builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_
     Mode))->unref(); | 
|  381             builder.setRenderTarget(rt); |  378             builder.setRenderTarget(rt); | 
|  382             builder.setClip(clip); |  379             builder.setClip(clip); | 
|  383  |  380  | 
|  384             SkAutoTUnref<const GrFragmentProcessor> fp( |  381             SkAutoTUnref<const GrFragmentProcessor> fp( | 
|  385                 GrProcessorTestFactory<GrFragmentProcessor>::CreateIdx(i, &ptd))
     ; |  382                 GrProcessorTestFactory<GrFragmentProcessor>::CreateIdx(i, &ptd))
     ; | 
|  386             SkAutoTUnref<const GrFragmentProcessor> blockFP( |  383             SkAutoTUnref<const GrFragmentProcessor> blockFP( | 
|  387                 BlockInputFragmentProcessor::Create(fp)); |  384                 BlockInputFragmentProcessor::Create(fp)); | 
|  388             builder.addColorFragmentProcessor(blockFP); |  385             builder.addColorFragmentProcessor(blockFP); | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  442             } |  439             } | 
|  443 #endif |  440 #endif | 
|  444             GrTestTarget target; |  441             GrTestTarget target; | 
|  445             context->getTestTarget(&target); |  442             context->getTestTarget(&target); | 
|  446             REPORTER_ASSERT(reporter, target.target()->programUnitTest(context, 
     maxStages)); |  443             REPORTER_ASSERT(reporter, target.target()->programUnitTest(context, 
     maxStages)); | 
|  447         } |  444         } | 
|  448     } |  445     } | 
|  449 } |  446 } | 
|  450  |  447  | 
|  451 #endif |  448 #endif | 
| OLD | NEW |