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); |
kkinnunen | 9e61bb7 | 2014-10-09 05:24:15 -0700 | [diff] [blame] | 20 | SkGLContext* glCtx = 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 && |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 25 | factory->getGLContext(GrContextFactory::kNative_GLContextType) && |
kkinnunen | 30bc88c | 2014-10-15 23:03:54 -0700 | [diff] [blame] | 26 | !factory->getGLContext(GrContextFactory::kNative_GLContextType)->gl()->hasExtension("GL_NV_path_rendering")) { |
kkinnunen | 9e61bb7 | 2014-10-09 05:24:15 -0700 | [diff] [blame] | 27 | REPORTER_ASSERT(reporter, NULL == glCtx); |
commit-bot@chromium.org | d8ed851 | 2014-01-24 20:49:44 +0000 | [diff] [blame] | 28 | continue; |
| 29 | } |
| 30 | |
kkinnunen | 9e61bb7 | 2014-10-09 05:24:15 -0700 | [diff] [blame] | 31 | REPORTER_ASSERT(reporter, glCtx); |
| 32 | if (glCtx) { |
| 33 | const GrGLInterface* interface = glCtx->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 |