Bug 1432309 - ensure the GL context is current when updating wr. r=sotaro

To avoid future issues, this is done by combining the Render and Update methods
into a single call. As a minor side-effect, timing in the parent method now
includes the time to run update.

MozReview-Commit-ID: GJ0l049eFRj

--HG--
extra : rebase_source : f9b4ee6f34bc45d87b3df40e5a25f3bfb2ec8068
This commit is contained in:
Alexis Beingessner 2018-01-31 21:34:43 -05:00
Родитель 3cbbdda385
Коммит 291824030e
3 изменённых файлов: 5 добавлений и 14 удалений

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

@ -220,11 +220,9 @@ RenderThread::UpdateAndRender(wr::WindowId aWindowId)
}
auto& renderer = it->second;
renderer->Update();
TimeStamp start = TimeStamp::Now();
bool ret = renderer->Render();
bool ret = renderer->UpdateAndRender();
if (!ret) {
// Render did not happen, do not call NotifyDidRender.
return;

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

@ -81,14 +81,8 @@ RendererOGL::GetExternalImageHandler()
};
}
void
RendererOGL::Update()
{
wr_renderer_update(mRenderer);
}
bool
RendererOGL::Render()
RendererOGL::UpdateAndRender()
{
uint32_t flags = gfx::gfxVars::WebRenderDebugFlags();
@ -117,6 +111,8 @@ RendererOGL::Render()
return false;
}
wr_renderer_update(mRenderer);
auto size = mCompositor->GetClientSize();
if (!wr_renderer_render(mRenderer, size.width, size.height)) {

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

@ -50,10 +50,7 @@ public:
wr::WrExternalImageHandler GetExternalImageHandler();
/// This can be called on the render thread only.
void Update();
/// This can be called on the render thread only.
bool Render();
bool UpdateAndRender();
/// This can be called on the render thread only.
bool RenderToTarget(gfx::DrawTarget& aTarget);