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/renderer/pepper/pepper_platform_context_3d.h" | 5 #include "content/renderer/pepper/pepper_platform_context_3d.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/common/gpu/client/context_provider_command_buffer.h" | 8 #include "content/common/gpu/client/context_provider_command_buffer.h" |
9 #include "content/common/gpu/client/gpu_channel_host.h" | 9 #include "content/common/gpu/client/gpu_channel_host.h" |
10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return false; | 100 return false; |
101 if (!command_buffer_->Initialize()) | 101 if (!command_buffer_->Initialize()) |
102 return false; | 102 return false; |
103 std::vector<gpu::Mailbox> names; | 103 std::vector<gpu::Mailbox> names; |
104 if (!command_buffer_->GenerateMailboxNames(1, &names)) | 104 if (!command_buffer_->GenerateMailboxNames(1, &names)) |
105 return false; | 105 return false; |
106 DCHECK_EQ(names.size(), 1u); | 106 DCHECK_EQ(names.size(), 1u); |
107 if (!command_buffer_->ProduceFrontBuffer(names[0])) | 107 if (!command_buffer_->ProduceFrontBuffer(names[0])) |
108 return false; | 108 return false; |
109 mailbox_ = names[0]; | 109 mailbox_ = names[0]; |
| 110 sync_point_ = command_buffer_->InsertSyncPoint(); |
110 | 111 |
111 command_buffer_->SetChannelErrorCallback( | 112 command_buffer_->SetChannelErrorCallback( |
112 base::Bind(&PlatformContext3D::OnContextLost, | 113 base::Bind(&PlatformContext3D::OnContextLost, |
113 weak_ptr_factory_.GetWeakPtr())); | 114 weak_ptr_factory_.GetWeakPtr())); |
114 command_buffer_->SetOnConsoleMessageCallback( | 115 command_buffer_->SetOnConsoleMessageCallback( |
115 base::Bind(&PlatformContext3D::OnConsoleMessage, | 116 base::Bind(&PlatformContext3D::OnConsoleMessage, |
116 weak_ptr_factory_.GetWeakPtr())); | 117 weak_ptr_factory_.GetWeakPtr())); |
117 | 118 |
118 return true; | 119 return true; |
119 } | 120 } |
120 | 121 |
121 void PlatformContext3D::GetBackingMailbox(gpu::Mailbox* mailbox) { | 122 void PlatformContext3D::GetBackingMailbox(gpu::Mailbox* mailbox, |
| 123 uint32* sync_point) { |
122 *mailbox = mailbox_; | 124 *mailbox = mailbox_; |
| 125 *sync_point = sync_point_; |
| 126 } |
| 127 |
| 128 void PlatformContext3D::InsertSyncPointForBackingMailbox() { |
| 129 DCHECK(command_buffer_); |
| 130 sync_point_ = command_buffer_->InsertSyncPoint(); |
123 } | 131 } |
124 | 132 |
125 bool PlatformContext3D::IsOpaque() { | 133 bool PlatformContext3D::IsOpaque() { |
126 DCHECK(command_buffer_); | 134 DCHECK(command_buffer_); |
127 return !has_alpha_; | 135 return !has_alpha_; |
128 } | 136 } |
129 | 137 |
130 gpu::CommandBuffer* PlatformContext3D::GetCommandBuffer() { | 138 gpu::CommandBuffer* PlatformContext3D::GetCommandBuffer() { |
131 return command_buffer_; | 139 return command_buffer_; |
132 } | 140 } |
(...skipping 28 matching lines...) Expand all Loading... |
161 } | 169 } |
162 | 170 |
163 void PlatformContext3D::OnConsoleMessage(const std::string& msg, int id) { | 171 void PlatformContext3D::OnConsoleMessage(const std::string& msg, int id) { |
164 DCHECK(command_buffer_); | 172 DCHECK(command_buffer_); |
165 | 173 |
166 if (!console_message_callback_.is_null()) | 174 if (!console_message_callback_.is_null()) |
167 console_message_callback_.Run(msg, id); | 175 console_message_callback_.Run(msg, id); |
168 } | 176 } |
169 | 177 |
170 } // namespace content | 178 } // namespace content |
OLD | NEW |