summaryrefslogtreecommitdiff
path: root/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2011-12-24 02:19:30 -0600
committerSonicadvance1 <sonicadvance1@RH-Live.(none)>2012-10-09 23:43:22 -0500
commit5c486587a68c2513412fe67d7bad24673ce2969f (patch)
treeae51ae01b15fd26dde23a33c076a927f58345dff /Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
parent4eb227bd4ce853f2df9af3e18ef317d5a15edff8 (diff)
Write all shaders to disk on emulator stop instead of constantly. Also change pair from u64 to u32.
Diffstat (limited to 'Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp')
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
index 628cbae865..6514e1e775 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
@@ -29,7 +29,7 @@ namespace OGL
LinearDiskCache<PROGRAMUID, u8> g_program_disk_cache;
GLenum ProgramFormat;
- std::pair<u64, u64> ProgramShaderCache::CurrentShaderProgram;
+ std::pair<u32, u32> ProgramShaderCache::CurrentShaderProgram;
const char *UniformNames[NUM_UNIFORMS] = {
// SAMPLERS
"samp0","samp1","samp2","samp3","samp4","samp5","samp6","samp7",
@@ -116,7 +116,7 @@ namespace OGL
// Fragment shaders can survive without Vertex Shaders
// We have a valid fragment shader, let's create our program
- std::pair<u64, u64> ShaderPair = std::make_pair(uid.uid.psid, uid.uid.vsid);
+ std::pair<u32, u32> ShaderPair = std::make_pair(uid.uid.psid, uid.uid.vsid);
PCache::iterator iter = pshaders.find(ShaderPair);
if (iter != pshaders.end())
{
@@ -129,6 +129,7 @@ namespace OGL
PCacheEntry entry;
entry.program.vsid = CurrentVShader;
entry.program.psid = CurrentFShader;
+ entry.program.uid = uid;
entry.program.glprogid = glCreateProgram();
// Right, the program is created now
@@ -148,10 +149,6 @@ namespace OGL
SetProgramVariables(entry, uid);
- // Add it to our cache
- if (g_ActiveConfig.backend_info.bSupportsGLSLCache)
- g_program_disk_cache.Append(uid, entry.Data(), entry.Size());
-
pshaders[ShaderPair] = entry;
CurrentShaderProgram = ShaderPair;
CurrentProgram = entry.program.glprogid;
@@ -226,6 +223,10 @@ namespace OGL
{
if (g_ActiveConfig.backend_info.bSupportsGLSLCache)
{
+ PCache::iterator iter = pshaders.begin();
+ for (; iter != pshaders.end(); ++iter)
+ g_program_disk_cache.Append(iter->second.program.uid, iter->second.program.Data(), iter->second.program.Size());
+
g_program_disk_cache.Sync();
g_program_disk_cache.Close();
}