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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 1916303003: Report lost context from GLES2Implementation based on share group state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lost-share-group: disconnect-channel Created 4 years, 8 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/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index cad26ab7b62288db7d4ae3532a8033208975dd95..84f8ef73821fa5b2f2606f62b66e1790e69dda3d 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -327,15 +327,21 @@ IdAllocator* GLES2Implementation::GetIdAllocator(int namespace_id) const {
}
void GLES2Implementation::OnGpuControlLostContext() {
-#if DCHECK_IS_ON()
// This should never occur more than once.
- DCHECK(!lost_context_);
- lost_context_ = true;
-#endif
+ DCHECK(!lost_context_callback_run_);
+ lost_context_callback_run_ = true;
+ share_group_->Lose();
if (!lost_context_callback_.is_null())
lost_context_callback_.Run();
}
+void GLES2Implementation::OnGpuControlLostContextMaybeReentrant() {
+ // Queries for lost context state should immediately reflect reality,
+ // but don't call out to clients yet to avoid them re-entering this
+ // class.
+ share_group_->Lose();
+}
+
void GLES2Implementation::OnGpuControlErrorMessage(const char* message,
int32_t id) {
if (!error_message_callback_.is_null())
@@ -367,7 +373,7 @@ void GLES2Implementation::FreeEverything() {
}
void GLES2Implementation::RunIfContextNotLost(const base::Closure& callback) {
- if (!helper_->IsContextLost())
+ if (!lost_context_callback_run_)
callback.Run();
}
@@ -4637,15 +4643,10 @@ void GLES2Implementation::GetVertexAttribIuiv(
GLenum GLES2Implementation::GetGraphicsResetStatusKHR() {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetGraphicsResetStatusKHR()");
- // If we can't make command buffers then the context is lost.
- if (gpu_control_->IsGpuChannelLost())
- return GL_UNKNOWN_CONTEXT_RESET_KHR;
- // Otherwise, check the command buffer if it is lost.
- if (helper_->IsContextLost()) {
- // TODO(danakj): We could GetLastState() off the CommandBuffer and return
- // the actual reason here if we cared to.
+ // If any context (including ourselves) has seen itself become lost,
+ // then it will have told the ShareGroup, so just report its status.
+ if (share_group_->IsLost())
return GL_UNKNOWN_CONTEXT_RESET_KHR;
- }
return GL_NO_ERROR;
}
@@ -5382,11 +5383,6 @@ void GLES2Implementation::EndQueryEXT(GLenum target) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] EndQueryEXT("
<< GLES2Util::GetStringQueryTarget(target) << ")");
- // Don't do anything if the context is lost.
- if (helper_->IsContextLost()) {
- return;
- }
-
if (query_tracker_->EndQuery(target, this))
CheckGLError();
}
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.h ('k') | gpu/command_buffer/client/gles2_implementation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698