Don't sort extensions when there are none. Make an ANGLE context to validate the ANGLE GrGLInterface with.

R=robertphillips@google.com

git-svn-id: http://skia.googlecode.com/svn/trunk@8049 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2013-03-08 19:01:01 +00:00
parent 27b90fae0e
commit a1d27cd07a
2 changed files with 22 additions and 8 deletions

View File

@ -48,7 +48,7 @@ bool GrGLExtensions::init(GrGLBinding binding,
}
} else {
const char* extensions = (const char*) getString(GR_GL_EXTENSIONS);
if (NULL == extensions) {
if (NULL == extensions) {
return false;
}
while (true) {
@ -66,8 +66,10 @@ bool GrGLExtensions::init(GrGLBinding binding,
extensions += length;
}
}
SkTSearchCompareLTFunctor<SkString, extension_compare> cmp;
SkTQSort(&fStrings.front(), &fStrings.back(), cmp);
if (0 != fStrings.count()) {
SkTSearchCompareLTFunctor<SkString, extension_compare> cmp;
SkTQSort(&fStrings.front(), &fStrings.back(), cmp);
}
return true;
}

View File

@ -37,23 +37,35 @@ static void GLInterfaceValidationTest(skiatest::Reporter* reporter) {
{GrGLCreateNullInterface, "Null"},
};
static const int kBogusSize = 16;
#if SK_ANGLE
SkANGLEGLContext::AutoContextRestore angleACR;
SkANGLEGLContext angleContext;
bool angleContextInit = angleContext.init(kBogusSize, kBogusSize);
REPORTER_ASSERT(reporter, angleContextInit);
if (!angleContextInit) {
return;
}
#endif
// On some platforms GrGLCreateNativeInterface will fail unless an OpenGL
// context has been created. Also, preserve the current context that may
// be in use by outer test harness.
SkNativeGLContext::AutoContextRestore nglacr;
SkNativeGLContext::AutoContextRestore nglACR;
SkNativeGLContext nglctx;
static const int gBOGUS_SIZE = 16;
bool nativeContextInit = nglctx.init(gBOGUS_SIZE, gBOGUS_SIZE);
bool nativeContextInit = nglctx.init(kBogusSize, kBogusSize);
REPORTER_ASSERT(reporter, nativeContextInit);
if (!nativeContextInit) {
return;
}
#if SK_MESA
// We must have a current OSMesa context to initialize an OSMesa
// GrGLInterface
SkMesaGLContext::AutoContextRestore mglacr;
SkMesaGLContext::AutoContextRestore mglACR;
SkMesaGLContext mglctx;
bool mesaContextInit = mglctx.init(gBOGUS_SIZE, gBOGUS_SIZE);
bool mesaContextInit = mglctx.init(kBogusSize, kBogusSize);
REPORTER_ASSERT(reporter, mesaContextInit);
if(!mesaContextInit) {
return;