Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1714883002: command_buffer_gles2: Implement EGL default Display as a global object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@command_buffer_gles2-multiple-contexts
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index ae331e5a4a080d4cf275e8cb35d2caf30011a28a..d23dbd9f5ea9c53204e7b941d6fc7b3558720feb 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -563,6 +563,7 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
bool ResizeOffscreenFrameBuffer(const gfx::Size& size) override;
void UpdateParentTextureInfo();
bool MakeCurrent() override;
+ void ReleaseCurrent() override;
GLES2Util* GetGLES2Util() override { return &util_; }
gfx::GLContext* GetGLContext() override { return context_.get(); }
ContextGroup* GetContextGroup() override { return group_.get(); }
@@ -3612,6 +3613,18 @@ bool GLES2DecoderImpl::MakeCurrent() {
return true;
}
+void GLES2DecoderImpl::ReleaseCurrent() {
+ if (!context_.get())
+ return;
+
+ if (WasContextLost()) {
+ LOG(ERROR) << " GLES2DecoderImpl: Trying to release lost context.";
+ return;
+ }
+
+ context_->ReleaseCurrent(surface_.get());
+}
+
void GLES2DecoderImpl::ProcessFinishedAsyncTransfers() {
ProcessPendingReadPixels(false);
if (engine() && query_manager_.get())
@@ -4133,7 +4146,7 @@ void GLES2DecoderImpl::Destroy(bool have_context) {
void GLES2DecoderImpl::SetSurface(
const scoped_refptr<gfx::GLSurface>& surface) {
DCHECK(context_->IsCurrent(NULL));
- DCHECK(surface_.get());
+ // Surface can be null, but then the client should not use the decoder.
surface_ = surface;
RestoreCurrentFramebufferBindings();
}

Powered by Google App Engine
This is Rietveld 408576698