OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h" | 7 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_3d.h" |
8 | 8 |
9 #include "gpu/command_buffer/client/gles2_implementation.h" | 9 #include "gpu/command_buffer/client/gles2_implementation.h" |
10 #include "native_client/src/shared/ppapi_proxy/command_buffer_nacl.h" | 10 #include "native_client/src/shared/ppapi_proxy/command_buffer_nacl.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 return impl; | 205 return impl; |
206 } | 206 } |
207 | 207 |
208 | 208 |
209 bool PluginGraphics3D::InitFromBrowserResource(PP_Resource res) { | 209 bool PluginGraphics3D::InitFromBrowserResource(PP_Resource res) { |
210 DebugPrintf("PluginGraphics3D::InitFromBrowserResource: " | 210 DebugPrintf("PluginGraphics3D::InitFromBrowserResource: " |
211 "resource=%"NACL_PRIu32"\n", res); | 211 "resource=%"NACL_PRIu32"\n", res); |
212 | 212 |
213 // Create and initialize the objects required to issue GLES2 calls. | 213 // Create and initialize the objects required to issue GLES2 calls. |
214 command_buffer_.reset(new CommandBufferNacl(res, PluginCore::GetInterface())); | 214 command_buffer_.reset(new CommandBufferNacl(res, PluginCore::GetInterface())); |
215 if (command_buffer_->Initialize(kRingBufferSize)) { | 215 if (command_buffer_->Initialize()) { |
216 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get())); | 216 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get())); |
217 gpu::Buffer buffer = command_buffer_->GetRingBuffer(); | 217 if (gles2_helper_->Initialize(kRingBufferSize)) { |
218 DebugPrintf("PluginGraphics3D::InitFromBrowserResource: buffer size: %d\n", | |
219 buffer.size); | |
220 if (gles2_helper_->Initialize(buffer.size)) { | |
221 // Request id -1 to signify 'don't care' | 218 // Request id -1 to signify 'don't care' |
222 int32 transfer_buffer_id = | 219 int32 transfer_buffer_id = |
223 command_buffer_->CreateTransferBuffer(kTransferBufferSize, -1); | 220 command_buffer_->CreateTransferBuffer(kTransferBufferSize, -1); |
224 gpu::Buffer transfer_buffer = | 221 gpu::Buffer transfer_buffer = |
225 command_buffer_->GetTransferBuffer(transfer_buffer_id); | 222 command_buffer_->GetTransferBuffer(transfer_buffer_id); |
226 if (transfer_buffer.ptr) { | 223 if (transfer_buffer.ptr) { |
227 gles2_implementation_.reset(new gpu::gles2::GLES2Implementation( | 224 gles2_implementation_.reset(new gpu::gles2::GLES2Implementation( |
228 gles2_helper_.get(), | 225 gles2_helper_.get(), |
229 transfer_buffer.size, | 226 transfer_buffer.size, |
230 transfer_buffer.ptr, | 227 transfer_buffer.ptr, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 &SetAttribs, | 269 &SetAttribs, |
273 &GetError, | 270 &GetError, |
274 &ResizeBuffers, | 271 &ResizeBuffers, |
275 &SwapBuffs, | 272 &SwapBuffs, |
276 }; | 273 }; |
277 return &intf; | 274 return &intf; |
278 } | 275 } |
279 | 276 |
280 } // namespace ppapi_proxy | 277 } // namespace ppapi_proxy |
281 | 278 |
OLD | NEW |