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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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* GetVaryingInfo(const std::string& name) const; |
| 88 const sh::Attribute* GetOutputVariableInfo(const std::string& name) const; |
88 | 89 |
89 // If the original_name is not found, return NULL. | 90 // If the original_name is not found, return NULL. |
90 const std::string* GetAttribMappedName( | 91 const std::string* GetAttribMappedName( |
91 const std::string& original_name) const; | 92 const std::string& original_name) const; |
92 | 93 |
93 // If the hashed_name is not found, return NULL. | 94 // If the hashed_name is not found, return NULL. |
94 const std::string* GetOriginalNameFromHashedName( | 95 const std::string* GetOriginalNameFromHashedName( |
95 const std::string& hashed_name) const; | 96 const std::string& hashed_name) const; |
96 | 97 |
97 const std::string& log_info() const { | 98 const std::string& log_info() const { |
(...skipping 21 matching lines...) Expand all Loading... |
119 // Used by program cache. | 120 // Used by program cache. |
120 const UniformMap& uniform_map() const { | 121 const UniformMap& uniform_map() const { |
121 return uniform_map_; | 122 return uniform_map_; |
122 } | 123 } |
123 | 124 |
124 // Used by program cache. | 125 // Used by program cache. |
125 const VaryingMap& varying_map() const { | 126 const VaryingMap& varying_map() const { |
126 return varying_map_; | 127 return varying_map_; |
127 } | 128 } |
128 | 129 |
| 130 const AttributeList& output_variable_list() const { |
| 131 return output_variable_list_; |
| 132 } |
| 133 |
129 // Used by program cache. | 134 // Used by program cache. |
130 void set_attrib_map(const AttributeMap& attrib_map) { | 135 void set_attrib_map(const AttributeMap& attrib_map) { |
131 // copied because cache might be cleared | 136 // copied because cache might be cleared |
132 attrib_map_ = AttributeMap(attrib_map); | 137 attrib_map_ = AttributeMap(attrib_map); |
133 } | 138 } |
134 | 139 |
135 // Used by program cache. | 140 // Used by program cache. |
136 void set_uniform_map(const UniformMap& uniform_map) { | 141 void set_uniform_map(const UniformMap& uniform_map) { |
137 // copied because cache might be cleared | 142 // copied because cache might be cleared |
138 uniform_map_ = UniformMap(uniform_map); | 143 uniform_map_ = UniformMap(uniform_map); |
139 } | 144 } |
140 | 145 |
141 // Used by program cache. | 146 // Used by program cache. |
142 void set_varying_map(const VaryingMap& varying_map) { | 147 void set_varying_map(const VaryingMap& varying_map) { |
143 // copied because cache might be cleared | 148 // copied because cache might be cleared |
144 varying_map_ = VaryingMap(varying_map); | 149 varying_map_ = VaryingMap(varying_map); |
145 } | 150 } |
146 | 151 |
| 152 // Used by program cache. |
| 153 void set_output_variable_list(const AttributeList& output_variable_list) { |
| 154 // copied because cache might be cleared |
| 155 output_variable_list_ = output_variable_list; |
| 156 } |
| 157 |
147 private: | 158 private: |
148 friend class base::RefCounted<Shader>; | 159 friend class base::RefCounted<Shader>; |
149 friend class ShaderManager; | 160 friend class ShaderManager; |
150 | 161 |
151 Shader(GLuint service_id, GLenum shader_type); | 162 Shader(GLuint service_id, GLenum shader_type); |
152 ~Shader(); | 163 ~Shader(); |
153 | 164 |
154 // Must be called only if we currently own the context. Forces the deletion | 165 // Must be called only if we currently own the context. Forces the deletion |
155 // of the underlying shader service id. | 166 // of the underlying shader service id. |
156 void Destroy(); | 167 void Destroy(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // The translated shader source. | 207 // The translated shader source. |
197 std::string translated_source_; | 208 std::string translated_source_; |
198 | 209 |
199 // The shader translation log. | 210 // The shader translation log. |
200 std::string log_info_; | 211 std::string log_info_; |
201 | 212 |
202 // The type info when the shader was last compiled. | 213 // The type info when the shader was last compiled. |
203 AttributeMap attrib_map_; | 214 AttributeMap attrib_map_; |
204 UniformMap uniform_map_; | 215 UniformMap uniform_map_; |
205 VaryingMap varying_map_; | 216 VaryingMap varying_map_; |
| 217 AttributeList output_variable_list_; |
206 | 218 |
207 // The name hashing info when the shader was last compiled. | 219 // The name hashing info when the shader was last compiled. |
208 NameMap name_map_; | 220 NameMap name_map_; |
209 }; | 221 }; |
210 | 222 |
211 // Tracks the Shaders. | 223 // Tracks the Shaders. |
212 // | 224 // |
213 // NOTE: To support shared resources an instance of this class will | 225 // NOTE: To support shared resources an instance of this class will |
214 // need to be shared by multiple GLES2Decoders. | 226 // need to be shared by multiple GLES2Decoders. |
215 class GPU_EXPORT ShaderManager { | 227 class GPU_EXPORT ShaderManager { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 void RemoveShader(Shader* shader); | 267 void RemoveShader(Shader* shader); |
256 | 268 |
257 DISALLOW_COPY_AND_ASSIGN(ShaderManager); | 269 DISALLOW_COPY_AND_ASSIGN(ShaderManager); |
258 }; | 270 }; |
259 | 271 |
260 } // namespace gles2 | 272 } // namespace gles2 |
261 } // namespace gpu | 273 } // namespace gpu |
262 | 274 |
263 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ | 275 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_MANAGER_H_ |
264 | 276 |
OLD | NEW |