diff options
author | amarinichev@google.com <amarinichev@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-22 23:27:37 +0000 |
---|---|---|
committer | amarinichev@google.com <amarinichev@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-22 23:27:37 +0000 |
commit | 30e25a3e5b5160a3857b062db812b509a5a32dad (patch) | |
tree | 036a095d359d372734fa0f41e16392063e619593 | |
parent | 9521d0a19f83d229aa4e663489c59d5830b3cb29 (diff) | |
download | chromium_src-30e25a3e5b5160a3857b062db812b509a5a32dad.zip chromium_src-30e25a3e5b5160a3857b062db812b509a5a32dad.tar.gz chromium_src-30e25a3e5b5160a3857b062db812b509a5a32dad.tar.bz2 |
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
-rw-r--r-- | chrome/renderer/ggl/ggl.cc | 11 | ||||
-rw-r--r-- | chrome/renderer/ggl/ggl.h | 4 | ||||
-rw-r--r-- | chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/webgraphicscontext3d_command_buffer_impl.h | 2 |
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, |