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_manager.h" | 5 #include "gpu/command_buffer/service/shader_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 valid_ = false; | 68 valid_ = false; |
69 | 69 |
70 // Translate GL ES 2.0 shader to Desktop GL shader and pass that to | 70 // Translate GL ES 2.0 shader to Desktop GL shader and pass that to |
71 // glShaderSource and then glCompileShader. | 71 // glShaderSource and then glCompileShader. |
72 const char* source_for_driver = last_compiled_source_.c_str(); | 72 const char* source_for_driver = last_compiled_source_.c_str(); |
73 ShaderTranslatorInterface* translator = translator_.get(); | 73 ShaderTranslatorInterface* translator = translator_.get(); |
74 if (translator) { | 74 if (translator) { |
75 bool success = translator->Translate( | 75 bool success = translator->Translate( |
76 last_compiled_source_, &log_info_, &translated_source_, | 76 last_compiled_source_, &log_info_, &translated_source_, |
77 &shader_version_, &attrib_map_, &uniform_map_, &varying_map_, | 77 &shader_version_, &attrib_map_, &uniform_map_, &varying_map_, |
78 &interface_block_map_, &output_variable_list_, &name_map_); | 78 &interface_block_map_, &output_variable_list_); |
79 if (!success) { | 79 if (!success) { |
80 return; | 80 return; |
81 } | 81 } |
82 source_for_driver = translated_source_.c_str(); | 82 source_for_driver = translated_source_.c_str(); |
83 } | 83 } |
84 | 84 |
85 glShaderSource(service_id_, 1, &source_for_driver, NULL); | 85 glShaderSource(service_id_, 1, &source_for_driver, NULL); |
86 glCompileShader(service_id_); | 86 glCompileShader(service_id_); |
87 | 87 |
88 if (source_type_ == kANGLE) { | 88 if (source_type_ == kANGLE) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 359 |
360 void ShaderManager::UnuseShader(Shader* shader) { | 360 void ShaderManager::UnuseShader(Shader* shader) { |
361 DCHECK(shader); | 361 DCHECK(shader); |
362 DCHECK(IsOwned(shader)); | 362 DCHECK(IsOwned(shader)); |
363 shader->DecUseCount(); | 363 shader->DecUseCount(); |
364 RemoveShader(shader); | 364 RemoveShader(shader); |
365 } | 365 } |
366 | 366 |
367 } // namespace gles2 | 367 } // namespace gles2 |
368 } // namespace gpu | 368 } // namespace gpu |
OLD | NEW |