| 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 <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
| 6 | 6 |
| 7 #include "gpu/command_buffer/service/shader_translator_cache.h" | 7 #include "gpu/command_buffer/service/shader_translator_cache.h" |
| 8 | 8 |
| 9 namespace gpu { | 9 namespace gpu { |
| 10 namespace gles2 { | 10 namespace gles2 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 return; | 24 return; |
| 25 } | 25 } |
| 26 it++; | 26 it++; |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 scoped_refptr<ShaderTranslator> ShaderTranslatorCache::GetTranslator( | 30 scoped_refptr<ShaderTranslator> ShaderTranslatorCache::GetTranslator( |
| 31 sh::GLenum shader_type, | 31 sh::GLenum shader_type, |
| 32 ShShaderSpec shader_spec, | 32 ShShaderSpec shader_spec, |
| 33 const ShBuiltInResources* resources, | 33 const ShBuiltInResources* resources, |
| 34 ShaderTranslatorInterface::GlslImplementationType | 34 ShShaderOutput shader_output_language, |
| 35 glsl_implementation_type, | |
| 36 ShCompileOptions driver_bug_workarounds) { | 35 ShCompileOptions driver_bug_workarounds) { |
| 37 ShaderTranslatorInitParams params(shader_type, | 36 ShaderTranslatorInitParams params(shader_type, shader_spec, *resources, |
| 38 shader_spec, | 37 shader_output_language, |
| 39 *resources, | |
| 40 glsl_implementation_type, | |
| 41 driver_bug_workarounds); | 38 driver_bug_workarounds); |
| 42 | 39 |
| 43 Cache::iterator it = cache_.find(params); | 40 Cache::iterator it = cache_.find(params); |
| 44 if (it != cache_.end()) | 41 if (it != cache_.end()) |
| 45 return it->second; | 42 return it->second; |
| 46 | 43 |
| 47 ShaderTranslator* translator = new ShaderTranslator(); | 44 ShaderTranslator* translator = new ShaderTranslator(); |
| 48 if (translator->Init(shader_type, shader_spec, resources, | 45 if (translator->Init(shader_type, shader_spec, resources, |
| 49 glsl_implementation_type, | 46 shader_output_language, driver_bug_workarounds)) { |
| 50 driver_bug_workarounds)) { | |
| 51 cache_[params] = translator; | 47 cache_[params] = translator; |
| 52 translator->AddDestructionObserver(this); | 48 translator->AddDestructionObserver(this); |
| 53 return translator; | 49 return translator; |
| 54 } else { | 50 } else { |
| 55 return NULL; | 51 return NULL; |
| 56 } | 52 } |
| 57 } | 53 } |
| 58 | 54 |
| 59 } // namespace gles2 | 55 } // namespace gles2 |
| 60 } // namespace gpu | 56 } // namespace gpu |
| OLD | NEW |