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

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 1450513002: Revert of Update testing frameworks/tests for MDB (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « 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
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 0xffff, 294 0xffff,
295 0xffff); 295 0xffff);
296 296
297 if (random->nextBool()) { 297 if (random->nextBool()) {
298 pipelineBuilder->setStencil(kDoesWriteStencil); 298 pipelineBuilder->setStencil(kDoesWriteStencil);
299 } else { 299 } else {
300 pipelineBuilder->setStencil(kDoesNotWriteStencil); 300 pipelineBuilder->setStencil(kDoesNotWriteStencil);
301 } 301 }
302 } 302 }
303 303
304 bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { 304 bool GrDrawingManager::ProgramUnitTest(GrContext* context,
305 GrDrawTarget* drawTarget,
306 int maxStages) {
305 GrDrawingManager* drawingManager = context->drawingManager(); 307 GrDrawingManager* drawingManager = context->drawingManager();
306 308
307 // setup dummy textures 309 // setup dummy textures
308 GrSurfaceDesc dummyDesc; 310 GrSurfaceDesc dummyDesc;
309 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag; 311 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
310 dummyDesc.fConfig = kSkia8888_GrPixelConfig; 312 dummyDesc.fConfig = kSkia8888_GrPixelConfig;
311 dummyDesc.fWidth = 34; 313 dummyDesc.fWidth = 34;
312 dummyDesc.fHeight = 18; 314 dummyDesc.fHeight = 18;
313 SkAutoTUnref<GrTexture> dummyTexture1( 315 SkAutoTUnref<GrTexture> dummyTexture1(
314 context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0)) ; 316 context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0)) ;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 351
350 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)); 352 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
351 SkASSERT(batch); 353 SkASSERT(batch);
352 354
353 GrProcessorTestData ptd(&random, context, context->caps(), dummyTextures ); 355 GrProcessorTestData ptd(&random, context, context->caps(), dummyTextures );
354 set_random_color_coverage_stages(&pipelineBuilder, &ptd, maxStages); 356 set_random_color_coverage_stages(&pipelineBuilder, &ptd, maxStages);
355 set_random_xpf(&pipelineBuilder, &ptd); 357 set_random_xpf(&pipelineBuilder, &ptd);
356 set_random_state(&pipelineBuilder, &random); 358 set_random_state(&pipelineBuilder, &random);
357 set_random_stencil(&pipelineBuilder, &random); 359 set_random_stencil(&pipelineBuilder, &random);
358 360
359 GrTestTarget tt; 361 drawTarget->drawBatch(pipelineBuilder, batch);
360 context->getTestTarget(&tt);
361
362 tt.target()->drawBatch(pipelineBuilder, batch);
363 } 362 }
364 // Flush everything, test passes if flush is successful(ie, no asserts are h it, no crashes) 363 // Flush everything, test passes if flush is successful(ie, no asserts are h it, no crashes)
365 drawingManager->flush(); 364 drawingManager->flush();
366 365
367 // Validate that GrFPs work correctly without an input. 366 // Validate that GrFPs work correctly without an input.
368 GrSurfaceDesc rtDesc; 367 GrSurfaceDesc rtDesc;
369 rtDesc.fWidth = kRenderTargetWidth; 368 rtDesc.fWidth = kRenderTargetWidth;
370 rtDesc.fHeight = kRenderTargetHeight; 369 rtDesc.fHeight = kRenderTargetHeight;
371 rtDesc.fFlags = kRenderTarget_GrSurfaceFlag; 370 rtDesc.fFlags = kRenderTarget_GrSurfaceFlag;
372 rtDesc.fConfig = kRGBA_8888_GrPixelConfig; 371 rtDesc.fConfig = kRGBA_8888_GrPixelConfig;
(...skipping 10 matching lines...) Expand all
383 builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_ Mode))->unref(); 382 builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_ Mode))->unref();
384 builder.setRenderTarget(rt); 383 builder.setRenderTarget(rt);
385 builder.setClip(clip); 384 builder.setClip(clip);
386 385
387 SkAutoTUnref<const GrFragmentProcessor> fp( 386 SkAutoTUnref<const GrFragmentProcessor> fp(
388 GrProcessorTestFactory<GrFragmentProcessor>::CreateIdx(i, &ptd)) ; 387 GrProcessorTestFactory<GrFragmentProcessor>::CreateIdx(i, &ptd)) ;
389 SkAutoTUnref<const GrFragmentProcessor> blockFP( 388 SkAutoTUnref<const GrFragmentProcessor> blockFP(
390 BlockInputFragmentProcessor::Create(fp)); 389 BlockInputFragmentProcessor::Create(fp));
391 builder.addColorFragmentProcessor(blockFP); 390 builder.addColorFragmentProcessor(blockFP);
392 391
393 GrTestTarget tt; 392 drawTarget->drawBatch(builder, batch);
394 context->getTestTarget(&tt);
395
396 tt.target()->drawBatch(builder, batch);
397 drawingManager->flush(); 393 drawingManager->flush();
398 } 394 }
399 } 395 }
400 396
401 return true; 397 return true;
402 } 398 }
403 399
404 DEF_GPUTEST(GLPrograms, reporter, factory) { 400 DEF_GPUTEST(GLPrograms, reporter, factory) {
405 // Set a locale that would cause shader compilation to fail because of , as decimal separator. 401 // Set a locale that would cause shader compilation to fail because of , as decimal separator.
406 // skbug 3330 402 // skbug 3330
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 maxStages = 2; 436 maxStages = 2;
441 } 437 }
442 #endif 438 #endif
443 #if SK_COMMAND_BUFFER 439 #if SK_COMMAND_BUFFER
444 // Some long shaders run out of temporary registers in the D3D compi ler on ANGLE. 440 // Some long shaders run out of temporary registers in the D3D compi ler on ANGLE.
445 // TODO(hendrikw): This only needs to happen with the ANGLE comand b uffer backend. 441 // TODO(hendrikw): This only needs to happen with the ANGLE comand b uffer backend.
446 if (type == GrContextFactory::kCommandBuffer_GLContextType) { 442 if (type == GrContextFactory::kCommandBuffer_GLContextType) {
447 maxStages = 2; 443 maxStages = 2;
448 } 444 }
449 #endif 445 #endif
450 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(context, maxStages)); 446 GrTestTarget testTarget;
447 context->getTestTarget(&testTarget);
448 REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(
449 context, testTarget.target(), maxSta ges));
451 } 450 }
452 } 451 }
453 } 452 }
454 453
455 #endif 454 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698