| 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 "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "gpu/command_buffer/client/gpu_control.h" | 11 #include "gpu/command_buffer/client/gpu_control.h" |
| 12 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 12 #include "gpu/command_buffer/service/feature_info.h" | 13 #include "gpu/command_buffer/service/feature_info.h" |
| 13 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
| 14 #include "ui/gfx/gpu_memory_buffer.h" | 15 #include "ui/gfx/gpu_memory_buffer.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class CommandLine; | 18 class CommandLine; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace gfx { | 21 namespace gfx { |
| 21 | 22 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // If not null will share a mailbox manager with this context. | 55 // If not null will share a mailbox manager with this context. |
| 55 GLManager* share_mailbox_manager; | 56 GLManager* share_mailbox_manager; |
| 56 // If not null will create a virtual manager based on this context. | 57 // If not null will create a virtual manager based on this context. |
| 57 GLManager* virtual_manager; | 58 GLManager* virtual_manager; |
| 58 // Whether or not glBindXXX generates a resource. | 59 // Whether or not glBindXXX generates a resource. |
| 59 bool bind_generates_resource; | 60 bool bind_generates_resource; |
| 60 // Whether or not the context is auto-lost when GL_OUT_OF_MEMORY occurs. | 61 // Whether or not the context is auto-lost when GL_OUT_OF_MEMORY occurs. |
| 61 bool lose_context_when_out_of_memory; | 62 bool lose_context_when_out_of_memory; |
| 62 // Whether or not it's ok to lose the context. | 63 // Whether or not it's ok to lose the context. |
| 63 bool context_lost_allowed; | 64 bool context_lost_allowed; |
| 64 // 0 indicates not WebGL context - default. | 65 gles2::ContextType context_type; |
| 65 // 1 indicates WebGL 1 context. | |
| 66 // 2 indicates WebGL 2 context. | |
| 67 unsigned webgl_version; | |
| 68 }; | 66 }; |
| 69 GLManager(); | 67 GLManager(); |
| 70 ~GLManager() override; | 68 ~GLManager() override; |
| 71 | 69 |
| 72 static scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer( | 70 static scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer( |
| 73 const gfx::Size& size, | 71 const gfx::Size& size, |
| 74 gfx::BufferFormat format); | 72 gfx::BufferFormat format); |
| 75 | 73 |
| 76 void Initialize(const Options& options); | 74 void Initialize(const Options& options); |
| 77 void InitializeWithCommandLine(const Options& options, | 75 void InitializeWithCommandLine(const Options& options, |
| 78 base::CommandLine* command_line); | 76 base::CommandLine* command_line); |
| 79 void Destroy(); | 77 void Destroy(); |
| 80 | 78 |
| 79 bool IsInitialized() const { return gles2_implementation() != nullptr; } |
| 80 |
| 81 void MakeCurrent(); | 81 void MakeCurrent(); |
| 82 | 82 |
| 83 void SetSurface(gfx::GLSurface* surface); | 83 void SetSurface(gfx::GLSurface* surface); |
| 84 | 84 |
| 85 gles2::GLES2Decoder* decoder() const { | 85 gles2::GLES2Decoder* decoder() const { |
| 86 return decoder_.get(); | 86 return decoder_.get(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 gles2::MailboxManager* mailbox_manager() const { | 89 gles2::MailboxManager* mailbox_manager() const { |
| 90 return mailbox_manager_.get(); | 90 return mailbox_manager_.get(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // Used on Android to virtualize GL for all contexts. | 148 // Used on Android to virtualize GL for all contexts. |
| 149 static int use_count_; | 149 static int use_count_; |
| 150 static scoped_refptr<gfx::GLShareGroup>* base_share_group_; | 150 static scoped_refptr<gfx::GLShareGroup>* base_share_group_; |
| 151 static scoped_refptr<gfx::GLSurface>* base_surface_; | 151 static scoped_refptr<gfx::GLSurface>* base_surface_; |
| 152 static scoped_refptr<gfx::GLContext>* base_context_; | 152 static scoped_refptr<gfx::GLContext>* base_context_; |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace gpu | 155 } // namespace gpu |
| 156 | 156 |
| 157 #endif // GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ | 157 #endif // GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ |
| OLD | NEW |