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 "ppapi/proxy/ppb_graphics_3d_proxy.h" | 5 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 #include "gpu/command_buffer/common/command_buffer.h" | 8 #include "gpu/command_buffer/common/command_buffer.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/proxy/enter_proxy.h" | 10 #include "ppapi/proxy/enter_proxy.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 virtual void SetContextLostReason( | 161 virtual void SetContextLostReason( |
162 gpu::error::ContextLostReason reason) OVERRIDE { | 162 gpu::error::ContextLostReason reason) OVERRIDE { |
163 MaybeLock lock(need_to_lock_); | 163 MaybeLock lock(need_to_lock_); |
164 gpu_command_buffer_->SetContextLostReason(reason); | 164 gpu_command_buffer_->SetContextLostReason(reason); |
165 } | 165 } |
166 virtual uint32 InsertSyncPoint() OVERRIDE { | 166 virtual uint32 InsertSyncPoint() OVERRIDE { |
167 MaybeLock lock(need_to_lock_); | 167 MaybeLock lock(need_to_lock_); |
168 return gpu_command_buffer_->InsertSyncPoint(); | 168 return gpu_command_buffer_->InsertSyncPoint(); |
169 } | 169 } |
| 170 gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, |
| 171 size_t height, |
| 172 unsigned internalformat, |
| 173 int32* id) { |
| 174 MaybeLock lock(need_to_lock_); |
| 175 return gpu_command_buffer_->CreateGpuMemoryBuffer(width, |
| 176 height, |
| 177 internalformat, |
| 178 id); |
| 179 } |
| 180 void DestroyGpuMemoryBuffer(int32 id) { |
| 181 MaybeLock lock(need_to_lock_); |
| 182 gpu_command_buffer_->DestroyGpuMemoryBuffer(id); |
| 183 } |
| 184 gfx::GLImage* GetImage(int32 id) { |
| 185 MaybeLock lock(need_to_lock_); |
| 186 return gpu_command_buffer_->GetImage(id); |
| 187 } |
170 | 188 |
171 // Weak pointer - see class Graphics3D for the scopted_ptr. | 189 // Weak pointer - see class Graphics3D for the scopted_ptr. |
172 gpu::CommandBuffer* gpu_command_buffer_; | 190 gpu::CommandBuffer* gpu_command_buffer_; |
173 | 191 |
174 bool need_to_lock_; | 192 bool need_to_lock_; |
175 }; | 193 }; |
176 | 194 |
177 Graphics3D::Graphics3D(const HostResource& resource) | 195 Graphics3D::Graphics3D(const HostResource& resource) |
178 : PPB_Graphics3D_Shared(resource), | 196 : PPB_Graphics3D_Shared(resource), |
179 num_already_locked_calls_(0) { | 197 num_already_locked_calls_(0) { |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 int32_t result, | 506 int32_t result, |
489 const HostResource& context) { | 507 const HostResource& context) { |
490 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( | 508 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( |
491 API_ID_PPB_GRAPHICS_3D, context, result)); | 509 API_ID_PPB_GRAPHICS_3D, context, result)); |
492 } | 510 } |
493 #endif // !defined(OS_NACL) | 511 #endif // !defined(OS_NACL) |
494 | 512 |
495 } // namespace proxy | 513 } // namespace proxy |
496 } // namespace ppapi | 514 } // namespace ppapi |
497 | 515 |
OLD | NEW |