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-03 15:00:52 +00:00
|
|
|
#include "Test.h"
|
2014-01-10 22:08:27 +00:00
|
|
|
|
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"
|
|
|
|
|
2014-01-10 22:08:27 +00:00
|
|
|
DEF_GPUTEST(GLInterfaceValidation, reporter, factory) {
|
2013-03-11 20:22:38 +00:00
|
|
|
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);
|
2014-01-24 20:49:44 +00:00
|
|
|
|
|
|
|
// We're supposed to fail the NVPR context type when we the native context that does not
|
|
|
|
// support the NVPR extension.
|
|
|
|
if (GrContextFactory::kNVPR_GLContextType == glCtxType &&
|
|
|
|
NULL != factory->getGLContext(GrContextFactory::kNative_GLContextType) &&
|
|
|
|
!factory->getGLContext(GrContextFactory::kNative_GLContextType)->hasExtension("GL_NV_path_rendering")) {
|
|
|
|
REPORTER_ASSERT(reporter, NULL == glCtxHelper);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2013-03-11 20:22:38 +00:00
|
|
|
REPORTER_ASSERT(reporter, NULL != glCtxHelper);
|
|
|
|
if (NULL != glCtxHelper) {
|
|
|
|
const GrGLInterface* interface = glCtxHelper->gl();
|
2014-01-16 16:35:09 +00:00
|
|
|
REPORTER_ASSERT(reporter, interface->validate());
|
2011-10-24 21:17:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-02 14:03:32 +00:00
|
|
|
#endif
|