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_TRANSLATOR_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 ShCompileOptions driver_bug_workarounds) = 0; | 46 ShCompileOptions driver_bug_workarounds) = 0; |
47 | 47 |
48 // Translates the given shader source. | 48 // Translates the given shader source. |
49 // Returns true if translation is successful, false otherwise. | 49 // Returns true if translation is successful, false otherwise. |
50 // Always fill |info_log| if it's non-null. | 50 // Always fill |info_log| if it's non-null. |
51 // Upon success, fill |translated_shader|, |attrib_map|, |uniform_map|, | 51 // Upon success, fill |translated_shader|, |attrib_map|, |uniform_map|, |
52 // |varying_map|, and |name_map| if they are non-null. | 52 // |varying_map|, and |name_map| if they are non-null. |
53 virtual bool Translate(const std::string& shader_source, | 53 virtual bool Translate(const std::string& shader_source, |
54 std::string* info_log, | 54 std::string* info_log, |
55 std::string* translated_shader, | 55 std::string* translated_shader, |
| 56 int* shader_version, |
56 AttributeMap* attrib_map, | 57 AttributeMap* attrib_map, |
57 UniformMap* uniform_map, | 58 UniformMap* uniform_map, |
58 VaryingMap* varying_map, | 59 VaryingMap* varying_map, |
59 NameMap* name_map) const = 0; | 60 NameMap* name_map) const = 0; |
60 | 61 |
61 // Return a string that is unique for a specfic set of options that would | 62 // Return a string that is unique for a specfic set of options that would |
62 // possibly affect compilation. | 63 // possibly affect compilation. |
63 virtual std::string GetStringForOptionsThatWouldAffectCompilation() const = 0; | 64 virtual std::string GetStringForOptionsThatWouldAffectCompilation() const = 0; |
64 | 65 |
65 protected: | 66 protected: |
(...skipping 25 matching lines...) Expand all Loading... |
91 bool Init(sh::GLenum shader_type, | 92 bool Init(sh::GLenum shader_type, |
92 ShShaderSpec shader_spec, | 93 ShShaderSpec shader_spec, |
93 const ShBuiltInResources* resources, | 94 const ShBuiltInResources* resources, |
94 GlslImplementationType glsl_implementation_type, | 95 GlslImplementationType glsl_implementation_type, |
95 ShCompileOptions driver_bug_workarounds) override; | 96 ShCompileOptions driver_bug_workarounds) override; |
96 | 97 |
97 // Overridden from ShaderTranslatorInterface. | 98 // Overridden from ShaderTranslatorInterface. |
98 bool Translate(const std::string& shader_source, | 99 bool Translate(const std::string& shader_source, |
99 std::string* info_log, | 100 std::string* info_log, |
100 std::string* translated_source, | 101 std::string* translated_source, |
| 102 int* shader_version, |
101 AttributeMap* attrib_map, | 103 AttributeMap* attrib_map, |
102 UniformMap* uniform_map, | 104 UniformMap* uniform_map, |
103 VaryingMap* varying_map, | 105 VaryingMap* varying_map, |
104 NameMap* name_map) const override; | 106 NameMap* name_map) const override; |
105 | 107 |
106 std::string GetStringForOptionsThatWouldAffectCompilation() const override; | 108 std::string GetStringForOptionsThatWouldAffectCompilation() const override; |
107 | 109 |
108 void AddDestructionObserver(DestructionObserver* observer); | 110 void AddDestructionObserver(DestructionObserver* observer); |
109 void RemoveDestructionObserver(DestructionObserver* observer); | 111 void RemoveDestructionObserver(DestructionObserver* observer); |
110 | 112 |
111 private: | 113 private: |
112 ~ShaderTranslator() override; | 114 ~ShaderTranslator() override; |
113 | 115 |
114 int GetCompileOptions() const; | 116 int GetCompileOptions() const; |
115 | 117 |
116 ShHandle compiler_; | 118 ShHandle compiler_; |
117 bool implementation_is_glsl_es_; | 119 bool implementation_is_glsl_es_; |
118 ShCompileOptions driver_bug_workarounds_; | 120 ShCompileOptions driver_bug_workarounds_; |
119 ObserverList<DestructionObserver> destruction_observers_; | 121 ObserverList<DestructionObserver> destruction_observers_; |
120 }; | 122 }; |
121 | 123 |
122 } // namespace gles2 | 124 } // namespace gles2 |
123 } // namespace gpu | 125 } // namespace gpu |
124 | 126 |
125 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ | 127 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ |
126 | 128 |
OLD | NEW |