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

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 1734043002: Revert of Move Budgeted enum out of SkSurface, use in GrTextureProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « tests/FloatingPointTextureTest.cpp ('k') | tests/GpuDrawPathTest.cpp » ('j') | 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 GrUniqueKey key; 164 GrUniqueKey key;
165 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); 165 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
166 GrUniqueKey::Builder builder(&key, kDomain, 2); 166 GrUniqueKey::Builder builder(&key, kDomain, 2);
167 builder[0] = texDesc.fOrigin; 167 builder[0] = texDesc.fOrigin;
168 builder[1] = texDesc.fSampleCnt; 168 builder[1] = texDesc.fSampleCnt;
169 builder.finish(); 169 builder.finish();
170 170
171 GrTexture* texture = textureProvider->findAndRefTextureByUniqueKey(key); 171 GrTexture* texture = textureProvider->findAndRefTextureByUniqueKey(key);
172 if (!texture) { 172 if (!texture) {
173 texture = textureProvider->createTexture(texDesc, SkBudgeted::kYes); 173 texture = textureProvider->createTexture(texDesc, true);
174 if (texture) { 174 if (texture) {
175 textureProvider->assignUniqueKeyToTexture(key, texture); 175 textureProvider->assignUniqueKeyToTexture(key, texture);
176 } 176 }
177 } 177 }
178 return texture ? texture->asRenderTarget() : nullptr; 178 return texture ? texture->asRenderTarget() : nullptr;
179 } 179 }
180 180
181 static void set_random_xpf(GrPipelineBuilder* pipelineBuilder, GrProcessorTestDa ta* d) { 181 static void set_random_xpf(GrPipelineBuilder* pipelineBuilder, GrProcessorTestDa ta* d) {
182 SkAutoTUnref<const GrXPFactory> xpf(GrProcessorTestFactory<GrXPFactory>::Cre ate(d)); 182 SkAutoTUnref<const GrXPFactory> xpf(GrProcessorTestFactory<GrXPFactory>::Cre ate(d));
183 SkASSERT(xpf); 183 SkASSERT(xpf);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { 303 bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
304 GrDrawingManager* drawingManager = context->drawingManager(); 304 GrDrawingManager* drawingManager = context->drawingManager();
305 305
306 // setup dummy textures 306 // setup dummy textures
307 GrSurfaceDesc dummyDesc; 307 GrSurfaceDesc dummyDesc;
308 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag; 308 dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
309 dummyDesc.fConfig = kSkia8888_GrPixelConfig; 309 dummyDesc.fConfig = kSkia8888_GrPixelConfig;
310 dummyDesc.fWidth = 34; 310 dummyDesc.fWidth = 34;
311 dummyDesc.fHeight = 18; 311 dummyDesc.fHeight = 18;
312 SkAutoTUnref<GrTexture> dummyTexture1( 312 SkAutoTUnref<GrTexture> dummyTexture1(
313 context->textureProvider()->createTexture(dummyDesc, SkBudgeted::kNo, nu llptr, 0)); 313 context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0)) ;
314 dummyDesc.fFlags = kNone_GrSurfaceFlags; 314 dummyDesc.fFlags = kNone_GrSurfaceFlags;
315 dummyDesc.fConfig = kAlpha_8_GrPixelConfig; 315 dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
316 dummyDesc.fWidth = 16; 316 dummyDesc.fWidth = 16;
317 dummyDesc.fHeight = 22; 317 dummyDesc.fHeight = 22;
318 SkAutoTUnref<GrTexture> dummyTexture2( 318 SkAutoTUnref<GrTexture> dummyTexture2(
319 context->textureProvider()->createTexture(dummyDesc, SkBudgeted::kNo, nu llptr, 0)); 319 context->textureProvider()->createTexture(dummyDesc, false, nullptr, 0)) ;
320 320
321 if (!dummyTexture1 || ! dummyTexture2) { 321 if (!dummyTexture1 || ! dummyTexture2) {
322 SkDebugf("Could not allocate dummy textures"); 322 SkDebugf("Could not allocate dummy textures");
323 return false; 323 return false;
324 } 324 }
325 325
326 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()}; 326 GrTexture* dummyTextures[] = {dummyTexture1.get(), dummyTexture2.get()};
327 327
328 // dummy scissor state 328 // dummy scissor state
329 GrScissorState scissor; 329 GrScissorState scissor;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
375 SkAutoTUnref<GrRenderTarget> rt( 375 SkAutoTUnref<GrRenderTarget> rt(
376 context->textureProvider()->createTexture(rtDesc, SkBudgeted::kNo)->asRe nderTarget()); 376 context->textureProvider()->createTexture(rtDesc, false)->asRenderTarget ());
377 int fpFactoryCnt = GrProcessorTestFactory<GrFragmentProcessor>::Count(); 377 int fpFactoryCnt = GrProcessorTestFactory<GrFragmentProcessor>::Count();
378 for (int i = 0; i < fpFactoryCnt; ++i) { 378 for (int i = 0; i < fpFactoryCnt; ++i) {
379 // Since FP factories internally randomize, call each 10 times. 379 // Since FP factories internally randomize, call each 10 times.
380 for (int j = 0; j < 10; ++j) { 380 for (int j = 0; j < 10; ++j) {
381 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)) ; 381 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)) ;
382 SkASSERT(batch); 382 SkASSERT(batch);
383 GrProcessorTestData ptd(&random, context, context->caps(), rt, dummy Textures); 383 GrProcessorTestData ptd(&random, context, context->caps(), rt, dummy Textures);
384 GrPipelineBuilder builder; 384 GrPipelineBuilder builder;
385 builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_ Mode))->unref(); 385 builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_ Mode))->unref();
386 builder.setRenderTarget(rt); 386 builder.setRenderTarget(rt);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « tests/FloatingPointTextureTest.cpp ('k') | tests/GpuDrawPathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698