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

Unified Diff: gpu/command_buffer/service/shader_translator.h

Issue 619723008: Switch to use ANGLE's new APIs to query shader variables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win build fix Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/shader_translator.h
diff --git a/gpu/command_buffer/service/shader_translator.h b/gpu/command_buffer/service/shader_translator.h
index 57a198e22f9f603c9979c92da9f3743ac828eb41..ff9d741cd38bbbe5e4026c39382115331d955e0c 100644
--- a/gpu/command_buffer/service/shader_translator.h
+++ b/gpu/command_buffer/service/shader_translator.h
@@ -18,6 +18,13 @@
namespace gpu {
namespace gles2 {
+// Mapping between variable name and info.
+typedef base::hash_map<std::string, sh::Attribute> AttributeMap;
+typedef base::hash_map<std::string, sh::Uniform> UniformMap;
+typedef base::hash_map<std::string, sh::Varying> VaryingMap;
+// Mapping between hashed name and original name.
+typedef base::hash_map<std::string, std::string> NameMap;
+
// Translates a GLSL ES 2.0 shader to desktop GLSL shader, or just
// validates GLSL ES 2.0 shaders on a true GLSL ES implementation.
class ShaderTranslatorInterface {
@@ -27,42 +34,6 @@ class ShaderTranslatorInterface {
kGlslES
};
- struct VariableInfo {
- VariableInfo()
- : type(0),
- size(0),
- precision(SH_PRECISION_UNDEFINED),
- static_use(0) {
- }
-
- VariableInfo(int _type, int _size, int _precision,
- int _static_use, std::string _name)
- : type(_type),
- size(_size),
- precision(_precision),
- static_use(_static_use),
- name(_name) {
- }
- bool operator==(
- const ShaderTranslatorInterface::VariableInfo& other) const {
- return type == other.type &&
- size == other.size &&
- precision == other.precision &&
- strcmp(name.c_str(), other.name.c_str()) == 0;
- }
-
- int type;
- int size;
- int precision;
- int static_use;
- std::string name; // name in the original shader source.
- };
-
- // Mapping between variable name and info.
- typedef base::hash_map<std::string, VariableInfo> VariableMap;
- // Mapping between hashed name and original name.
- typedef base::hash_map<std::string, std::string> NameMap;
-
// Initializes the translator.
// Must be called once before using the translator object.
virtual bool Init(
@@ -80,9 +51,9 @@ class ShaderTranslatorInterface {
virtual bool Translate(const std::string& shader_source,
std::string* info_log,
std::string* translated_shader,
- VariableMap* attrib_map,
- VariableMap* uniform_map,
- VariableMap* varying_map,
+ AttributeMap* attrib_map,
+ UniformMap* uniform_map,
+ VaryingMap* varying_map,
NameMap* name_map) const = 0;
// Return a string that is unique for a specfic set of options that would
@@ -123,9 +94,9 @@ class GPU_EXPORT ShaderTranslator
virtual bool Translate(const std::string& shader_source,
std::string* info_log,
std::string* translated_source,
- VariableMap* attrib_map,
- VariableMap* uniform_map,
- VariableMap* varying_map,
+ AttributeMap* attrib_map,
+ UniformMap* uniform_map,
+ VaryingMap* varying_map,
NameMap* name_map) const override;
virtual std::string GetStringForOptionsThatWouldAffectCompilation() const
« no previous file with comments | « gpu/command_buffer/service/shader_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