From 6401a18143f9c0e8fbcdf07cbd656e1ae9e833b4 Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 19 Jan 2013 00:12:02 +0100 Subject: [PATCH] remove texture sampler from uniform list --- .../Plugin_VideoOGL/Src/ProgramShaderCache.cpp | 13 +++++++------ .../Plugin_VideoOGL/Src/ProgramShaderCache.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp index 24cdb9c444..ad0173341c 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp @@ -37,8 +37,6 @@ GLuint ProgramShaderCache::PCacheEntry::prog_format = 0; std::pair ProgramShaderCache::CurrentShaderProgram; const char *UniformNames[NUM_UNIFORMS] = { - // SAMPLERS - "samp0","samp1","samp2","samp3","samp4","samp5","samp6","samp7", // PIXEL SHADER UNIFORMS I_COLORS, I_KCOLORS, @@ -84,16 +82,19 @@ void ProgramShaderCache::SetProgramVariables(PCacheEntry &entry) //glGetUniformIndices(entry.prog_id, NUM_UNIFORMS, UniformNames, entry.UniformLocations); // Got to do it this crappy way. if (!g_ActiveConfig.backend_info.bSupportsGLSLUBO) - for (int a = 8; a < NUM_UNIFORMS; ++a) + for (int a = 0; a < NUM_UNIFORMS; ++a) entry.UniformLocations[a] = glGetUniformLocation(entry.prog_id, UniformNames[a]); // Bind Texture Sampler for (int a = 0; a < 8; ++a) { + char name[8]; + snprintf(name, 8, "samp%d", a); + // Still need to get sampler locations since we aren't binding them statically in the shaders - entry.UniformLocations[a] = glGetUniformLocation(entry.prog_id, UniformNames[a]); - if (entry.UniformLocations[a] != -1) - glUniform1i(entry.UniformLocations[a], a); + int loc = glGetUniformLocation(entry.prog_id, name); + if (loc != -1) + glUniform1i(loc, a); } } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h index 00a95457ba..890679380b 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h @@ -30,7 +30,7 @@ namespace OGL { -const int NUM_UNIFORMS = 27; +const int NUM_UNIFORMS = 19; extern const char *UniformNames[NUM_UNIFORMS]; class ProgramShaderCache