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 #include "gpu/command_buffer/service/shader_translator.h" | 5 #include "gpu/command_buffer/service/shader_translator.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 if (info_log_len > 1) { | 194 if (info_log_len > 1) { |
195 info_log_.reset(new char[info_log_len]); | 195 info_log_.reset(new char[info_log_len]); |
196 ShGetInfoLog(compiler_, info_log_.get()); | 196 ShGetInfoLog(compiler_, info_log_.get()); |
197 } else { | 197 } else { |
198 info_log_.reset(); | 198 info_log_.reset(); |
199 } | 199 } |
200 | 200 |
201 return success; | 201 return success; |
202 } | 202 } |
203 | 203 |
204 std::string ShaderTranslator::GetStringForOptionsThatWouldEffectCompilation() | 204 std::string ShaderTranslator::GetStringForOptionsThatWouldAffectCompilation() |
205 const { | 205 const { |
| 206 #if ANGLE_SH_VERSION >= 124 |
| 207 DCHECK(compiler_ != NULL); |
206 | 208 |
| 209 ANGLEGetInfoType resource_len = 0; |
| 210 ShGetInfo(compiler_, SH_RESOURCES_STRING_LENGTH, &resource_len); |
| 211 DCHECK(resource_len > 1); |
| 212 scoped_ptr<char[]> resource_str(new char[resource_len]); |
| 213 |
| 214 ShGetBuiltInResourcesString(compiler_, resource_len, resource_str.get()); |
| 215 |
| 216 return std::string(":CompileOptions:" + |
| 217 base::IntToString(GetCompileOptions())) + |
| 218 std::string(resource_str.get()); |
| 219 #else |
207 #if ANGLE_SH_VERSION >= 123 | 220 #if ANGLE_SH_VERSION >= 123 |
208 const size_t kNumIntFields = 21; | 221 const size_t kNumIntFields = 21; |
209 #elif ANGLE_SH_VERSION >= 122 | 222 #elif ANGLE_SH_VERSION >= 122 |
210 const size_t kNumIntFields = 20; | 223 const size_t kNumIntFields = 20; |
211 #else | 224 #else |
212 const size_t kNumIntFields = 16; | 225 const size_t kNumIntFields = 16; |
213 #endif | 226 #endif |
214 const size_t kNumEnumFields = 1; | 227 const size_t kNumEnumFields = 1; |
215 const size_t kNumFunctionPointerFields = 1; | 228 const size_t kNumFunctionPointerFields = 1; |
216 struct MustMatchShBuiltInResource { | 229 struct MustMatchShBuiltInResource { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 base::IntToString(compiler_options_.MaxVertexOutputVectors) + | 284 base::IntToString(compiler_options_.MaxVertexOutputVectors) + |
272 ":MaxFragmentInputVectors:" + | 285 ":MaxFragmentInputVectors:" + |
273 base::IntToString(compiler_options_.MaxFragmentInputVectors) + | 286 base::IntToString(compiler_options_.MaxFragmentInputVectors) + |
274 ":MinProgramTexelOffset:" + | 287 ":MinProgramTexelOffset:" + |
275 base::IntToString(compiler_options_.MinProgramTexelOffset) + | 288 base::IntToString(compiler_options_.MinProgramTexelOffset) + |
276 ":MaxProgramTexelOffset:" + | 289 ":MaxProgramTexelOffset:" + |
277 base::IntToString(compiler_options_.MaxProgramTexelOffset)); | 290 base::IntToString(compiler_options_.MaxProgramTexelOffset)); |
278 #else // ANGLE_SH_VERSION < 122 | 291 #else // ANGLE_SH_VERSION < 122 |
279 base::IntToString(compiler_options_.EXT_frag_depth)); | 292 base::IntToString(compiler_options_.EXT_frag_depth)); |
280 #endif | 293 #endif |
| 294 #endif |
281 } | 295 } |
282 | 296 |
283 const char* ShaderTranslator::translated_shader() const { | 297 const char* ShaderTranslator::translated_shader() const { |
284 return translated_shader_.get(); | 298 return translated_shader_.get(); |
285 } | 299 } |
286 | 300 |
287 const char* ShaderTranslator::info_log() const { | 301 const char* ShaderTranslator::info_log() const { |
288 return info_log_.get(); | 302 return info_log_.get(); |
289 } | 303 } |
290 | 304 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 info_log_.reset(); | 346 info_log_.reset(); |
333 attrib_map_.clear(); | 347 attrib_map_.clear(); |
334 uniform_map_.clear(); | 348 uniform_map_.clear(); |
335 varying_map_.clear(); | 349 varying_map_.clear(); |
336 name_map_.clear(); | 350 name_map_.clear(); |
337 } | 351 } |
338 | 352 |
339 } // namespace gles2 | 353 } // namespace gles2 |
340 } // namespace gpu | 354 } // namespace gpu |
341 | 355 |
OLD | NEW |