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_MEMORY_PROGRAM_CACHE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
15 #include "base/containers/mru_cache.h" | 15 #include "base/containers/mru_cache.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 18 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
19 #include "gpu/command_buffer/service/program_cache.h" | 19 #include "gpu/command_buffer/service/program_cache.h" |
20 | 20 |
21 namespace gpu { | 21 namespace gpu { |
22 | 22 |
23 namespace gles2 { | 23 namespace gles2 { |
24 | 24 |
25 // Program cache that stores binaries completely in-memory | 25 // Program cache that stores binaries completely in-memory |
26 class GPU_EXPORT MemoryProgramCache : public ProgramCache { | 26 class GPU_EXPORT MemoryProgramCache : public ProgramCache { |
27 public: | 27 public: |
28 MemoryProgramCache(size_t max_cache_size_bytes, | 28 MemoryProgramCache(size_t max_cache_size_bytes, |
29 bool disable_gpu_shader_disk_cache); | 29 bool disable_gpu_shader_disk_cache, |
| 30 bool disable_program_caching_for_transform_feedback); |
30 ~MemoryProgramCache() override; | 31 ~MemoryProgramCache() override; |
31 | 32 |
32 ProgramLoadResult LoadLinkedProgram( | 33 ProgramLoadResult LoadLinkedProgram( |
33 GLuint program, | 34 GLuint program, |
34 Shader* shader_a, | 35 Shader* shader_a, |
35 Shader* shader_b, | 36 Shader* shader_b, |
36 const LocationMap* bind_attrib_location_map, | 37 const LocationMap* bind_attrib_location_map, |
37 const std::vector<std::string>& transform_feedback_varyings, | 38 const std::vector<std::string>& transform_feedback_varyings, |
38 GLenum transform_feedback_buffer_mode, | 39 GLenum transform_feedback_buffer_mode, |
39 const ShaderCacheCallback& shader_callback) override; | 40 const ShaderCacheCallback& shader_callback) override; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 DISALLOW_COPY_AND_ASSIGN(ProgramCacheValue); | 158 DISALLOW_COPY_AND_ASSIGN(ProgramCacheValue); |
158 }; | 159 }; |
159 | 160 |
160 friend class ProgramCacheValue; | 161 friend class ProgramCacheValue; |
161 | 162 |
162 typedef base::MRUCache<std::string, | 163 typedef base::MRUCache<std::string, |
163 scoped_refptr<ProgramCacheValue> > ProgramMRUCache; | 164 scoped_refptr<ProgramCacheValue> > ProgramMRUCache; |
164 | 165 |
165 const size_t max_size_bytes_; | 166 const size_t max_size_bytes_; |
166 const bool disable_gpu_shader_disk_cache_; | 167 const bool disable_gpu_shader_disk_cache_; |
| 168 const bool disable_program_caching_for_transform_feedback_; |
167 size_t curr_size_bytes_; | 169 size_t curr_size_bytes_; |
168 ProgramMRUCache store_; | 170 ProgramMRUCache store_; |
169 | 171 |
170 DISALLOW_COPY_AND_ASSIGN(MemoryProgramCache); | 172 DISALLOW_COPY_AND_ASSIGN(MemoryProgramCache); |
171 }; | 173 }; |
172 | 174 |
173 } // namespace gles2 | 175 } // namespace gles2 |
174 } // namespace gpu | 176 } // namespace gpu |
175 | 177 |
176 #endif // GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_ | 178 #endif // GPU_COMMAND_BUFFER_SERVICE_MEMORY_PROGRAM_CACHE_H_ |
OLD | NEW |