OLD | NEW |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2011 The Native Client 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 "native_client/src/shared/ppapi_proxy/command_buffer_nacl.h" | 5 #include "native_client/src/shared/ppapi_proxy/command_buffer_nacl.h" |
6 | 6 |
7 #include <sys/mman.h> | 7 #include <sys/mman.h> |
8 #include "gpu/command_buffer/common/logging.h" | 8 #include "gpu/command_buffer/common/logging.h" |
9 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" | 9 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" |
10 #include "native_client/src/shared/ppapi_proxy/utility.h" | 10 #include "native_client/src/shared/ppapi_proxy/utility.h" |
11 #include "ppapi/c/ppb_core.h" | 11 #include "ppapi/c/ppb_core.h" |
12 | 12 |
13 #include "srpcgen/ppb_rpc.h" | 13 #include "srpcgen/ppb_rpc.h" |
14 | 14 |
15 using ppapi_proxy::DebugPrintf; | 15 using ppapi_proxy::DebugPrintf; |
16 | 16 |
17 CommandBufferNacl::CommandBufferNacl(PP_Resource graphics_3d, | 17 CommandBufferNacl::CommandBufferNacl(PP_Resource graphics_3d, |
18 const PPB_Core* iface_core) | 18 const PPB_Core* iface_core) |
19 : graphics_3d_(graphics_3d), iface_core_(iface_core) { | 19 : graphics_3d_(graphics_3d), iface_core_(iface_core) { |
20 iface_core_->AddRefResource(graphics_3d_); | 20 iface_core_->AddRefResource(graphics_3d_); |
21 } | 21 } |
22 | 22 |
23 CommandBufferNacl::~CommandBufferNacl() { | 23 CommandBufferNacl::~CommandBufferNacl() { |
| 24 DebugPrintf("CommandBufferNacl::~CommandBufferNacl()\n"); |
24 iface_core_->ReleaseResource(graphics_3d_); | 25 iface_core_->ReleaseResource(graphics_3d_); |
25 } | 26 } |
26 | 27 |
27 bool CommandBufferNacl::Initialize(int32 size) { | 28 bool CommandBufferNacl::Initialize(int32 size) { |
28 DebugPrintf("CommandBufferNacl::Initialize\n"); | 29 DebugPrintf("CommandBufferNacl::Initialize\n"); |
29 int32_t success; | 30 int32_t success; |
30 NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel(); | 31 NaClSrpcChannel* channel = ppapi_proxy::GetMainSrpcChannel(); |
31 NaClSrpcError retval = | 32 NaClSrpcError retval = |
32 PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_InitCommandBuffer( | 33 PpbGraphics3DRpcClient::PPB_Graphics3DTrusted_InitCommandBuffer( |
33 channel, graphics_3d_, size, &success); | 34 channel, graphics_3d_, size, &success); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 gpu::CommandBuffer::State CommandBufferNacl::PpapiToGpuState( | 197 gpu::CommandBuffer::State CommandBufferNacl::PpapiToGpuState( |
197 PP_Graphics3DTrustedState s) { | 198 PP_Graphics3DTrustedState s) { |
198 gpu::CommandBuffer::State state; | 199 gpu::CommandBuffer::State state; |
199 state.num_entries = s.num_entries; | 200 state.num_entries = s.num_entries; |
200 state.get_offset = s.get_offset; | 201 state.get_offset = s.get_offset; |
201 state.put_offset = s.put_offset; | 202 state.put_offset = s.put_offset; |
202 state.token = s.token; | 203 state.token = s.token; |
203 state.error = static_cast<gpu::error::Error>(s.error); | 204 state.error = static_cast<gpu::error::Error>(s.error); |
204 return state; | 205 return state; |
205 } | 206 } |
OLD | NEW |