OLD | NEW |
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 GrContextFactory testFactory; | 16 GrContextFactory testFactory; |
17 | 17 |
18 // Test that if we do not have NV_path_rendering -related GL extensions, | 18 // Test that if we do not have NV_path_rendering -related GL extensions, |
19 // GrContextFactory::get(.., kEnableNVPR_GLContextOptions) always returns nu
llptr. | 19 // GrContextFactory::get(.., kEnableNVPR_GLContextOptions) always returns nu
llptr. |
20 for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { | 20 for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { |
21 GrContextFactory::GLContextType glCtxType = static_cast<GrContextFactory
::GLContextType>(i); | 21 GrContextFactory::GLContextType glCtxType = static_cast<GrContextFactory
::GLContextType>(i); |
22 GrContextFactory::ContextInfo* context = | 22 GrContextFactory::ContextInfo* context = |
23 testFactory.getContextInfo(glCtxType, kNone_GrGLStandard, | 23 testFactory.getContextInfo(glCtxType, GrContextFactory::kNone_GL
ContextOptions); |
24 GrContextFactory::kNone_GLContextOpti
ons); | |
25 if (!context) { | 24 if (!context) { |
26 continue; | 25 continue; |
27 } | 26 } |
28 | 27 |
29 SkGLContext* glContext = context->fGLContext; | 28 SkGLContext* glContext = context->fGLContext; |
30 REPORTER_ASSERT(reporter, glContext->gl()->validate()); | 29 REPORTER_ASSERT(reporter, glContext->gl()->validate()); |
31 | 30 |
32 if (!(glContext->gl()->hasExtension("GL_NV_path_rendering") || | 31 if (!(glContext->gl()->hasExtension("GL_NV_path_rendering") || |
33 glContext->gl()->hasExtension("GL_CHROMIUM_path_rendering"))) { | 32 glContext->gl()->hasExtension("GL_CHROMIUM_path_rendering"))) { |
34 REPORTER_ASSERT(reporter, | 33 REPORTER_ASSERT(reporter, |
35 nullptr == testFactory.getContextInfo( | 34 nullptr == testFactory.getContextInfo( |
36 glCtxType, | 35 glCtxType, |
37 kNone_GrGLStandard, | |
38 GrContextFactory::kEnableNVPR_GLContextOptio
ns)); | 36 GrContextFactory::kEnableNVPR_GLContextOptio
ns)); |
39 } | 37 } |
40 } | 38 } |
41 | 39 |
42 } | 40 } |
43 | 41 |
44 #endif | 42 #endif |
OLD | NEW |