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

Side by Side Diff: tests/GLInterfaceValidationTest.cpp

Issue 1448883002: Make NVPR a GL context option instead of a GL context (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-02-other-tests-refactor
Patch Set: Created 5 years 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
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 #include "Test.h" 8 #include "Test.h"
9 9
10 // This is a GPU-backend specific test 10 // This is a GPU-backend specific test
11 #if SK_SUPPORT_GPU 11 #if SK_SUPPORT_GPU
12 12
13 #include "GrContextFactory.h" 13 #include "GrContextFactory.h"
14 14
15 DEF_GPUTEST(GLInterfaceValidation, reporter, factory) { 15 DEF_GPUTEST(GLInterfaceValidation, reporter, /*factory*/) {
16 for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) { 16 GrContextFactory testFactory;
17 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext Type)i;
18 // this forces the factory to make the context if it hasn't yet
19 GrContextFactory::ContextInfo* contextInfo = factory->getContextInfo(glC txType);
20 SkGLContext* glCtx = contextInfo ? contextInfo->fGLContext : nullptr;
21 17
22 // We're supposed to fail the NVPR context type when we the native conte xt that does not 18 // Test that if we do not have NV_path_rendering -related GL extensions,
23 // support the NVPR extension. 19 // GrContextFactory::get(.., kEnableNVPR_GLContextOptions) always returns nu llptr.
24 if (GrContextFactory::kNVPR_GLContextType == glCtxType && 20 for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) {
25 factory->getContextInfo(GrContextFactory::kNative_GLContextType) && 21 GrContextFactory::GLContextType glCtxType = static_cast<GrContextFactory ::GLContextType>(i);
26 !factory->getContextInfo(GrContextFactory::kNative_GLContextType)->f GLContext->gl()->hasExtension("GL_NV_path_rendering")) { 22 GrContextFactory::ContextInfo* context =
27 REPORTER_ASSERT(reporter, nullptr == glCtx); 23 testFactory.getContextInfo(glCtxType, kNone_GrGLStandard,
24 GrContextFactory::kNone_GLContextOpti ons);
25 if (!context) {
28 continue; 26 continue;
29 } 27 }
30 28
31 REPORTER_ASSERT(reporter, glCtx); 29 SkGLContext* glContext = context->fGLContext;
32 if (glCtx) { 30 REPORTER_ASSERT(reporter, glContext->gl()->validate());
33 const GrGLInterface* interface = glCtx->gl(); 31
34 REPORTER_ASSERT(reporter, interface->validate()); 32 if (!(glContext->gl()->hasExtension("GL_NV_path_rendering") ||
33 glContext->gl()->hasExtension("GL_CHROMIUM_path_rendering"))) {
34 REPORTER_ASSERT(reporter,
35 nullptr == testFactory.getContextInfo(
36 glCtxType,
37 kNone_GrGLStandard,
38 GrContextFactory::kEnableNVPR_GLContextOptio ns));
35 } 39 }
36 } 40 }
41
37 } 42 }
38 43
39 #endif 44 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698