| 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_workarounds.h" | 14 #include "gpu/config/gpu_driver_bug_workaround_type.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 { |
| 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 |
| 109 // Constructor with workarounds taken from the current process's CommandLine |
| 93 FeatureInfo(); | 110 FeatureInfo(); |
| 94 | 111 |
| 95 // Constructor with workarounds taken from the current process's CommandLine | |
| 96 explicit FeatureInfo( | |
| 97 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds); | |
| 98 | |
| 99 // Constructor with workarounds taken from |command_line| | 112 // Constructor with workarounds taken from |command_line| |
| 100 FeatureInfo(const base::CommandLine& command_line, | 113 FeatureInfo(const base::CommandLine& command_line); |
| 101 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds); | |
| 102 | 114 |
| 103 // Initializes the feature information. Needs a current GL context. | 115 // Initializes the feature information. Needs a current GL context. |
| 104 bool Initialize(ContextType context_type, | 116 bool Initialize(ContextType context_type, |
| 105 const DisallowedFeatures& disallowed_features); | 117 const DisallowedFeatures& disallowed_features); |
| 106 | 118 |
| 107 // Helper that defaults to no disallowed features and a GLES2 context. | 119 // Helper that defaults to no disallowed features and a GLES2 context. |
| 108 bool InitializeForTesting(); | 120 bool InitializeForTesting(); |
| 109 // Helper that defaults to a GLES2 context. | 121 // Helper that defaults to a GLES2 context. |
| 110 bool InitializeForTesting(const DisallowedFeatures& disallowed_features); | 122 bool InitializeForTesting(const DisallowedFeatures& disallowed_features); |
| 111 | 123 |
| 112 const Validators* validators() const { | 124 const Validators* validators() const { |
| 113 return &validators_; | 125 return &validators_; |
| 114 } | 126 } |
| 115 | 127 |
| 116 ContextType context_type() const { return context_type_; } | 128 ContextType context_type() const { return context_type_; } |
| 117 | 129 |
| 118 const std::string& extensions() const { | 130 const std::string& extensions() const { |
| 119 return extensions_; | 131 return extensions_; |
| 120 } | 132 } |
| 121 | 133 |
| 122 const FeatureFlags& feature_flags() const { | 134 const FeatureFlags& feature_flags() const { |
| 123 return feature_flags_; | 135 return feature_flags_; |
| 124 } | 136 } |
| 125 | 137 |
| 126 const GpuDriverBugWorkarounds& workarounds() const { return workarounds_; } | 138 const Workarounds& workarounds() const { |
| 139 return workarounds_; |
| 140 } |
| 127 | 141 |
| 128 const DisallowedFeatures& disallowed_features() const { | 142 const DisallowedFeatures& disallowed_features() const { |
| 129 return disallowed_features_; | 143 return disallowed_features_; |
| 130 } | 144 } |
| 131 | 145 |
| 132 const gfx::GLVersionInfo& gl_version_info() const { | 146 const gfx::GLVersionInfo& gl_version_info() const { |
| 133 DCHECK(gl_version_info_.get()); | 147 DCHECK(gl_version_info_.get()); |
| 134 return *(gl_version_info_.get()); | 148 return *(gl_version_info_.get()); |
| 135 } | 149 } |
| 136 | 150 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 167 | 181 |
| 168 ContextType context_type_; | 182 ContextType context_type_; |
| 169 | 183 |
| 170 // The extensions string returned by glGetString(GL_EXTENSIONS); | 184 // The extensions string returned by glGetString(GL_EXTENSIONS); |
| 171 std::string extensions_; | 185 std::string extensions_; |
| 172 | 186 |
| 173 // Flags for some features | 187 // Flags for some features |
| 174 FeatureFlags feature_flags_; | 188 FeatureFlags feature_flags_; |
| 175 | 189 |
| 176 // Flags for Workarounds. | 190 // Flags for Workarounds. |
| 177 const GpuDriverBugWorkarounds workarounds_; | 191 Workarounds workarounds_; |
| 178 | 192 |
| 179 // Whether the command line switch kEnableUnsafeES3APIs is passed in. | 193 // Whether the command line switch kEnableUnsafeES3APIs is passed in. |
| 180 bool enable_unsafe_es3_apis_switch_; | 194 bool enable_unsafe_es3_apis_switch_; |
| 181 | 195 |
| 182 bool unsafe_es3_apis_enabled_; | 196 bool unsafe_es3_apis_enabled_; |
| 183 | 197 |
| 184 bool chromium_color_buffer_float_rgba_available_; | 198 bool chromium_color_buffer_float_rgba_available_; |
| 185 bool chromium_color_buffer_float_rgb_available_; | 199 bool chromium_color_buffer_float_rgb_available_; |
| 186 bool ext_color_buffer_float_available_; | 200 bool ext_color_buffer_float_available_; |
| 187 bool oes_texture_float_linear_available_; | 201 bool oes_texture_float_linear_available_; |
| 188 bool oes_texture_half_float_linear_available_; | 202 bool oes_texture_half_float_linear_available_; |
| 189 | 203 |
| 190 bool disable_shader_translator_; | 204 bool disable_shader_translator_; |
| 191 scoped_ptr<gfx::GLVersionInfo> gl_version_info_; | 205 scoped_ptr<gfx::GLVersionInfo> gl_version_info_; |
| 192 | 206 |
| 193 DISALLOW_COPY_AND_ASSIGN(FeatureInfo); | 207 DISALLOW_COPY_AND_ASSIGN(FeatureInfo); |
| 194 }; | 208 }; |
| 195 | 209 |
| 196 } // namespace gles2 | 210 } // namespace gles2 |
| 197 } // namespace gpu | 211 } // namespace gpu |
| 198 | 212 |
| 199 #endif // GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ | 213 #endif // GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ |
| OLD | NEW |