From 5ab81fdab319e80fca69592989a09ba96e6641a0 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Mon, 21 May 2018 14:41:56 -0400 Subject: [PATCH] Set fPreferExternalImagesOverES3 option in Skia (#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. --- shell/common/io_manager.cc | 4 ++++ shell/gpu/gpu_surface_gl.cc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/shell/common/io_manager.cc b/shell/common/io_manager.cc index 2b4523a46..2d004fedb 100644 --- a/shell/common/io_manager.cc +++ b/shell/common/io_manager.cc @@ -23,6 +23,10 @@ sk_sp 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. diff --git a/shell/gpu/gpu_surface_gl.cc b/shell/gpu/gpu_surface_gl.cc index 11482e48f..317d2ba29 100644 --- a/shell/gpu/gpu_surface_gl.cc +++ b/shell/gpu/gpu_surface_gl.cc @@ -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) { -- GitLab