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

Side by Side Diff: tests/GLProgramsTest.cpp

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