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 "content/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/gpu_channel_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 #include "content/common/gpu/gpu_memory_manager.h" | 10 #include "content/common/gpu/gpu_memory_manager.h" |
11 #include "content/common/gpu/gpu_messages.h" | 11 #include "content/common/gpu/gpu_messages.h" |
12 #include "content/common/gpu/sync_point_manager.h" | 12 #include "content/common/gpu/sync_point_manager.h" |
13 #include "content/common/message_router.h" | 13 #include "content/common/message_router.h" |
14 #include "gpu/command_buffer/service/feature_info.h" | 14 #include "gpu/command_buffer/service/feature_info.h" |
15 #include "gpu/command_buffer/service/gpu_switches.h" | 15 #include "gpu/command_buffer/service/gpu_switches.h" |
16 #include "gpu/command_buffer/service/mailbox_manager.h" | 16 #include "gpu/command_buffer/service/mailbox_manager.h" |
17 #include "gpu/command_buffer/service/memory_program_cache.h" | 17 #include "gpu/command_buffer/service/memory_program_cache.h" |
| 18 #include "gpu/command_buffer/service/shader_translator_cache.h" |
18 #include "ui/gl/gl_bindings.h" | 19 #include "ui/gl/gl_bindings.h" |
19 #include "ui/gl/gl_share_group.h" | 20 #include "ui/gl/gl_share_group.h" |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 | 23 |
23 GpuChannelManager::ImageOperation::ImageOperation( | 24 GpuChannelManager::ImageOperation::ImageOperation( |
24 int32 sync_point, base::Closure callback) | 25 int32 sync_point, base::Closure callback) |
25 : sync_point(sync_point), | 26 : sync_point(sync_point), |
26 callback(callback) { | 27 callback(callback) { |
27 } | 28 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 if (!program_cache_.get() && | 61 if (!program_cache_.get() && |
61 (gfx::g_driver_gl.ext.b_GL_ARB_get_program_binary || | 62 (gfx::g_driver_gl.ext.b_GL_ARB_get_program_binary || |
62 gfx::g_driver_gl.ext.b_GL_OES_get_program_binary) && | 63 gfx::g_driver_gl.ext.b_GL_OES_get_program_binary) && |
63 !CommandLine::ForCurrentProcess()->HasSwitch( | 64 !CommandLine::ForCurrentProcess()->HasSwitch( |
64 switches::kDisableGpuProgramCache)) { | 65 switches::kDisableGpuProgramCache)) { |
65 program_cache_.reset(new gpu::gles2::MemoryProgramCache()); | 66 program_cache_.reset(new gpu::gles2::MemoryProgramCache()); |
66 } | 67 } |
67 return program_cache_.get(); | 68 return program_cache_.get(); |
68 } | 69 } |
69 | 70 |
| 71 gpu::gles2::ShaderTranslatorCache* |
| 72 GpuChannelManager::shader_translator_cache() { |
| 73 if (!shader_translator_cache_.get()) |
| 74 shader_translator_cache_ = new gpu::gles2::ShaderTranslatorCache; |
| 75 return shader_translator_cache_.get(); |
| 76 } |
| 77 |
70 void GpuChannelManager::RemoveChannel(int client_id) { | 78 void GpuChannelManager::RemoveChannel(int client_id) { |
71 Send(new GpuHostMsg_DestroyChannel(client_id)); | 79 Send(new GpuHostMsg_DestroyChannel(client_id)); |
72 gpu_channels_.erase(client_id); | 80 gpu_channels_.erase(client_id); |
73 } | 81 } |
74 | 82 |
75 int GpuChannelManager::GenerateRouteID() { | 83 int GpuChannelManager::GenerateRouteID() { |
76 static int last_id = 0; | 84 static int last_id = 0; |
77 return ++last_id; | 85 return ++last_id; |
78 } | 86 } |
79 | 87 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 299 |
292 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { | 300 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
293 if (!default_offscreen_surface_.get()) { | 301 if (!default_offscreen_surface_.get()) { |
294 default_offscreen_surface_ = | 302 default_offscreen_surface_ = |
295 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); | 303 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); |
296 } | 304 } |
297 return default_offscreen_surface_.get(); | 305 return default_offscreen_surface_.get(); |
298 } | 306 } |
299 | 307 |
300 } // namespace content | 308 } // namespace content |
OLD | NEW |