diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 21:16:02 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-09 21:16:02 +0000 |
commit | d37231fa18e0978822c6aa2c9d03e7a56e61810b (patch) | |
tree | 2765f8b09fe2f23a667cc1c0fb821d384a35dbd0 /gpu/command_buffer/service/gpu_processor.cc | |
parent | 7b70a92006d329a3e2df40ec6b61322212f75d95 (diff) | |
download | chromium_src-d37231fa18e0978822c6aa2c9d03e7a56e61810b.zip chromium_src-d37231fa18e0978822c6aa2c9d03e7a56e61810b.tar.gz chromium_src-d37231fa18e0978822c6aa2c9d03e7a56e61810b.tar.bz2 |
- Extracted platform specific code from GLES2 command decoder to platform specific GLContext classes.
- GLContext encapsulates management of GL contexts on each platform.
- ReadPixels uses actual current window size to validate source rectangle.
TEST=trybots, running Pepper 3D and WebGL demos on all platforms
BUG=none
Review URL: http://codereview.chromium.org/1605014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44129 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service/gpu_processor.cc')
-rw-r--r-- | gpu/command_buffer/service/gpu_processor.cc | 64 |
1 files changed, 47 insertions, 17 deletions
diff --git a/gpu/command_buffer/service/gpu_processor.cc b/gpu/command_buffer/service/gpu_processor.cc index d08069c..4514211 100644 --- a/gpu/command_buffer/service/gpu_processor.cc +++ b/gpu/command_buffer/service/gpu_processor.cc @@ -5,6 +5,7 @@ #include "base/callback.h" #include "base/compiler_specific.h" #include "base/message_loop.h" +#include "gpu/command_buffer/service/gl_context.h" #include "gpu/command_buffer/service/gpu_processor.h" using ::base::SharedMemory; @@ -36,6 +37,52 @@ GPUProcessor::~GPUProcessor() { Destroy(); } +bool GPUProcessor::InitializeCommon(const gfx::Size& size, + gles2::GLES2Decoder* parent_decoder, + uint32 parent_texture_id) { + // Context should have been created by platform specific Initialize(). + DCHECK(context_.get()); + + // Map the ring buffer and create the parser. + Buffer ring_buffer = command_buffer_->GetRingBuffer(); + if (ring_buffer.ptr) { + parser_.reset(new CommandParser(ring_buffer.ptr, + ring_buffer.size, + 0, + ring_buffer.size, + 0, + decoder_.get())); + } else { + parser_.reset(new CommandParser(NULL, 0, 0, 0, 0, + decoder_.get())); + } + + // Initialize the decoder with either the view or pbuffer GLContext. + if (!decoder_->Initialize(context_.get(), + size, + parent_decoder, + parent_texture_id)) { + Destroy(); + return false; + } + + return true; +} + +void GPUProcessor::Destroy() { + if (decoder_.get()) { + decoder_->Destroy(); + decoder_.reset(); + } + + if (context_.get()) { + context_->Destroy(); + context_.reset(); + } + + parser_.reset(); +} + void GPUProcessor::ProcessCommands() { CommandBuffer::State state = command_buffer_->GetState(); if (state.error != error::kNoError) @@ -92,23 +139,6 @@ void GPUProcessor::ResizeOffscreenFrameBuffer(const gfx::Size& size) { decoder_->ResizeOffscreenFrameBuffer(size); } -#if defined(OS_MACOSX) -uint64 GPUProcessor::SetWindowSizeForIOSurface(int32 width, int32 height) { - return decoder_->SetWindowSizeForIOSurface(width, height); -} - -TransportDIB::Handle GPUProcessor::SetWindowSizeForTransportDIB(int32 width, - int32 height) { - return decoder_->SetWindowSizeForTransportDIB(width, height); -} - -void GPUProcessor::SetTransportDIBAllocAndFree( - Callback2<size_t, TransportDIB::Handle*>::Type* allocator, - Callback1<TransportDIB::Id>::Type* deallocator) { - decoder_->SetTransportDIBAllocAndFree(allocator, deallocator); -} -#endif - void GPUProcessor::SetSwapBuffersCallback( Callback0::Type* callback) { decoder_->SetSwapBuffersCallback(callback); |