summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/ggl/ggl.cc11
-rw-r--r--chrome/renderer/ggl/ggl.h4
-rw-r--r--chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc4
-rw-r--r--chrome/renderer/webgraphicscontext3d_command_buffer_impl.h2
4 files changed, 21 insertions, 0 deletions
diff --git a/chrome/renderer/ggl/ggl.cc b/chrome/renderer/ggl/ggl.cc
index f5d8ab1..b983514 100644
--- a/chrome/renderer/ggl/ggl.cc
+++ b/chrome/renderer/ggl/ggl.cc
@@ -111,6 +111,8 @@ class Context : public base::SupportsWeakPtr<Context> {
// Replace the current error code with this.
void SetError(Error error);
+ bool IsCommandBufferContextLost();
+
// TODO(gman): Remove this.
void DisableShaderTranslation();
@@ -405,6 +407,11 @@ void Context::SetError(Error error) {
last_error_ = error;
}
+bool Context::IsCommandBufferContextLost() {
+ gpu::CommandBuffer::State state = command_buffer_->GetLastState();
+ return state.error == gpu::error::kLostContext;
+}
+
// TODO(gman): Remove This
void Context::DisableShaderTranslation() {
gles2_implementation_->CommandBufferEnableCHROMIUM(
@@ -542,6 +549,10 @@ Error GetError(Context* context) {
#endif
}
+bool IsCommandBufferContextLost(Context* context) {
+ return context->IsCommandBufferContextLost();
+}
+
// TODO(gman): Remove This
void DisableShaderTranslation(Context* context) {
#if defined(ENABLE_GPU)
diff --git a/chrome/renderer/ggl/ggl.h b/chrome/renderer/ggl/ggl.h
index 54a7f8e..dcedcc0 100644
--- a/chrome/renderer/ggl/ggl.h
+++ b/chrome/renderer/ggl/ggl.h
@@ -162,6 +162,10 @@ gpu::gles2::GLES2Implementation* GetImplementation(Context* context);
// Return the current GGL error.
Error GetError(Context* context);
+// Return true if GPU process reported context lost or there was a problem
+// communicating with the GPU process.
+bool IsCommandBufferContextLost(Context* context);
+
} // namespace ggl
#endif // CHROME_RENDERER_GGL_GGL_H_
diff --git a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
index f6f731d..af89470 100644
--- a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
+++ b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc
@@ -669,6 +669,10 @@ unsigned long WebGraphicsContext3DCommandBufferImpl::getError() {
return glGetError();
}
+bool WebGraphicsContext3DCommandBufferImpl::isContextLost() {
+ return ggl::IsCommandBufferContextLost(context_);
+}
+
DELEGATE_TO_GL_2(getFloatv, GetFloatv, unsigned long, float*)
DELEGATE_TO_GL_4(getFramebufferAttachmentParameteriv,
diff --git a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h
index 481ee2d..bf9ecfe 100644
--- a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h
+++ b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.h
@@ -165,6 +165,8 @@ class WebGraphicsContext3DCommandBufferImpl
virtual unsigned long getError();
+ virtual bool isContextLost();
+
virtual void getFloatv(unsigned long pname, float* value);
virtual void getFramebufferAttachmentParameteriv(unsigned long target,