| 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_fence.h" |
| 20 #include "ui/gfx/gpu_memory_buffer.h" | 21 #include "ui/gfx/gpu_memory_buffer.h" |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 class CommandLine; | 24 class CommandLine; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace gl { | 27 namespace gl { |
| 27 | 28 |
| 28 class GLContext; | 29 class GLContext; |
| 29 class GLShareGroup; | 30 class GLShareGroup; |
| 30 class GLSurface; | 31 class GLSurface; |
| 31 | 32 |
| 32 } | 33 } |
| 33 | 34 |
| 34 namespace gpu { | 35 namespace gpu { |
| 35 | 36 |
| 36 class CommandBufferService; | 37 class CommandBufferService; |
| 37 class CommandExecutor; | 38 class CommandExecutor; |
| 39 class FenceFactory; |
| 38 class ImageFactory; | 40 class ImageFactory; |
| 39 class SyncPointClient; | 41 class SyncPointClient; |
| 40 class SyncPointOrderData; | 42 class SyncPointOrderData; |
| 41 class SyncPointManager; | 43 class SyncPointManager; |
| 42 class TransferBuffer; | 44 class TransferBuffer; |
| 43 | 45 |
| 44 namespace gles2 { | 46 namespace gles2 { |
| 45 | 47 |
| 46 class ContextGroup; | 48 class ContextGroup; |
| 47 class MailboxManager; | 49 class MailboxManager; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 75 bool context_lost_allowed; | 77 bool context_lost_allowed; |
| 76 gles2::ContextType context_type; | 78 gles2::ContextType context_type; |
| 77 // Force shader name hashing for all context types. | 79 // Force shader name hashing for all context types. |
| 78 bool force_shader_name_hashing; | 80 bool force_shader_name_hashing; |
| 79 // Whether the buffer is multisampled. | 81 // Whether the buffer is multisampled. |
| 80 bool multisampled; | 82 bool multisampled; |
| 81 // Whether the backbuffer has an alpha channel. | 83 // Whether the backbuffer has an alpha channel. |
| 82 bool backbuffer_alpha; | 84 bool backbuffer_alpha; |
| 83 // The ImageFactory to use to generate images for the backbuffer. | 85 // The ImageFactory to use to generate images for the backbuffer. |
| 84 gpu::ImageFactory* image_factory; | 86 gpu::ImageFactory* image_factory; |
| 87 // The FenceFactory to use to generate fences. |
| 88 gpu::FenceFactory* fence_factory; |
| 85 // Whether to preserve the backbuffer after a call to SwapBuffers(). | 89 // Whether to preserve the backbuffer after a call to SwapBuffers(). |
| 86 bool preserve_backbuffer; | 90 bool preserve_backbuffer; |
| 87 }; | 91 }; |
| 88 GLManager(); | 92 GLManager(); |
| 89 ~GLManager() override; | 93 ~GLManager() override; |
| 90 | 94 |
| 91 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer( | 95 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer( |
| 92 const gfx::Size& size, | 96 const gfx::Size& size, |
| 93 gfx::BufferFormat format); | 97 gfx::BufferFormat format); |
| 94 | 98 |
| 99 std::unique_ptr<gfx::GpuFence> CreateGpuFence(); |
| 100 |
| 95 void Initialize(const Options& options); | 101 void Initialize(const Options& options); |
| 96 void InitializeWithCommandLine(const Options& options, | 102 void InitializeWithCommandLine(const Options& options, |
| 97 const base::CommandLine& command_line); | 103 const base::CommandLine& command_line); |
| 98 void Destroy(); | 104 void Destroy(); |
| 99 | 105 |
| 100 bool IsInitialized() const { return gles2_implementation() != nullptr; } | 106 bool IsInitialized() const { return gles2_implementation() != nullptr; } |
| 101 | 107 |
| 102 void MakeCurrent(); | 108 void MakeCurrent(); |
| 103 | 109 |
| 104 void SetSurface(gl::GLSurface* surface); | 110 void SetSurface(gl::GLSurface* surface); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 gpu::CommandBufferNamespace GetNamespaceID() const override; | 151 gpu::CommandBufferNamespace GetNamespaceID() const override; |
| 146 CommandBufferId GetCommandBufferID() const override; | 152 CommandBufferId GetCommandBufferID() const override; |
| 147 int32_t GetExtraCommandBufferData() const override; | 153 int32_t GetExtraCommandBufferData() const override; |
| 148 uint64_t GenerateFenceSyncRelease() override; | 154 uint64_t GenerateFenceSyncRelease() override; |
| 149 bool IsFenceSyncRelease(uint64_t release) override; | 155 bool IsFenceSyncRelease(uint64_t release) override; |
| 150 bool IsFenceSyncFlushed(uint64_t release) override; | 156 bool IsFenceSyncFlushed(uint64_t release) override; |
| 151 bool IsFenceSyncFlushReceived(uint64_t release) override; | 157 bool IsFenceSyncFlushReceived(uint64_t release) override; |
| 152 void SignalSyncToken(const gpu::SyncToken& sync_token, | 158 void SignalSyncToken(const gpu::SyncToken& sync_token, |
| 153 const base::Closure& callback) override; | 159 const base::Closure& callback) override; |
| 154 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; | 160 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override; |
| 161 int32_t CreateFence(ClientFence fence) override; |
| 162 void DestroyFence(int32_t id) override; |
| 155 | 163 |
| 156 private: | 164 private: |
| 157 void PumpCommands(); | 165 void PumpCommands(); |
| 158 bool GetBufferChanged(int32_t transfer_buffer_id); | 166 bool GetBufferChanged(int32_t transfer_buffer_id); |
| 159 void SetupBaseContext(); | 167 void SetupBaseContext(); |
| 160 void OnFenceSyncRelease(uint64_t release); | 168 void OnFenceSyncRelease(uint64_t release); |
| 161 bool OnWaitFenceSync(gpu::CommandBufferNamespace namespace_id, | 169 bool OnWaitFenceSync(gpu::CommandBufferNamespace namespace_id, |
| 162 gpu::CommandBufferId command_buffer_id, | 170 gpu::CommandBufferId command_buffer_id, |
| 163 uint64_t release); | 171 uint64_t release); |
| 164 | 172 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 190 // Used on Android to virtualize GL for all contexts. | 198 // Used on Android to virtualize GL for all contexts. |
| 191 static int use_count_; | 199 static int use_count_; |
| 192 static scoped_refptr<gl::GLShareGroup>* base_share_group_; | 200 static scoped_refptr<gl::GLShareGroup>* base_share_group_; |
| 193 static scoped_refptr<gl::GLSurface>* base_surface_; | 201 static scoped_refptr<gl::GLSurface>* base_surface_; |
| 194 static scoped_refptr<gl::GLContext>* base_context_; | 202 static scoped_refptr<gl::GLContext>* base_context_; |
| 195 }; | 203 }; |
| 196 | 204 |
| 197 } // namespace gpu | 205 } // namespace gpu |
| 198 | 206 |
| 199 #endif // GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ | 207 #endif // GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ |
| OLD | NEW |