Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 1574383002: Hide drawBatch on GrDrawTarget from test Methods (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rename internal Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/gpu/GrTest.cpp ('K') | « src/gpu/GrTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrDrawingManager.h" 19 #include "GrDrawingManager.h"
19 #include "GrInvariantOutput.h" 20 #include "GrInvariantOutput.h"
20 #include "GrPipeline.h" 21 #include "GrPipeline.h"
21 #include "GrResourceProvider.h" 22 #include "GrResourceProvider.h"
22 #include "GrTest.h" 23 #include "GrTest.h"
23 #include "GrXferProcessor.h" 24 #include "GrXferProcessor.h"
24 #include "SkChecksum.h" 25 #include "SkChecksum.h"
25 #include "SkRandom.h" 26 #include "SkRandom.h"
26 #include "Test.h" 27 #include "Test.h"
27 28
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 350
350 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)); 351 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
351 SkASSERT(batch); 352 SkASSERT(batch);
352 353
353 GrProcessorTestData ptd(&random, context, context->caps(), rt, dummyText ures); 354 GrProcessorTestData ptd(&random, context, context->caps(), rt, dummyText ures);
354 set_random_color_coverage_stages(&pipelineBuilder, &ptd, maxStages); 355 set_random_color_coverage_stages(&pipelineBuilder, &ptd, maxStages);
355 set_random_xpf(&pipelineBuilder, &ptd); 356 set_random_xpf(&pipelineBuilder, &ptd);
356 set_random_state(&pipelineBuilder, &random); 357 set_random_state(&pipelineBuilder, &random);
357 set_random_stencil(&pipelineBuilder, &random); 358 set_random_stencil(&pipelineBuilder, &random);
358 359
359 GrTestTarget tt; 360 GrDrawContext* drawContext = context->drawContext(rt);
360 context->getTestTarget(&tt, rt);
361 361
362 tt.target()->drawBatch(pipelineBuilder, batch); 362 drawContext->internal_drawBatch(&pipelineBuilder, batch);
363 } 363 }
364 // Flush everything, test passes if flush is successful(ie, no asserts are h it, no crashes) 364 // Flush everything, test passes if flush is successful(ie, no asserts are h it, no crashes)
365 drawingManager->flush(); 365 drawingManager->flush();
366 366
367 // Validate that GrFPs work correctly without an input. 367 // Validate that GrFPs work correctly without an input.
368 GrSurfaceDesc rtDesc; 368 GrSurfaceDesc rtDesc;
369 rtDesc.fWidth = kRenderTargetWidth; 369 rtDesc.fWidth = kRenderTargetWidth;
370 rtDesc.fHeight = kRenderTargetHeight; 370 rtDesc.fHeight = kRenderTargetHeight;
371 rtDesc.fFlags = kRenderTarget_GrSurfaceFlag; 371 rtDesc.fFlags = kRenderTarget_GrSurfaceFlag;
372 rtDesc.fConfig = kRGBA_8888_GrPixelConfig; 372 rtDesc.fConfig = kRGBA_8888_GrPixelConfig;
(...skipping 10 matching lines...) Expand all
383 builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_ Mode))->unref(); 383 builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_ Mode))->unref();
384 builder.setRenderTarget(rt); 384 builder.setRenderTarget(rt);
385 builder.setClip(clip); 385 builder.setClip(clip);
386 386
387 SkAutoTUnref<const GrFragmentProcessor> fp( 387 SkAutoTUnref<const GrFragmentProcessor> fp(
388 GrProcessorTestFactory<GrFragmentProcessor>::CreateIdx(i, &ptd)) ; 388 GrProcessorTestFactory<GrFragmentProcessor>::CreateIdx(i, &ptd)) ;
389 SkAutoTUnref<const GrFragmentProcessor> blockFP( 389 SkAutoTUnref<const GrFragmentProcessor> blockFP(
390 BlockInputFragmentProcessor::Create(fp)); 390 BlockInputFragmentProcessor::Create(fp));
391 builder.addColorFragmentProcessor(blockFP); 391 builder.addColorFragmentProcessor(blockFP);
392 392
393 GrTestTarget tt; 393 GrDrawContext* drawContext = context->drawContext(rt);
394 context->getTestTarget(&tt, rt); 394 drawContext->internal_drawBatch(&builder, batch);
395
396 tt.target()->drawBatch(builder, batch);
397 drawingManager->flush(); 395 drawingManager->flush();
398 } 396 }
399 } 397 }
400 398
401 return true; 399 return true;
402 } 400 }
403 401
404 static int get_glprograms_max_stages(GrContext* context) { 402 static int get_glprograms_max_stages(GrContext* context) {
405 GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu()); 403 GrGLGpu* gpu = static_cast<GrGLGpu*>(context->getGpu());
406 /* 404 /*
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 GrContextOptions opts; 450 GrContextOptions opts;
453 opts.fSuppressPrints = true; 451 opts.fSuppressPrints = true;
454 GrContextFactory debugFactory(opts); 452 GrContextFactory debugFactory(opts);
455 skiatest::RunWithGPUTestContexts(test_glprograms_native, skiatest::kNative_G PUTestContexts, 453 skiatest::RunWithGPUTestContexts(test_glprograms_native, skiatest::kNative_G PUTestContexts,
456 reporter, &debugFactory); 454 reporter, &debugFactory);
457 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts, 455 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts,
458 skiatest::kOther_GPUTestContexts, reporter, &debugFactory); 456 skiatest::kOther_GPUTestContexts, reporter, &debugFactory);
459 } 457 }
460 458
461 #endif 459 #endif
OLDNEW
« src/gpu/GrTest.cpp ('K') | « src/gpu/GrTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698