Index: webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc |
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc |
index c63e85585557856c6eb46ac035fe8ebd2aa2bb37..60c974755ddcf61c9be419f4026a395a0b341ecc 100644 |
--- a/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc |
+++ b/webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc |
@@ -27,14 +27,17 @@ |
#include "base/synchronization/lock.h" |
#include "gpu/command_buffer/client/gles2_implementation.h" |
#include "gpu/command_buffer/client/gles2_lib.h" |
+#include "gpu/command_buffer/client/gpu_memory_buffer_factory.h" |
#include "gpu/command_buffer/client/transfer_buffer.h" |
#include "gpu/command_buffer/common/constants.h" |
#include "gpu/command_buffer/service/command_buffer_service.h" |
#include "gpu/command_buffer/service/context_group.h" |
#include "gpu/command_buffer/service/gl_context_virtual.h" |
#include "gpu/command_buffer/service/gpu_scheduler.h" |
+#include "gpu/command_buffer/service/image_manager.h" |
#include "gpu/command_buffer/service/transfer_buffer_manager.h" |
#include "ui/gl/gl_context.h" |
+#include "ui/gl/gl_image.h" |
#include "ui/gl/gl_share_group.h" |
#include "ui/gl/gl_surface.h" |
#include "webkit/gpu/gl_bindings_skia_cmd_buffer.h" |
@@ -143,6 +146,7 @@ class GLInProcessContext { |
::gpu::gles2::GLES2Decoder* GetDecoder(); |
+ |
private: |
explicit GLInProcessContext(bool share_resources); |
@@ -156,6 +160,8 @@ class GLInProcessContext { |
void OnContextLost(); |
+ ::gpu::gles2::ImageManager* GetImageManager(); |
+ |
base::Closure context_lost_callback_; |
scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
scoped_ptr<CommandBufferService> command_buffer_; |
@@ -385,6 +391,10 @@ GLES2Implementation* GLInProcessContext::GetImplementation() { |
return gles2_implementation_.get(); |
} |
+::gpu::gles2::ImageManager* GLInProcessContext::GetImageManager() { |
+ return decoder_->GetContextGroup()->image_manager(); |
+} |
+ |
GLInProcessContext::GLInProcessContext(bool share_resources) |
: last_error_(SUCCESS), |
share_resources_(share_resources), |
@@ -464,6 +474,8 @@ bool GLInProcessContext::Initialize( |
new ::gpu::gles2::ContextGroup( |
NULL, NULL, NULL, bind_generates_resource))); |
+ ::gpu::SetProcessDefaultImageManager(GetImageManager()); |
+ |
gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(), |
decoder_.get(), |
decoder_.get())); |
@@ -1644,6 +1656,11 @@ WebGLId WebGraphicsContext3DInProcessCommandBufferImpl::createTexture() { |
void WebGraphicsContext3DInProcessCommandBufferImpl::deleteBuffer( |
WebGLId buffer) { |
ClearContext(); |
+ // It is safe to call this method even though the buffer being deleted |
+ // isn't a GPU memory buffer as it eventually translates to a |
+ // hash_map::erase() which doesn't throw an exception if the key |
+ // isn't in the hash_map |
+ DeleteImageForGpuMemoryBuffer(buffer); |
gl_->DeleteBuffers(1, &buffer); |
} |
@@ -1777,6 +1794,12 @@ void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
} |
} |
+void WebGraphicsContext3DInProcessCommandBufferImpl::imageBufferDataCHROMIUM( |
+ WGC3Denum target, WGC3Dsizei width, WGC3Dsizei height) { |
+ ClearContext(); |
+ gl_->ImageBufferDataCHROMIUM(target, width, height); |
+} |
+ |
DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM, |
WebGLId, WGC3Dint, const WGC3Dchar*) |