3902628e35
There is some logic in here for 2.0 as well, just as a "as long as I was looking at the specs", but only 1.0 is really supported. This seems to resolve the bug where some GPUs weren't advertising correctly that they had vertex array object support, by checking for both extension names (with and without "GL_" prefix) Of note, this saves about 18 Kb (5.5 Kb gzipped) of code size by compiling out the unneeded GLES checks/functionality. Bug: skia:8378 Change-Id: I773bf4dbf231b991051d2a9f640b8047a9010e7d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203461 Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
/*
|
|
* Copyright 2017 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "SkTypes.h"
|
|
|
|
#include "gl/GrGLDefines.h"
|
|
#include "gl/GrGLExtensions.h"
|
|
#include "Test.h"
|
|
|
|
const GrGLubyte* simpleGetString(GrGLenum name) {
|
|
return (const GrGLubyte*)(name == GR_GL_VERSION ? "3.0" : "");
|
|
}
|
|
|
|
void simpleGetIntegerv(GrGLenum name, GrGLint* params) {
|
|
if (name == GR_GL_NUM_EXTENSIONS) {
|
|
*params = 2;
|
|
} else {
|
|
*params = 0;
|
|
}
|
|
}
|
|
|
|
const GrGLubyte* simpleGetStringi(GrGLenum name, GrGLuint index) {
|
|
if (name != GR_GL_EXTENSIONS || index >= 2)
|
|
return (const GrGLubyte*)"";
|
|
return (const GrGLubyte*)(index == 0 ? "test_extension_1" : "test_extension_2");
|
|
}
|
|
|
|
DEF_TEST(GrGLExtensionsTest_remove, reporter) {
|
|
GrGLExtensions ext;
|
|
ext.init(kGL_GrGLStandard,
|
|
&simpleGetString,
|
|
&simpleGetStringi,
|
|
&simpleGetIntegerv,
|
|
nullptr,
|
|
nullptr);
|
|
|
|
REPORTER_ASSERT(reporter, ext.isInitialized());
|
|
REPORTER_ASSERT(reporter, ext.has("test_extension_1"));
|
|
REPORTER_ASSERT(reporter, ext.has("test_extension_2"));
|
|
REPORTER_ASSERT(reporter, ext.remove("test_extension_2"));
|
|
REPORTER_ASSERT(reporter, !ext.has("test_extension_2"));
|
|
REPORTER_ASSERT(reporter, ext.remove("test_extension_1"));
|
|
REPORTER_ASSERT(reporter, !ext.has("test_extension_1"));
|
|
}
|