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