Chromium Code Reviews| Index: gpu/command_buffer/service/memory_program_cache.h |
| diff --git a/gpu/command_buffer/service/memory_program_cache.h b/gpu/command_buffer/service/memory_program_cache.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9ed7a9867d4eb0231a22658f7673a08dd0ac0332 |
| --- /dev/null |
| +++ b/gpu/command_buffer/service/memory_program_cache.h |
| @@ -0,0 +1,72 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef GPU_COMMAND_BUFFER_SERVICE_MEMORY_program_cache_H_ |
| +#define GPU_COMMAND_BUFFER_SERVICE_MEMORY_program_cache_H_ |
| + |
| +#include "base/hash_tables.h" |
| +#include "gpu/command_buffer/service/program_cache.h" |
| +#include "gpu/command_buffer/service/shader_translator.h" |
| +#include "net/disk_cache/disk_cache.h" |
| + |
| +namespace gpu { |
| +namespace gles2 { |
| + |
| +struct StoreValue { |
| + StoreValue() : length(0), format(0), data(NULL) { } |
| + StoreValue(GLsizei _length, |
| + GLenum _format, |
| + GLvoid* _data, |
|
greggman
2012/06/19 22:27:50
const?
dmurph
2012/06/23 01:37:28
Done.
|
| + ShaderTranslator::VariableMap& _attrib_map_0, |
|
greggman
2012/06/19 22:27:50
const?
dmurph
2012/06/23 01:37:28
Done.
|
| + ShaderTranslator::VariableMap& _uniform_map_0, |
| + ShaderTranslator::VariableMap& _attrib_map_1, |
| + ShaderTranslator::VariableMap& _uniform_map_1) |
| + : length(_length), |
| + format(_format), |
| + data(_data), |
| + attrib_map_0(_attrib_map_0), |
| + uniform_map_0(_uniform_map_0), |
| + attrib_map_1(_attrib_map_1), |
| + uniform_map_1(_uniform_map_1) { } |
| + GLsizei length; |
| + GLenum format; |
| + GLvoid* data; |
| + ShaderTranslator::VariableMap attrib_map_0; |
| + ShaderTranslator::VariableMap uniform_map_0; |
| + ShaderTranslator::VariableMap attrib_map_1; |
| + ShaderTranslator::VariableMap uniform_map_1; |
| +}; |
| + |
| +// Program cache that stores binaries completely in-memory |
| +class GPU_EXPORT MemoryProgramCache : public ProgramCache { |
| + public: |
| + typedef base::hash_map<CachedProgramKey, |
| + StoreValue, |
| + CachedProgramKeyHash, |
| + CachedProgramKeyEquals> store_map; |
|
greggman
2012/06/19 22:27:50
style: types are CamelCase
dmurph
2012/06/23 01:37:28
Done.
|
| + |
| + MemoryProgramCache(); |
| + virtual ~MemoryProgramCache(); |
| + |
| + void LoadLinkedProgram( |
| + GLuint program, |
| + ShaderManager::ShaderInfo* shader_a, |
| + ShaderManager::ShaderInfo* shader_b, |
| + std::map<std::string, GLint>* bind_attrib_location_map) const; |
| + void SaveLinkedProgram( |
| + GLuint program, |
| + ShaderManager::ShaderInfo* shader_a, |
|
greggman
2012/06/19 22:27:50
const?
dmurph
2012/06/23 01:37:28
Done.
|
| + ShaderManager::ShaderInfo* shader_b, |
| + std::map<std::string, GLint>* bind_attrib_location_map); |
|
greggman
2012/06/19 22:27:50
const?
dmurph
2012/06/23 01:37:28
Done.
|
| + |
| + private: |
| + store_map store_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MemoryProgramCache); |
| +}; |
| + |
| +} // namespace gles2 |
| +} // namespace gpu |
| + |
| +#endif /* GPU_COMMAND_BUFFER_SERVICE_MEMORY_program_cache_H_ */ |