Bug 1406494 - Add a WR_RESOURCE_PATH environment variable that lets you set a resource override path for webrender. r=kats

This allows easier testing of shader changes. If you point this environment
variable at your gfx/webrender/res/ directory, the shaders will be read from
that directory when Firefox is launched, so you can test shader changes just by
restarting Firefox and don't need to recompile.

MozReview-Commit-ID: 9Dt6MhErnGS

--HG--
extra : rebase_source : 3c8cb83f28a6b6b00fb4437a7fd7f04dd5511633
This commit is contained in:
Markus Stange 2017-10-06 14:38:56 -04:00
Родитель aeab286746
Коммит 089e60417f
4 изменённых файлов: 26 добавлений и 2 удалений

Просмотреть файл

@ -64,6 +64,15 @@ bool gfx_use_wrench()
return gfxEnv::EnableWebRenderRecording();
}
const char* gfx_wr_resource_path_override()
{
const char* resourcePath = PR_GetEnv("WR_RESOURCE_Path");
if (!resourcePath || resourcePath[0] == '\0') {
return nullptr;
}
return resourcePath;
}
void gfx_critical_note(const char* msg)
{
gfxCriticalNote << msg;

Просмотреть файл

@ -1,4 +1,4 @@
use std::ffi::CString;
use std::ffi::{CStr, CString};
use std::{mem, slice};
use std::path::PathBuf;
use std::ptr;
@ -415,6 +415,7 @@ extern "C" {
// be disabled in WebRenderBridgeParent::ProcessWebRenderCommands
// by commenting out the path that adds an external image ID
fn gfx_use_wrench() -> bool;
fn gfx_wr_resource_path_override() -> *const c_char;
fn gfx_critical_note(msg: *const c_char);
}
@ -644,6 +645,17 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
blob_image_renderer: Some(Box::new(Moz2dImageRenderer::new(workers.clone()))),
workers: Some(workers.clone()),
enable_render_on_scroll: false,
resource_override_path: unsafe {
let override_charptr = gfx_wr_resource_path_override();
if override_charptr.is_null() {
None
} else {
match CStr::from_ptr(override_charptr).to_str() {
Ok(override_str) => Some(PathBuf::from(override_str)),
_ => None
}
}
},
..Default::default()
};

Просмотреть файл

@ -21,6 +21,7 @@ bool is_in_main_thread();
bool is_in_render_thread();
bool is_glcontext_egl(void* glcontext_ptr);
bool gfx_use_wrench();
const char* gfx_wr_resource_path_override();
void gfx_critical_note(const char* msg);
void* get_proc_address_from_glcontext(void* glcontext_ptr, const char* procname);

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Generated with cbindgen:0.1.23 */
/* Generated with cbindgen:0.1.25 */
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
* To generate this file:
@ -763,6 +763,8 @@ extern void gfx_critical_note(const char *aMsg);
extern bool gfx_use_wrench();
extern const char *gfx_wr_resource_path_override();
extern bool is_glcontext_egl(void *aGlcontextPtr);
extern bool is_in_compositor_thread();