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:
authorClément Foucault <foucault.clem@gmail.com>2022-02-15 02:48:18 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-02-15 02:48:18 +0300
commitd7d827789b4cbb1b55edae890f510302eff2eb49 (patch)
tree84d43a5e14295b2148ffb02a3f2cfdd9d06539a8
parentb744081f838409fda9a131e9039bd05b092c9d16 (diff)
GLShaderInterface: Fix undefined behavior when attributes are optimized away.
Optimized out attributes returns an invalid location `-1` resulting in an undefined behavior shift.
-rw-r--r--source/blender/gpu/opengl/gl_shader_interface.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc
index 71b908665d3..292e52e857b 100644
--- a/source/blender/gpu/opengl/gl_shader_interface.cc
+++ b/source/blender/gpu/opengl/gl_shader_interface.cc
@@ -391,7 +391,9 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI
else {
input->location = input->binding = attr.index;
}
- enabled_attr_mask_ |= (1 << input->location);
+ if (input->location != -1) {
+ enabled_attr_mask_ |= (1 << input->location);
+ }
input++;
}