mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Since glProgramUniform is not supported on MAc we need a workaround...
This commit is contained in:
parent
dc27bfb6ef
commit
b5eb4a7f5b
1 changed files with 13 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue