OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/containers/scoped_ptr_hash_map.h" | 13 #include "base/containers/scoped_ptr_hash_map.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "gpu/command_buffer/client/gpu_control.h" | 15 #include "gpu/command_buffer/client/gpu_control.h" |
16 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 16 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
17 #include "gpu/command_buffer/service/feature_info.h" | 17 #include "gpu/command_buffer/service/feature_info.h" |
18 #include "gpu/command_buffer/service/gpu_preferences.h" | 18 #include "gpu/command_buffer/service/gpu_preferences.h" |
19 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
20 #include "ui/gfx/gpu_memory_buffer.h" | 20 #include "ui/gfx/gpu_memory_buffer.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class CommandLine; | 23 class CommandLine; |
24 } | 24 } |
25 | 25 |
26 namespace gfx { | 26 namespace gl { |
27 | 27 |
28 class GLContext; | 28 class GLContext; |
29 class GLShareGroup; | 29 class GLShareGroup; |
30 class GLSurface; | 30 class GLSurface; |
31 | 31 |
32 } | 32 } |
33 | 33 |
34 namespace gpu { | 34 namespace gpu { |
35 | 35 |
36 class CommandBufferService; | 36 class CommandBufferService; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 void Initialize(const Options& options); | 88 void Initialize(const Options& options); |
89 void InitializeWithCommandLine(const Options& options, | 89 void InitializeWithCommandLine(const Options& options, |
90 const base::CommandLine& command_line); | 90 const base::CommandLine& command_line); |
91 void Destroy(); | 91 void Destroy(); |
92 | 92 |
93 bool IsInitialized() const { return gles2_implementation() != nullptr; } | 93 bool IsInitialized() const { return gles2_implementation() != nullptr; } |
94 | 94 |
95 void MakeCurrent(); | 95 void MakeCurrent(); |
96 | 96 |
97 void SetSurface(gfx::GLSurface* surface); | 97 void SetSurface(gl::GLSurface* surface); |
98 | 98 |
99 void set_use_iosurface_memory_buffers(bool use_iosurface_memory_buffers) { | 99 void set_use_iosurface_memory_buffers(bool use_iosurface_memory_buffers) { |
100 use_iosurface_memory_buffers_ = use_iosurface_memory_buffers; | 100 use_iosurface_memory_buffers_ = use_iosurface_memory_buffers; |
101 } | 101 } |
102 | 102 |
103 void SetCommandsPaused(bool paused) { pause_commands_ = paused; } | 103 void SetCommandsPaused(bool paused) { pause_commands_ = paused; } |
104 | 104 |
105 gles2::GLES2Decoder* decoder() const { | 105 gles2::GLES2Decoder* decoder() const { |
106 return decoder_.get(); | 106 return decoder_.get(); |
107 } | 107 } |
108 | 108 |
109 gles2::MailboxManager* mailbox_manager() const { | 109 gles2::MailboxManager* mailbox_manager() const { |
110 return mailbox_manager_.get(); | 110 return mailbox_manager_.get(); |
111 } | 111 } |
112 | 112 |
113 gfx::GLShareGroup* share_group() const { | 113 gl::GLShareGroup* share_group() const { return share_group_.get(); } |
114 return share_group_.get(); | |
115 } | |
116 | 114 |
117 gles2::GLES2Implementation* gles2_implementation() const { | 115 gles2::GLES2Implementation* gles2_implementation() const { |
118 return gles2_implementation_.get(); | 116 return gles2_implementation_.get(); |
119 } | 117 } |
120 | 118 |
121 gfx::GLContext* context() { | 119 gl::GLContext* context() { return context_.get(); } |
122 return context_.get(); | |
123 } | |
124 | 120 |
125 const GpuDriverBugWorkarounds& workarounds() const; | 121 const GpuDriverBugWorkarounds& workarounds() const; |
126 | 122 |
127 // GpuControl implementation. | 123 // GpuControl implementation. |
128 void SetGpuControlClient(GpuControlClient*) override; | 124 void SetGpuControlClient(GpuControlClient*) override; |
129 Capabilities GetCapabilities() override; | 125 Capabilities GetCapabilities() override; |
130 int32_t CreateImage(ClientBuffer buffer, | 126 int32_t CreateImage(ClientBuffer buffer, |
131 size_t width, | 127 size_t width, |
132 size_t height, | 128 size_t height, |
133 unsigned internalformat) override; | 129 unsigned internalformat) override; |
(...skipping 25 matching lines...) Expand all Loading... |
159 gpu::CommandBufferId command_buffer_id, | 155 gpu::CommandBufferId command_buffer_id, |
160 uint64_t release); | 156 uint64_t release); |
161 | 157 |
162 gpu::GpuPreferences gpu_preferences_; | 158 gpu::GpuPreferences gpu_preferences_; |
163 | 159 |
164 SyncPointManager* sync_point_manager_; // Non-owning. | 160 SyncPointManager* sync_point_manager_; // Non-owning. |
165 | 161 |
166 scoped_refptr<SyncPointOrderData> sync_point_order_data_; | 162 scoped_refptr<SyncPointOrderData> sync_point_order_data_; |
167 std::unique_ptr<SyncPointClient> sync_point_client_; | 163 std::unique_ptr<SyncPointClient> sync_point_client_; |
168 scoped_refptr<gles2::MailboxManager> mailbox_manager_; | 164 scoped_refptr<gles2::MailboxManager> mailbox_manager_; |
169 scoped_refptr<gfx::GLShareGroup> share_group_; | 165 scoped_refptr<gl::GLShareGroup> share_group_; |
170 std::unique_ptr<CommandBufferService> command_buffer_; | 166 std::unique_ptr<CommandBufferService> command_buffer_; |
171 std::unique_ptr<gles2::GLES2Decoder> decoder_; | 167 std::unique_ptr<gles2::GLES2Decoder> decoder_; |
172 std::unique_ptr<CommandExecutor> executor_; | 168 std::unique_ptr<CommandExecutor> executor_; |
173 scoped_refptr<gfx::GLSurface> surface_; | 169 scoped_refptr<gl::GLSurface> surface_; |
174 scoped_refptr<gfx::GLContext> context_; | 170 scoped_refptr<gl::GLContext> context_; |
175 std::unique_ptr<gles2::GLES2CmdHelper> gles2_helper_; | 171 std::unique_ptr<gles2::GLES2CmdHelper> gles2_helper_; |
176 std::unique_ptr<TransferBuffer> transfer_buffer_; | 172 std::unique_ptr<TransferBuffer> transfer_buffer_; |
177 std::unique_ptr<gles2::GLES2Implementation> gles2_implementation_; | 173 std::unique_ptr<gles2::GLES2Implementation> gles2_implementation_; |
178 bool context_lost_allowed_; | 174 bool context_lost_allowed_; |
179 bool pause_commands_; | 175 bool pause_commands_; |
180 uint32_t paused_order_num_; | 176 uint32_t paused_order_num_; |
181 | 177 |
182 const CommandBufferId command_buffer_id_; | 178 const CommandBufferId command_buffer_id_; |
183 uint64_t next_fence_sync_release_; | 179 uint64_t next_fence_sync_release_; |
184 | 180 |
185 bool use_iosurface_memory_buffers_ = false; | 181 bool use_iosurface_memory_buffers_ = false; |
186 | 182 |
187 // Used on Android to virtualize GL for all contexts. | 183 // Used on Android to virtualize GL for all contexts. |
188 static int use_count_; | 184 static int use_count_; |
189 static scoped_refptr<gfx::GLShareGroup>* base_share_group_; | 185 static scoped_refptr<gl::GLShareGroup>* base_share_group_; |
190 static scoped_refptr<gfx::GLSurface>* base_surface_; | 186 static scoped_refptr<gl::GLSurface>* base_surface_; |
191 static scoped_refptr<gfx::GLContext>* base_context_; | 187 static scoped_refptr<gl::GLContext>* base_context_; |
192 }; | 188 }; |
193 | 189 |
194 } // namespace gpu | 190 } // namespace gpu |
195 | 191 |
196 #endif // GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ | 192 #endif // GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ |
OLD | NEW |