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 <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 18 matching lines...) Expand all Loading... |
29 TRACE_EVENT0("gpu", "ShInitialize"); | 29 TRACE_EVENT0("gpu", "ShInitialize"); |
30 CHECK(sh::Initialize()); | 30 CHECK(sh::Initialize()); |
31 } | 31 } |
32 | 32 |
33 ~ShaderTranslatorInitializer() { | 33 ~ShaderTranslatorInitializer() { |
34 TRACE_EVENT0("gpu", "ShFinalize"); | 34 TRACE_EVENT0("gpu", "ShFinalize"); |
35 sh::Finalize(); | 35 sh::Finalize(); |
36 } | 36 } |
37 }; | 37 }; |
38 | 38 |
39 base::LazyInstance<ShaderTranslatorInitializer> g_translator_initializer = | 39 base::LazyInstance<ShaderTranslatorInitializer>::DestructorAtExit |
40 LAZY_INSTANCE_INITIALIZER; | 40 g_translator_initializer = LAZY_INSTANCE_INITIALIZER; |
41 | 41 |
42 void GetAttributes(ShHandle compiler, AttributeMap* var_map) { | 42 void GetAttributes(ShHandle compiler, AttributeMap* var_map) { |
43 if (!var_map) | 43 if (!var_map) |
44 return; | 44 return; |
45 var_map->clear(); | 45 var_map->clear(); |
46 const std::vector<sh::Attribute>* attribs = sh::GetAttributes(compiler); | 46 const std::vector<sh::Attribute>* attribs = sh::GetAttributes(compiler); |
47 if (attribs) { | 47 if (attribs) { |
48 for (size_t ii = 0; ii < attribs->size(); ++ii) | 48 for (size_t ii = 0; ii < attribs->size(); ++ii) |
49 (*var_map)[(*attribs)[ii].mappedName] = (*attribs)[ii]; | 49 (*var_map)[(*attribs)[ii].mappedName] = (*attribs)[ii]; |
50 } | 50 } |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 for (auto& observer : destruction_observers_) | 278 for (auto& observer : destruction_observers_) |
279 observer.OnDestruct(this); | 279 observer.OnDestruct(this); |
280 | 280 |
281 if (compiler_ != NULL) | 281 if (compiler_ != NULL) |
282 sh::Destruct(compiler_); | 282 sh::Destruct(compiler_); |
283 } | 283 } |
284 | 284 |
285 } // namespace gles2 | 285 } // namespace gles2 |
286 } // namespace gpu | 286 } // namespace gpu |
287 | 287 |
OLD | NEW |