OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/hash_tables.h" | 11 #include "base/hash_tables.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "gpu/gpu_export.h" | |
14 #include "third_party/angle/include/GLSLANG/ShaderLang.h" | 13 #include "third_party/angle/include/GLSLANG/ShaderLang.h" |
15 | 14 |
16 namespace gpu { | 15 namespace gpu { |
17 namespace gles2 { | 16 namespace gles2 { |
18 | 17 |
19 // Translates a GLSL ES 2.0 shader to desktop GLSL shader, or just | 18 // Translates a GLSL ES 2.0 shader to desktop GLSL shader, or just |
20 // validates GLSL ES 2.0 shaders on a true GLSL ES implementation. | 19 // validates GLSL ES 2.0 shaders on a true GLSL ES implementation. |
21 class ShaderTranslatorInterface { | 20 class ShaderTranslatorInterface { |
22 public: | 21 public: |
23 enum GlslImplementationType { | 22 enum GlslImplementationType { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 int size; | 65 int size; |
67 std::string name; // name in the original shader source. | 66 std::string name; // name in the original shader source. |
68 }; | 67 }; |
69 // Mapping between variable name and info. | 68 // Mapping between variable name and info. |
70 typedef base::hash_map<std::string, VariableInfo> VariableMap; | 69 typedef base::hash_map<std::string, VariableInfo> VariableMap; |
71 virtual const VariableMap& attrib_map() const = 0; | 70 virtual const VariableMap& attrib_map() const = 0; |
72 virtual const VariableMap& uniform_map() const = 0; | 71 virtual const VariableMap& uniform_map() const = 0; |
73 }; | 72 }; |
74 | 73 |
75 // Implementation of ShaderTranslatorInterface | 74 // Implementation of ShaderTranslatorInterface |
76 class GPU_EXPORT ShaderTranslator | 75 class ShaderTranslator : public ShaderTranslatorInterface { |
77 : NON_EXPORTED_BASE(public ShaderTranslatorInterface) { | |
78 public: | 76 public: |
79 ShaderTranslator(); | 77 ShaderTranslator(); |
80 virtual ~ShaderTranslator(); | 78 virtual ~ShaderTranslator(); |
81 | 79 |
82 // Overridden from ShaderTranslatorInterface. | 80 // Overridden from ShaderTranslatorInterface. |
83 virtual bool Init( | 81 virtual bool Init( |
84 ShShaderType shader_type, | 82 ShShaderType shader_type, |
85 ShShaderSpec shader_spec, | 83 ShShaderSpec shader_spec, |
86 const ShBuiltInResources* resources, | 84 const ShBuiltInResources* resources, |
87 GlslImplementationType glsl_implementation_type, | 85 GlslImplementationType glsl_implementation_type, |
(...skipping 22 matching lines...) Expand all Loading... |
110 bool needs_built_in_function_emulation_; | 108 bool needs_built_in_function_emulation_; |
111 | 109 |
112 DISALLOW_COPY_AND_ASSIGN(ShaderTranslator); | 110 DISALLOW_COPY_AND_ASSIGN(ShaderTranslator); |
113 }; | 111 }; |
114 | 112 |
115 } // namespace gles2 | 113 } // namespace gles2 |
116 } // namespace gpu | 114 } // namespace gpu |
117 | 115 |
118 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ | 116 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_H_ |
119 | 117 |
OLD | NEW |