summaryrefslogtreecommitdiff
path: root/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp')
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp
index 8bdab0f9a7..5387436d3a 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp
@@ -42,41 +42,23 @@ GLuint PixelShaderCache::CurrentShader;
bool PixelShaderCache::ShaderEnabled;
static FRAGMENTSHADER* pShaderLast = NULL;
-static float lastPSconstants[C_PENVCONST_END][4];
void SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
{
- if (lastPSconstants[const_number][0] != f1 || lastPSconstants[const_number][1] != f2 ||
- lastPSconstants[const_number][2] != f3 || lastPSconstants[const_number][3] != f4)
- {
- lastPSconstants[const_number][0] = f1;
- lastPSconstants[const_number][1] = f2;
- lastPSconstants[const_number][2] = f3;
- lastPSconstants[const_number][3] = f4;
- glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number, lastPSconstants[const_number]);
-
- }
+ float f[4] = { f1, f2, f3, f4 };
+ glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number, f);
}
void SetPSConstant4fv(unsigned int const_number, const float *f)
{
- if (memcmp(&lastPSconstants[const_number], f, sizeof(float) * 4)) {
- memcpy(&lastPSconstants[const_number], f, sizeof(float) * 4);
- glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number, f);
- }
+ glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number, f);
}
void SetMultiPSConstant4fv(unsigned int const_number, unsigned int count, const float *f)
{
- const float *f0 = f;
- for (unsigned int i = 0; i < count ;i++,f0+=4)
- {
- if (memcmp(&lastPSconstants[const_number + i], f0, sizeof(float) * 4)) {
- memcpy(&lastPSconstants[const_number + i], f0, sizeof(float) * 4);
- glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number + i, lastPSconstants[const_number + i]);
- }
- }
+ for (unsigned int i = 0; i < count; i++,f+=4)
+ glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number + i, f);
}
void PixelShaderCache::Init()
@@ -86,8 +68,6 @@ void PixelShaderCache::Init()
CurrentShader = 0;
GL_REPORT_ERRORD();
- for (unsigned int i = 0; i < (C_PENVCONST_END) * 4; i++)
- lastPSconstants[i/4][i%4] = -100000000.0f;
memset(&last_pixel_shader_uid, 0xFF, sizeof(last_pixel_shader_uid));
s_displayCompileAlert = true;