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 ea5fbdd4f176b57af2c923e468f34f1bcd8f634c..82d2c306a6f2ba0cd46ec55cfa2d5cc6b43def84 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -682,6 +682,7 @@ class GLES2DecoderImpl : public GLES2Decoder, |
void OnTextureRefDetachedFromFramebuffer(TextureRef* texture) override; |
// Overriden from ErrorStateClient. |
+ void OnContextLostError() override; |
void OnOutOfMemoryError() override; |
// Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound. |
@@ -2642,6 +2643,7 @@ bool GLES2DecoderImpl::Initialize( |
has_robustness_extension_ = |
context->HasExtension("GL_ARB_robustness") || |
+ context->HasExtension("GL_KHR_robustness") || |
context->HasExtension("GL_EXT_robustness"); |
if (!InitializeShaderTranslator()) { |
@@ -9734,6 +9736,20 @@ void GLES2DecoderImpl::LoseContext(uint32 reset_status) { |
return; |
} |
+ // If the reason for the call was a GL error, we can try to determine the |
+ // reset status more accurately. |
+ // TODO(oetuaho@nvidia.com): This is not correct in virtual context mode. |
no sievers
2014/10/29 23:35:33
Should we just always say UNKNOWN with virtual con
oetuaho-nv
2014/10/30 09:17:14
Yep, that sounds like it would work, probably a be
|
+ // Maybe implement a special version of GetGraphicsResetStatus for virtual |
+ // contexts. |
+ if (reset_status == GL_UNKNOWN_CONTEXT_RESET_ARB && |
+ has_robustness_extension_) { |
+ GLenum driver_status = glGetGraphicsResetStatusARB(); |
+ if (driver_status == GL_GUILTY_CONTEXT_RESET_ARB || |
+ driver_status == GL_INNOCENT_CONTEXT_RESET_ARB) { |
+ reset_status = driver_status; |
+ } |
+ } |
+ |
// Marks this context as lost. |
reset_status_ = reset_status; |
current_decoder_error_ = error::kLostContext; |
@@ -11225,10 +11241,13 @@ void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer( |
DoDidUseTexImageIfNeeded(texture, texture->target()); |
} |
+void GLES2DecoderImpl::OnContextLostError() { |
+ group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); |
+} |
+ |
void GLES2DecoderImpl::OnOutOfMemoryError() { |
if (lose_context_when_out_of_memory_) { |
group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB); |
- LoseContext(GL_GUILTY_CONTEXT_RESET_ARB); |
} |
} |