diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 00:40:50 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 00:40:50 +0000 |
commit | 79311e89bc4fbd952d5ce872011f8360bfa5e6e6 (patch) | |
tree | 3d5225bf67189ff0e8946c36498b79136c1f2bc9 /gpu/gles2_conform_support | |
parent | db021357a069782b9fa5c4be509c88e26acdd727 (diff) | |
download | chromium_src-79311e89bc4fbd952d5ce872011f8360bfa5e6e6.zip chromium_src-79311e89bc4fbd952d5ce872011f8360bfa5e6e6.tar.gz chromium_src-79311e89bc4fbd952d5ce872011f8360bfa5e6e6.tar.bz2 |
Reland 101545 - Moved code not relating to GPU scheduling out of GpuScheduler and into GpuCommandBufferStub.
Reason for revert: Compile failure on Arm.
This was mostly a refactor because the code was awkward.
I also deleted the original gles2_demo since we have the gles2 book demos now.
THings still to do are a common way of setting up the few objects involved in initializing a command buffer that is now more-or-less duplicated in the gles2 conformance tests, the gles2 demos, the command buffer stub and the in-process webgl context. I also want to completely remove the reference to the decoder from the scheduler.
I tested WebGL on both windows and mac and saw no regressions. I checked the conformance tests, the gpu tests and am running by the try bots now. The gles2 demos still work.
Review URL: http://codereview.chromium.org/7782041
Review URL: http://codereview.chromium.org/7951008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/gles2_conform_support')
-rw-r--r-- | gpu/gles2_conform_support/egl/display.cc | 65 | ||||
-rw-r--r-- | gpu/gles2_conform_support/egl/display.h | 11 |
2 files changed, 50 insertions, 26 deletions
diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc index da0ac3c..f6016bc 100644 --- a/gpu/gles2_conform_support/egl/display.cc +++ b/gpu/gles2_conform_support/egl/display.cc @@ -6,10 +6,7 @@ #include <vector> #include "gpu/command_buffer/client/gles2_lib.h" -#include "gpu/command_buffer/service/command_buffer_service.h" #include "gpu/command_buffer/service/context_group.h" -#include "gpu/command_buffer/service/gles2_cmd_decoder.h" -#include "gpu/command_buffer/service/gpu_scheduler.h" #include "gpu/gles2_conform_support/egl/config.h" #include "gpu/gles2_conform_support/egl/surface.h" @@ -31,22 +28,20 @@ Display::~Display() { } bool Display::Initialize() { - using gpu::CommandBufferService; - scoped_ptr<CommandBufferService> command_buffer(new CommandBufferService); + scoped_ptr<gpu::CommandBufferService> command_buffer( + new gpu::CommandBufferService); if (!command_buffer->Initialize(kCommandBufferSize)) return false; - using gpu::Buffer; int32 transfer_buffer_id = command_buffer->CreateTransferBuffer(kTransferBufferSize, -1); - Buffer transfer_buffer = + gpu::Buffer transfer_buffer = command_buffer->GetTransferBuffer(transfer_buffer_id); if (transfer_buffer.ptr == NULL) return false; - using gpu::gles2::GLES2CmdHelper; - scoped_ptr<GLES2CmdHelper> cmd_helper( - new GLES2CmdHelper(command_buffer.get())); + scoped_ptr<gpu::gles2::GLES2CmdHelper> cmd_helper( + new gpu::gles2::GLES2CmdHelper(command_buffer.get())); if (!cmd_helper->Initialize(kCommandBufferSize)) return false; @@ -106,19 +101,39 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config, return EGL_NO_SURFACE; } - using gpu::GpuScheduler; - std::vector<int32> attribs; gpu::gles2::ContextGroup::Ref group(new gpu::gles2::ContextGroup(true)); - scoped_ptr<GpuScheduler> gpu_scheduler( - GpuScheduler::Create(command_buffer_.get(), group.get())); - if (!gpu_scheduler->Initialize( - win, gfx::Size(), false, gpu::gles2::DisallowedExtensions(), NULL, - attribs, NULL)) + + decoder_.reset(gpu::gles2::GLES2Decoder::Create(group.get())); + if (!decoder_.get()) return EGL_NO_SURFACE; + gpu_scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), + decoder_.get(), + NULL)); + + decoder_->set_engine(gpu_scheduler_.get()); + + gl_surface_ = gfx::GLSurface::CreateViewGLSurface(false, win); + if (!gl_surface_.get()) + return EGL_NO_SURFACE; + + gl_context_ = gfx::GLContext::CreateGLContext(NULL, gl_surface_.get()); + if (!gl_context_.get()) + return EGL_NO_SURFACE; + + std::vector<int32> attribs; + if (!decoder_->Initialize(gl_surface_.get(), + gl_context_.get(), + gfx::Size(), + gpu::gles2::DisallowedExtensions(), + NULL, + attribs)) { + return EGL_NO_SURFACE; + } + command_buffer_->SetPutOffsetChangeCallback( - NewCallback(gpu_scheduler.get(), &GpuScheduler::PutChanged)); - gpu_scheduler_.reset(gpu_scheduler.release()); + NewCallback(gpu_scheduler_.get(), &gpu::GpuScheduler::PutChanged)); + surface_.reset(new Surface(win)); return surface_.get(); @@ -127,6 +142,9 @@ EGLSurface Display::CreateWindowSurface(EGLConfig config, void Display::DestroySurface(EGLSurface surface) { DCHECK(IsValidSurface(surface)); gpu_scheduler_.reset(); + decoder_.reset(); + gl_surface_ = NULL; + gl_context_ = NULL; surface_.reset(); } @@ -152,8 +170,7 @@ EGLContext Display::CreateContext(EGLConfig config, gpu::Buffer buffer = command_buffer_->GetTransferBuffer(transfer_buffer_id_); DCHECK(buffer.ptr != NULL); bool share_resources = share_ctx != NULL; - using gpu::gles2::GLES2Implementation; - context_.reset(new GLES2Implementation( + context_.reset(new gpu::gles2::GLES2Implementation( gles2_cmd_helper_.get(), buffer.size, buffer.ptr, @@ -161,10 +178,8 @@ EGLContext Display::CreateContext(EGLConfig config, share_resources, true)); - context_->EnableFeatureCHROMIUM( - "pepper3d_allow_buffers_on_multiple_targets"); - context_->EnableFeatureCHROMIUM( - "pepper3d_support_fixed_attribs"); + context_->EnableFeatureCHROMIUM("pepper3d_allow_buffers_on_multiple_targets"); + context_->EnableFeatureCHROMIUM("pepper3d_support_fixed_attribs"); return context_.get(); } diff --git a/gpu/gles2_conform_support/egl/display.h b/gpu/gles2_conform_support/egl/display.h index 48f993c..19571b3 100644 --- a/gpu/gles2_conform_support/egl/display.h +++ b/gpu/gles2_conform_support/egl/display.h @@ -7,8 +7,14 @@ #include <EGL/egl.h> -#include "base/basictypes.h" #include "base/memory/scoped_ptr.h" +#include "gpu/command_buffer/client/gles2_cmd_helper.h" +#include "gpu/command_buffer/service/command_buffer_service.h" +#include "gpu/command_buffer/service/gpu_scheduler.h" +#include "gpu/command_buffer/service/gles2_cmd_decoder.h" +#include "ui/gfx/gl/gl_context.h" +#include "ui/gfx/gl/gl_surface.h" +#include "ui/gfx/native_widget_types.h" namespace gpu { class CommandBufferService; @@ -61,6 +67,9 @@ class Display { bool is_initialized_; scoped_ptr<gpu::CommandBufferService> command_buffer_; scoped_ptr<gpu::GpuScheduler> gpu_scheduler_; + scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; + scoped_refptr<gfx::GLContext> gl_context_; + scoped_refptr<gfx::GLSurface> gl_surface_; scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_cmd_helper_; int32 transfer_buffer_id_; |