diff options
author | dspringer@google.com <dspringer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-23 18:00:07 +0000 |
---|---|---|
committer | dspringer@google.com <dspringer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-23 18:00:07 +0000 |
commit | 1aef9813f6edaead72c9dfe24ccd07ec525c75b3 (patch) | |
tree | 9cd13cab509d4e9d32d63b043a0c8132b7033cce /chrome/browser/renderer_host | |
parent | bcc3a0cb7f900dda0b4065055f3539c01f901df2 (diff) | |
download | chromium_src-1aef9813f6edaead72c9dfe24ccd07ec525c75b3.zip chromium_src-1aef9813f6edaead72c9dfe24ccd07ec525c75b3.tar.gz chromium_src-1aef9813f6edaead72c9dfe24ccd07ec525c75b3.tar.bz2 |
Add 3D support for the Mac on Leopard (OS X 10.5) and earlier. This CL uses
FBO rendering with glGetTexImage() into a TransportDIB that is then used as
a texture for rendering the final image in the render view in the browser.
While not optimal, it works and can be optimized later, after the new GPU
process work is completed.
This CL also enables stencil buffer support on the Mac. All the Pepper3D
demos run on the Mac with these changes.
BUG=none
TEST=3D rendering unit tests.
Review URL: http://codereview.chromium.org/647043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39744 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
7 files changed, 49 insertions, 6 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc index c8ac130..dcb348c 100644 --- a/chrome/browser/renderer_host/render_widget_host.cc +++ b/chrome/browser/renderer_host/render_widget_host.cc @@ -150,6 +150,8 @@ void RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) { OnDestroyFakePluginWindowHandle) IPC_MESSAGE_HANDLER(ViewHostMsg_GPUPluginSetIOSurface, OnGPUPluginSetIOSurface) + IPC_MESSAGE_HANDLER(ViewHostMsg_GPUPluginSetTransportDIB, + OnGPUPluginSetTransportDIB) IPC_MESSAGE_HANDLER(ViewHostMsg_GPUPluginBuffersSwapped, OnGPUPluginBuffersSwapped) #endif @@ -914,6 +916,16 @@ void RenderWidgetHost::OnGPUPluginSetIOSurface(gfx::PluginWindowHandle window, } } +void RenderWidgetHost::OnGPUPluginSetTransportDIB( + gfx::PluginWindowHandle window, + int32 width, + int32 height, + TransportDIB::Handle transport_dib) { + if (view_) { + view_->GPUPluginSetTransportDIB(window, width, height, transport_dib); + } +} + void RenderWidgetHost::OnGPUPluginBuffersSwapped( gfx::PluginWindowHandle window) { if (view_) { diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h index 146be7f..e96eae7 100644 --- a/chrome/browser/renderer_host/render_widget_host.h +++ b/chrome/browser/renderer_host/render_widget_host.h @@ -452,6 +452,10 @@ class RenderWidgetHost : public IPC::Channel::Listener, int32 width, int32 height, uint64 mach_port); + void OnGPUPluginSetTransportDIB(gfx::PluginWindowHandle window, + int32 width, + int32 height, + TransportDIB::Handle transport_dib); void OnGPUPluginBuffersSwapped(gfx::PluginWindowHandle window); #endif diff --git a/chrome/browser/renderer_host/render_widget_host_view.h b/chrome/browser/renderer_host/render_widget_host_view.h index 8febbb0..f6f8788 100644 --- a/chrome/browser/renderer_host/render_widget_host_view.h +++ b/chrome/browser/renderer_host/render_widget_host_view.h @@ -11,6 +11,7 @@ #include "app/gfx/native_widget_types.h" #include "base/shared_memory.h" +#include "chrome/common/transport_dib.h" #include "third_party/skia/include/core/SkBitmap.h" #include "webkit/glue/webplugin.h" @@ -187,6 +188,10 @@ class RenderWidgetHostView { int32 width, int32 height, uint64 io_surface_identifier) = 0; + virtual void GPUPluginSetTransportDIB(gfx::PluginWindowHandle window, + int32 width, + int32 height, + TransportDIB::Handle transport_dib) = 0; virtual void GPUPluginBuffersSwapped(gfx::PluginWindowHandle window) = 0; // Draws the current GPU plugin instances into the given context. virtual void DrawGPUPluginInstances(CGLContextObj context) = 0; diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.h b/chrome/browser/renderer_host/render_widget_host_view_mac.h index 332263e..db0c381 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.h +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.h @@ -124,6 +124,10 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView { int32 width, int32 height, uint64 io_surface_identifier); + virtual void GPUPluginSetTransportDIB(gfx::PluginWindowHandle window, + int32 width, + int32 height, + TransportDIB::Handle transport_dib); virtual void GPUPluginBuffersSwapped(gfx::PluginWindowHandle window); // Draws the current GPU plugin instances into the given context. virtual void DrawGPUPluginInstances(CGLContextObj context); diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm index d9cb616a..b413c54 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm @@ -503,10 +503,6 @@ void RenderWidgetHostViewMac::KillSelf() { gfx::PluginWindowHandle RenderWidgetHostViewMac::AllocateFakePluginWindowHandle() { - // We currently only support the GPU plugin on 10.6 and later. - if (!IOSurfaceSupport::Initialize()) - return 0; - // If we don't already have a GPUPluginLayer allocated for our view, // set one up now. if (gpu_plugin_layer_.get() == nil) { @@ -544,10 +540,21 @@ void RenderWidgetHostViewMac::GPUPluginSetIOSurface( int32 width, int32 height, uint64 io_surface_identifier) { - plugin_container_manager_.SetSizeAndBackingStore(window, + plugin_container_manager_.SetSizeAndIOSurface(window, + width, + height, + io_surface_identifier); +} + +void RenderWidgetHostViewMac::GPUPluginSetTransportDIB( + gfx::PluginWindowHandle window, + int32 width, + int32 height, + TransportDIB::Handle transport_dib) { + plugin_container_manager_.SetSizeAndTransportDIB(window, width, height, - io_surface_identifier); + transport_dib); } void RenderWidgetHostViewMac::GPUPluginBuffersSwapped( diff --git a/chrome/browser/renderer_host/test/test_render_view_host.cc b/chrome/browser/renderer_host/test/test_render_view_host.cc index 1c71d05..91b7b914 100644 --- a/chrome/browser/renderer_host/test/test_render_view_host.cc +++ b/chrome/browser/renderer_host/test/test_render_view_host.cc @@ -108,6 +108,13 @@ void TestRenderWidgetHostView::GPUPluginSetIOSurface( uint64 io_surface_identifier) { } +void TestRenderWidgetHostView::GPUPluginSetTransportDIB( + gfx::PluginWindowHandle window, + int32 width, + int32 height, + TransportDIB::Handle transport_dib) { +} + void TestRenderWidgetHostView::GPUPluginBuffersSwapped( gfx::PluginWindowHandle window) { } diff --git a/chrome/browser/renderer_host/test/test_render_view_host.h b/chrome/browser/renderer_host/test/test_render_view_host.h index 063b7dd..fbeb388 100644 --- a/chrome/browser/renderer_host/test/test_render_view_host.h +++ b/chrome/browser/renderer_host/test/test_render_view_host.h @@ -85,6 +85,10 @@ class TestRenderWidgetHostView : public RenderWidgetHostView { int32 width, int32 height, uint64 io_surface_identifier); + virtual void GPUPluginSetTransportDIB(gfx::PluginWindowHandle window, + int32 width, + int32 height, + TransportDIB::Handle transport_dib); virtual void GPUPluginBuffersSwapped(gfx::PluginWindowHandle window); virtual void DrawGPUPluginInstances(CGLContextObj context); #endif |