OLD | NEW |
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_CACHE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_CACHE_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_CACHE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_CACHE_H_ |
7 | 7 |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 14 matching lines...) Expand all Loading... |
25 class GPU_EXPORT ShaderTranslatorCache | 25 class GPU_EXPORT ShaderTranslatorCache |
26 : public base::RefCounted<ShaderTranslatorCache>, | 26 : public base::RefCounted<ShaderTranslatorCache>, |
27 public NON_EXPORTED_BASE(ShaderTranslator::DestructionObserver) { | 27 public NON_EXPORTED_BASE(ShaderTranslator::DestructionObserver) { |
28 public: | 28 public: |
29 ShaderTranslatorCache(); | 29 ShaderTranslatorCache(); |
30 | 30 |
31 // ShaderTranslator::DestructionObserver implementation | 31 // ShaderTranslator::DestructionObserver implementation |
32 virtual void OnDestruct(ShaderTranslator* translator) OVERRIDE; | 32 virtual void OnDestruct(ShaderTranslator* translator) OVERRIDE; |
33 | 33 |
34 scoped_refptr<ShaderTranslator> GetTranslator( | 34 scoped_refptr<ShaderTranslator> GetTranslator( |
35 #if (ANGLE_SH_VERSION >= 126) | |
36 sh::GLenum shader_type, | 35 sh::GLenum shader_type, |
37 #else | |
38 ShShaderType shader_type, | |
39 #endif | |
40 ShShaderSpec shader_spec, | 36 ShShaderSpec shader_spec, |
41 const ShBuiltInResources* resources, | 37 const ShBuiltInResources* resources, |
42 ShaderTranslatorInterface::GlslImplementationType | 38 ShaderTranslatorInterface::GlslImplementationType |
43 glsl_implementation_type, | 39 glsl_implementation_type, |
44 ShCompileOptions driver_bug_workarounds); | 40 ShCompileOptions driver_bug_workarounds); |
45 | 41 |
46 private: | 42 private: |
47 friend class base::RefCounted<ShaderTranslatorCache>; | 43 friend class base::RefCounted<ShaderTranslatorCache>; |
48 virtual ~ShaderTranslatorCache(); | 44 virtual ~ShaderTranslatorCache(); |
49 | 45 |
50 // Parameters passed into ShaderTranslator::Init | 46 // Parameters passed into ShaderTranslator::Init |
51 struct ShaderTranslatorInitParams { | 47 struct ShaderTranslatorInitParams { |
52 #if (ANGLE_SH_VERSION >= 126) | |
53 sh::GLenum shader_type; | 48 sh::GLenum shader_type; |
54 #else | |
55 ShShaderType shader_type; | |
56 #endif | |
57 ShShaderSpec shader_spec; | 49 ShShaderSpec shader_spec; |
58 ShBuiltInResources resources; | 50 ShBuiltInResources resources; |
59 ShaderTranslatorInterface::GlslImplementationType | 51 ShaderTranslatorInterface::GlslImplementationType |
60 glsl_implementation_type; | 52 glsl_implementation_type; |
61 ShCompileOptions driver_bug_workarounds; | 53 ShCompileOptions driver_bug_workarounds; |
62 | 54 |
63 ShaderTranslatorInitParams( | 55 ShaderTranslatorInitParams( |
64 #if (ANGLE_SH_VERSION >= 126) | |
65 sh::GLenum shader_type, | 56 sh::GLenum shader_type, |
66 #else | |
67 ShShaderType shader_type, | |
68 #endif | |
69 ShShaderSpec shader_spec, | 57 ShShaderSpec shader_spec, |
70 const ShBuiltInResources& resources, | 58 const ShBuiltInResources& resources, |
71 ShaderTranslatorInterface::GlslImplementationType | 59 ShaderTranslatorInterface::GlslImplementationType |
72 glsl_implementation_type, | 60 glsl_implementation_type, |
73 ShCompileOptions driver_bug_workarounds) | 61 ShCompileOptions driver_bug_workarounds) |
74 : shader_type(shader_type), | 62 : shader_type(shader_type), |
75 shader_spec(shader_spec), | 63 shader_spec(shader_spec), |
76 resources(resources), | 64 resources(resources), |
77 glsl_implementation_type(glsl_implementation_type), | 65 glsl_implementation_type(glsl_implementation_type), |
78 driver_bug_workarounds(driver_bug_workarounds) { | 66 driver_bug_workarounds(driver_bug_workarounds) { |
(...skipping 15 matching lines...) Expand all Loading... |
94 typedef std::map<ShaderTranslatorInitParams, ShaderTranslator* > Cache; | 82 typedef std::map<ShaderTranslatorInitParams, ShaderTranslator* > Cache; |
95 Cache cache_; | 83 Cache cache_; |
96 | 84 |
97 DISALLOW_COPY_AND_ASSIGN(ShaderTranslatorCache); | 85 DISALLOW_COPY_AND_ASSIGN(ShaderTranslatorCache); |
98 }; | 86 }; |
99 | 87 |
100 } // namespace gles2 | 88 } // namespace gles2 |
101 } // namespace gpu | 89 } // namespace gpu |
102 | 90 |
103 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_CACHE_H_ | 91 #endif // GPU_COMMAND_BUFFER_SERVICE_SHADER_TRANSLATOR_CACHE_H_ |
OLD | NEW |