| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ | 5 #ifndef MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ |
| 6 #define MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ | 6 #define MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 // CommandBuffer implementation: | 50 // CommandBuffer implementation: |
| 51 virtual bool Initialize() OVERRIDE; | 51 virtual bool Initialize() OVERRIDE; |
| 52 virtual State GetState() OVERRIDE; | 52 virtual State GetState() OVERRIDE; |
| 53 virtual State GetLastState() OVERRIDE; | 53 virtual State GetLastState() OVERRIDE; |
| 54 virtual int32 GetLastToken() OVERRIDE; | 54 virtual int32 GetLastToken() OVERRIDE; |
| 55 virtual void Flush(int32 put_offset) OVERRIDE; | 55 virtual void Flush(int32 put_offset) OVERRIDE; |
| 56 virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE; | 56 virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE; |
| 57 virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE; | 57 virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE; |
| 58 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; | 58 virtual void SetGetBuffer(int32 shm_id) OVERRIDE; |
| 59 virtual void SetGetOffset(int32 get_offset) OVERRIDE; | |
| 60 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, | 59 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, |
| 61 int32* id) OVERRIDE; | 60 int32* id) OVERRIDE; |
| 62 virtual void DestroyTransferBuffer(int32 id) OVERRIDE; | 61 virtual void DestroyTransferBuffer(int32 id) OVERRIDE; |
| 63 virtual scoped_refptr<gpu::Buffer> GetTransferBuffer(int32 id) OVERRIDE; | |
| 64 virtual void SetToken(int32 token) OVERRIDE; | |
| 65 virtual void SetParseError(gpu::error::Error error) OVERRIDE; | |
| 66 virtual void SetContextLostReason(gpu::error::ContextLostReason reason) | |
| 67 OVERRIDE; | |
| 68 | 62 |
| 69 // gpu::GpuControl implementation: | 63 // gpu::GpuControl implementation: |
| 70 virtual gpu::Capabilities GetCapabilities() OVERRIDE; | 64 virtual gpu::Capabilities GetCapabilities() OVERRIDE; |
| 71 virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, | 65 virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(size_t width, |
| 72 size_t height, | 66 size_t height, |
| 73 unsigned internalformat, | 67 unsigned internalformat, |
| 74 int32* id) OVERRIDE; | 68 int32* id) OVERRIDE; |
| 75 virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; | 69 virtual void DestroyGpuMemoryBuffer(int32 id) OVERRIDE; |
| 76 virtual uint32 InsertSyncPoint() OVERRIDE; | 70 virtual uint32 InsertSyncPoint() OVERRIDE; |
| 77 virtual void SignalSyncPoint(uint32 sync_point, | 71 virtual void SignalSyncPoint(uint32 sync_point, |
| 78 const base::Closure& callback) OVERRIDE; | 72 const base::Closure& callback) OVERRIDE; |
| 79 virtual void SignalQuery(uint32 query, | 73 virtual void SignalQuery(uint32 query, |
| 80 const base::Closure& callback) OVERRIDE; | 74 const base::Closure& callback) OVERRIDE; |
| 81 virtual void SetSurfaceVisible(bool visible) OVERRIDE; | 75 virtual void SetSurfaceVisible(bool visible) OVERRIDE; |
| 82 virtual void SendManagedMemoryStats(const gpu::ManagedMemoryStats& stats) | 76 virtual void SendManagedMemoryStats(const gpu::ManagedMemoryStats& stats) |
| 83 OVERRIDE; | 77 OVERRIDE; |
| 84 virtual void Echo(const base::Closure& callback) OVERRIDE; | 78 virtual void Echo(const base::Closure& callback) OVERRIDE; |
| 85 virtual uint32 CreateStreamTexture(uint32 texture_id) OVERRIDE; | 79 virtual uint32 CreateStreamTexture(uint32 texture_id) OVERRIDE; |
| 86 | 80 |
| 87 void RequestAnimationFrames(); | 81 void RequestAnimationFrames(); |
| 88 void CancelAnimationFrames(); | 82 void CancelAnimationFrames(); |
| 89 | 83 |
| 90 private: | 84 private: |
| 91 typedef std::map<int32, scoped_refptr<gpu::Buffer> > TransferBufferMap; | |
| 92 | |
| 93 // CommandBufferClient implementation: | 85 // CommandBufferClient implementation: |
| 94 virtual void DidInitialize(bool success) OVERRIDE; | 86 virtual void DidInitialize(bool success) OVERRIDE; |
| 95 virtual void DidMakeProgress(const CommandBufferState& state) OVERRIDE; | 87 virtual void DidMakeProgress(const CommandBufferState& state) OVERRIDE; |
| 96 virtual void DidDestroy() OVERRIDE; | 88 virtual void DidDestroy() OVERRIDE; |
| 97 virtual void LostContext(int32_t lost_reason) OVERRIDE; | 89 virtual void LostContext(int32_t lost_reason) OVERRIDE; |
| 98 | 90 |
| 99 // ErrorHandler implementation: | 91 // ErrorHandler implementation: |
| 100 virtual void OnError() OVERRIDE; | 92 virtual void OnError() OVERRIDE; |
| 101 | 93 |
| 102 virtual void DrawAnimationFrame() OVERRIDE; | 94 virtual void DrawAnimationFrame() OVERRIDE; |
| 103 | 95 |
| 104 void TryUpdateState(); | 96 void TryUpdateState(); |
| 105 void MakeProgressAndUpdateState(); | 97 void MakeProgressAndUpdateState(); |
| 106 | 98 |
| 107 gpu::CommandBufferSharedState* shared_state() const { | 99 gpu::CommandBufferSharedState* shared_state() const { |
| 108 return reinterpret_cast<gpu::CommandBufferSharedState*>( | 100 return reinterpret_cast<gpu::CommandBufferSharedState*>( |
| 109 shared_state_shm_->memory()); | 101 shared_state_shm_->memory()); |
| 110 } | 102 } |
| 111 | 103 |
| 112 CommandBufferDelegate* delegate_; | 104 CommandBufferDelegate* delegate_; |
| 113 RemotePtr<mojo::CommandBuffer> command_buffer_; | 105 RemotePtr<mojo::CommandBuffer> command_buffer_; |
| 114 scoped_ptr<SyncDispatcher<CommandBufferSyncClient> > sync_dispatcher_; | 106 scoped_ptr<SyncDispatcher<CommandBufferSyncClient> > sync_dispatcher_; |
| 115 | 107 |
| 116 State last_state_; | 108 State last_state_; |
| 117 scoped_ptr<base::SharedMemory> shared_state_shm_; | 109 scoped_ptr<base::SharedMemory> shared_state_shm_; |
| 118 TransferBufferMap transfer_buffers_; | |
| 119 int32 last_put_offset_; | 110 int32 last_put_offset_; |
| 120 int32 next_transfer_buffer_id_; | 111 int32 next_transfer_buffer_id_; |
| 121 | 112 |
| 122 bool initialize_result_; | 113 bool initialize_result_; |
| 123 }; | 114 }; |
| 124 | 115 |
| 125 } // gles2 | 116 } // gles2 |
| 126 } // mojo | 117 } // mojo |
| 127 | 118 |
| 128 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ | 119 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ |
| OLD | NEW |