blob: 792ed039fbbaa9e3abfdb81b28b7bd6b74262577 [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#include "TestClassDef.h"
10
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000011// This is a GPU-backend specific test
12#if SK_SUPPORT_GPU
13
bsalomon@google.com7fa1bb42013-03-11 20:22:38 +000014#include "GrContextFactory.h"
bsalomon@google.com57f5d982011-10-24 21:17:53 +000015
tfarina@chromium.org4ee16bf2014-01-10 22:08:27 +000016DEF_GPUTEST(GLInterfaceValidation, reporter, factory) {
bsalomon@google.com7fa1bb42013-03-11 20:22:38 +000017 for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) {
18 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType)i;
19 // this forces the factory to make the context if it hasn't yet
20 factory->get(glCtxType);
21 SkGLContextHelper* glCtxHelper = factory->getGLContext(glCtxType);
22 REPORTER_ASSERT(reporter, NULL != glCtxHelper);
23 if (NULL != glCtxHelper) {
24 const GrGLInterface* interface = glCtxHelper->gl();
bsalomon@google.comb447d212012-02-10 20:25:36 +000025 for (GrGLBinding binding = kFirstGrGLBinding;
bsalomon@google.com89ec61e2012-02-10 20:05:18 +000026 binding <= kLastGrGLBinding;
27 binding = static_cast<GrGLBinding>(binding << 1)) {
bsalomon@google.com7fa1bb42013-03-11 20:22:38 +000028 if (interface->fBindingsExported & binding) {
29 REPORTER_ASSERT(reporter, interface->validate(binding));
bsalomon@google.com89ec61e2012-02-10 20:05:18 +000030 }
31 }
bsalomon@google.com57f5d982011-10-24 21:17:53 +000032 }
33 }
34}
35
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000036#endif