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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 class CommandBufferClientImpl : public CommandBufferClient, | 32 class CommandBufferClientImpl : public CommandBufferClient, |
33 public ErrorHandler, | 33 public ErrorHandler, |
34 public gpu::CommandBuffer, | 34 public gpu::CommandBuffer, |
35 public gpu::GpuControl { | 35 public gpu::GpuControl { |
36 public: | 36 public: |
37 explicit CommandBufferClientImpl( | 37 explicit CommandBufferClientImpl( |
38 CommandBufferDelegate* delegate, | 38 CommandBufferDelegate* delegate, |
39 const MojoAsyncWaiter* async_waiter, | 39 const MojoAsyncWaiter* async_waiter, |
40 ScopedMessagePipeHandle command_buffer_handle); | 40 ScopedMessagePipeHandle command_buffer_handle); |
41 virtual ~CommandBufferClientImpl(); | 41 ~CommandBufferClientImpl() override; |
42 | 42 |
43 // CommandBuffer implementation: | 43 // CommandBuffer implementation: |
44 virtual bool Initialize() override; | 44 bool Initialize() override; |
45 virtual State GetLastState() override; | 45 State GetLastState() override; |
46 virtual int32 GetLastToken() override; | 46 int32 GetLastToken() override; |
47 virtual void Flush(int32 put_offset) override; | 47 void Flush(int32 put_offset) override; |
48 virtual void WaitForTokenInRange(int32 start, int32 end) override; | 48 void WaitForTokenInRange(int32 start, int32 end) override; |
49 virtual void WaitForGetOffsetInRange(int32 start, int32 end) override; | 49 void WaitForGetOffsetInRange(int32 start, int32 end) override; |
50 virtual void SetGetBuffer(int32 shm_id) override; | 50 void SetGetBuffer(int32 shm_id) override; |
51 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, | 51 scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, |
52 int32* id) override; | 52 int32* id) override; |
53 virtual void DestroyTransferBuffer(int32 id) override; | 53 void DestroyTransferBuffer(int32 id) override; |
54 | 54 |
55 // gpu::GpuControl implementation: | 55 // gpu::GpuControl implementation: |
56 virtual gpu::Capabilities GetCapabilities() override; | 56 gpu::Capabilities GetCapabilities() override; |
57 virtual int32_t CreateImage(ClientBuffer buffer, | 57 int32_t CreateImage(ClientBuffer buffer, |
58 size_t width, | 58 size_t width, |
59 size_t height, | 59 size_t height, |
60 unsigned internalformat) override; | 60 unsigned internalformat) override; |
61 virtual void DestroyImage(int32_t id) override; | 61 void DestroyImage(int32_t id) override; |
62 virtual int32_t CreateGpuMemoryBufferImage(size_t width, | 62 int32_t CreateGpuMemoryBufferImage(size_t width, |
63 size_t height, | 63 size_t height, |
64 unsigned internalformat, | 64 unsigned internalformat, |
65 unsigned usage) override; | 65 unsigned usage) override; |
66 virtual uint32 InsertSyncPoint() override; | 66 uint32 InsertSyncPoint() override; |
67 virtual uint32 InsertFutureSyncPoint() override; | 67 uint32 InsertFutureSyncPoint() override; |
68 virtual void RetireSyncPoint(uint32 sync_point) override; | 68 void RetireSyncPoint(uint32 sync_point) override; |
69 virtual void SignalSyncPoint(uint32 sync_point, | 69 void SignalSyncPoint(uint32 sync_point, |
70 const base::Closure& callback) override; | 70 const base::Closure& callback) override; |
71 virtual void SignalQuery(uint32 query, | 71 void SignalQuery(uint32 query, const base::Closure& callback) override; |
72 const base::Closure& callback) override; | 72 void SetSurfaceVisible(bool visible) override; |
73 virtual void SetSurfaceVisible(bool visible) override; | 73 uint32 CreateStreamTexture(uint32 texture_id) override; |
74 virtual uint32 CreateStreamTexture(uint32 texture_id) override; | |
75 | 74 |
76 private: | 75 private: |
77 class SyncClientImpl; | 76 class SyncClientImpl; |
78 | 77 |
79 // CommandBufferClient implementation: | 78 // CommandBufferClient implementation: |
80 virtual void DidDestroy() override; | 79 void DidDestroy() override; |
81 virtual void LostContext(int32_t lost_reason) override; | 80 void LostContext(int32_t lost_reason) override; |
82 | 81 |
83 // ErrorHandler implementation: | 82 // ErrorHandler implementation: |
84 virtual void OnConnectionError() override; | 83 void OnConnectionError() override; |
85 | 84 |
86 void TryUpdateState(); | 85 void TryUpdateState(); |
87 void MakeProgressAndUpdateState(); | 86 void MakeProgressAndUpdateState(); |
88 | 87 |
89 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } | 88 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } |
90 | 89 |
91 CommandBufferDelegate* delegate_; | 90 CommandBufferDelegate* delegate_; |
92 CommandBufferPtr command_buffer_; | 91 CommandBufferPtr command_buffer_; |
93 scoped_ptr<SyncClientImpl> sync_client_impl_; | 92 scoped_ptr<SyncClientImpl> sync_client_impl_; |
94 | 93 |
95 State last_state_; | 94 State last_state_; |
96 mojo::ScopedSharedBufferHandle shared_state_handle_; | 95 mojo::ScopedSharedBufferHandle shared_state_handle_; |
97 gpu::CommandBufferSharedState* shared_state_; | 96 gpu::CommandBufferSharedState* shared_state_; |
98 int32 last_put_offset_; | 97 int32 last_put_offset_; |
99 int32 next_transfer_buffer_id_; | 98 int32 next_transfer_buffer_id_; |
100 | 99 |
101 const MojoAsyncWaiter* async_waiter_; | 100 const MojoAsyncWaiter* async_waiter_; |
102 }; | 101 }; |
103 | 102 |
104 } // gles2 | 103 } // gles2 |
105 } // mojo | 104 } // mojo |
106 | 105 |
107 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ | 106 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ |
OLD | NEW |