Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: gpu/command_buffer/tests/gl_manager.h

Issue 1325433003: command_buffer: Add support for creating non-WebGL ES 3 contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 27 matching lines...) Expand all
38 class GLES2Decoder; 38 class GLES2Decoder;
39 class GLES2CmdHelper; 39 class GLES2CmdHelper;
40 class GLES2Implementation; 40 class GLES2Implementation;
41 class ImageManager; 41 class ImageManager;
42 class ShareGroup; 42 class ShareGroup;
43 43
44 }; 44 };
45 45
46 class GLManager : private GpuControl { 46 class GLManager : private GpuControl {
47 public: 47 public:
48 enum ContextType {
Zhenyao Mo 2015/08/28 17:16:25 Can we not redefine this, but instead, use the one
Kimmo Kinnunen 2015/08/31 12:23:13 Done.
49 CONTEXT_TYPE_WEBGL1,
50 CONTEXT_TYPE_WEBGL2,
51 CONTEXT_TYPE_OPENGLES2,
52 CONTEXT_TYPE_OPENGLES3
53 };
48 struct Options { 54 struct Options {
49 Options(); 55 Options();
50 // The size of the backbuffer. 56 // The size of the backbuffer.
51 gfx::Size size; 57 gfx::Size size;
52 // If not null will share resources with this context. 58 // If not null will share resources with this context.
53 GLManager* share_group_manager; 59 GLManager* share_group_manager;
54 // If not null will share a mailbox manager with this context. 60 // If not null will share a mailbox manager with this context.
55 GLManager* share_mailbox_manager; 61 GLManager* share_mailbox_manager;
56 // If not null will create a virtual manager based on this context. 62 // If not null will create a virtual manager based on this context.
57 GLManager* virtual_manager; 63 GLManager* virtual_manager;
58 // Whether or not glBindXXX generates a resource. 64 // Whether or not glBindXXX generates a resource.
59 bool bind_generates_resource; 65 bool bind_generates_resource;
60 // Whether or not the context is auto-lost when GL_OUT_OF_MEMORY occurs. 66 // Whether or not the context is auto-lost when GL_OUT_OF_MEMORY occurs.
61 bool lose_context_when_out_of_memory; 67 bool lose_context_when_out_of_memory;
62 // Whether or not it's ok to lose the context. 68 // Whether or not it's ok to lose the context.
63 bool context_lost_allowed; 69 bool context_lost_allowed;
64 // 0 indicates not WebGL context - default. 70
65 // 1 indicates WebGL 1 context. 71 ContextType context_type;
66 // 2 indicates WebGL 2 context.
67 unsigned webgl_version;
68 }; 72 };
69 GLManager(); 73 GLManager();
70 ~GLManager() override; 74 ~GLManager() override;
71 75
72 static scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer( 76 static scoped_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer(
73 const gfx::Size& size, 77 const gfx::Size& size,
74 gfx::BufferFormat format); 78 gfx::BufferFormat format);
75 79
76 void Initialize(const Options& options); 80 void Initialize(const Options& options);
77 void InitializeWithCommandLine(const Options& options, 81 void InitializeWithCommandLine(const Options& options,
78 base::CommandLine* command_line); 82 base::CommandLine* command_line);
79 void Destroy(); 83 void Destroy();
80 84
85 bool IsInitialized() const { return gles2_implementation() != nullptr; }
86
81 void MakeCurrent(); 87 void MakeCurrent();
82 88
83 void SetSurface(gfx::GLSurface* surface); 89 void SetSurface(gfx::GLSurface* surface);
84 90
85 gles2::GLES2Decoder* decoder() const { 91 gles2::GLES2Decoder* decoder() const {
86 return decoder_.get(); 92 return decoder_.get();
87 } 93 }
88 94
89 gles2::MailboxManager* mailbox_manager() const { 95 gles2::MailboxManager* mailbox_manager() const {
90 return mailbox_manager_.get(); 96 return mailbox_manager_.get();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // Used on Android to virtualize GL for all contexts. 152 // Used on Android to virtualize GL for all contexts.
147 static int use_count_; 153 static int use_count_;
148 static scoped_refptr<gfx::GLShareGroup>* base_share_group_; 154 static scoped_refptr<gfx::GLShareGroup>* base_share_group_;
149 static scoped_refptr<gfx::GLSurface>* base_surface_; 155 static scoped_refptr<gfx::GLSurface>* base_surface_;
150 static scoped_refptr<gfx::GLContext>* base_context_; 156 static scoped_refptr<gfx::GLContext>* base_context_;
151 }; 157 };
152 158
153 } // namespace gpu 159 } // namespace gpu
154 160
155 #endif // GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_ 161 #endif // GPU_COMMAND_BUFFER_TESTS_GL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698