blob: d47a66da0f5847d20553ebce9a77d3ea42e9ca21 [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);
21 REPORTER_ASSERT(reporter, NULL != glCtxHelper);
22 if (NULL != glCtxHelper) {
23 const GrGLInterface* interface = glCtxHelper->gl();
bsalomon@google.comb447d212012-02-10 20:25:36 +000024 for (GrGLBinding binding = kFirstGrGLBinding;
bsalomon@google.com89ec61e2012-02-10 20:05:18 +000025 binding <= kLastGrGLBinding;
26 binding = static_cast<GrGLBinding>(binding << 1)) {
bsalomon@google.com7fa1bb42013-03-11 20:22:38 +000027 if (interface->fBindingsExported & binding) {
28 REPORTER_ASSERT(reporter, interface->validate(binding));
bsalomon@google.com89ec61e2012-02-10 20:05:18 +000029 }
30 }
bsalomon@google.com57f5d982011-10-24 21:17:53 +000031 }
32 }
33}
34
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000035#endif