From 30e25a3e5b5160a3857b062db812b509a5a32dad Mon Sep 17 00:00:00 2001 From: "amarinichev@google.com" Date: Mon, 22 Nov 2010 23:27:37 +0000 Subject: Added ggl::IsCommandBufferContextLost that checks the state of the command buffer. This will be used in the implementation of Extensions3DChromium::getGraphicsResetStatusARB. Webkit change will follow once this lands. BUG=58785 TEST=requires webkit change Review URL: http://codereview.chromium.org/5188008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67021 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/ggl/ggl.cc | 11 +++++++++++ chrome/renderer/ggl/ggl.h | 4 ++++ chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc | 4 ++++ chrome/renderer/webgraphicscontext3d_command_buffer_impl.h | 2 ++ 4 files changed, 21 insertions(+) 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 { // 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, -- cgit v1.1