OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_COMMAND_BUFFER_NACL_H |
| 6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_COMMAND_BUFFER_NACL_H |
| 7 |
| 8 #include "gpu/command_buffer/common/command_buffer.h" |
| 9 #include "ppapi/c/dev/pp_graphics_3d_dev.h" |
| 10 #include "ppapi/c/dev/ppb_graphics_3d_trusted_dev.h" |
| 11 #include "ppapi/c/pp_resource.h" |
| 12 |
| 13 struct PPB_Core; |
| 14 |
| 15 // A CommandBuffer proxy implementation that uses trusted PPAPI interface to |
| 16 // access a CommandBuffer. |
| 17 |
| 18 class CommandBufferNacl : public gpu::CommandBuffer { |
| 19 public: |
| 20 // This class will addref the graphics 3d resource using the core interface. |
| 21 CommandBufferNacl(PP_Resource graphics_3d, const PPB_Core* iface_core); |
| 22 virtual ~CommandBufferNacl(); |
| 23 |
| 24 // CommandBuffer implementation. |
| 25 virtual bool Initialize(int32 size); |
| 26 virtual bool Initialize(base::SharedMemory* buffer, int32 size) { |
| 27 // TODO(neb): support for nacl if neccessary |
| 28 return false; |
| 29 } |
| 30 virtual gpu::Buffer GetRingBuffer(); |
| 31 virtual State GetState(); |
| 32 virtual State GetLastState(); |
| 33 virtual void Flush(int32 put_offset); |
| 34 virtual State FlushSync(int32 put_offset, int32 last_known_get); |
| 35 virtual void SetGetOffset(int32 get_offset); |
| 36 virtual int32 CreateTransferBuffer(size_t size, int32 id_request); |
| 37 virtual int32 RegisterTransferBuffer(base::SharedMemory* buffer, |
| 38 size_t size, |
| 39 int32 id_request) { |
| 40 // TODO(neb): support for nacl if neccessary |
| 41 return -1; |
| 42 } |
| 43 virtual void DestroyTransferBuffer(int32 id); |
| 44 virtual gpu::Buffer GetTransferBuffer(int32 handle); |
| 45 virtual void SetToken(int32 token); |
| 46 virtual void SetParseError(gpu::error::Error error); |
| 47 virtual void SetContextLostReason(gpu::error::ContextLostReason); |
| 48 |
| 49 private: |
| 50 PP_Resource graphics_3d_; |
| 51 const PPB_Core* iface_core_; |
| 52 gpu::Buffer buffer_; |
| 53 State last_state_; |
| 54 |
| 55 static gpu::CommandBuffer::State PpapiToGpuState(PP_Graphics3DTrustedState s); |
| 56 static gpu::CommandBuffer::State ErrorGpuState(); |
| 57 static gpu::Buffer BufferFromShm(int shm_handle, uint32_t shm_size); |
| 58 }; |
| 59 |
| 60 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_COMMAND_BUFFER_NACL_H |
OLD | NEW |