mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 23:36:44 +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) {
|
int makeUniformSlots(GLuint glprogram, const Shader::BindingSet& slotBindings, Shader::SlotSet& uniforms, Shader::SlotSet& textures, Shader::SlotSet& samplers) {
|
||||||
GLint uniformsCount = 0;
|
GLint uniformsCount = 0;
|
||||||
|
|
||||||
|
#if (GPU_FEATURE_PROFILE == GPU_LEGACY)
|
||||||
|
GLuint currentProgram = glGetIntegerv(GL_CURRENT_PROGRAM);
|
||||||
|
glUseProgram(glprogram);
|
||||||
|
#endif
|
||||||
|
|
||||||
glGetProgramiv(glprogram, GL_ACTIVE_UNIFORMS, &uniformsCount);
|
glGetProgramiv(glprogram, GL_ACTIVE_UNIFORMS, &uniformsCount);
|
||||||
|
|
||||||
for (int i = 0; i < uniformsCount; i++) {
|
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 (requestedBinding != slotBindings.end()) {
|
||||||
if (binding != (*requestedBinding)._location) {
|
if (binding != (*requestedBinding)._location) {
|
||||||
binding = (*requestedBinding)._location;
|
binding = (*requestedBinding)._location;
|
||||||
|
#if (GPU_FEATURE_PROFILE == GPU_LEGACY)
|
||||||
|
glUniform1i(location, binding);
|
||||||
|
#else
|
||||||
glProgramUniform1i(glprogram, location, binding);
|
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;
|
return uniformsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue