Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: gpu/command_buffer/service/shader_translator.h

Issue 1716813002: Use GpuPreferences to avoid directly accessing switches in gpu related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 26 matching lines...) Expand all
37 : public base::RefCounted<ShaderTranslatorInterface> { 37 : public base::RefCounted<ShaderTranslatorInterface> {
38 public: 38 public:
39 ShaderTranslatorInterface() {} 39 ShaderTranslatorInterface() {}
40 40
41 // Initializes the translator. 41 // Initializes the translator.
42 // Must be called once before using the translator object. 42 // Must be called once before using the translator object.
43 virtual bool Init(sh::GLenum shader_type, 43 virtual bool Init(sh::GLenum shader_type,
44 ShShaderSpec shader_spec, 44 ShShaderSpec shader_spec,
45 const ShBuiltInResources* resources, 45 const ShBuiltInResources* resources,
46 ShShaderOutput shader_output_language, 46 ShShaderOutput shader_output_language,
47 ShCompileOptions driver_bug_workarounds) = 0; 47 ShCompileOptions driver_bug_workarounds,
48 bool gl_shader_interm_output) = 0;
48 49
49 // Translates the given shader source. 50 // Translates the given shader source.
50 // Returns true if translation is successful, false otherwise. 51 // Returns true if translation is successful, false otherwise.
51 // Always fill |info_log| if it's non-null. 52 // Always fill |info_log| if it's non-null.
52 // Upon success, fill |translated_shader|, |attrib_map|, |uniform_map|, 53 // Upon success, fill |translated_shader|, |attrib_map|, |uniform_map|,
53 // |varying_map|, and |name_map| if they are non-null. 54 // |varying_map|, and |name_map| if they are non-null.
54 virtual bool Translate(const std::string& shader_source, 55 virtual bool Translate(const std::string& shader_source,
55 std::string* info_log, 56 std::string* info_log,
56 std::string* translated_shader, 57 std::string* translated_shader,
57 int* shader_version, 58 int* shader_version,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 94
94 // Return shader output lanaguage type based on the context version. 95 // Return shader output lanaguage type based on the context version.
95 static ShShaderOutput GetShaderOutputLanguageForContext( 96 static ShShaderOutput GetShaderOutputLanguageForContext(
96 const gfx::GLVersionInfo& context_version); 97 const gfx::GLVersionInfo& context_version);
97 98
98 // Overridden from ShaderTranslatorInterface. 99 // Overridden from ShaderTranslatorInterface.
99 bool Init(sh::GLenum shader_type, 100 bool Init(sh::GLenum shader_type,
100 ShShaderSpec shader_spec, 101 ShShaderSpec shader_spec,
101 const ShBuiltInResources* resources, 102 const ShBuiltInResources* resources,
102 ShShaderOutput shader_output_language, 103 ShShaderOutput shader_output_language,
103 ShCompileOptions driver_bug_workarounds) override; 104 ShCompileOptions driver_bug_workarounds,
105 bool gl_shader_interm_output) override;
104 106
105 // Overridden from ShaderTranslatorInterface. 107 // Overridden from ShaderTranslatorInterface.
106 bool Translate(const std::string& shader_source, 108 bool Translate(const std::string& shader_source,
107 std::string* info_log, 109 std::string* info_log,
108 std::string* translated_source, 110 std::string* translated_source,
109 int* shader_version, 111 int* shader_version,
110 AttributeMap* attrib_map, 112 AttributeMap* attrib_map,
111 UniformMap* uniform_map, 113 UniformMap* uniform_map,
112 VaryingMap* varying_map, 114 VaryingMap* varying_map,
113 InterfaceBlockMap* interface_block_map, 115 InterfaceBlockMap* interface_block_map,
114 OutputVariableList* output_variable_list, 116 OutputVariableList* output_variable_list,
115 NameMap* name_map) const override; 117 NameMap* name_map) const override;
116 118
117 std::string GetStringForOptionsThatWouldAffectCompilation() const override; 119 std::string GetStringForOptionsThatWouldAffectCompilation() const override;
118 120
119 void AddDestructionObserver(DestructionObserver* observer); 121 void AddDestructionObserver(DestructionObserver* observer);
120 void RemoveDestructionObserver(DestructionObserver* observer); 122 void RemoveDestructionObserver(DestructionObserver* observer);
121 123
122 private: 124 private:
123 ~ShaderTranslator() override; 125 ~ShaderTranslator() override;
124 126
125 int GetCompileOptions() const; 127 int GetCompileOptions() const;
126 128
127 ShHandle compiler_; 129 ShHandle compiler_;
128 ShCompileOptions driver_bug_workarounds_; 130 ShCompileOptions driver_bug_workarounds_;
131 bool gl_shader_interm_output_;
129 base::ObserverList<DestructionObserver> destruction_observers_; 132 base::ObserverList<DestructionObserver> destruction_observers_;
130 }; 133 };
131 134
132 } // namespace gles2 135 } // namespace gles2
133 } // namespace gpu 136 } // namespace gpu
134 137
135 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ 138 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_
136 139
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/program_manager_unittest.cc ('k') | gpu/command_buffer/service/shader_translator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698