Bug 1339313 - Remove wr_gl_init() r=nical
authorsotaro <sotaro.ikeda.g@gmail.com>
Thu, 16 Feb 2017 11:24:55 +0900
changeset 373003 d2b4aa8dde09b73858b7cac79e54868d4ef8b3aa
parent 373002 e53e00cd7900394faa41a28f28be9ea1d0ba1b99
child 373004 74bf6080eb3a4ac4d34c3304f2bb283e4df4c314
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1339313
milestone54.0a1
Bug 1339313 - Remove wr_gl_init() r=nical
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/src/bindings.rs
gfx/webrender_bindings/webrender_ffi.h
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -42,20 +42,18 @@ public:
 
     RefPtr<gl::GLContext> gl = gl::GLContextProvider::CreateForCompositorWidget(mCompositorWidget, true);
     if (!gl || !gl->MakeCurrent()) {
       return;
     }
 
     gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, mMaxTextureSize);
 
-    wr_gl_init(gl.get());
-
     WrRenderer* wrRenderer = nullptr;
-    if (!wr_window_new(aWindowId, this->mEnableProfiler, mWrApi, &wrRenderer)) {
+    if (!wr_window_new(aWindowId, gl.get(), this->mEnableProfiler, mWrApi, &wrRenderer)) {
       return;
     }
     MOZ_ASSERT(wrRenderer);
 
     RefPtr<RenderThread> thread = &aRenderThread;
     auto renderer = MakeUnique<RendererOGL>(Move(thread),
                                             Move(gl),
                                             Move(mCompositorWidget),
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -157,30 +157,40 @@ pub unsafe extern fn wr_api_set_root_dis
     //let (dl_builder, aux_builder) = fb.dl_builder.finalize();
     api.set_root_display_list(Some(root_background_color),
                               epoch,
                               LayoutSize::new(viewport_width, viewport_height),
                               frame_builder.dl_builder,
                               preserve_frame_state);
     api.generate_frame(None);
 }
+
+// Call MakeCurrent before this.
 #[no_mangle]
 pub extern fn wr_window_new(window_id: WrWindowId,
+                            gl_context: *mut c_void,
                             enable_profiler: bool,
                             out_api: &mut *mut RenderApi,
                             out_renderer: &mut *mut Renderer) -> bool {
     assert!(unsafe { is_in_render_thread() });
 
     let recorder: Option<Box<ApiRecordingReceiver>> = if ENABLE_RECORDING {
         let name = format!("wr-record-{}.bin", window_id.0);
         Some(Box::new(BinaryRecorder::new(&PathBuf::from(name))))
     } else {
         None
     };
 
+    gl::load_with(|symbol| get_proc_address(gl_context, symbol));
+    gl::clear_color(0.3, 0.0, 0.0, 1.0);
+
+    let version = gl::get_string(gl::VERSION);
+
+    println!("WebRender - OpenGL version new {}", version);
+
     let opts = RendererOptions {
         device_pixel_ratio: 1.0,
         resource_override_path: None,
         enable_aa: false,
         enable_subpixel_aa: false,
         enable_profiler: enable_profiler,
         enable_scrollbars: false,
         precache_shaders: false,
@@ -204,29 +214,16 @@ pub extern fn wr_window_new(window_id: W
     renderer.set_render_notifier(Box::new(CppNotifier { window_id: window_id }));
 
     *out_api = Box::into_raw(Box::new(sender.create_api()));
     *out_renderer = Box::into_raw(Box::new(renderer));
 
     return true;
 }
 
-// Call MakeCurrent before this.
-#[no_mangle]
-pub extern fn wr_gl_init(gl_context: *mut c_void) {
-    assert!(unsafe { is_in_render_thread() });
-
-    gl::load_with(|symbol| get_proc_address(gl_context, symbol));
-    gl::clear_color(0.3, 0.0, 0.0, 1.0);
-
-    let version = gl::get_string(gl::VERSION);
-
-    println!("WebRender - OpenGL version new {}", version);
-}
-
 #[no_mangle]
 pub extern fn wr_state_new(width: u32, height: u32, pipeline_id: PipelineId) -> *mut WrState {
     assert!(unsafe { is_in_compositor_thread() });
 
     let state = Box::new(WrState {
         size: (width, height),
         pipeline_id: pipeline_id,
         z_index: 0,
--- a/gfx/webrender_bindings/webrender_ffi.h
+++ b/gfx/webrender_bindings/webrender_ffi.h
@@ -357,22 +357,18 @@ wr_renderer_flush_rendered_epochs(WrRend
 WR_INLINE bool
 wr_rendered_epochs_next(WrRenderedEpochs* pipeline_epochs,
                         WrPipelineId* out_pipeline,
                         WrEpoch* out_epoch) WR_FUNC;
 
 WR_INLINE void
 wr_rendered_epochs_delete(WrRenderedEpochs* pipeline_epochs) WR_DESTRUCTOR_SAFE_FUNC;
 
-WR_INLINE void
-wr_gl_init(void* aGLContext)
-WR_FUNC;
-
 WR_INLINE bool
-wr_window_new(WrWindowId window_id, bool enable_profiler, WrAPI** out_api,
+wr_window_new(WrWindowId window_id, void* aGLContext, bool enable_profiler, WrAPI** out_api,
               WrRenderer** out_renderer)
 WR_FUNC;
 
 WR_INLINE void
 wr_api_delete(WrAPI* api)
 WR_DESTRUCTOR_SAFE_FUNC;
 
 WR_INLINE WrImageKey