Ensure that the EGL rendering context is bound to the GPU thread in Rasterizer::MakeRasterSnapshot (flutter/engine#6816)
Fixes https://github.com/flutter/flutter/issues/24083
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -68,4 +68,8 @@ flow::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Surface::MakeRenderContextCurrent() {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace shell
|
||||
|
||||
@@ -58,6 +58,8 @@ class Surface {
|
||||
|
||||
virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder();
|
||||
|
||||
virtual bool MakeRenderContextCurrent();
|
||||
|
||||
private:
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(Surface);
|
||||
};
|
||||
|
||||
@@ -363,4 +363,9 @@ flow::ExternalViewEmbedder* GPUSurfaceGL::GetExternalViewEmbedder() {
|
||||
return delegate_->GetExternalViewEmbedder();
|
||||
}
|
||||
|
||||
// |shell::Surface|
|
||||
bool GPUSurfaceGL::MakeRenderContextCurrent() {
|
||||
return delegate_->GLContextMakeCurrent();
|
||||
}
|
||||
|
||||
} // namespace shell
|
||||
|
||||
@@ -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_;
|
||||
|
||||
Reference in New Issue
Block a user