blob: a4709ba104aca28b3bf820cdb611030e63dd04e4 [file] [log] [blame]
bsalomon@google.com57f5d982011-10-24 21:17:53 +00001
2/*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +00009
bsalomon@google.coma68937c2012-08-03 15:00:52 +000010
11#include "Test.h"
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000012// This is a GPU-backend specific test
13#if SK_SUPPORT_GPU
14
bsalomon@google.com7fa1bb42013-03-11 20:22:38 +000015#include "GrContextFactory.h"
bsalomon@google.com57f5d982011-10-24 21:17:53 +000016
bsalomon@google.com7fa1bb42013-03-11 20:22:38 +000017static void GLInterfaceValidationTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
18 for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) {
19 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType)i;
20 // this forces the factory to make the context if it hasn't yet
21 factory->get(glCtxType);
22 SkGLContextHelper* glCtxHelper = factory->getGLContext(glCtxType);
23 REPORTER_ASSERT(reporter, NULL != glCtxHelper);
24 if (NULL != glCtxHelper) {
25 const GrGLInterface* interface = glCtxHelper->gl();
bsalomon@google.comb447d212012-02-10 20:25:36 +000026 for (GrGLBinding binding = kFirstGrGLBinding;
bsalomon@google.com89ec61e2012-02-10 20:05:18 +000027 binding <= kLastGrGLBinding;
28 binding = static_cast<GrGLBinding>(binding << 1)) {
bsalomon@google.com7fa1bb42013-03-11 20:22:38 +000029 if (interface->fBindingsExported & binding) {
30 REPORTER_ASSERT(reporter, interface->validate(binding));
bsalomon@google.com89ec61e2012-02-10 20:05:18 +000031 }
32 }
bsalomon@google.com57f5d982011-10-24 21:17:53 +000033 }
34 }
35}
36
37
38#include "TestClassDef.h"
bsalomon@google.com7fa1bb42013-03-11 20:22:38 +000039DEFINE_GPUTESTCLASS("GLInterfaceValidation",
40 GLInterfaceValidationTestClass,
41 GLInterfaceValidationTest)
bsalomon@google.com57f5d982011-10-24 21:17:53 +000042
bsalomon@google.comcf8fb1f2012-08-02 14:03:32 +000043#endif