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

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 1933053002: Use constexpr constructors of GrStencilSettings rather than hacky macro system (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 4 years, 7 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 | « src/gpu/text/GrStencilAndCoverTextContext.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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 // This is a GPU-backend specific test. It relies on static intializers to work 8 // This is a GPU-backend specific test. It relies on static intializers to work
9 9
10 #include "SkTypes.h" 10 #include "SkTypes.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 // If we don't have an MSAA rendertarget then we have to disable useHWAA 270 // If we don't have an MSAA rendertarget then we have to disable useHWAA
271 if ((state | GrPipelineBuilder::kHWAntialias_Flag) && 271 if ((state | GrPipelineBuilder::kHWAntialias_Flag) &&
272 !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled()) { 272 !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled()) {
273 state &= ~GrPipelineBuilder::kHWAntialias_Flag; 273 state &= ~GrPipelineBuilder::kHWAntialias_Flag;
274 } 274 }
275 pipelineBuilder->enableState(state); 275 pipelineBuilder->enableState(state);
276 } 276 }
277 277
278 // right now, the only thing we seem to care about in drawState's stencil is 'do esWrite()' 278 // right now, the only thing we seem to care about in drawState's stencil is 'do esWrite()'
279 static void set_random_stencil(GrPipelineBuilder* pipelineBuilder, SkRandom* ran dom) { 279 static void set_random_stencil(GrPipelineBuilder* pipelineBuilder, SkRandom* ran dom) {
280 GR_STATIC_CONST_SAME_STENCIL(kDoesWriteStencil, 280 static constexpr GrStencilSettings kDoesWriteStencil(
281 kReplace_StencilOp, 281 kReplace_StencilOp,
282 kReplace_StencilOp, 282 kReplace_StencilOp,
283 kAlways_StencilFunc, 283 kAlways_StencilFunc,
284 0xffff, 284 0xffff,
285 0xffff, 285 0xffff,
286 0xffff); 286 0xffff);
287 GR_STATIC_CONST_SAME_STENCIL(kDoesNotWriteStencil, 287 static constexpr GrStencilSettings kDoesNotWriteStencil(
288 kKeep_StencilOp, 288 kKeep_StencilOp,
289 kKeep_StencilOp, 289 kKeep_StencilOp,
290 kNever_StencilFunc, 290 kNever_StencilFunc,
291 0xffff, 291 0xffff,
292 0xffff, 292 0xffff,
293 0xffff); 293 0xffff);
294 294
295 if (random->nextBool()) { 295 if (random->nextBool()) {
296 pipelineBuilder->setStencil(kDoesWriteStencil); 296 pipelineBuilder->setStencil(kDoesWriteStencil);
297 } else { 297 } else {
298 pipelineBuilder->setStencil(kDoesNotWriteStencil); 298 pipelineBuilder->setStencil(kDoesNotWriteStencil);
299 } 299 }
300 } 300 }
301 301
302 bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { 302 bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
303 GrDrawingManager* drawingManager = context->drawingManager(); 303 GrDrawingManager* drawingManager = context->drawingManager();
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 GrContextOptions opts; 469 GrContextOptions opts;
470 opts.fSuppressPrints = true; 470 opts.fSuppressPrints = true;
471 sk_gpu_test::GrContextFactory debugFactory(opts); 471 sk_gpu_test::GrContextFactory debugFactory(opts);
472 skiatest::RunWithGPUTestContexts(test_glprograms_native, &is_native_gl_conte xt_type, 472 skiatest::RunWithGPUTestContexts(test_glprograms_native, &is_native_gl_conte xt_type,
473 reporter, &debugFactory); 473 reporter, &debugFactory);
474 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts, 474 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts,
475 &is_other_rendering_gl_context_type, report er, &debugFactory); 475 &is_other_rendering_gl_context_type, report er, &debugFactory);
476 } 476 }
477 477
478 #endif 478 #endif
OLDNEW
« no previous file with comments | « src/gpu/text/GrStencilAndCoverTextContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698