Reland "Request specific ANGLE context versions."

This is a reland of 8eeff5ccf3

Original change's description:
> Request specific ANGLE context versions.
> 
> Using the ANGLE_create_context_backwards_compatible extension, request
> explicit ANGLE context versions to make sure test coverage of context
> versions matches Chrome.
> 
> BUG=skia:10309
> 
> Change-Id: Ifa4a36851a0517b369d094e5707348a20eaf3879
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293339
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Auto-Submit: Geoff Lang <geofflang@google.com>

Bug: skia:10309
Change-Id: Ida0f226a693354211f35c391bdc0b5bb285a2d3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293761
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Geoff Lang 2020-06-01 15:25:58 -04:00 committed by Skia Commit-Bot
parent 9adc1d4f7d
commit c3320be506

View File

@ -25,6 +25,8 @@
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D
#define EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE 0x3483
using sk_gpu_test::ANGLEBackend;
using sk_gpu_test::ANGLEContextVersion;
@ -281,12 +283,20 @@ ANGLEGLContext::ANGLEGLContext(ANGLEBackend type, ANGLEContextVersion version,
}
int versionNum = ANGLEContextVersion::kES2 == version ? 2 : 3;
const EGLint contextAttribs[] = {
std::vector<EGLint> contextAttribs = {
EGL_CONTEXT_CLIENT_VERSION, versionNum,
EGL_NONE
};
const char* extensions = eglQueryString(fDisplay, EGL_EXTENSIONS);
if (strstr(extensions, "EGL_ANGLE_create_context_backwards_compatible")) {
contextAttribs.push_back(EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE);
contextAttribs.push_back(EGL_FALSE);
}
contextAttribs.push_back(EGL_NONE);
EGLContext eglShareContext = shareContext ? shareContext->fContext : nullptr;
fContext = eglCreateContext(fDisplay, surfaceConfig, eglShareContext, contextAttribs);
fContext = eglCreateContext(fDisplay, surfaceConfig, eglShareContext, contextAttribs.data());
if (EGL_NO_CONTEXT == fContext) {
SkDebugf("Could not create context!");
this->destroyGLContext();
@ -337,7 +347,6 @@ ANGLEGLContext::ANGLEGLContext(ANGLEBackend type, ANGLEContextVersion version,
break;
}
#endif
const char* extensions = eglQueryString(fDisplay, EGL_EXTENSIONS);
if (strstr(extensions, "EGL_KHR_image")) {
fCreateImage = (PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR");
fDestroyImage = (PFNEGLDESTROYIMAGEKHRPROC)eglGetProcAddress("eglDestroyImageKHR");