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 "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 "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/proxy/enter_proxy.h" | 9 #include "ppapi/proxy/enter_proxy.h" |
10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 class CommandBuffer : public gpu::CommandBuffer { | 28 class CommandBuffer : public gpu::CommandBuffer { |
29 public: | 29 public: |
30 CommandBuffer(const HostResource& resource, PluginDispatcher* dispatcher); | 30 CommandBuffer(const HostResource& resource, PluginDispatcher* dispatcher); |
31 virtual ~CommandBuffer(); | 31 virtual ~CommandBuffer(); |
32 | 32 |
33 // gpu::CommandBuffer implementation: | 33 // gpu::CommandBuffer implementation: |
34 virtual bool Initialize(int32 size); | 34 virtual bool Initialize(int32 size); |
35 virtual bool Initialize(base::SharedMemory* buffer, int32 size); | 35 virtual bool Initialize(base::SharedMemory* buffer, int32 size); |
36 virtual gpu::Buffer GetRingBuffer(); | 36 virtual gpu::Buffer GetRingBuffer(); |
37 virtual State GetState(); | 37 virtual State GetState(); |
| 38 virtual State GetLastState(); |
38 virtual void Flush(int32 put_offset); | 39 virtual void Flush(int32 put_offset); |
39 virtual State FlushSync(int32 put_offset, int32 last_known_get); | 40 virtual State FlushSync(int32 put_offset, int32 last_known_get); |
40 virtual void SetGetOffset(int32 get_offset); | 41 virtual void SetGetOffset(int32 get_offset); |
41 virtual int32 CreateTransferBuffer(size_t size, int32 id_request); | 42 virtual int32 CreateTransferBuffer(size_t size, int32 id_request); |
42 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, | 43 virtual int32 RegisterTransferBuffer(base::SharedMemory* shared_memory, |
43 size_t size, | 44 size_t size, |
44 int32 id_request); | 45 int32 id_request); |
45 virtual void DestroyTransferBuffer(int32 id); | 46 virtual void DestroyTransferBuffer(int32 id); |
46 virtual gpu::Buffer GetTransferBuffer(int32 handle); | 47 virtual gpu::Buffer GetTransferBuffer(int32 handle); |
47 virtual void SetToken(int32 token); | 48 virtual void SetToken(int32 token); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 if (last_state_.error == gpu::error::kNoError) { | 126 if (last_state_.error == gpu::error::kNoError) { |
126 gpu::CommandBuffer::State state; | 127 gpu::CommandBuffer::State state; |
127 if (Send(new PpapiHostMsg_PPBGraphics3D_GetState( | 128 if (Send(new PpapiHostMsg_PPBGraphics3D_GetState( |
128 INTERFACE_ID_PPB_GRAPHICS_3D, resource_, &state))) | 129 INTERFACE_ID_PPB_GRAPHICS_3D, resource_, &state))) |
129 UpdateState(state); | 130 UpdateState(state); |
130 } | 131 } |
131 | 132 |
132 return last_state_; | 133 return last_state_; |
133 } | 134 } |
134 | 135 |
| 136 gpu::CommandBuffer::State CommandBuffer::GetLastState() { |
| 137 return last_state_; |
| 138 } |
| 139 |
135 void CommandBuffer::Flush(int32 put_offset) { | 140 void CommandBuffer::Flush(int32 put_offset) { |
136 if (last_state_.error != gpu::error::kNoError) | 141 if (last_state_.error != gpu::error::kNoError) |
137 return; | 142 return; |
138 | 143 |
139 IPC::Message* message = new PpapiHostMsg_PPBGraphics3D_AsyncFlush( | 144 IPC::Message* message = new PpapiHostMsg_PPBGraphics3D_AsyncFlush( |
140 INTERFACE_ID_PPB_GRAPHICS_3D, resource_, put_offset); | 145 INTERFACE_ID_PPB_GRAPHICS_3D, resource_, put_offset); |
141 | 146 |
142 // Do not let a synchronous flush hold up this message. If this handler is | 147 // Do not let a synchronous flush hold up this message. If this handler is |
143 // deferred until after the synchronous flush completes, it will overwrite the | 148 // deferred until after the synchronous flush completes, it will overwrite the |
144 // cached last_state_ with out-of-date data. | 149 // cached last_state_ with out-of-date data. |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( | 608 void PPB_Graphics3D_Proxy::SendSwapBuffersACKToPlugin( |
604 int32_t result, | 609 int32_t result, |
605 const HostResource& context) { | 610 const HostResource& context) { |
606 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( | 611 dispatcher()->Send(new PpapiMsg_PPBGraphics3D_SwapBuffersACK( |
607 INTERFACE_ID_PPB_GRAPHICS_3D, context, result)); | 612 INTERFACE_ID_PPB_GRAPHICS_3D, context, result)); |
608 } | 613 } |
609 | 614 |
610 } // namespace proxy | 615 } // namespace proxy |
611 } // namespace pp | 616 } // namespace pp |
612 | 617 |
OLD | NEW |