blob: 541af8fe9232434fa99b9aa2940a176d2107eb20 [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
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000015DEF_GPUTEST(GLInterfaceValidation, reporter, factory) {
bsalomon@google.com7fa1bb42013-03-11 20:22:38 +000016 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.orgd8ed8512014-01-24 20:49:44 +000021
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.com7fa1bb42013-03-11 20:22:38 +000031 REPORTER_ASSERT(reporter, NULL != glCtxHelper);
32 if (NULL != glCtxHelper) {
33 const GrGLInterface* interface = glCtxHelper->gl();
commit-bot@chromium.org9e90aed2014-01-16 16:35:09 +000034 REPORTER_ASSERT(reporter, interface->validate());
bsalomon@google.com57f5d982011-10-24 21:17:53 +000035 }
36 }
37}
38
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000039#endif