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
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_
10 #include "base/containers/hash_tables.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/sys_info.h"
13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
14 #include "gpu/command_buffer/service/gles2_cmd_validation.h"
15 #include "gpu/config/gpu_driver_bug_workaround_type.h"
16 #include "gpu/gpu_export.h"
23 // FeatureInfo records the features that are available for a ContextGroup.
24 class GPU_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> {
29 bool chromium_framebuffer_multisample;
30 bool multisampled_render_to_texture;
31 // Use the IMG GLenum values and functions rather than EXT.
32 bool use_img_for_multisampled_render_to_texture;
33 bool oes_standard_derivatives;
34 bool oes_egl_image_external;
37 bool enable_texture_float_linear;
38 bool enable_texture_half_float_linear;
39 bool chromium_stream_texture;
40 bool angle_translated_shader_source;
41 bool angle_pack_reverse_row_order;
42 bool arb_texture_rectangle;
43 bool angle_instanced_arrays;
44 bool occlusion_query_boolean;
45 bool use_arb_occlusion_query2_for_occlusion_query_boolean;
46 bool use_arb_occlusion_query_for_occlusion_query_boolean;
47 bool native_vertex_array_object;
48 bool enable_shader_name_hashing;
50 bool ext_draw_buffers;
52 bool use_async_readpixels;
53 bool map_buffer_range;
54 bool ext_discard_framebuffer;
60 #define GPU_OP(type, name) bool name;
61 GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
64 // Note: 0 here means use driver limit.
65 GLint max_texture_size;
66 GLint max_cube_map_texture_size;
69 // Constructor with workarounds taken from the current process's CommandLine
72 // Constructor with workarounds taken from |command_line|
73 FeatureInfo(const CommandLine& command_line);
75 // Initializes the feature information. Needs a current GL context.
77 bool Initialize(const DisallowedFeatures& disallowed_features);
79 const Validators* validators() const {
83 const ValueValidator<GLenum>& GetTextureFormatValidator(GLenum format) {
84 return texture_format_validators_[format];
87 const std::string& extensions() const {
91 const FeatureFlags& feature_flags() const {
92 return feature_flags_;
95 const Workarounds& workarounds() const {
100 friend class base::RefCounted<FeatureInfo>;
101 friend class BufferManagerClientSideArraysTest;
102 friend class GLES2DecoderTestBase;
104 typedef base::hash_map<GLenum, ValueValidator<GLenum> > ValidatorMap;
105 ValidatorMap texture_format_validators_;
109 void AddExtensionString(const std::string& str);
110 void InitializeBasicState(const CommandLine& command_line);
111 void InitializeFeatures();
113 Validators validators_;
115 DisallowedFeatures disallowed_features_;
117 // The extensions string returned by glGetString(GL_EXTENSIONS);
118 std::string extensions_;
120 // Flags for some features
121 FeatureFlags feature_flags_;
123 // Flags for Workarounds.
124 Workarounds workarounds_;
126 DISALLOW_COPY_AND_ASSIGN(FeatureInfo);
132 #endif // GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_