Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Side by Side Diff: gpu/command_buffer/tests/gl_manager.cc

Issue 10106015: Allow textures to be moved from one GL context group to another. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "gpu/command_buffer/tests/gl_manager.h" 5 #include "gpu/command_buffer/tests/gl_manager.h"
6 #include "base/at_exit.h" 6 #include "base/at_exit.h"
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "gles2/gl2.h"
9 #include "gles2/gl2ext.h"
8 #include "gpu/command_buffer/client/gles2_lib.h" 10 #include "gpu/command_buffer/client/gles2_lib.h"
9 #include "gpu/command_buffer/client/gles2_implementation.h" 11 #include "gpu/command_buffer/client/gles2_implementation.h"
10 #include "gpu/command_buffer/client/transfer_buffer.h" 12 #include "gpu/command_buffer/client/transfer_buffer.h"
11 #include "gpu/command_buffer/common/constants.h" 13 #include "gpu/command_buffer/common/constants.h"
14 #include "gpu/command_buffer/service/command_buffer_service.h"
12 #include "gpu/command_buffer/service/context_group.h" 15 #include "gpu/command_buffer/service/context_group.h"
13 #include "gpu/command_buffer/service/gpu_scheduler.h" 16 #include "gpu/command_buffer/service/gpu_scheduler.h"
14 #include "gpu/command_buffer/service/command_buffer_service.h" 17 #include "gpu/command_buffer/service/mailbox_manager.h"
15 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
16 #include "ui/gfx/gl/gl_context.h" 19 #include "ui/gfx/gl/gl_context.h"
17 #include "ui/gfx/gl/gl_share_group.h" 20 #include "ui/gfx/gl/gl_share_group.h"
18 #include "ui/gfx/gl/gl_surface.h" 21 #include "ui/gfx/gl/gl_surface.h"
19 22
20 namespace gpu { 23 namespace gpu {
21 24
22 GLManager::GLManager() { 25 GLManager::GLManager(gles2::MailboxManager* mailbox_manager,
26 gfx::GLShareGroup* share_group)
27 : mailbox_manager_(mailbox_manager),
28 share_group_(share_group) {
23 } 29 }
24 30
25 GLManager::~GLManager() { 31 GLManager::~GLManager() {
26 } 32 }
27 33
28 void GLManager::Initialize(const gfx::Size& size) { 34 void GLManager::Initialize(const gfx::Size& size) {
29 const int32 kCommandBufferSize = 1024 * 1024; 35 const int32 kCommandBufferSize = 1024 * 1024;
30 const size_t kStartTransferBufferSize = 4 * 1024 * 1024; 36 const size_t kStartTransferBufferSize = 4 * 1024 * 1024;
31 const size_t kMinTransferBufferSize = 1 * 256 * 1024; 37 const size_t kMinTransferBufferSize = 1 * 256 * 1024;
32 const size_t kMaxTransferBufferSize = 16 * 1024 * 1024; 38 const size_t kMaxTransferBufferSize = 16 * 1024 * 1024;
(...skipping 14 matching lines...) Expand all
47 attribs.push_back(EGL_GREEN_SIZE); 53 attribs.push_back(EGL_GREEN_SIZE);
48 attribs.push_back(8); 54 attribs.push_back(8);
49 attribs.push_back(EGL_BLUE_SIZE); 55 attribs.push_back(EGL_BLUE_SIZE);
50 attribs.push_back(8); 56 attribs.push_back(8);
51 attribs.push_back(EGL_ALPHA_SIZE); 57 attribs.push_back(EGL_ALPHA_SIZE);
52 attribs.push_back(8); 58 attribs.push_back(8);
53 attribs.push_back(EGL_DEPTH_SIZE); 59 attribs.push_back(EGL_DEPTH_SIZE);
54 attribs.push_back(16); 60 attribs.push_back(16);
55 attribs.push_back(EGL_NONE); 61 attribs.push_back(EGL_NONE);
56 62
57 share_group_ = new gfx::GLShareGroup;
58 command_buffer_.reset(new CommandBufferService); 63 command_buffer_.reset(new CommandBufferService);
59 ASSERT_TRUE(command_buffer_->Initialize()) 64 ASSERT_TRUE(command_buffer_->Initialize())
60 << "could not create command buffer service"; 65 << "could not create command buffer service";
61 66
62 decoder_.reset(::gpu::gles2::GLES2Decoder::Create( 67 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(
63 new gles2::ContextGroup(false))); 68 new gles2::ContextGroup(mailbox_manager_.get(), false)));
64 69
65 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(), 70 gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(),
66 decoder_.get(), 71 decoder_.get(),
67 decoder_.get())); 72 decoder_.get()));
68 73
69 decoder_->set_engine(gpu_scheduler_.get()); 74 decoder_->set_engine(gpu_scheduler_.get());
70 75
71 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, size); 76 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, size);
72 ASSERT_TRUE(surface_.get() != NULL) << "could not create offscreen surface"; 77 ASSERT_TRUE(surface_.get() != NULL) << "could not create offscreen surface";
73 78
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 ::gpu::CommandBuffer::State state = command_buffer_->GetState(); 140 ::gpu::CommandBuffer::State state = command_buffer_->GetState();
136 ASSERT_EQ(::gpu::error::kNoError, state.error); 141 ASSERT_EQ(::gpu::error::kNoError, state.error);
137 } 142 }
138 143
139 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { 144 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) {
140 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); 145 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id);
141 } 146 }
142 147
143 } // namespace gpu 148 } // namespace gpu
144 149
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698