Since glProgramUniform is not supported on MAc we need a workaround...

This commit is contained in:
Sam Gateau 2015-03-18 16:12:47 -07:00
parent dc27bfb6ef
commit b5eb4a7f5b

View file

@ -509,6 +509,11 @@ ElementResource getFormatFromGLUniform(GLenum gltype) {
int makeUniformSlots(GLuint glprogram, const Shader::BindingSet& slotBindings, Shader::SlotSet& uniforms, Shader::SlotSet& textures, Shader::SlotSet& samplers) {
GLint uniformsCount = 0;
#if (GPU_FEATURE_PROFILE == GPU_LEGACY)
GLuint currentProgram = glGetIntegerv(GL_CURRENT_PROGRAM);
glUseProgram(glprogram);
#endif
glGetProgramiv(glprogram, GL_ACTIVE_UNIFORMS, &uniformsCount);
for (int i = 0; i < uniformsCount; i++) {
@ -551,7 +556,11 @@ int makeUniformSlots(GLuint glprogram, const Shader::BindingSet& slotBindings, S
if (requestedBinding != slotBindings.end()) {
if (binding != (*requestedBinding)._location) {
binding = (*requestedBinding)._location;
#if (GPU_FEATURE_PROFILE == GPU_LEGACY)
glUniform1i(location, binding);
#else
glProgramUniform1i(glprogram, location, binding);
#endif
}
}
@ -561,6 +570,10 @@ int makeUniformSlots(GLuint glprogram, const Shader::BindingSet& slotBindings, S
}
}
#if (GPU_FEATURE_PROFILE == GPU_LEGACY)
glUseProgram(currentProgram);
#endif
return uniformsCount;
}