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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 translator_->GetStringForOptionsThatWouldAffectCompilation(); | 81 translator_->GetStringForOptionsThatWouldAffectCompilation(); |
82 } | 82 } |
83 return last_compiled_source_; | 83 return last_compiled_source_; |
84 } | 84 } |
85 | 85 |
86 const sh::Attribute* GetAttribInfo(const std::string& name) const; | 86 const sh::Attribute* GetAttribInfo(const std::string& name) const; |
87 const sh::Uniform* GetUniformInfo(const std::string& name) const; | 87 const sh::Uniform* GetUniformInfo(const std::string& name) const; |
88 const sh::Varying* GetVaryingInfo(const std::string& name) const; | 88 const sh::Varying* GetVaryingInfo(const std::string& name) const; |
89 const sh::InterfaceBlock* GetInterfaceBlockInfo( | 89 const sh::InterfaceBlock* GetInterfaceBlockInfo( |
90 const std::string& name) const; | 90 const std::string& name) const; |
| 91 const sh::OutputVariable* GetOutputVariableInfo( |
| 92 const std::string& name) const; |
91 | 93 |
92 // If the original_name is not found, return NULL. | 94 // If the original_name is not found, return NULL. |
93 const std::string* GetAttribMappedName( | 95 const std::string* GetAttribMappedName( |
94 const std::string& original_name) const; | 96 const std::string& original_name) const; |
95 | 97 |
96 // If the original_name is not found, return NULL. | 98 // If the original_name is not found, return NULL. |
97 const std::string* GetUniformMappedName( | 99 const std::string* GetUniformMappedName( |
98 const std::string& original_name) const; | 100 const std::string& original_name) const; |
99 | 101 |
100 // If the original_name is not found, return NULL. | 102 // If the original_name is not found, return NULL. |
101 const std::string* GetVaryingMappedName( | 103 const std::string* GetVaryingMappedName( |
102 const std::string& original_name) const; | 104 const std::string& original_name) const; |
103 | 105 |
104 // If the original_name is not found, return NULL. | 106 // If the original_name is not found, return NULL. |
105 const std::string* GetInterfaceBlockMappedName( | 107 const std::string* GetInterfaceBlockMappedName( |
106 const std::string& original_name) const; | 108 const std::string& original_name) const; |
107 | 109 |
| 110 // If the original_name is not found, return NULL. |
| 111 const std::string* GetOutputVariableMappedName( |
| 112 const std::string& original_name) const; |
| 113 |
108 // If the hashed_name is not found, return NULL. | 114 // If the hashed_name is not found, return NULL. |
109 const std::string* GetOriginalNameFromHashedName( | 115 const std::string* GetOriginalNameFromHashedName( |
110 const std::string& hashed_name) const; | 116 const std::string& hashed_name) const; |
111 | 117 |
112 const std::string* GetMappedName( | 118 const std::string* GetMappedName( |
113 const std::string& original_name) const; | 119 const std::string& original_name) const; |
114 | 120 |
115 const std::string& log_info() const { | 121 const std::string& log_info() const { |
116 return log_info_; | 122 return log_info_; |
117 } | 123 } |
(...skipping 19 matching lines...) Expand all Loading... |
137 // Used by program cache. | 143 // Used by program cache. |
138 const UniformMap& uniform_map() const { | 144 const UniformMap& uniform_map() const { |
139 return uniform_map_; | 145 return uniform_map_; |
140 } | 146 } |
141 | 147 |
142 // Used by program cache. | 148 // Used by program cache. |
143 const VaryingMap& varying_map() const { | 149 const VaryingMap& varying_map() const { |
144 return varying_map_; | 150 return varying_map_; |
145 } | 151 } |
146 | 152 |
| 153 const OutputVariableList& output_variable_list() const { |
| 154 return output_variable_list_; |
| 155 } |
| 156 |
147 // Used by program cache. | 157 // Used by program cache. |
148 const InterfaceBlockMap& interface_block_map() const { | 158 const InterfaceBlockMap& interface_block_map() const { |
149 return interface_block_map_; | 159 return interface_block_map_; |
150 } | 160 } |
151 | 161 |
152 // Used by program cache. | 162 // Used by program cache. |
153 void set_attrib_map(const AttributeMap& attrib_map) { | 163 void set_attrib_map(const AttributeMap& attrib_map) { |
154 // copied because cache might be cleared | 164 // copied because cache might be cleared |
155 attrib_map_ = AttributeMap(attrib_map); | 165 attrib_map_ = AttributeMap(attrib_map); |
156 } | 166 } |
(...skipping 13 matching lines...) Expand all Loading... |
170 // Used by program cache. | 180 // Used by program cache. |
171 void set_interface_block_map(const InterfaceBlockMap& interface_block_map) { | 181 void set_interface_block_map(const InterfaceBlockMap& interface_block_map) { |
172 // copied because cache might be cleared | 182 // copied because cache might be cleared |
173 interface_block_map_ = InterfaceBlockMap(interface_block_map); | 183 interface_block_map_ = InterfaceBlockMap(interface_block_map); |
174 } | 184 } |
175 | 185 |
176 void AddUniformToUniformMap(sh::Uniform uniform) { | 186 void AddUniformToUniformMap(sh::Uniform uniform) { |
177 uniform_map_[uniform.mappedName] = uniform; | 187 uniform_map_[uniform.mappedName] = uniform; |
178 } | 188 } |
179 | 189 |
| 190 void set_output_variable_list( |
| 191 const OutputVariableList& output_variable_list) { |
| 192 // copied because cache might be cleared |
| 193 output_variable_list_ = output_variable_list; |
| 194 } |
| 195 |
180 private: | 196 private: |
181 friend class base::RefCounted<Shader>; | 197 friend class base::RefCounted<Shader>; |
182 friend class ShaderManager; | 198 friend class ShaderManager; |
183 | 199 |
184 Shader(GLuint service_id, GLenum shader_type); | 200 Shader(GLuint service_id, GLenum shader_type); |
185 ~Shader(); | 201 ~Shader(); |
186 | 202 |
187 // Must be called only if we currently own the context. Forces the deletion | 203 // Must be called only if we currently own the context. Forces the deletion |
188 // of the underlying shader service id. | 204 // of the underlying shader service id. |
189 void Destroy(); | 205 void Destroy(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 std::string translated_source_; | 246 std::string translated_source_; |
231 | 247 |
232 // The shader translation log. | 248 // The shader translation log. |
233 std::string log_info_; | 249 std::string log_info_; |
234 | 250 |
235 // The type info when the shader was last compiled. | 251 // The type info when the shader was last compiled. |
236 AttributeMap attrib_map_; | 252 AttributeMap attrib_map_; |
237 UniformMap uniform_map_; | 253 UniformMap uniform_map_; |
238 VaryingMap varying_map_; | 254 VaryingMap varying_map_; |
239 InterfaceBlockMap interface_block_map_; | 255 InterfaceBlockMap interface_block_map_; |
| 256 OutputVariableList output_variable_list_; |
240 | 257 |
241 // The name hashing info when the shader was last compiled. | 258 // The name hashing info when the shader was last compiled. |
242 NameMap name_map_; | 259 NameMap name_map_; |
243 }; | 260 }; |
244 | 261 |
245 // Tracks the Shaders. | 262 // Tracks the Shaders. |
246 // | 263 // |
247 // NOTE: To support shared resources an instance of this class will | 264 // NOTE: To support shared resources an instance of this class will |
248 // need to be shared by multiple GLES2Decoders. | 265 // need to be shared by multiple GLES2Decoders. |
249 class GPU_EXPORT ShaderManager { | 266 class GPU_EXPORT ShaderManager { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 void RemoveShader(Shader* shader); | 306 void RemoveShader(Shader* shader); |
290 | 307 |
291 DISALLOW_COPY_AND_ASSIGN(ShaderManager); | 308 DISALLOW_COPY_AND_ASSIGN(ShaderManager); |
292 }; | 309 }; |
293 | 310 |
294 } // namespace gles2 | 311 } // namespace gles2 |
295 } // namespace gpu | 312 } // namespace gpu |
296 | 313 |
297 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ | 314 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ |
298 | 315 |
OLD | NEW |