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);
|
2014-10-09 12:24:15 +00:00
|
|
|
SkGLContext* glCtx = 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 &&
|
2014-09-05 20:34:00 +00:00
|
|
|
factory->getGLContext(GrContextFactory::kNative_GLContextType) &&
|
2014-10-16 06:03:54 +00:00
|
|
|
!factory->getGLContext(GrContextFactory::kNative_GLContextType)->gl()->hasExtension("GL_NV_path_rendering")) {
|
2015-08-27 14:41:13 +00:00
|
|
|
REPORTER_ASSERT(reporter, nullptr == glCtx);
|
2014-01-24 20:49:44 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-04-21 18:13:17 +00:00
|
|
|
REPORTER_ASSERT(reporter, glCtx);
|
2014-10-09 12:24:15 +00:00
|
|
|
if (glCtx) {
|
|
|
|
const GrGLInterface* interface = glCtx->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
|