Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1736)

Unified Diff: gpu/command_buffer/service/memory_program_cache.h

Issue 10534173: GPU Program Caching (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: solid in-memory implementation Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_ */

Powered by Google App Engine
This is Rietveld 408576698