2011-10-24 21:17:53 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2012-08-02 14:03:32 +00:00
|
|
|
|
2012-08-03 15:00:52 +00:00
|
|
|
|
|
|
|
#include "Test.h"
|
2012-08-02 14:03:32 +00:00
|
|
|
// This is a GPU-backend specific test
|
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
|
2013-03-11 20:22:38 +00:00
|
|
|
#include "GrContextFactory.h"
|
|
|
|
|
|
|
|
static void GLInterfaceValidationTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
|
|
|
|
for (int i = 0; i <= GrContextFactory::kLastGLContextType; ++i) {
|
|
|
|
GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContextType)i;
|
|
|
|
// this forces the factory to make the context if it hasn't yet
|
|
|
|
factory->get(glCtxType);
|
|
|
|
SkGLContextHelper* glCtxHelper = factory->getGLContext(glCtxType);
|
|
|
|
REPORTER_ASSERT(reporter, NULL != glCtxHelper);
|
|
|
|
if (NULL != glCtxHelper) {
|
|
|
|
const GrGLInterface* interface = glCtxHelper->gl();
|
2012-02-10 20:25:36 +00:00
|
|
|
for (GrGLBinding binding = kFirstGrGLBinding;
|
2012-02-10 20:05:18 +00:00
|
|
|
binding <= kLastGrGLBinding;
|
|
|
|
binding = static_cast<GrGLBinding>(binding << 1)) {
|
2013-03-11 20:22:38 +00:00
|
|
|
if (interface->fBindingsExported & binding) {
|
|
|
|
REPORTER_ASSERT(reporter, interface->validate(binding));
|
2012-02-10 20:05:18 +00:00
|
|
|
}
|
|
|
|
}
|
2011-10-24 21:17:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "TestClassDef.h"
|
2013-03-11 20:22:38 +00:00
|
|
|
DEFINE_GPUTESTCLASS("GLInterfaceValidation",
|
|
|
|
GLInterfaceValidationTestClass,
|
|
|
|
GLInterfaceValidationTest)
|
2011-10-24 21:17:53 +00:00
|
|
|
|
2012-08-02 14:03:32 +00:00
|
|
|
#endif
|