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_SERVICE_FEATURE_INFO_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 GLint max_copy_texture_chromium_size; | 103 GLint max_copy_texture_chromium_size; |
104 }; | 104 }; |
105 | 105 |
106 // Constructor with workarounds taken from the current process's CommandLine | 106 // Constructor with workarounds taken from the current process's CommandLine |
107 FeatureInfo(); | 107 FeatureInfo(); |
108 | 108 |
109 // Constructor with workarounds taken from |command_line| | 109 // Constructor with workarounds taken from |command_line| |
110 FeatureInfo(const base::CommandLine& command_line); | 110 FeatureInfo(const base::CommandLine& command_line); |
111 | 111 |
112 // Initializes the feature information. Needs a current GL context. | 112 // Initializes the feature information. Needs a current GL context. |
113 bool Initialize(); | 113 bool Initialize(ContextType context_type, |
114 bool Initialize(const DisallowedFeatures& disallowed_features); | 114 const DisallowedFeatures& disallowed_features); |
| 115 |
| 116 // Helper that defaults to no disallowed features and a GLES2 context. |
| 117 bool InitializeForTesting(); |
115 | 118 |
116 const Validators* validators() const { | 119 const Validators* validators() const { |
117 return &validators_; | 120 return &validators_; |
118 } | 121 } |
119 | 122 |
| 123 ContextType context_type() const { return context_type_; } |
| 124 |
120 const std::string& extensions() const { | 125 const std::string& extensions() const { |
121 return extensions_; | 126 return extensions_; |
122 } | 127 } |
123 | 128 |
124 const FeatureFlags& feature_flags() const { | 129 const FeatureFlags& feature_flags() const { |
125 return feature_flags_; | 130 return feature_flags_; |
126 } | 131 } |
127 | 132 |
128 const Workarounds& workarounds() const { | 133 const Workarounds& workarounds() const { |
129 return workarounds_; | 134 return workarounds_; |
(...skipping 11 matching lines...) Expand all Loading... |
141 return unsafe_es3_apis_enabled_; | 146 return unsafe_es3_apis_enabled_; |
142 } | 147 } |
143 | 148 |
144 bool disable_shader_translator() const { return disable_shader_translator_; } | 149 bool disable_shader_translator() const { return disable_shader_translator_; } |
145 | 150 |
146 bool UseVirtualizedGLContexts() const { | 151 bool UseVirtualizedGLContexts() const { |
147 return !disable_virtual_contexts_ && | 152 return !disable_virtual_contexts_ && |
148 workarounds_.use_virtualized_gl_contexts; | 153 workarounds_.use_virtualized_gl_contexts; |
149 } | 154 } |
150 | 155 |
| 156 bool IsWebGLContext() const; |
| 157 |
151 private: | 158 private: |
152 friend class base::RefCounted<FeatureInfo>; | 159 friend class base::RefCounted<FeatureInfo>; |
153 friend class BufferManagerClientSideArraysTest; | 160 friend class BufferManagerClientSideArraysTest; |
154 | 161 |
155 ~FeatureInfo(); | 162 ~FeatureInfo(); |
156 | 163 |
157 void AddExtensionString(const char* s); | 164 void AddExtensionString(const char* s); |
158 void InitializeBasicState(const base::CommandLine* command_line); | 165 void InitializeBasicState(const base::CommandLine* command_line); |
159 void InitializeFeatures(); | 166 void InitializeFeatures(); |
160 | 167 |
161 Validators validators_; | 168 Validators validators_; |
162 | 169 |
163 DisallowedFeatures disallowed_features_; | 170 DisallowedFeatures disallowed_features_; |
164 | 171 |
| 172 ContextType context_type_; |
| 173 |
165 // The extensions string returned by glGetString(GL_EXTENSIONS); | 174 // The extensions string returned by glGetString(GL_EXTENSIONS); |
166 std::string extensions_; | 175 std::string extensions_; |
167 | 176 |
168 // Flags for some features | 177 // Flags for some features |
169 FeatureFlags feature_flags_; | 178 FeatureFlags feature_flags_; |
170 | 179 |
171 // Flags for Workarounds. | 180 // Flags for Workarounds. |
172 Workarounds workarounds_; | 181 Workarounds workarounds_; |
173 | 182 |
174 // Whether the command line switch kEnableUnsafeES3APIs is passed in. | 183 // Whether the command line switch kEnableUnsafeES3APIs is passed in. |
(...skipping 10 matching lines...) Expand all Loading... |
185 bool disable_shader_translator_; | 194 bool disable_shader_translator_; |
186 scoped_ptr<gfx::GLVersionInfo> gl_version_info_; | 195 scoped_ptr<gfx::GLVersionInfo> gl_version_info_; |
187 | 196 |
188 DISALLOW_COPY_AND_ASSIGN(FeatureInfo); | 197 DISALLOW_COPY_AND_ASSIGN(FeatureInfo); |
189 }; | 198 }; |
190 | 199 |
191 } // namespace gles2 | 200 } // namespace gles2 |
192 } // namespace gpu | 201 } // namespace gpu |
193 | 202 |
194 #endif // GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ | 203 #endif // GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ |
OLD | NEW |