| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 namespace gles2 { | 26 namespace gles2 { |
| 27 class CommandBufferClientImpl; | 27 class CommandBufferClientImpl; |
| 28 | 28 |
| 29 class CommandBufferDelegate { | 29 class CommandBufferDelegate { |
| 30 public: | 30 public: |
| 31 virtual ~CommandBufferDelegate(); | 31 virtual ~CommandBufferDelegate(); |
| 32 virtual void ContextLost(); | 32 virtual void ContextLost(); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class CommandBufferClientImpl | 35 class CommandBufferClientImpl |
| 36 : public mus::mojom::CommandBufferLostContextObserver, | 36 : public mus::mojom::CommandBufferClient, |
| 37 public gpu::CommandBuffer, | 37 public gpu::CommandBuffer, |
| 38 public gpu::GpuControl { | 38 public gpu::GpuControl { |
| 39 public: | 39 public: |
| 40 explicit CommandBufferClientImpl( | 40 explicit CommandBufferClientImpl( |
| 41 CommandBufferDelegate* delegate, | 41 CommandBufferDelegate* delegate, |
| 42 const std::vector<int32_t>& attribs, | 42 const std::vector<int32_t>& attribs, |
| 43 const MojoAsyncWaiter* async_waiter, | 43 const MojoAsyncWaiter* async_waiter, |
| 44 mojo::ScopedMessagePipeHandle command_buffer_handle); | 44 mojo::ScopedMessagePipeHandle command_buffer_handle); |
| 45 ~CommandBufferClientImpl() override; | 45 ~CommandBufferClientImpl() override; |
| 46 | 46 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 77 int32_t GetExtraCommandBufferData() const override; | 77 int32_t GetExtraCommandBufferData() const override; |
| 78 uint64_t GenerateFenceSyncRelease() override; | 78 uint64_t GenerateFenceSyncRelease() override; |
| 79 bool IsFenceSyncRelease(uint64_t release) override; | 79 bool IsFenceSyncRelease(uint64_t release) override; |
| 80 bool IsFenceSyncFlushed(uint64_t release) override; | 80 bool IsFenceSyncFlushed(uint64_t release) override; |
| 81 bool IsFenceSyncFlushReceived(uint64_t release) override; | 81 bool IsFenceSyncFlushReceived(uint64_t release) override; |
| 82 void SignalSyncToken(const gpu::SyncToken& sync_token, | 82 void SignalSyncToken(const gpu::SyncToken& sync_token, |
| 83 const base::Closure& callback) override; | 83 const base::Closure& callback) override; |
| 84 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; | 84 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 // mus::mojom::CommandBufferLostContextObserver implementation: | 87 // mus::mojom::CommandBufferClient implementation: |
| 88 void DidLoseContext(int32_t lost_reason) override; | 88 void Destroyed(int32_t lost_reason, int32_t error) override; |
| 89 void SignalAck(uint32_t id) override; |
| 90 void SwapBuffersCompleted(int32_t result) override; |
| 91 void UpdateState(const gpu::CommandBuffer::State& state) override; |
| 92 void UpdateVSyncParameters(int64_t timebase, int64_t interval) override; |
| 89 | 93 |
| 90 void TryUpdateState(); | 94 void TryUpdateState(); |
| 91 void MakeProgressAndUpdateState(); | 95 void MakeProgressAndUpdateState(); |
| 92 | 96 |
| 93 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } | 97 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } |
| 94 | 98 |
| 95 CommandBufferDelegate* delegate_; | 99 CommandBufferDelegate* delegate_; |
| 96 std::vector<int32_t> attribs_; | 100 std::vector<int32_t> attribs_; |
| 97 mojo::Binding<mus::mojom::CommandBufferLostContextObserver> observer_binding_; | 101 mojo::Binding<mus::mojom::CommandBufferClient> client_binding_; |
| 98 mus::mojom::CommandBufferPtr command_buffer_; | 102 mus::mojom::CommandBufferPtr command_buffer_; |
| 99 | 103 |
| 100 uint64_t command_buffer_id_; | 104 uint64_t command_buffer_id_; |
| 101 gpu::Capabilities capabilities_; | 105 gpu::Capabilities capabilities_; |
| 102 State last_state_; | 106 State last_state_; |
| 103 mojo::ScopedSharedBufferHandle shared_state_handle_; | 107 mojo::ScopedSharedBufferHandle shared_state_handle_; |
| 104 gpu::CommandBufferSharedState* shared_state_; | 108 gpu::CommandBufferSharedState* shared_state_; |
| 105 int32_t last_put_offset_; | 109 int32_t last_put_offset_; |
| 106 int32_t next_transfer_buffer_id_; | 110 int32_t next_transfer_buffer_id_; |
| 107 | 111 |
| 108 // Image IDs are allocated in sequence. | 112 // Image IDs are allocated in sequence. |
| 109 int next_image_id_; | 113 int next_image_id_; |
| 110 | 114 |
| 111 uint64_t next_fence_sync_release_; | 115 uint64_t next_fence_sync_release_; |
| 112 uint64_t flushed_fence_sync_release_; | 116 uint64_t flushed_fence_sync_release_; |
| 113 | 117 |
| 114 const MojoAsyncWaiter* async_waiter_; | 118 const MojoAsyncWaiter* async_waiter_; |
| 115 }; | 119 }; |
| 116 | 120 |
| 117 } // gles2 | 121 } // gles2 |
| 118 | 122 |
| 119 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ | 123 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ |
| OLD | NEW |