Bug 1563035 - Webrender assumes that an EGL context uses GLES (but it can be GL, too). r=jgilbert

This commit is contained in:
Robert Mader 2019-07-03 16:38:00 +03:00
parent e501ee889d
commit 46c9b36d04
3 changed files with 7 additions and 13 deletions

View File

@ -85,15 +85,9 @@ bool gecko_profiler_thread_is_being_profiled() {
#endif
}
bool is_glcontext_egl(void* glcontext_ptr) {
MOZ_ASSERT(glcontext_ptr);
mozilla::gl::GLContext* glcontext =
reinterpret_cast<mozilla::gl::GLContext*>(glcontext_ptr);
if (!glcontext) {
return false;
}
return glcontext->GetContextType() == mozilla::gl::GLContextType::EGL;
bool is_glcontext_gles(void* const glcontext_ptr) {
MOZ_RELEASE_ASSERT(glcontext_ptr);
return reinterpret_cast<mozilla::gl::GLContext*>(glcontext_ptr)->IsGLES();
}
bool is_glcontext_angle(void* glcontext_ptr) {

View File

@ -535,7 +535,7 @@ extern "C" {
fn is_in_compositor_thread() -> bool;
fn is_in_render_thread() -> bool;
fn is_in_main_thread() -> bool;
fn is_glcontext_egl(glcontext_ptr: *mut c_void) -> bool;
fn is_glcontext_gles(glcontext_ptr: *mut c_void) -> bool;
fn is_glcontext_angle(glcontext_ptr: *mut c_void) -> bool;
// Enables binary recording that can be used with `wrench replay`
// Outputs a wr-record-*.bin file for each window that is shown
@ -1106,7 +1106,7 @@ fn wr_device_new(gl_context: *mut c_void, pc: Option<&mut WrProgramCache>)
assert!(unsafe { is_in_render_thread() });
let gl;
if unsafe { is_glcontext_egl(gl_context) } {
if unsafe { is_glcontext_gles(gl_context) } {
gl = unsafe { gl::GlesFns::load_with(|symbol| get_proc_address(gl_context, symbol)) };
} else {
gl = unsafe { gl::GlFns::load_with(|symbol| get_proc_address(gl_context, symbol)) };
@ -1171,7 +1171,7 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
};
let gl;
if unsafe { is_glcontext_egl(gl_context) } {
if unsafe { is_glcontext_gles(gl_context) } {
gl = unsafe { gl::GlesFns::load_with(|symbol| get_proc_address(gl_context, symbol)) };
} else {
gl = unsafe { gl::GlFns::load_with(|symbol| get_proc_address(gl_context, symbol)) };

View File

@ -19,7 +19,7 @@ extern "C" {
bool is_in_compositor_thread();
bool is_in_main_thread();
bool is_in_render_thread();
bool is_glcontext_egl(void* glcontext_ptr);
bool is_glcontext_gles(void* glcontext_ptr);
bool is_glcontext_angle(void* glcontext_ptr);
bool gfx_use_wrench();
const char* gfx_wr_resource_path_override();