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

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

Issue 14456004: GPU client side changes for GpuMemoryBuffers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@glapi
Patch Set: Add missing parameter in GLES2Implementation ctor in GLES2Implementation unittest Created 7 years, 7 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
« no previous file with comments | « gpu/command_buffer/tests/gl_manager.h ('k') | gpu/gles2_conform_support/egl/display.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "gpu/command_buffer/client/gles2_implementation.h" 11 #include "gpu/command_buffer/client/gles2_implementation.h"
12 #include "gpu/command_buffer/client/gles2_lib.h" 12 #include "gpu/command_buffer/client/gles2_lib.h"
13 #include "gpu/command_buffer/client/transfer_buffer.h" 13 #include "gpu/command_buffer/client/transfer_buffer.h"
14 #include "gpu/command_buffer/common/constants.h" 14 #include "gpu/command_buffer/common/constants.h"
15 #include "gpu/command_buffer/service/command_buffer_service.h" 15 #include "gpu/command_buffer/service/command_buffer_service.h"
16 #include "gpu/command_buffer/service/context_group.h" 16 #include "gpu/command_buffer/service/context_group.h"
17 #include "gpu/command_buffer/service/gl_context_virtual.h" 17 #include "gpu/command_buffer/service/gl_context_virtual.h"
18 #include "gpu/command_buffer/service/gpu_scheduler.h" 18 #include "gpu/command_buffer/service/gpu_scheduler.h"
19 #include "gpu/command_buffer/service/image_manager.h"
19 #include "gpu/command_buffer/service/mailbox_manager.h" 20 #include "gpu/command_buffer/service/mailbox_manager.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 #include "ui/gl/gl_context.h" 22 #include "ui/gl/gl_context.h"
22 #include "ui/gl/gl_share_group.h" 23 #include "ui/gl/gl_share_group.h"
23 #include "ui/gl/gl_surface.h" 24 #include "ui/gl/gl_surface.h"
24 25
25 namespace gpu { 26 namespace gpu {
26 27
27 int GLManager::use_count_; 28 int GLManager::use_count_;
28 scoped_refptr<gfx::GLShareGroup>* GLManager::base_share_group_; 29 scoped_refptr<gfx::GLShareGroup>* GLManager::base_share_group_;
29 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_; 30 scoped_refptr<gfx::GLSurface>* GLManager::base_surface_;
30 scoped_refptr<gfx::GLContext>* GLManager::base_context_; 31 scoped_refptr<gfx::GLContext>* GLManager::base_context_;
31 32
32 GLManager::Options::Options() 33 GLManager::Options::Options()
33 : size(4, 4), 34 : size(4, 4),
34 share_group_manager(NULL), 35 share_group_manager(NULL),
35 share_mailbox_manager(NULL), 36 share_mailbox_manager(NULL),
36 virtual_manager(NULL), 37 virtual_manager(NULL),
37 bind_generates_resource(false), 38 bind_generates_resource(false),
38 context_lost_allowed(false) { 39 context_lost_allowed(false),
40 image_manager(NULL),
41 image_factory(NULL) {
39 } 42 }
40 43
41 GLManager::GLManager() 44 GLManager::GLManager()
42 : context_lost_allowed_(false) { 45 : context_lost_allowed_(false) {
43 SetupBaseContext(); 46 SetupBaseContext();
44 } 47 }
45 48
46 GLManager::~GLManager() { 49 GLManager::~GLManager() {
47 --use_count_; 50 --use_count_;
48 if (!use_count_) { 51 if (!use_count_) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 attribs.push_back(EGL_BLUE_SIZE); 123 attribs.push_back(EGL_BLUE_SIZE);
121 attribs.push_back(8); 124 attribs.push_back(8);
122 attribs.push_back(EGL_ALPHA_SIZE); 125 attribs.push_back(EGL_ALPHA_SIZE);
123 attribs.push_back(8); 126 attribs.push_back(8);
124 attribs.push_back(EGL_DEPTH_SIZE); 127 attribs.push_back(EGL_DEPTH_SIZE);
125 attribs.push_back(16); 128 attribs.push_back(16);
126 attribs.push_back(EGL_NONE); 129 attribs.push_back(EGL_NONE);
127 130
128 if (!context_group) { 131 if (!context_group) {
129 context_group = new gles2::ContextGroup(mailbox_manager_.get(), 132 context_group = new gles2::ContextGroup(mailbox_manager_.get(),
130 NULL, 133 options.image_manager,
131 NULL, 134 NULL,
132 options.bind_generates_resource); 135 options.bind_generates_resource);
133 } 136 }
134 137
135 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); 138 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group));
136 139
137 command_buffer_.reset(new CommandBufferService( 140 command_buffer_.reset(new CommandBufferService(
138 decoder_->GetContextGroup()->transfer_buffer_manager())); 141 decoder_->GetContextGroup()->transfer_buffer_manager()));
139 ASSERT_TRUE(command_buffer_->Initialize()) 142 ASSERT_TRUE(command_buffer_->Initialize())
140 << "could not create command buffer service"; 143 << "could not create command buffer service";
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 192
190 // Create a transfer buffer. 193 // Create a transfer buffer.
191 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get())); 194 transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get()));
192 195
193 // Create the object exposing the OpenGL API. 196 // Create the object exposing the OpenGL API.
194 gles2_implementation_.reset(new gles2::GLES2Implementation( 197 gles2_implementation_.reset(new gles2::GLES2Implementation(
195 gles2_helper_.get(), 198 gles2_helper_.get(),
196 client_share_group, 199 client_share_group,
197 transfer_buffer_.get(), 200 transfer_buffer_.get(),
198 kShareResources, 201 kShareResources,
199 options.bind_generates_resource)); 202 options.bind_generates_resource,
203 options.image_factory));
200 204
201 ASSERT_TRUE(gles2_implementation_->Initialize( 205 ASSERT_TRUE(gles2_implementation_->Initialize(
202 kStartTransferBufferSize, 206 kStartTransferBufferSize,
203 kMinTransferBufferSize, 207 kMinTransferBufferSize,
204 kMaxTransferBufferSize)) << "Could not init GLES2Implementation"; 208 kMaxTransferBufferSize)) << "Could not init GLES2Implementation";
205 209
206 MakeCurrent(); 210 MakeCurrent();
207 } 211 }
208 212
209 void GLManager::SetupBaseContext() { 213 void GLManager::SetupBaseContext() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (!context_lost_allowed_) { 259 if (!context_lost_allowed_) {
256 ASSERT_EQ(::gpu::error::kNoError, state.error); 260 ASSERT_EQ(::gpu::error::kNoError, state.error);
257 } 261 }
258 } 262 }
259 263
260 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { 264 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) {
261 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); 265 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id);
262 } 266 }
263 267
264 } // namespace gpu 268 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_manager.h ('k') | gpu/gles2_conform_support/egl/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698