1 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 9 10 11 #include "Test.h" 12 // This is a GPU-backend specific test 13 #if SK_SUPPORT_GPU 14 15 #include "GrContextFactory.h" 16 17 static 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(); 26 for (GrGLBinding binding = kFirstGrGLBinding; 27 binding <= kLastGrGLBinding; 28 binding = static_cast<GrGLBinding>(binding << 1)) { 29 if (interface->fBindingsExported & binding) { 30 REPORTER_ASSERT(reporter, interface->validate(binding)); 31 } 32 } 33 } 34 } 35 } 36 37 38 #include "TestClassDef.h" 39 DEFINE_GPUTESTCLASS("GLInterfaceValidation", 40 GLInterfaceValidationTestClass, 41 GLInterfaceValidationTest) 42 43 #endif 44