From ca4c9488278216ca587a6c01e1222fe2cd8f9c17 Mon Sep 17 00:00:00 2001 From: Kris Taeleman Date: Mon, 8 Jun 2020 08:18:34 +0000 Subject: [PATCH] Bug 1643832 - Add Pref flag to enable shader precaching at startup. r=jnicol Differential Revision: https://phabricator.services.mozilla.com/D78580 --- gfx/webrender_bindings/RenderThread.cpp | 4 +++- gfx/webrender_bindings/src/bindings.rs | 3 ++- modules/libpref/init/StaticPrefList.yaml | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gfx/webrender_bindings/RenderThread.cpp b/gfx/webrender_bindings/RenderThread.cpp index 8867f10c38b5..8b36dce70d46 100644 --- a/gfx/webrender_bindings/RenderThread.cpp +++ b/gfx/webrender_bindings/RenderThread.cpp @@ -926,7 +926,9 @@ void RenderThread::MaybeEnableGLDebugMessage(gl::GLContext* aGLContext) { WebRenderShaders::WebRenderShaders(gl::GLContext* gl, WebRenderProgramCache* programCache) { mGL = gl; - mShaders = wr_shaders_new(gl, programCache ? programCache->Raw() : nullptr); + mShaders = + wr_shaders_new(gl, programCache ? programCache->Raw() : nullptr, + StaticPrefs::gfx_webrender_precache_shaders_AtStartup()); } WebRenderShaders::~WebRenderShaders() { diff --git a/gfx/webrender_bindings/src/bindings.rs b/gfx/webrender_bindings/src/bindings.rs index 64e46828a597..c6838ff1db4e 100644 --- a/gfx/webrender_bindings/src/bindings.rs +++ b/gfx/webrender_bindings/src/bindings.rs @@ -3749,10 +3749,11 @@ pub unsafe extern "C" fn wr_device_delete(device: *mut Device) { pub extern "C" fn wr_shaders_new( gl_context: *mut c_void, program_cache: Option<&mut WrProgramCache>, + precache_shaders: bool, ) -> *mut WrShaders { let mut device = wr_device_new(gl_context, program_cache); - let precache_flags = if env_var_to_bool("MOZ_WR_PRECACHE_SHADERS") { + let precache_flags = if precache_shaders || env_var_to_bool("MOZ_WR_PRECACHE_SHADERS") { ShaderPrecacheFlags::FULL_COMPILE } else { ShaderPrecacheFlags::ASYNC_COMPILE diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 6b94f175c9fc..1cc16574cf66 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -4274,6 +4274,11 @@ value: true mirror: once +- name: gfx.webrender.precache-shaders + type: bool + value: false + mirror: once + # When gl debug message is a high severity message, forwward it to gfx critical # note. - name: gfx.webrender.gl-debug-message-critical-note