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 |
11 #include <map> | 11 #include <map> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "components/mus/public/interfaces/command_buffer.mojom.h" | 16 #include "components/mus/public/interfaces/command_buffer.mojom.h" |
17 #include "gpu/command_buffer/client/gpu_control.h" | 17 #include "gpu/command_buffer/client/gpu_control.h" |
18 #include "gpu/command_buffer/common/command_buffer.h" | 18 #include "gpu/command_buffer/common/command_buffer.h" |
| 19 #include "gpu/command_buffer/common/command_buffer_id.h" |
19 #include "gpu/command_buffer/common/command_buffer_shared.h" | 20 #include "gpu/command_buffer/common/command_buffer_shared.h" |
20 #include "mojo/public/cpp/bindings/binding.h" | 21 #include "mojo/public/cpp/bindings/binding.h" |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class RunLoop; | 24 class RunLoop; |
24 } | 25 } |
25 | 26 |
26 namespace gles2 { | 27 namespace gles2 { |
27 class CommandBufferClientImpl; | 28 class CommandBufferClientImpl; |
28 | 29 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 void DestroyImage(int32_t id) override; | 67 void DestroyImage(int32_t id) override; |
67 int32_t CreateGpuMemoryBufferImage(size_t width, | 68 int32_t CreateGpuMemoryBufferImage(size_t width, |
68 size_t height, | 69 size_t height, |
69 unsigned internalformat, | 70 unsigned internalformat, |
70 unsigned usage) override; | 71 unsigned usage) override; |
71 void SignalQuery(uint32_t query, const base::Closure& callback) override; | 72 void SignalQuery(uint32_t query, const base::Closure& callback) override; |
72 void SetLock(base::Lock*) override; | 73 void SetLock(base::Lock*) override; |
73 bool IsGpuChannelLost() override; | 74 bool IsGpuChannelLost() override; |
74 void EnsureWorkVisible() override; | 75 void EnsureWorkVisible() override; |
75 gpu::CommandBufferNamespace GetNamespaceID() const override; | 76 gpu::CommandBufferNamespace GetNamespaceID() const override; |
76 uint64_t GetCommandBufferID() const override; | 77 gpu::CommandBufferId GetCommandBufferID() const override; |
77 int32_t GetExtraCommandBufferData() const override; | 78 int32_t GetExtraCommandBufferData() const override; |
78 uint64_t GenerateFenceSyncRelease() override; | 79 uint64_t GenerateFenceSyncRelease() override; |
79 bool IsFenceSyncRelease(uint64_t release) override; | 80 bool IsFenceSyncRelease(uint64_t release) override; |
80 bool IsFenceSyncFlushed(uint64_t release) override; | 81 bool IsFenceSyncFlushed(uint64_t release) override; |
81 bool IsFenceSyncFlushReceived(uint64_t release) override; | 82 bool IsFenceSyncFlushReceived(uint64_t release) override; |
82 void SignalSyncToken(const gpu::SyncToken& sync_token, | 83 void SignalSyncToken(const gpu::SyncToken& sync_token, |
83 const base::Closure& callback) override; | 84 const base::Closure& callback) override; |
84 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; | 85 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; |
85 | 86 |
86 private: | 87 private: |
87 // mus::mojom::CommandBufferLostContextObserver implementation: | 88 // mus::mojom::CommandBufferLostContextObserver implementation: |
88 void DidLoseContext(int32_t lost_reason) override; | 89 void DidLoseContext(int32_t lost_reason) override; |
89 | 90 |
90 void TryUpdateState(); | 91 void TryUpdateState(); |
91 void MakeProgressAndUpdateState(); | 92 void MakeProgressAndUpdateState(); |
92 | 93 |
93 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } | 94 gpu::CommandBufferSharedState* shared_state() const { return shared_state_; } |
94 | 95 |
95 CommandBufferDelegate* delegate_; | 96 CommandBufferDelegate* delegate_; |
96 std::vector<int32_t> attribs_; | 97 std::vector<int32_t> attribs_; |
97 mojo::Binding<mus::mojom::CommandBufferLostContextObserver> observer_binding_; | 98 mojo::Binding<mus::mojom::CommandBufferLostContextObserver> observer_binding_; |
98 mus::mojom::CommandBufferPtr command_buffer_; | 99 mus::mojom::CommandBufferPtr command_buffer_; |
99 | 100 |
100 uint64_t command_buffer_id_; | 101 gpu::CommandBufferId command_buffer_id_; |
101 gpu::Capabilities capabilities_; | 102 gpu::Capabilities capabilities_; |
102 State last_state_; | 103 State last_state_; |
103 mojo::ScopedSharedBufferHandle shared_state_handle_; | 104 mojo::ScopedSharedBufferHandle shared_state_handle_; |
104 gpu::CommandBufferSharedState* shared_state_; | 105 gpu::CommandBufferSharedState* shared_state_; |
105 int32_t last_put_offset_; | 106 int32_t last_put_offset_; |
106 int32_t next_transfer_buffer_id_; | 107 int32_t next_transfer_buffer_id_; |
107 | 108 |
108 // Image IDs are allocated in sequence. | 109 // Image IDs are allocated in sequence. |
109 int next_image_id_; | 110 int next_image_id_; |
110 | 111 |
111 uint64_t next_fence_sync_release_; | 112 uint64_t next_fence_sync_release_; |
112 uint64_t flushed_fence_sync_release_; | 113 uint64_t flushed_fence_sync_release_; |
113 | 114 |
114 const MojoAsyncWaiter* async_waiter_; | 115 const MojoAsyncWaiter* async_waiter_; |
115 }; | 116 }; |
116 | 117 |
117 } // gles2 | 118 } // gles2 |
118 | 119 |
119 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ | 120 #endif // MOJO_GLES2_COMMAND_BUFFER_CLIENT_IMPL_H_ |
OLD | NEW |