| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 #include "gpu/command_buffer/client/gles2_lib.h" | 8 #include "gpu/command_buffer/client/gles2_lib.h" |
| 9 #include "gpu/command_buffer/client/transfer_buffer.h" | 9 #include "gpu/command_buffer/client/transfer_buffer.h" |
| 10 #include "gpu/command_buffer/common/constants.h" | 10 #include "gpu/command_buffer/common/constants.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 attribs.push_back(EGL_GREEN_SIZE); | 86 attribs.push_back(EGL_GREEN_SIZE); |
| 87 attribs.push_back(8); | 87 attribs.push_back(8); |
| 88 attribs.push_back(EGL_BLUE_SIZE); | 88 attribs.push_back(EGL_BLUE_SIZE); |
| 89 attribs.push_back(8); | 89 attribs.push_back(8); |
| 90 attribs.push_back(EGL_ALPHA_SIZE); | 90 attribs.push_back(EGL_ALPHA_SIZE); |
| 91 attribs.push_back(8); | 91 attribs.push_back(8); |
| 92 attribs.push_back(EGL_DEPTH_SIZE); | 92 attribs.push_back(EGL_DEPTH_SIZE); |
| 93 attribs.push_back(16); | 93 attribs.push_back(16); |
| 94 attribs.push_back(EGL_NONE); | 94 attribs.push_back(EGL_NONE); |
| 95 | 95 |
| 96 command_buffer_.reset(new CommandBufferService); | 96 if (!context_group) { |
| 97 context_group = new gles2::ContextGroup( |
| 98 mailbox_manager_.get(), kBindGeneratesResource); |
| 99 } |
| 100 |
| 101 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); |
| 102 |
| 103 command_buffer_.reset(new CommandBufferService( |
| 104 decoder_->GetContextGroup()->transfer_buffer_manager())); |
| 97 ASSERT_TRUE(command_buffer_->Initialize()) | 105 ASSERT_TRUE(command_buffer_->Initialize()) |
| 98 << "could not create command buffer service"; | 106 << "could not create command buffer service"; |
| 99 | 107 |
| 100 decoder_.reset(::gpu::gles2::GLES2Decoder::Create( | |
| 101 context_group ? context_group : | |
| 102 new gles2::ContextGroup( | |
| 103 mailbox_manager_.get(), kBindGeneratesResource))); | |
| 104 | |
| 105 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(), | 108 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(), |
| 106 decoder_.get(), | 109 decoder_.get(), |
| 107 decoder_.get())); | 110 decoder_.get())); |
| 108 | 111 |
| 109 decoder_->set_engine(gpu_scheduler_.get()); | 112 decoder_->set_engine(gpu_scheduler_.get()); |
| 110 | 113 |
| 111 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, size); | 114 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, size); |
| 112 ASSERT_TRUE(surface_.get() != NULL) << "could not create offscreen surface"; | 115 ASSERT_TRUE(surface_.get() != NULL) << "could not create offscreen surface"; |
| 113 | 116 |
| 114 context_ = gfx::GLContext::CreateGLContext(share_group_.get(), | 117 context_ = gfx::GLContext::CreateGLContext(share_group_.get(), |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 ::gpu::CommandBuffer::State state = command_buffer_->GetState(); | 184 ::gpu::CommandBuffer::State state = command_buffer_->GetState(); |
| 182 ASSERT_EQ(::gpu::error::kNoError, state.error); | 185 ASSERT_EQ(::gpu::error::kNoError, state.error); |
| 183 } | 186 } |
| 184 | 187 |
| 185 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { | 188 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { |
| 186 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); | 189 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); |
| 187 } | 190 } |
| 188 | 191 |
| 189 } // namespace gpu | 192 } // namespace gpu |
| 190 | 193 |
| OLD | NEW |