summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2011-12-29 01:35:50 -0600
committerSonicadvance1 <sonicadvance1@RH-Live.(none)>2012-10-09 23:56:00 -0500
commit03b09bed5dba644a06b5a591c477e7c4345f2b2d (patch)
treecc0f76e9edb0162b8b9a666ac22c0c43b93c3361 /Source
parent2e15440896f0267ef4b602ebfded277c95e0572f (diff)
Get the program binary type correctly or else ATI makes massive (~400MB) shader caches. Also, don't need the line in the PixelShaderGen.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp2
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp11
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h25
3 files changed, 19 insertions, 19 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index a4d3f3a397..6b0b61902a 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -577,8 +577,6 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
if (g_ActiveConfig.backend_info.bSupportsGLSLATTRBind)
WRITE(p, "#extension GL_ARB_explicit_attrib_location : enable\n");
- if (g_ActiveConfig.backend_info.bSupportsGLSLBlend)
- WRITE(p, "#extension GL_ARB_blend_func_extended : enable\n");
// Silly differences
WRITE(p, "#define float2 vec2\n");
WRITE(p, "#define float3 vec3\n");
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
index 728e4e8a01..57470959d2 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp
@@ -25,6 +25,7 @@ GLuint ProgramShaderCache::CurrentFShader = 0, ProgramShaderCache::CurrentVShade
ProgramShaderCache::PCache ProgramShaderCache::pshaders;
GLuint ProgramShaderCache::s_ps_vs_ubo;
GLintptr ProgramShaderCache::s_vs_data_offset;
+GLenum ProgramShaderCache::prog_format;
LinearDiskCache<ProgramShaderCache::ShaderUID, u8> g_program_disk_cache;
GLenum ProgramFormat;
@@ -213,6 +214,16 @@ void ProgramShaderCache::Init(void)
// Read our shader cache, only if supported
if (g_ActiveConfig.backend_info.bSupportsGLSLCache)
{
+ GLint Supported;
+ glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &Supported);
+
+ GLint *Formats = new GLint[Supported];
+ glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, Formats);
+ // We don't really care about format
+ // We just need the correct data type
+ prog_format = (GLenum)Formats[0];
+ delete[] Formats;
+
char cache_filename[MAX_PATH];
sprintf(cache_filename, "%sogl-%s-shaders.cache", File::GetUserPath(D_SHADERCACHE_IDX).c_str(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str());
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h
index 6089f205e7..6ea72c05dd 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h
+++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h
@@ -41,7 +41,6 @@ public:
struct PCacheEntry
{
GLuint prog_id;
- GLenum prog_format;
u8 *binary;
GLint binary_size;
GLuint vsid, psid;
@@ -75,25 +74,15 @@ public:
glGetProgramiv(prog_id, GL_PROGRAM_BINARY_LENGTH, &binary_size);
}
- // No idea how necessary this is
- void SetProgramFormat()
- {
- GLint Supported;
- glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &Supported);
-
- GLint *Formats = new GLint[Supported];
- glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, Formats);
- // We don't really care about format
- prog_format = (GLenum)Formats[0];
- delete[] Formats;
- }
-
u8 *GetProgram()
{
UpdateSize();
FreeProgram();
binary = new u8[binary_size];
- glGetProgramBinary(prog_id, binary_size, NULL, &prog_format, binary);
+ GLenum _form;
+ glGetProgramBinary(prog_id, binary_size, NULL, &_form, binary);
+ if (_form != prog_format)
+ ERROR_LOG(VIDEO, "Returned format not the same as expected! %d vs %d", _form, prog_format);
return binary;
}
@@ -130,8 +119,7 @@ private:
// But it is fine, no need to worry about that
PCacheEntry entry;
entry.Create(key.first, key.second);
-
- glProgramBinary(entry.prog_id, entry.prog_format, value, value_size);
+ glProgramBinary(entry.prog_id, prog_format, value, value_size);
GLint success;
glGetProgramiv(entry.prog_id, GL_LINK_STATUS, &success);
@@ -153,6 +141,9 @@ private:
static GLuint s_ps_vs_ubo;
static GLintptr s_vs_data_offset;
+
+ static GLenum prog_format;
+
static void SetProgramVariables(PCacheEntry &entry);
};