OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/gpu/renderer_gl_context.h" | 5 #include "content/renderer/gpu/renderer_gl_context.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/shared_memory.h" | 13 #include "base/shared_memory.h" |
14 #include "content/common/view_messages.h" | 14 #include "content/common/view_messages.h" |
15 #include "content/renderer/gpu/command_buffer_proxy.h" | 15 #include "content/renderer/gpu/command_buffer_proxy.h" |
16 #include "content/renderer/gpu/gpu_channel_host.h" | 16 #include "content/renderer/gpu/gpu_channel_host.h" |
17 #include "content/renderer/gpu/transport_texture_host.h" | 17 #include "content/renderer/gpu/transport_texture_host.h" |
18 #include "content/renderer/gpu/transport_texture_service.h" | 18 #include "content/renderer/gpu/transport_texture_service.h" |
19 #include "content/renderer/render_thread.h" | 19 #include "content/renderer/render_thread.h" |
20 #include "content/renderer/render_widget.h" | 20 #include "content/renderer/render_widget.h" |
21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
22 #include "ipc/ipc_channel_handle.h" | 22 #include "ipc/ipc_channel_handle.h" |
23 | 23 |
24 #if defined(ENABLE_GPU) | 24 #if defined(ENABLE_GPU) |
25 #include "gpu/command_buffer/client/gles2_cmd_helper.h" | 25 #include "gpu/command_buffer/client/gles2_cmd_helper.h" |
26 #include "gpu/command_buffer/client/gles2_implementation.h" | 26 #include "gpu/command_buffer/client/gles2_implementation.h" |
27 #include "gpu/command_buffer/client/gles2_lib.h" | 27 #include "gpu/command_buffer/client/gles2_lib.h" |
28 #include "gpu/command_buffer/common/constants.h" | 28 #include "gpu/command_buffer/common/constants.h" |
29 #include "gpu/GLES2/gles2_command_buffer.h" | |
30 #endif // ENABLE_GPU | 29 #endif // ENABLE_GPU |
31 | 30 |
32 namespace { | 31 namespace { |
33 | 32 |
34 const int32 kCommandBufferSize = 1024 * 1024; | 33 const int32 kCommandBufferSize = 1024 * 1024; |
35 // TODO(kbr): make the transfer buffer size configurable via context | 34 // TODO(kbr): make the transfer buffer size configurable via context |
36 // creation attributes. | 35 // creation attributes. |
37 const int32 kTransferBufferSize = 1024 * 1024; | 36 const int32 kTransferBufferSize = 1024 * 1024; |
38 | 37 |
39 // Singleton used to initialize and terminate the gles2 library. | 38 // Singleton used to initialize and terminate the gles2 library. |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); | 275 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); |
277 return state.error == gpu::error::kLostContext; | 276 return state.error == gpu::error::kLostContext; |
278 } | 277 } |
279 | 278 |
280 CommandBufferProxy* RendererGLContext::GetCommandBufferProxy() { | 279 CommandBufferProxy* RendererGLContext::GetCommandBufferProxy() { |
281 return command_buffer_; | 280 return command_buffer_; |
282 } | 281 } |
283 | 282 |
284 // TODO(gman): Remove This | 283 // TODO(gman): Remove This |
285 void RendererGLContext::DisableShaderTranslation() { | 284 void RendererGLContext::DisableShaderTranslation() { |
286 gles2_implementation_->CommandBufferEnableCHROMIUM( | 285 NOTREACHED(); |
287 PEPPER3D_SKIP_GLSL_TRANSLATION); | |
288 } | 286 } |
289 | 287 |
290 gpu::gles2::GLES2Implementation* RendererGLContext::GetImplementation() { | 288 gpu::gles2::GLES2Implementation* RendererGLContext::GetImplementation() { |
291 return gles2_implementation_; | 289 return gles2_implementation_; |
292 } | 290 } |
293 | 291 |
294 RendererGLContext::RendererGLContext(GpuChannelHost* channel) | 292 RendererGLContext::RendererGLContext(GpuChannelHost* channel) |
295 : channel_(channel), | 293 : channel_(channel), |
296 parent_(base::WeakPtr<RendererGLContext>()), | 294 parent_(base::WeakPtr<RendererGLContext>()), |
297 parent_texture_id_(0), | 295 parent_texture_id_(0), |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 void RendererGLContext::OnContextLost() { | 467 void RendererGLContext::OnContextLost() { |
470 if (context_lost_callback_.get()) { | 468 if (context_lost_callback_.get()) { |
471 RendererGLContext::ContextLostReason reason = kUnknown; | 469 RendererGLContext::ContextLostReason reason = kUnknown; |
472 if (command_buffer_) { | 470 if (command_buffer_) { |
473 reason = ConvertReason( | 471 reason = ConvertReason( |
474 command_buffer_->GetLastState().context_lost_reason); | 472 command_buffer_->GetLastState().context_lost_reason); |
475 } | 473 } |
476 context_lost_callback_->Run(reason); | 474 context_lost_callback_->Run(reason); |
477 } | 475 } |
478 } | 476 } |
OLD | NEW |