mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-09 03:40:05 +00:00
Write all shaders to disk on emulator stop instead of constantly. Also change pair from u64 to u32.
This commit is contained in:
parent
b90fa37c60
commit
aa2032af2c
@ -29,7 +29,7 @@ namespace OGL
|
|||||||
LinearDiskCache<PROGRAMUID, u8> g_program_disk_cache;
|
LinearDiskCache<PROGRAMUID, u8> g_program_disk_cache;
|
||||||
GLenum ProgramFormat;
|
GLenum ProgramFormat;
|
||||||
|
|
||||||
std::pair<u64, u64> ProgramShaderCache::CurrentShaderProgram;
|
std::pair<u32, u32> ProgramShaderCache::CurrentShaderProgram;
|
||||||
const char *UniformNames[NUM_UNIFORMS] = {
|
const char *UniformNames[NUM_UNIFORMS] = {
|
||||||
// SAMPLERS
|
// SAMPLERS
|
||||||
"samp0","samp1","samp2","samp3","samp4","samp5","samp6","samp7",
|
"samp0","samp1","samp2","samp3","samp4","samp5","samp6","samp7",
|
||||||
@ -116,7 +116,7 @@ namespace OGL
|
|||||||
|
|
||||||
// Fragment shaders can survive without Vertex Shaders
|
// Fragment shaders can survive without Vertex Shaders
|
||||||
// We have a valid fragment shader, let's create our program
|
// 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);
|
PCache::iterator iter = pshaders.find(ShaderPair);
|
||||||
if (iter != pshaders.end())
|
if (iter != pshaders.end())
|
||||||
{
|
{
|
||||||
@ -129,6 +129,7 @@ namespace OGL
|
|||||||
PCacheEntry entry;
|
PCacheEntry entry;
|
||||||
entry.program.vsid = CurrentVShader;
|
entry.program.vsid = CurrentVShader;
|
||||||
entry.program.psid = CurrentFShader;
|
entry.program.psid = CurrentFShader;
|
||||||
|
entry.program.uid = uid;
|
||||||
entry.program.glprogid = glCreateProgram();
|
entry.program.glprogid = glCreateProgram();
|
||||||
|
|
||||||
// Right, the program is created now
|
// Right, the program is created now
|
||||||
@ -148,10 +149,6 @@ namespace OGL
|
|||||||
|
|
||||||
SetProgramVariables(entry, uid);
|
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;
|
pshaders[ShaderPair] = entry;
|
||||||
CurrentShaderProgram = ShaderPair;
|
CurrentShaderProgram = ShaderPair;
|
||||||
CurrentProgram = entry.program.glprogid;
|
CurrentProgram = entry.program.glprogid;
|
||||||
@ -226,6 +223,10 @@ namespace OGL
|
|||||||
{
|
{
|
||||||
if (g_ActiveConfig.backend_info.bSupportsGLSLCache)
|
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.Sync();
|
||||||
g_program_disk_cache.Close();
|
g_program_disk_cache.Close();
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ struct PROGRAMSHADER
|
|||||||
PROGRAMSHADER() : glprogid(0), vsid(0), psid(0), binaryLength(0){}
|
PROGRAMSHADER() : glprogid(0), vsid(0), psid(0), binaryLength(0){}
|
||||||
GLuint glprogid; // opengl program id
|
GLuint glprogid; // opengl program id
|
||||||
GLuint vsid, psid;
|
GLuint vsid, psid;
|
||||||
|
PROGRAMUID uid;
|
||||||
GLint UniformLocations[NUM_UNIFORMS];
|
GLint UniformLocations[NUM_UNIFORMS];
|
||||||
GLint binaryLength;
|
GLint binaryLength;
|
||||||
u8 *Data()
|
u8 *Data()
|
||||||
@ -152,11 +153,11 @@ class ProgramShaderCache
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::map<std::pair<u64, u64>, PCacheEntry> PCache;
|
typedef std::map<std::pair<u32, u32>, PCacheEntry> PCache;
|
||||||
|
|
||||||
static PCache pshaders;
|
static PCache pshaders;
|
||||||
static GLuint CurrentFShader, CurrentVShader, CurrentProgram;
|
static GLuint CurrentFShader, CurrentVShader, CurrentProgram;
|
||||||
static std::pair<u64, u64> CurrentShaderProgram;
|
static std::pair<u32, u32> CurrentShaderProgram;
|
||||||
|
|
||||||
static GLuint s_ps_vs_ubo;
|
static GLuint s_ps_vs_ubo;
|
||||||
static GLintptr s_vs_data_offset;
|
static GLintptr s_vs_data_offset;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user