Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc

Issue 14456004: GPU client side changes for GpuMemoryBuffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@glapi
Patch Set: Implement DeleteImageBuffersHelper and remove unused GetNativeBufferForGpuMemoryBuffer Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 c0d011345fa3aa6df6b94c9bb0ec459811750274..9cc6acb92b366a249ccee5c4cd95945a4a47a066 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"
@@ -162,6 +165,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_;
@@ -417,6 +422,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),
@@ -601,6 +610,12 @@ bool GLInProcessContext::Initialize(
true,
false));
+ // GLES2Implementation::Initialize() which is called next
+ // needs the GpuMemoryBufferFactory so we set it before
+ // Initialize is called.
+ gles2_implementation_->SetGpuMemoryBufferFactory(
+ new ::gpu::gles2::GpuMemoryBufferFactory(GetImageManager()));
+
if (!gles2_implementation_->Initialize(
kStartTransferBufferSize,
kMinTransferBufferSize,
@@ -1705,6 +1720,12 @@ void WebGraphicsContext3DInProcessCommandBufferImpl::deleteFramebuffer(
gl_->DeleteFramebuffers(1, &framebuffer);
}
+void WebGraphicsContext3DInProcessCommandBufferImpl::deleteImageBuffer(
+ WebGLId imagebuffer) {
+ ClearContext();
+ gl_->DeleteImageBuffers(1, &imagebuffer);
+}
+
void WebGraphicsContext3DInProcessCommandBufferImpl::deleteProgram(
WebGLId program) {
ClearContext();
@@ -1829,6 +1850,13 @@ void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() {
}
}
+void WebGraphicsContext3DInProcessCommandBufferImpl::
+ createGpuMemoryBuffer2DCHROMIUM(WGC3Duint image_id,
+ WGC3Dint width, WGC3Dint height) {
+ ClearContext();
+ gl_->CreateGpuMemoryBuffer2DCHROMIUM(image_id, width, height);
+}
+
DELEGATE_TO_GL_3(bindUniformLocationCHROMIUM, BindUniformLocationCHROMIUM,
WebGLId, WGC3Dint, const WGC3Dchar*)

Powered by Google App Engine
This is Rietveld 408576698