summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authordspringer@google.com <dspringer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 18:00:07 +0000
committerdspringer@google.com <dspringer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 18:00:07 +0000
commit1aef9813f6edaead72c9dfe24ccd07ec525c75b3 (patch)
tree9cd13cab509d4e9d32d63b043a0c8132b7033cce /chrome/plugin
parentbcc3a0cb7f900dda0b4065055f3539c01f901df2 (diff)
downloadchromium_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/plugin')
-rw-r--r--chrome/plugin/command_buffer_stub.cc31
-rw-r--r--chrome/plugin/command_buffer_stub.h3
2 files changed, 33 insertions, 1 deletions
diff --git a/chrome/plugin/command_buffer_stub.cc b/chrome/plugin/command_buffer_stub.cc
index e6f4b76..103bde3 100644
--- a/chrome/plugin/command_buffer_stub.cc
+++ b/chrome/plugin/command_buffer_stub.cc
@@ -86,6 +86,9 @@ void CommandBufferStub::OnInitialize(int32 size,
processor_->SetSwapBuffersCallback(
NewCallback(this,
&CommandBufferStub::SwapBuffersCallback));
+ processor_->SetTransportDIBAllocAndFree(
+ NewCallback(this, &CommandBufferStub::AllocTransportDIB),
+ NewCallback(this, &CommandBufferStub::FreeTransportDIB));
#endif
buffer.shared_memory->ShareToProcess(peer_handle, ring_buffer);
} else {
@@ -149,13 +152,27 @@ void CommandBufferStub::OnGetTransferBuffer(
#if defined(OS_MACOSX)
void CommandBufferStub::OnSetWindowSize(int32 width, int32 height) {
- uint64 new_backing_store = processor_->SetWindowSize(width, height);
+ // Try using the IOSurface version first.
+ uint64 new_backing_store = processor_->SetWindowSizeForIOSurface(width,
+ height);
if (new_backing_store) {
Send(new PluginHostMsg_GPUPluginSetIOSurface(plugin_host_route_id_,
window_,
width,
height,
new_backing_store));
+ } else {
+ // If |new_backing_store| is 0, it might mean that the IOSurface APIs are
+ // not available. In this case, see if TransportDIBs are supported.
+ TransportDIB::Handle transport_dib =
+ processor_->SetWindowSizeForTransportDIB(width, height);
+ if (TransportDIB::is_valid(transport_dib)) {
+ Send(new PluginHostMsg_GPUPluginSetTransportDIB(plugin_host_route_id_,
+ window_,
+ width,
+ height,
+ transport_dib));
+ }
}
}
@@ -163,4 +180,16 @@ void CommandBufferStub::SwapBuffersCallback() {
Send(new PluginHostMsg_GPUPluginBuffersSwapped(plugin_host_route_id_,
window_));
}
+
+void CommandBufferStub::AllocTransportDIB(const size_t size,
+ TransportDIB::Handle* dib_handle) {
+ Send(new PluginHostMsg_AllocTransportDIB(plugin_host_route_id_,
+ size,
+ dib_handle));
+}
+
+void CommandBufferStub::FreeTransportDIB(TransportDIB::Id dib_id) {
+ Send(new PluginHostMsg_FreeTransportDIB(plugin_host_route_id_,
+ dib_id));
+}
#endif
diff --git a/chrome/plugin/command_buffer_stub.h b/chrome/plugin/command_buffer_stub.h
index f0d8ac0..219aadb 100644
--- a/chrome/plugin/command_buffer_stub.h
+++ b/chrome/plugin/command_buffer_stub.h
@@ -9,6 +9,7 @@
#include "app/gfx/native_widget_types.h"
#include "base/ref_counted.h"
+#include "chrome/common/transport_dib.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/service/command_buffer_service.h"
#include "gpu/command_buffer/service/gpu_processor.h"
@@ -52,6 +53,8 @@ class CommandBufferStub : public IPC::Channel::Listener,
#if defined(OS_MACOSX)
void OnSetWindowSize(int32 width, int32 height);
void SwapBuffersCallback();
+ void AllocTransportDIB(const size_t size, TransportDIB::Handle* dib_handle);
+ void FreeTransportDIB(TransportDIB::Id dib_id);
#endif
scoped_refptr<PluginChannel> channel_;