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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 12 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
13 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 13 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
14 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 14 #include "gpu/config/gpu_driver_bug_workarounds.h" |
15 #include "gpu/gpu_export.h" | 15 #include "gpu/gpu_export.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class CommandLine; | 18 class CommandLine; |
19 } | 19 } |
20 | 20 |
21 namespace gfx { | 21 namespace gfx { |
22 struct GLVersionInfo; | 22 struct GLVersionInfo; |
23 } | 23 } |
24 | 24 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 bool chromium_image_ycbcr_420v; | 83 bool chromium_image_ycbcr_420v; |
84 bool chromium_image_ycbcr_422; | 84 bool chromium_image_ycbcr_422; |
85 bool enable_subscribe_uniform; | 85 bool enable_subscribe_uniform; |
86 bool emulate_primitive_restart_fixed_index; | 86 bool emulate_primitive_restart_fixed_index; |
87 bool ext_render_buffer_format_bgra8888; | 87 bool ext_render_buffer_format_bgra8888; |
88 bool ext_multisample_compatibility; | 88 bool ext_multisample_compatibility; |
89 bool ext_blend_func_extended; | 89 bool ext_blend_func_extended; |
90 bool ext_read_format_bgra; | 90 bool ext_read_format_bgra; |
91 }; | 91 }; |
92 | 92 |
93 struct Workarounds { | 93 FeatureInfo(); |
94 Workarounds(); | |
95 | |
96 #define GPU_OP(type, name) bool name; | |
97 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) | |
98 #undef GPU_OP | |
99 | |
100 // Note: 0 here means use driver limit. | |
101 GLint max_texture_size; | |
102 GLint max_cube_map_texture_size; | |
103 GLint max_fragment_uniform_vectors; | |
104 GLint max_varying_vectors; | |
105 GLint max_vertex_uniform_vectors; | |
106 GLint max_copy_texture_chromium_size; | |
107 }; | |
108 | 94 |
109 // Constructor with workarounds taken from the current process's CommandLine | 95 // Constructor with workarounds taken from the current process's CommandLine |
110 FeatureInfo(); | 96 explicit FeatureInfo( |
| 97 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds); |
111 | 98 |
112 // Constructor with workarounds taken from |command_line| | 99 // Constructor with workarounds taken from |command_line| |
113 FeatureInfo(const base::CommandLine& command_line); | 100 FeatureInfo(const base::CommandLine& command_line, |
| 101 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds); |
114 | 102 |
115 // Initializes the feature information. Needs a current GL context. | 103 // Initializes the feature information. Needs a current GL context. |
116 bool Initialize(ContextType context_type, | 104 bool Initialize(ContextType context_type, |
117 const DisallowedFeatures& disallowed_features); | 105 const DisallowedFeatures& disallowed_features); |
118 | 106 |
119 // Helper that defaults to no disallowed features and a GLES2 context. | 107 // Helper that defaults to no disallowed features and a GLES2 context. |
120 bool InitializeForTesting(); | 108 bool InitializeForTesting(); |
121 // Helper that defaults to a GLES2 context. | 109 // Helper that defaults to a GLES2 context. |
122 bool InitializeForTesting(const DisallowedFeatures& disallowed_features); | 110 bool InitializeForTesting(const DisallowedFeatures& disallowed_features); |
123 | 111 |
124 const Validators* validators() const { | 112 const Validators* validators() const { |
125 return &validators_; | 113 return &validators_; |
126 } | 114 } |
127 | 115 |
128 ContextType context_type() const { return context_type_; } | 116 ContextType context_type() const { return context_type_; } |
129 | 117 |
130 const std::string& extensions() const { | 118 const std::string& extensions() const { |
131 return extensions_; | 119 return extensions_; |
132 } | 120 } |
133 | 121 |
134 const FeatureFlags& feature_flags() const { | 122 const FeatureFlags& feature_flags() const { |
135 return feature_flags_; | 123 return feature_flags_; |
136 } | 124 } |
137 | 125 |
138 const Workarounds& workarounds() const { | 126 const GpuDriverBugWorkarounds& workarounds() const { return workarounds_; } |
139 return workarounds_; | |
140 } | |
141 | 127 |
142 const DisallowedFeatures& disallowed_features() const { | 128 const DisallowedFeatures& disallowed_features() const { |
143 return disallowed_features_; | 129 return disallowed_features_; |
144 } | 130 } |
145 | 131 |
146 const gfx::GLVersionInfo& gl_version_info() const { | 132 const gfx::GLVersionInfo& gl_version_info() const { |
147 DCHECK(gl_version_info_.get()); | 133 DCHECK(gl_version_info_.get()); |
148 return *(gl_version_info_.get()); | 134 return *(gl_version_info_.get()); |
149 } | 135 } |
150 | 136 |
(...skipping 30 matching lines...) Expand all Loading... |
181 | 167 |
182 ContextType context_type_; | 168 ContextType context_type_; |
183 | 169 |
184 // The extensions string returned by glGetString(GL_EXTENSIONS); | 170 // The extensions string returned by glGetString(GL_EXTENSIONS); |
185 std::string extensions_; | 171 std::string extensions_; |
186 | 172 |
187 // Flags for some features | 173 // Flags for some features |
188 FeatureFlags feature_flags_; | 174 FeatureFlags feature_flags_; |
189 | 175 |
190 // Flags for Workarounds. | 176 // Flags for Workarounds. |
191 Workarounds workarounds_; | 177 const GpuDriverBugWorkarounds workarounds_; |
192 | 178 |
193 // Whether the command line switch kEnableUnsafeES3APIs is passed in. | 179 // Whether the command line switch kEnableUnsafeES3APIs is passed in. |
194 bool enable_unsafe_es3_apis_switch_; | 180 bool enable_unsafe_es3_apis_switch_; |
195 | 181 |
196 bool unsafe_es3_apis_enabled_; | 182 bool unsafe_es3_apis_enabled_; |
197 | 183 |
198 bool chromium_color_buffer_float_rgba_available_; | 184 bool chromium_color_buffer_float_rgba_available_; |
199 bool chromium_color_buffer_float_rgb_available_; | 185 bool chromium_color_buffer_float_rgb_available_; |
200 bool ext_color_buffer_float_available_; | 186 bool ext_color_buffer_float_available_; |
201 bool oes_texture_float_linear_available_; | 187 bool oes_texture_float_linear_available_; |
202 bool oes_texture_half_float_linear_available_; | 188 bool oes_texture_half_float_linear_available_; |
203 | 189 |
204 bool disable_shader_translator_; | 190 bool disable_shader_translator_; |
205 scoped_ptr<gfx::GLVersionInfo> gl_version_info_; | 191 scoped_ptr<gfx::GLVersionInfo> gl_version_info_; |
206 | 192 |
207 DISALLOW_COPY_AND_ASSIGN(FeatureInfo); | 193 DISALLOW_COPY_AND_ASSIGN(FeatureInfo); |
208 }; | 194 }; |
209 | 195 |
210 } // namespace gles2 | 196 } // namespace gles2 |
211 } // namespace gpu | 197 } // namespace gpu |
212 | 198 |
213 #endif // GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ | 199 #endif // GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ |
OLD | NEW |