bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
bsalomon@google.com | a68937c | 2012-08-03 15:00:52 +0000 | [diff] [blame] | 8 | #include "Test.h" |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 9 | |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame] | 10 | // This is a GPU-backend specific test |
| 11 | #if SK_SUPPORT_GPU |
| 12 | |
bsalomon@google.com | 7fa1bb4 | 2013-03-11 20:22:38 +0000 | [diff] [blame] | 13 | #include "GrContextFactory.h" |
bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 14 | |
tfarina@chromium.org | 4ee16bf | 2014-01-10 22:08:27 +0000 | [diff] [blame] | 15 | DEF_GPUTEST(GLInterfaceValidation, reporter, factory) { |
bsalomon@google.com | 7fa1bb4 | 2013-03-11 20:22:38 +0000 | [diff] [blame] | 16 | for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) { |
| 17 | GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType)i; |
| 18 | // this forces the factory to make the context if it hasn't yet |
| 19 | factory->get(glCtxType); |
| 20 | SkGLContextHelper* glCtxHelper = factory->getGLContext(glCtxType); |
commit-bot@chromium.org | d8ed851 | 2014-01-24 20:49:44 +0000 | [diff] [blame] | 21 | |
| 22 | // We're supposed to fail the NVPR context type when we the native context that does not |
| 23 | // support the NVPR extension. |
| 24 | if (GrContextFactory::kNVPR_GLContextType == glCtxType && |
| 25 | NULL != factory->getGLContext(GrContextFactory::kNative_GLContextType) && |
| 26 | !factory->getGLContext(GrContextFactory::kNative_GLContextType)->hasExtension("GL_NV_path_rendering")) { |
| 27 | REPORTER_ASSERT(reporter, NULL == glCtxHelper); |
| 28 | continue; |
| 29 | } |
| 30 | |
bsalomon@google.com | 7fa1bb4 | 2013-03-11 20:22:38 +0000 | [diff] [blame] | 31 | REPORTER_ASSERT(reporter, NULL != glCtxHelper); |
| 32 | if (NULL != glCtxHelper) { |
| 33 | const GrGLInterface* interface = glCtxHelper->gl(); |
commit-bot@chromium.org | 9e90aed | 2014-01-16 16:35:09 +0000 | [diff] [blame] | 34 | REPORTER_ASSERT(reporter, interface->validate()); |
bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame] | 39 | #endif |