OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
| 8 #include "Test.h" |
| 9 #include "TestClassDef.h" |
9 | 10 |
10 | |
11 #include "Test.h" | |
12 // This is a GPU-backend specific test | 11 // This is a GPU-backend specific test |
13 #if SK_SUPPORT_GPU | 12 #if SK_SUPPORT_GPU |
14 | 13 |
15 #include "GrContextFactory.h" | 14 #include "GrContextFactory.h" |
16 | 15 |
17 static void GLInterfaceValidationTest(skiatest::Reporter* reporter, GrContextFac
tory* factory) { | 16 DEF_GPUTEST(GLInterfaceValidation, reporter, factory) { |
18 for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) { | 17 for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) { |
19 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext
Type)i; | 18 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext
Type)i; |
20 // this forces the factory to make the context if it hasn't yet | 19 // this forces the factory to make the context if it hasn't yet |
21 factory->get(glCtxType); | 20 factory->get(glCtxType); |
22 SkGLContextHelper* glCtxHelper = factory->getGLContext(glCtxType); | 21 SkGLContextHelper* glCtxHelper = factory->getGLContext(glCtxType); |
23 REPORTER_ASSERT(reporter, NULL != glCtxHelper); | 22 REPORTER_ASSERT(reporter, NULL != glCtxHelper); |
24 if (NULL != glCtxHelper) { | 23 if (NULL != glCtxHelper) { |
25 const GrGLInterface* interface = glCtxHelper->gl(); | 24 const GrGLInterface* interface = glCtxHelper->gl(); |
26 for (GrGLBinding binding = kFirstGrGLBinding; | 25 for (GrGLBinding binding = kFirstGrGLBinding; |
27 binding <= kLastGrGLBinding; | 26 binding <= kLastGrGLBinding; |
28 binding = static_cast<GrGLBinding>(binding << 1)) { | 27 binding = static_cast<GrGLBinding>(binding << 1)) { |
29 if (interface->fBindingsExported & binding) { | 28 if (interface->fBindingsExported & binding) { |
30 REPORTER_ASSERT(reporter, interface->validate(binding)); | 29 REPORTER_ASSERT(reporter, interface->validate(binding)); |
31 } | 30 } |
32 } | 31 } |
33 } | 32 } |
34 } | 33 } |
35 } | 34 } |
36 | 35 |
37 | |
38 #include "TestClassDef.h" | |
39 DEFINE_GPUTESTCLASS("GLInterfaceValidation", | |
40 GLInterfaceValidationTestClass, | |
41 GLInterfaceValidationTest) | |
42 | |
43 #endif | 36 #endif |
OLD | NEW |