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 "gpu/command_buffer/service/context_group.h" | 5 #include "gpu/command_buffer/service/context_group.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
13 #include "gpu/command_buffer/common/id_allocator.h" | 13 #include "gpu/command_buffer/common/id_allocator.h" |
14 #include "gpu/command_buffer/service/buffer_manager.h" | 14 #include "gpu/command_buffer/service/buffer_manager.h" |
15 #include "gpu/command_buffer/service/framebuffer_manager.h" | 15 #include "gpu/command_buffer/service/framebuffer_manager.h" |
16 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 16 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
17 #include "gpu/command_buffer/service/gpu_switches.h" | 17 #include "gpu/command_buffer/service/gpu_switches.h" |
18 #include "gpu/command_buffer/service/image_manager.h" | 18 #include "gpu/command_buffer/service/image_manager.h" |
19 #include "gpu/command_buffer/service/mailbox_manager.h" | 19 #include "gpu/command_buffer/service/mailbox_manager.h" |
20 #include "gpu/command_buffer/service/memory_tracking.h" | 20 #include "gpu/command_buffer/service/memory_tracking.h" |
| 21 #include "gpu/command_buffer/service/path_manager.h" |
21 #include "gpu/command_buffer/service/program_manager.h" | 22 #include "gpu/command_buffer/service/program_manager.h" |
22 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 23 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
23 #include "gpu/command_buffer/service/shader_manager.h" | 24 #include "gpu/command_buffer/service/shader_manager.h" |
24 #include "gpu/command_buffer/service/texture_manager.h" | 25 #include "gpu/command_buffer/service/texture_manager.h" |
25 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 26 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
26 #include "ui/gl/gl_implementation.h" | 27 #include "ui/gl/gl_implementation.h" |
27 | 28 |
28 namespace gpu { | 29 namespace gpu { |
29 namespace gles2 { | 30 namespace gles2 { |
30 | 31 |
(...skipping 30 matching lines...) Expand all Loading... |
61 } | 62 } |
62 | 63 |
63 id_namespaces_[id_namespaces::kBuffers].reset(new IdAllocator); | 64 id_namespaces_[id_namespaces::kBuffers].reset(new IdAllocator); |
64 id_namespaces_[id_namespaces::kFramebuffers].reset(new IdAllocator); | 65 id_namespaces_[id_namespaces::kFramebuffers].reset(new IdAllocator); |
65 id_namespaces_[id_namespaces::kProgramsAndShaders].reset( | 66 id_namespaces_[id_namespaces::kProgramsAndShaders].reset( |
66 new NonReusedIdAllocator); | 67 new NonReusedIdAllocator); |
67 id_namespaces_[id_namespaces::kRenderbuffers].reset(new IdAllocator); | 68 id_namespaces_[id_namespaces::kRenderbuffers].reset(new IdAllocator); |
68 id_namespaces_[id_namespaces::kTextures].reset(new IdAllocator); | 69 id_namespaces_[id_namespaces::kTextures].reset(new IdAllocator); |
69 id_namespaces_[id_namespaces::kQueries].reset(new IdAllocator); | 70 id_namespaces_[id_namespaces::kQueries].reset(new IdAllocator); |
70 id_namespaces_[id_namespaces::kVertexArrays].reset(new IdAllocator); | 71 id_namespaces_[id_namespaces::kVertexArrays].reset(new IdAllocator); |
| 72 id_namespaces_[id_namespaces::kPaths].reset(new NonReusedIdAllocator); |
71 } | 73 } |
72 | 74 |
73 static void GetIntegerv(GLenum pname, uint32* var) { | 75 static void GetIntegerv(GLenum pname, uint32* var) { |
74 GLint value = 0; | 76 GLint value = 0; |
75 glGetIntegerv(pname, &value); | 77 glGetIntegerv(pname, &value); |
76 *var = value; | 78 *var = value; |
77 } | 79 } |
78 | 80 |
79 bool ContextGroup::Initialize( | 81 bool ContextGroup::Initialize( |
80 GLES2Decoder* decoder, | 82 GLES2Decoder* decoder, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 max_varying_vectors_, | 238 max_varying_vectors_, |
237 static_cast<uint32>(feature_info_->workarounds().max_varying_vectors)); | 239 static_cast<uint32>(feature_info_->workarounds().max_varying_vectors)); |
238 } | 240 } |
239 if (feature_info_->workarounds().max_vertex_uniform_vectors) { | 241 if (feature_info_->workarounds().max_vertex_uniform_vectors) { |
240 max_vertex_uniform_vectors_ = | 242 max_vertex_uniform_vectors_ = |
241 std::min(max_vertex_uniform_vectors_, | 243 std::min(max_vertex_uniform_vectors_, |
242 static_cast<uint32>( | 244 static_cast<uint32>( |
243 feature_info_->workarounds().max_vertex_uniform_vectors)); | 245 feature_info_->workarounds().max_vertex_uniform_vectors)); |
244 } | 246 } |
245 | 247 |
| 248 path_manager_.reset(new PathManager()); |
| 249 |
246 program_manager_.reset(new ProgramManager( | 250 program_manager_.reset(new ProgramManager( |
247 program_cache_, max_varying_vectors_)); | 251 program_cache_, max_varying_vectors_)); |
248 | 252 |
249 if (!texture_manager_->Initialize()) { | 253 if (!texture_manager_->Initialize()) { |
250 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " | 254 LOG(ERROR) << "Context::Group::Initialize failed because texture manager " |
251 << "failed to initialize."; | 255 << "failed to initialize."; |
252 return false; | 256 return false; |
253 } | 257 } |
254 | 258 |
255 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); | 259 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 if (renderbuffer_manager_ != NULL) { | 311 if (renderbuffer_manager_ != NULL) { |
308 renderbuffer_manager_->Destroy(have_context); | 312 renderbuffer_manager_->Destroy(have_context); |
309 renderbuffer_manager_.reset(); | 313 renderbuffer_manager_.reset(); |
310 } | 314 } |
311 | 315 |
312 if (texture_manager_ != NULL) { | 316 if (texture_manager_ != NULL) { |
313 texture_manager_->Destroy(have_context); | 317 texture_manager_->Destroy(have_context); |
314 texture_manager_.reset(); | 318 texture_manager_.reset(); |
315 } | 319 } |
316 | 320 |
| 321 if (path_manager_ != NULL) { |
| 322 path_manager_->Destroy(have_context); |
| 323 path_manager_.reset(); |
| 324 } |
| 325 |
317 if (program_manager_ != NULL) { | 326 if (program_manager_ != NULL) { |
318 program_manager_->Destroy(have_context); | 327 program_manager_->Destroy(have_context); |
319 program_manager_.reset(); | 328 program_manager_.reset(); |
320 } | 329 } |
321 | 330 |
322 if (shader_manager_ != NULL) { | 331 if (shader_manager_ != NULL) { |
323 shader_manager_->Destroy(have_context); | 332 shader_manager_->Destroy(have_context); |
324 shader_manager_.reset(); | 333 shader_manager_.reset(); |
325 } | 334 } |
326 | 335 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 GLenum pname, GLint min_required, uint32* v) { | 396 GLenum pname, GLint min_required, uint32* v) { |
388 uint32 value = 0; | 397 uint32 value = 0; |
389 GetIntegerv(pname, &value); | 398 GetIntegerv(pname, &value); |
390 bool result = CheckGLFeatureU(min_required, &value); | 399 bool result = CheckGLFeatureU(min_required, &value); |
391 *v = value; | 400 *v = value; |
392 return result; | 401 return result; |
393 } | 402 } |
394 | 403 |
395 } // namespace gles2 | 404 } // namespace gles2 |
396 } // namespace gpu | 405 } // namespace gpu |
OLD | NEW |