Avoid calling glGetString(GL_EXTENSIONS) on core profiles

Change-Id: I75c5cd61ddaad91187f65c494f75da720934936d
Reviewed-on: https://skia-review.googlesource.com/118683
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2018-04-04 14:27:48 -04:00 committed by Skia Commit-Bot
parent 9a544bcab8
commit 4470e349a6
3 changed files with 7 additions and 14 deletions

View File

@ -25,10 +25,6 @@ std::unique_ptr<GrGLContext> GrGLContext::Make(sk_sp<const GrGLInterface> interf
GR_GL_CALL_RET(interface.get(), rendererUByte, GetString(GR_GL_RENDERER));
const char* renderer = reinterpret_cast<const char*>(rendererUByte);
const GrGLubyte* extensionsUByte;
GR_GL_CALL_RET(interface.get(), extensionsUByte, GetString(GR_GL_EXTENSIONS));
const char* extensions = reinterpret_cast<const char*>(extensionsUByte);
ConstructorArgs args;
args.fGLVersion = GrGLGetVersionFromString(ver);
if (GR_GL_INVALID_VER == args.fGLVersion) {
@ -41,7 +37,7 @@ std::unique_ptr<GrGLContext> GrGLContext::Make(sk_sp<const GrGLInterface> interf
args.fVendor = GrGLGetVendor(interface.get());
args.fRenderer = GrGLGetRendererFromStrings(renderer, extensions);
args.fRenderer = GrGLGetRendererFromStrings(renderer, interface->fExtensions);
GrGLGetANGLEInfoFromString(renderer, &args.fANGLEBackend, &args.fANGLEVendor,
&args.fANGLERenderer);

View File

@ -292,15 +292,15 @@ static bool is_renderer_angle(const char* rendererString) {
return 0 == strncmp(rendererString, kHeader, kHeaderLength);
}
GrGLRenderer GrGLGetRendererFromStrings(const char* rendererString, const char* extensionString) {
GrGLRenderer GrGLGetRendererFromStrings(const char* rendererString,
const GrGLExtensions& extensions) {
if (rendererString) {
static const char kTegraStr[] = "NVIDIA Tegra";
if (0 == strncmp(rendererString, kTegraStr, SK_ARRAY_COUNT(kTegraStr) - 1)) {
// Tegra strings are not very descriptive. We distinguish between the modern and legacy
// architectures by the presence of NV_path_rendering.
return (extensionString && strstr(extensionString, "GL_NV_path_rendering"))
? kTegra_GrGLRenderer
: kTegra_PreK1_GrGLRenderer;
return extensions.has("GL_NV_path_rendering") ? kTegra_GrGLRenderer
: kTegra_PreK1_GrGLRenderer;
}
int lastDigit;
int n = sscanf(rendererString, "PowerVR SGX 54%d", &lastDigit);
@ -476,10 +476,7 @@ GrGLRenderer GrGLGetRenderer(const GrGLInterface* gl) {
const GrGLubyte* rendererString;
GR_GL_CALL_RET(gl, rendererString, GetString(GR_GL_RENDERER));
const GrGLubyte* extensionString;
GR_GL_CALL_RET(gl, extensionString, GetString(GR_GL_EXTENSIONS));
return GrGLGetRendererFromStrings((const char*) rendererString, (const char*) extensionString);
return GrGLGetRendererFromStrings((const char*)rendererString, gl->fExtensions);
}
GrGLenum GrToGLStencilFunc(GrStencilTest test) {

View File

@ -162,7 +162,7 @@ GrGLVersion GrGLGetVersionFromString(const char* versionString);
GrGLStandard GrGLGetStandardInUseFromString(const char* versionString);
GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString);
GrGLVendor GrGLGetVendorFromString(const char* vendorString);
GrGLRenderer GrGLGetRendererFromStrings(const char* rendererString, const char* extensionString);
GrGLRenderer GrGLGetRendererFromStrings(const char* rendererString, const GrGLExtensions&);
void GrGLGetANGLEInfoFromString(const char* rendererString, GrGLANGLEBackend*,
GrGLANGLEVendor*, GrGLANGLERenderer*);