blob: 1448f28fb0ef5d8efcadb00953b60dac0a303fbf [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);
kkinnunen9e61bb72014-10-09 05:24:15 -070020 SkGLContext* glCtx = 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 &&
bsalomon49f085d2014-09-05 13:34:00 -070025 factory->getGLContext(GrContextFactory::kNative_GLContextType) &&
kkinnunen30bc88c2014-10-15 23:03:54 -070026 !factory->getGLContext(GrContextFactory::kNative_GLContextType)->gl()->hasExtension("GL_NV_path_rendering")) {
kkinnunen9e61bb72014-10-09 05:24:15 -070027 REPORTER_ASSERT(reporter, NULL == glCtx);
commit-bot@chromium.orgd8ed8512014-01-24 20:49:44 +000028 continue;
29 }
30
senorblanco42a2c1d2015-04-21 11:13:17 -070031 REPORTER_ASSERT(reporter, glCtx);
kkinnunen9e61bb72014-10-09 05:24:15 -070032 if (glCtx) {
33 const GrGLInterface* interface = glCtx->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