blob: b890b44e5f733dc3c950e6bf70a6964716fb4e6f [file] [log] [blame]
bsalomon@google.com57f5d982011-10-24 21:17:53 +00001/*
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.coma68937c2012-08-03 15:00:52 +00008#include "Test.h"
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +00009
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000010// This is a GPU-backend specific test
11#if SK_SUPPORT_GPU
12
bsalomon@google.com7fa1bb42013-03-11 20:22:38 +000013#include "GrContextFactory.h"
bsalomon@google.com57f5d982011-10-24 21:17:53 +000014
kkinnuneneeebdb52015-12-01 05:10:48 -080015DEF_GPUTEST(GLInterfaceValidation, reporter, /*factory*/) {
16 GrContextFactory testFactory;
commit-bot@chromium.orgd8ed8512014-01-24 20:49:44 +000017
kkinnuneneeebdb52015-12-01 05:10:48 -080018 // 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.orgd8ed8512014-01-24 20:49:44 +000026 continue;
27 }
28
kkinnuneneeebdb52015-12-01 05:10:48 -080029 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.com57f5d982011-10-24 21:17:53 +000039 }
40 }
kkinnuneneeebdb52015-12-01 05:10:48 -080041
bsalomon@google.com57f5d982011-10-24 21:17:53 +000042}
43
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000044#endif