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 | |
kkinnunen | eeebdb5 | 2015-12-01 05:10:48 -0800 | [diff] [blame] | 15 | DEF_GPUTEST(GLInterfaceValidation, reporter, /*factory*/) { |
| 16 | GrContextFactory testFactory; |
commit-bot@chromium.org | d8ed851 | 2014-01-24 20:49:44 +0000 | [diff] [blame] | 17 | |
kkinnunen | eeebdb5 | 2015-12-01 05:10:48 -0800 | [diff] [blame] | 18 | // Test that if we do not have NV_path_rendering -related GL extensions, |
| 19 | // GrContextFactory::get(.., kEnableNVPR_GLContextOptions) always returns nullptr. |
| 20 | for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { |
| 21 | GrContextFactory::GLContextType glCtxType = static_cast<GrContextFactory::GLContextType>(i); |
| 22 | GrContextFactory::ContextInfo* context = |
| 23 | testFactory.getContextInfo(glCtxType, kNone_GrGLStandard, |
| 24 | GrContextFactory::kNone_GLContextOptions); |
| 25 | if (!context) { |
commit-bot@chromium.org | d8ed851 | 2014-01-24 20:49:44 +0000 | [diff] [blame] | 26 | continue; |
| 27 | } |
| 28 | |
kkinnunen | eeebdb5 | 2015-12-01 05:10:48 -0800 | [diff] [blame] | 29 | SkGLContext* glContext = context->fGLContext; |
| 30 | REPORTER_ASSERT(reporter, glContext->gl()->validate()); |
| 31 | |
| 32 | if (!(glContext->gl()->hasExtension("GL_NV_path_rendering") || |
| 33 | glContext->gl()->hasExtension("GL_CHROMIUM_path_rendering"))) { |
| 34 | REPORTER_ASSERT(reporter, |
| 35 | nullptr == testFactory.getContextInfo( |
| 36 | glCtxType, |
| 37 | kNone_GrGLStandard, |
| 38 | GrContextFactory::kEnableNVPR_GLContextOptions)); |
bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 39 | } |
| 40 | } |
kkinnunen | eeebdb5 | 2015-12-01 05:10:48 -0800 | [diff] [blame] | 41 | |
bsalomon@google.com | 57f5d98 | 2011-10-24 21:17:53 +0000 | [diff] [blame] | 42 | } |
| 43 | |
bsalomon@google.com | cf8fb1f | 2012-08-02 14:03:32 +0000 | [diff] [blame] | 44 | #endif |