| 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_SHADER_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 std::string last_compiled_signature() const { | 77 std::string last_compiled_signature() const { |
| 78 if (translator_.get()) { | 78 if (translator_.get()) { |
| 79 return last_compiled_source_ + | 79 return last_compiled_source_ + |
| 80 translator_->GetStringForOptionsThatWouldAffectCompilation(); | 80 translator_->GetStringForOptionsThatWouldAffectCompilation(); |
| 81 } | 81 } |
| 82 return last_compiled_source_; | 82 return last_compiled_source_; |
| 83 } | 83 } |
| 84 | 84 |
| 85 const sh::Attribute* GetAttribInfo(const std::string& name) const; | 85 const sh::Attribute* GetAttribInfo(const std::string& name) const; |
| 86 const sh::Uniform* GetUniformInfo(const std::string& name) const; | 86 const sh::Uniform* GetUniformInfo(const std::string& name) const; |
| 87 const sh::Varying* GetVaryingInfo(const std::string& name) const; | 87 const sh::Varying* GetInputVariableInfo(const std::string& name) const; |
| 88 const sh::OutputVariable* GetOutputVariableInfo( |
| 89 const std::string& name) const; |
| 88 | 90 |
| 89 // If the original_name is not found, return NULL. | 91 // If the original_name is not found, return NULL. |
| 90 const std::string* GetAttribMappedName( | 92 const std::string* GetAttribMappedName( |
| 91 const std::string& original_name) const; | 93 const std::string& original_name) const; |
| 92 | 94 |
| 93 // If the original_name is not found, return NULL. | 95 // If the original_name is not found, return NULL. |
| 94 const std::string* GetUniformMappedName( | 96 const std::string* GetUniformMappedName( |
| 95 const std::string& original_name) const; | 97 const std::string& original_name) const; |
| 96 | 98 |
| 97 // If the original_name is not found, return NULL. | 99 // If the original_name is not found, return NULL. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 127 // Used by program cache. | 129 // Used by program cache. |
| 128 const UniformMap& uniform_map() const { | 130 const UniformMap& uniform_map() const { |
| 129 return uniform_map_; | 131 return uniform_map_; |
| 130 } | 132 } |
| 131 | 133 |
| 132 // Used by program cache. | 134 // Used by program cache. |
| 133 const VaryingMap& varying_map() const { | 135 const VaryingMap& varying_map() const { |
| 134 return varying_map_; | 136 return varying_map_; |
| 135 } | 137 } |
| 136 | 138 |
| 139 const OutputVariableList& output_variable_list() const { |
| 140 return output_variable_list_; |
| 141 } |
| 142 |
| 137 // Used by program cache. | 143 // Used by program cache. |
| 138 void set_attrib_map(const AttributeMap& attrib_map) { | 144 void set_attrib_map(const AttributeMap& attrib_map) { |
| 139 // copied because cache might be cleared | 145 // copied because cache might be cleared |
| 140 attrib_map_ = AttributeMap(attrib_map); | 146 attrib_map_ = AttributeMap(attrib_map); |
| 141 } | 147 } |
| 142 | 148 |
| 143 // Used by program cache. | 149 // Used by program cache. |
| 144 void set_uniform_map(const UniformMap& uniform_map) { | 150 void set_uniform_map(const UniformMap& uniform_map) { |
| 145 // copied because cache might be cleared | 151 // copied because cache might be cleared |
| 146 uniform_map_ = UniformMap(uniform_map); | 152 uniform_map_ = UniformMap(uniform_map); |
| 147 } | 153 } |
| 148 | 154 |
| 149 // Used by program cache. | 155 // Used by program cache. |
| 150 void set_varying_map(const VaryingMap& varying_map) { | 156 void set_varying_map(const VaryingMap& varying_map) { |
| 151 // copied because cache might be cleared | 157 // copied because cache might be cleared |
| 152 varying_map_ = VaryingMap(varying_map); | 158 varying_map_ = VaryingMap(varying_map); |
| 153 } | 159 } |
| 154 | 160 |
| 161 // Used by program cache. |
| 162 void set_output_variable_list( |
| 163 const OutputVariableList& output_variable_list) { |
| 164 // copied because cache might be cleared |
| 165 output_variable_list_ = output_variable_list; |
| 166 } |
| 167 |
| 155 private: | 168 private: |
| 156 friend class base::RefCounted<Shader>; | 169 friend class base::RefCounted<Shader>; |
| 157 friend class ShaderManager; | 170 friend class ShaderManager; |
| 158 | 171 |
| 159 Shader(GLuint service_id, GLenum shader_type); | 172 Shader(GLuint service_id, GLenum shader_type); |
| 160 ~Shader(); | 173 ~Shader(); |
| 161 | 174 |
| 162 // Must be called only if we currently own the context. Forces the deletion | 175 // Must be called only if we currently own the context. Forces the deletion |
| 163 // of the underlying shader service id. | 176 // of the underlying shader service id. |
| 164 void Destroy(); | 177 void Destroy(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // The translated shader source. | 217 // The translated shader source. |
| 205 std::string translated_source_; | 218 std::string translated_source_; |
| 206 | 219 |
| 207 // The shader translation log. | 220 // The shader translation log. |
| 208 std::string log_info_; | 221 std::string log_info_; |
| 209 | 222 |
| 210 // The type info when the shader was last compiled. | 223 // The type info when the shader was last compiled. |
| 211 AttributeMap attrib_map_; | 224 AttributeMap attrib_map_; |
| 212 UniformMap uniform_map_; | 225 UniformMap uniform_map_; |
| 213 VaryingMap varying_map_; | 226 VaryingMap varying_map_; |
| 227 OutputVariableList output_variable_list_; |
| 214 | 228 |
| 215 // The name hashing info when the shader was last compiled. | 229 // The name hashing info when the shader was last compiled. |
| 216 NameMap name_map_; | 230 NameMap name_map_; |
| 217 }; | 231 }; |
| 218 | 232 |
| 219 // Tracks the Shaders. | 233 // Tracks the Shaders. |
| 220 // | 234 // |
| 221 // NOTE: To support shared resources an instance of this class will | 235 // NOTE: To support shared resources an instance of this class will |
| 222 // need to be shared by multiple GLES2Decoders. | 236 // need to be shared by multiple GLES2Decoders. |
| 223 class GPU_EXPORT ShaderManager { | 237 class GPU_EXPORT ShaderManager { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 void RemoveShader(Shader* shader); | 277 void RemoveShader(Shader* shader); |
| 264 | 278 |
| 265 DISALLOW_COPY_AND_ASSIGN(ShaderManager); | 279 DISALLOW_COPY_AND_ASSIGN(ShaderManager); |
| 266 }; | 280 }; |
| 267 | 281 |
| 268 } // namespace gles2 | 282 } // namespace gles2 |
| 269 } // namespace gpu | 283 } // namespace gpu |
| 270 | 284 |
| 271 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ | 285 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ |
| 272 | 286 |
| OLD | NEW |