| 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/hash_tables.h" |
| 9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 11 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 11 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 12 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
| 12 #include "gpu/gpu_export.h" | 13 #include "gpu/gpu_export.h" |
| 13 | 14 |
| 14 namespace gpu { | 15 namespace gpu { |
| 15 namespace gles2 { | 16 namespace gles2 { |
| 16 | 17 |
| 17 // FeatureInfo records the features that are available for a ContextGroup. | 18 // FeatureInfo records the features that are available for a ContextGroup. |
| 18 class GPU_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> { | 19 class GPU_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 const char* allowed_features); | 71 const char* allowed_features); |
| 71 | 72 |
| 72 // Turns on certain features if they can be turned on. NULL turns on | 73 // Turns on certain features if they can be turned on. NULL turns on |
| 73 // all available features. | 74 // all available features. |
| 74 void AddFeatures(const char* desired_features); | 75 void AddFeatures(const char* desired_features); |
| 75 | 76 |
| 76 const Validators* validators() const { | 77 const Validators* validators() const { |
| 77 return &validators_; | 78 return &validators_; |
| 78 } | 79 } |
| 79 | 80 |
| 81 const ValueValidator<GLenum>& GetTextureFormatValidator(GLenum format) { |
| 82 return texture_format_validators_[format]; |
| 83 } |
| 84 |
| 80 const std::string& extensions() const { | 85 const std::string& extensions() const { |
| 81 return extensions_; | 86 return extensions_; |
| 82 } | 87 } |
| 83 | 88 |
| 84 const FeatureFlags& feature_flags() const { | 89 const FeatureFlags& feature_flags() const { |
| 85 return feature_flags_; | 90 return feature_flags_; |
| 86 } | 91 } |
| 87 | 92 |
| 88 private: | 93 private: |
| 89 friend class base::RefCounted<FeatureInfo>; | 94 friend class base::RefCounted<FeatureInfo>; |
| 95 |
| 96 typedef base::hash_map<GLenum, ValueValidator<GLenum> > ValidatorMap; |
| 97 ValidatorMap texture_format_validators_; |
| 98 |
| 90 ~FeatureInfo(); | 99 ~FeatureInfo(); |
| 91 | 100 |
| 92 void AddExtensionString(const std::string& str); | 101 void AddExtensionString(const std::string& str); |
| 93 | 102 |
| 94 Validators validators_; | 103 Validators validators_; |
| 95 | 104 |
| 96 DisallowedFeatures disallowed_features_; | 105 DisallowedFeatures disallowed_features_; |
| 97 | 106 |
| 98 // The extensions string returned by glGetString(GL_EXTENSIONS); | 107 // The extensions string returned by glGetString(GL_EXTENSIONS); |
| 99 std::string extensions_; | 108 std::string extensions_; |
| 100 | 109 |
| 101 // Flags for some features | 110 // Flags for some features |
| 102 FeatureFlags feature_flags_; | 111 FeatureFlags feature_flags_; |
| 103 | 112 |
| 104 DISALLOW_COPY_AND_ASSIGN(FeatureInfo); | 113 DISALLOW_COPY_AND_ASSIGN(FeatureInfo); |
| 105 }; | 114 }; |
| 106 | 115 |
| 107 } // namespace gles2 | 116 } // namespace gles2 |
| 108 } // namespace gpu | 117 } // namespace gpu |
| 109 | 118 |
| 110 #endif // GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ | 119 #endif // GPU_COMMAND_BUFFER_SERVICE_FEATURE_INFO_H_ |
| 111 | 120 |
| 112 | 121 |
| OLD | NEW |