diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 22:08:35 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 22:08:35 +0000 |
commit | 6217d397bf501ec1ec5b7270d493006badd4d87a (patch) | |
tree | fce6c8e9c15b79bab29a9535ce9929dd9d53735b /gpu/command_buffer/service/gpu_processor.h | |
parent | 21dedcc12d21ccb288244249522d77bc074c501e (diff) | |
download | chromium_src-6217d397bf501ec1ec5b7270d493006badd4d87a.zip chromium_src-6217d397bf501ec1ec5b7270d493006badd4d87a.tar.gz chromium_src-6217d397bf501ec1ec5b7270d493006badd4d87a.tar.bz2 |
Calling OpenGL from the renderer process
- Added ability for renderer processes to render to a real window (Windows only so far).
- Added ability to create offscreen frame buffer objects that can be resized later.
- OpenGL context can have a "parent" context that can access its last swapped back buffer through a texture ID.
- Moved code to establish GPU channel from RenderWidget to RenderThread.
- Changed way service size command buffer object lifetimes are managed.
TEST=trybot and visual verification that OpenGL can clear the browser window to magenta.
BUG=none
Review URL: http://codereview.chromium.org/1136006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42679 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service/gpu_processor.h')
-rw-r--r-- | gpu/command_buffer/service/gpu_processor.h | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/gpu/command_buffer/service/gpu_processor.h b/gpu/command_buffer/service/gpu_processor.h index d34e35d..d61bd60 100644 --- a/gpu/command_buffer/service/gpu_processor.h +++ b/gpu/command_buffer/service/gpu_processor.h @@ -9,7 +9,9 @@ #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/shared_memory.h" +#include "base/task.h" #include "gfx/native_widget_types.h" +#include "gfx/size.h" #include "gpu/command_buffer/common/command_buffer.h" #include "gpu/command_buffer/service/cmd_buffer_engine.h" #include "gpu/command_buffer/service/cmd_parser.h" @@ -20,8 +22,7 @@ namespace gpu { // This class processes commands in a command buffer. It is event driven and // posts tasks to the current message loop to do additional work. -class GPUProcessor : public base::RefCounted<GPUProcessor>, - public CommandBufferEngine { +class GPUProcessor : public CommandBufferEngine { public: explicit GPUProcessor(CommandBuffer* command_buffer); @@ -31,7 +32,10 @@ class GPUProcessor : public base::RefCounted<GPUProcessor>, CommandParser* parser, int commands_per_update); - virtual bool Initialize(gfx::PluginWindowHandle hwnd); + virtual bool Initialize(gfx::PluginWindowHandle hwnd, + GPUProcessor* parent, + const gfx::Size& size, + uint32 parent_texture_id); virtual ~GPUProcessor(); @@ -45,6 +49,9 @@ class GPUProcessor : public base::RefCounted<GPUProcessor>, virtual bool SetGetOffset(int32 offset); virtual int32 GetGetOffset(); + // Asynchronously resizes an offscreen frame buffer. + void ResizeOffscreenFrameBuffer(const gfx::Size& size); + #if defined(OS_MACOSX) // Needed only on Mac OS X, which does not render into an on-screen // window and therefore requires the backing store to be resized @@ -71,37 +78,15 @@ class GPUProcessor : public base::RefCounted<GPUProcessor>, // through the ProcessCommands callback. CommandBuffer* command_buffer_; - scoped_ptr< ::base::SharedMemory> mapped_ring_buffer_; int commands_per_update_; gles2::ContextGroup group_; scoped_ptr<gles2::GLES2Decoder> decoder_; scoped_ptr<CommandParser> parser_; + + ScopedRunnableMethodFactory<GPUProcessor> method_factory_; }; } // namespace gpu -// Callbacks to the GPUProcessor hold a reference count. -template <typename Method> -class CallbackStorage<gpu::GPUProcessor, Method> { - public: - CallbackStorage(gpu::GPUProcessor* obj, Method method) - : obj_(obj), - meth_(method) { - DCHECK(obj_); - obj_->AddRef(); - } - - ~CallbackStorage() { - obj_->Release(); - } - - protected: - gpu::GPUProcessor* obj_; - Method meth_; - - private: - DISALLOW_COPY_AND_ASSIGN(CallbackStorage); -}; - #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_ |