Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2017-05-19 01:30:09 +0300
committerMike Erwin <significant.bit@gmail.com>2017-05-19 01:30:24 +0300
commite03e977385c9285ec13695f93e43bb805c4dd0af (patch)
tree7b10708c15620b74bc7a838da28f30285266685a /source/blender/gpu/intern/gpu_shader.c
parent77f8d631b1f6479b6e5b3b99ecb3611fca519444 (diff)
OpenGL: call glProgramUniform only if version >= 4.1
Otherwise crash! Called from OpenSubdiv setup code. Might start using this in more places...
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader.c')
-rw-r--r--source/blender/gpu/intern/gpu_shader.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index 58610ee7f4b..83e126bd39f 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -435,14 +435,22 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode,
#ifdef WITH_OPENSUBDIV
/* TODO(sergey): Find a better place for this. */
- if (use_opensubdiv && GLEW_VERSION_4_1) {
- glProgramUniform1i(shader->program,
- ShaderInterface_uniform(shader->interface, "FVarDataOffsetBuffer")->location,
- 30); /* GL_TEXTURE30 */
-
- glProgramUniform1i(shader->program,
- ShaderInterface_uniform(shader->interface, "FVarDataBuffer")->location,
- 31); /* GL_TEXTURE31 */
+ if (use_opensubdiv) {
+ if (GLEW_VERSION_4_1) {
+ glProgramUniform1i(shader->program,
+ ShaderInterface_uniform(shader->interface, "FVarDataOffsetBuffer")->location,
+ 30); /* GL_TEXTURE30 */
+
+ glProgramUniform1i(shader->program,
+ ShaderInterface_uniform(shader->interface, "FVarDataBuffer")->location,
+ 31); /* GL_TEXTURE31 */
+ }
+ else {
+ glUseProgram(shader->program);
+ glUniform1i(ShaderInterface_uniform(shader->interface, "FVarDataOffsetBuffer")->location, 30);
+ glUniform1i(ShaderInterface_uniform(shader->interface, "FVarDataBuffer")->location, 31);
+ glUseProgram(0);
+ }
}
#endif