Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that the EGL rendering context is bound to the GPU thread in Rasterizer::MakeRasterSnapshot #6816

Merged
merged 1 commit into from
Nov 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ sk_sp<SkImage> Rasterizer::MakeRasterSnapshot(sk_sp<SkPicture> picture,
SkISize picture_size) {
TRACE_EVENT0("flutter", __FUNCTION__);

if (!surface_->MakeRenderContextCurrent()) {
return nullptr;
}

sk_sp<SkSurface> surface;
if (surface_ == nullptr || surface_->GetContext() == nullptr) {
// Raster surface is fine if there is no on screen surface. This might
Expand Down
4 changes: 4 additions & 0 deletions shell/common/surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,8 @@ flow::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() {
return nullptr;
}

bool Surface::MakeRenderContextCurrent() {
return true;
}

} // namespace shell
2 changes: 2 additions & 0 deletions shell/common/surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class Surface {

virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder();

virtual bool MakeRenderContextCurrent();

private:
FML_DISALLOW_COPY_AND_ASSIGN(Surface);
};
Expand Down
5 changes: 5 additions & 0 deletions shell/gpu/gpu_surface_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,9 @@ flow::ExternalViewEmbedder* GPUSurfaceGL::GetExternalViewEmbedder() {
return delegate_->GetExternalViewEmbedder();
}

// |shell::Surface|
bool GPUSurfaceGL::MakeRenderContextCurrent() {
return delegate_->GLContextMakeCurrent();
}

} // namespace shell
3 changes: 3 additions & 0 deletions shell/gpu/gpu_surface_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ class GPUSurfaceGL : public Surface {
// |shell::Surface|
flow::ExternalViewEmbedder* GetExternalViewEmbedder() override;

// |shell::Surface|
bool MakeRenderContextCurrent() override;

private:
GPUSurfaceGLDelegate* delegate_;
GPUSurfaceGLDelegate::GLProcResolver proc_resolver_;
Expand Down