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

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: Updated the extension documentation 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
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) {
39 } 41 }
40 42
41 GLManager::GLManager() 43 GLManager::GLManager()
42 : context_lost_allowed_(false) { 44 : context_lost_allowed_(false) {
43 SetupBaseContext(); 45 SetupBaseContext();
44 } 46 }
45 47
46 GLManager::~GLManager() { 48 GLManager::~GLManager() {
47 --use_count_; 49 --use_count_;
48 if (!use_count_) { 50 if (!use_count_) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 attribs.push_back(EGL_BLUE_SIZE); 122 attribs.push_back(EGL_BLUE_SIZE);
121 attribs.push_back(8); 123 attribs.push_back(8);
122 attribs.push_back(EGL_ALPHA_SIZE); 124 attribs.push_back(EGL_ALPHA_SIZE);
123 attribs.push_back(8); 125 attribs.push_back(8);
124 attribs.push_back(EGL_DEPTH_SIZE); 126 attribs.push_back(EGL_DEPTH_SIZE);
125 attribs.push_back(16); 127 attribs.push_back(16);
126 attribs.push_back(EGL_NONE); 128 attribs.push_back(EGL_NONE);
127 129
128 if (!context_group) { 130 if (!context_group) {
129 context_group = new gles2::ContextGroup(mailbox_manager_.get(), 131 context_group = new gles2::ContextGroup(mailbox_manager_.get(),
130 NULL, 132 options.image_manager,
131 NULL, 133 NULL,
132 options.bind_generates_resource); 134 options.bind_generates_resource);
133 } 135 }
134 136
135 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); 137 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group));
136 138
137 command_buffer_.reset(new CommandBufferService( 139 command_buffer_.reset(new CommandBufferService(
138 decoder_->GetContextGroup()->transfer_buffer_manager())); 140 decoder_->GetContextGroup()->transfer_buffer_manager()));
139 ASSERT_TRUE(command_buffer_->Initialize()) 141 ASSERT_TRUE(command_buffer_->Initialize())
140 << "could not create command buffer service"; 142 << "could not create command buffer service";
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (!context_lost_allowed_) { 257 if (!context_lost_allowed_) {
256 ASSERT_EQ(::gpu::error::kNoError, state.error); 258 ASSERT_EQ(::gpu::error::kNoError, state.error);
257 } 259 }
258 } 260 }
259 261
260 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) { 262 bool GLManager::GetBufferChanged(int32 transfer_buffer_id) {
261 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id); 263 return gpu_scheduler_->SetGetBuffer(transfer_buffer_id);
262 } 264 }
263 265
264 } // namespace gpu 266 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698