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

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

Issue 1309743005: command_buffer: Implement EXT_blend_func_extended (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new-05-path-fragment-input-gen
Patch Set: Created 5 years, 3 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/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "gpu/gpu_export.h" 15 #include "gpu/gpu_export.h"
16 #include "third_party/angle/include/GLSLANG/ShaderLang.h" 16 #include "third_party/angle/include/GLSLANG/ShaderLang.h"
17 17
18 namespace gfx { 18 namespace gfx {
19 struct GLVersionInfo; 19 struct GLVersionInfo;
20 } 20 }
21 21
22 namespace gpu { 22 namespace gpu {
23 namespace gles2 { 23 namespace gles2 {
24 24
25 // Mapping between variable name and info. 25 // Mapping between variable name and info.
26 typedef base::hash_map<std::string, sh::Attribute> AttributeMap; 26 typedef base::hash_map<std::string, sh::Attribute> AttributeMap;
27 typedef std::vector<sh::Attribute> AttributeList;
27 typedef base::hash_map<std::string, sh::Uniform> UniformMap; 28 typedef base::hash_map<std::string, sh::Uniform> UniformMap;
28 typedef base::hash_map<std::string, sh::Varying> VaryingMap; 29 typedef base::hash_map<std::string, sh::Varying> VaryingMap;
29 // Mapping between hashed name and original name. 30 // Mapping between hashed name and original name.
30 typedef base::hash_map<std::string, std::string> NameMap; 31 typedef base::hash_map<std::string, std::string> NameMap;
31 32
32 // Translates a GLSL ES 2.0 shader to desktop GLSL shader, or just 33 // Translates a GLSL ES 2.0 shader to desktop GLSL shader, or just
33 // validates GLSL ES 2.0 shaders on a true GLSL ES implementation. 34 // validates GLSL ES 2.0 shaders on a true GLSL ES implementation.
34 class ShaderTranslatorInterface 35 class ShaderTranslatorInterface
35 : public base::RefCounted<ShaderTranslatorInterface> { 36 : public base::RefCounted<ShaderTranslatorInterface> {
36 public: 37 public:
(...skipping 12 matching lines...) Expand all
49 // Always fill |info_log| if it's non-null. 50 // Always fill |info_log| if it's non-null.
50 // Upon success, fill |translated_shader|, |attrib_map|, |uniform_map|, 51 // Upon success, fill |translated_shader|, |attrib_map|, |uniform_map|,
51 // |varying_map|, and |name_map| if they are non-null. 52 // |varying_map|, and |name_map| if they are non-null.
52 virtual bool Translate(const std::string& shader_source, 53 virtual bool Translate(const std::string& shader_source,
53 std::string* info_log, 54 std::string* info_log,
54 std::string* translated_shader, 55 std::string* translated_shader,
55 int* shader_version, 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,
60 AttributeList* output_variable_list,
59 NameMap* name_map) const = 0; 61 NameMap* name_map) const = 0;
60 62
61 // Return a string that is unique for a specfic set of options that would 63 // Return a string that is unique for a specfic set of options that would
62 // possibly affect compilation. 64 // possibly affect compilation.
63 virtual std::string GetStringForOptionsThatWouldAffectCompilation() const = 0; 65 virtual std::string GetStringForOptionsThatWouldAffectCompilation() const = 0;
64 66
65 protected: 67 protected:
66 virtual ~ShaderTranslatorInterface() {} 68 virtual ~ShaderTranslatorInterface() {}
67 69
68 private: 70 private:
(...skipping 30 matching lines...) Expand all
99 ShCompileOptions driver_bug_workarounds) override; 101 ShCompileOptions driver_bug_workarounds) override;
100 102
101 // Overridden from ShaderTranslatorInterface. 103 // Overridden from ShaderTranslatorInterface.
102 bool Translate(const std::string& shader_source, 104 bool Translate(const std::string& shader_source,
103 std::string* info_log, 105 std::string* info_log,
104 std::string* translated_source, 106 std::string* translated_source,
105 int* shader_version, 107 int* shader_version,
106 AttributeMap* attrib_map, 108 AttributeMap* attrib_map,
107 UniformMap* uniform_map, 109 UniformMap* uniform_map,
108 VaryingMap* varying_map, 110 VaryingMap* varying_map,
111 AttributeList* output_variable_list,
109 NameMap* name_map) const override; 112 NameMap* name_map) const override;
110 113
111 std::string GetStringForOptionsThatWouldAffectCompilation() const override; 114 std::string GetStringForOptionsThatWouldAffectCompilation() const override;
112 115
113 void AddDestructionObserver(DestructionObserver* observer); 116 void AddDestructionObserver(DestructionObserver* observer);
114 void RemoveDestructionObserver(DestructionObserver* observer); 117 void RemoveDestructionObserver(DestructionObserver* observer);
115 118
116 private: 119 private:
117 ~ShaderTranslator() override; 120 ~ShaderTranslator() override;
118 121
119 int GetCompileOptions() const; 122 int GetCompileOptions() const;
120 123
121 ShHandle compiler_; 124 ShHandle compiler_;
122 ShCompileOptions driver_bug_workarounds_; 125 ShCompileOptions driver_bug_workarounds_;
123 base::ObserverList<DestructionObserver> destruction_observers_; 126 base::ObserverList<DestructionObserver> destruction_observers_;
124 }; 127 };
125 128
126 } // namespace gles2 129 } // namespace gles2
127 } // namespace gpu 130 } // namespace gpu
128 131
129 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ 132 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_
130 133
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698