Set fPreferExternalImagesOverES3 option in Skia (flutter/engine#5331)

This causes Skia to fall back to the ES2 shading language when the GL
driver doesn't clearly communicate that it supports the ES3 external
image extension. Doing so ensures that video playback (which relies on
external images) works on many more devices.
This commit is contained in:
Brian Osman
2018-05-21 14:41:56 -04:00
committed by GitHub
parent 52e89069cb
commit 6fd73be906
2 changed files with 8 additions and 0 deletions

View File

@@ -23,6 +23,10 @@ sk_sp<GrContext> IOManager::CreateCompatibleResourceLoadingContext(
// that feature, which will cause texture uploads to do CPU YUV conversion.
options.fDisableGpuYUVConversion = true;
// To get video playback on the widest range of devices, we limit Skia to
// ES2 shading language when the ES3 external image extension is missing.
options.fPreferExternalImagesOverES3 = true;
if (auto context = GrContext::MakeGL(GrGLMakeNativeInterface(), options)) {
// Do not cache textures created by the image decoder. These textures
// should be deleted when they are no longer referenced by an SkImage.

View File

@@ -45,6 +45,10 @@ GPUSurfaceGL::GPUSurfaceGL(GPUSurfaceGLDelegate* delegate)
GrContextOptions options;
options.fAvoidStencilBuffers = true;
// To get video playback on the widest range of devices, we limit Skia to
// ES2 shading language when the ES3 external image extension is missing.
options.fPreferExternalImagesOverES3 = true;
auto context = GrContext::MakeGL(GrGLMakeNativeInterface(), options);
if (context == nullptr) {