bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame] | 9 | |
bsalomon@google.com | a68937c | 2012-08-03 15:00:52 +0000 | [diff] [blame] | 10 | |
| 11 | #include "Test.h" |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame] | 12 | // This is a GPU-backend specific test |
| 13 | #if SK_SUPPORT_GPU |
| 14 | |
bsalomon@google.com | 7fa1bb4 | 2013-03-11 20:22:38 +0000 | [diff] [blame] | 15 | #include "GrContextFactory.h" |
bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 16 | |
bsalomon@google.com | 7fa1bb4 | 2013-03-11 20:22:38 +0000 | [diff] [blame] | 17 | static void GLInterfaceValidationTest(skiatest::Reporter* reporter, GrContextFactory* factory) { |
| 18 | for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) { |
| 19 | GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType)i; |
| 20 | // this forces the factory to make the context if it hasn't yet |
| 21 | factory->get(glCtxType); |
| 22 | SkGLContextHelper* glCtxHelper = factory->getGLContext(glCtxType); |
| 23 | REPORTER_ASSERT(reporter, NULL != glCtxHelper); |
| 24 | if (NULL != glCtxHelper) { |
| 25 | const GrGLInterface* interface = glCtxHelper->gl(); |
bsalomon@google.com | b447d21 | 2012-02-10 20:25:36 +0000 | [diff] [blame] | 26 | for (GrGLBinding binding = kFirstGrGLBinding; |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 27 | binding <= kLastGrGLBinding; |
| 28 | binding = static_cast<GrGLBinding>(binding << 1)) { |
bsalomon@google.com | 7fa1bb4 | 2013-03-11 20:22:38 +0000 | [diff] [blame] | 29 | if (interface->fBindingsExported & binding) { |
| 30 | REPORTER_ASSERT(reporter, interface->validate(binding)); |
bsalomon@google.com | 89ec61e | 2012-02-10 20:05:18 +0000 | [diff] [blame] | 31 | } |
| 32 | } |
bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 33 | } |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | |
| 38 | #include "TestClassDef.h" |
bsalomon@google.com | 7fa1bb4 | 2013-03-11 20:22:38 +0000 | [diff] [blame] | 39 | DEFINE_GPUTESTCLASS("GLInterfaceValidation", |
| 40 | GLInterfaceValidationTestClass, |
| 41 | GLInterfaceValidationTest) |
bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 42 | |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame] | 43 | #endif |