diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2020-04-16 11:39:30 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2020-04-16 17:20:40 +0300 |
commit | d34c5eec19ad828237cff0916cc23240d0c25aa1 (patch) | |
tree | 7a10f0b48e00643907dfcb462634035f4cb725e2 /source/blender | |
parent | a1420da0276a49c4f259a1df7da73937cd34f5d4 (diff) |
GPU: Fix Negative Shift
glAttributes also include `gl_` names. These don't have a location and
should be ignored during shader interface creation. Those internal names
received a location of -1 and therefore the bitmasking was undefined.
Users wouldn't notice this, but ASAN warned developers of this situation.
ASAN could quit making ASAN un-usable as most shaders have this issue.
Reviewed By: Clément Foucault`
Differential Revision: https://developer.blender.org/D7448
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader_interface.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_shader_interface.c b/source/blender/gpu/intern/gpu_shader_interface.c index cb1cd9a6f6d..db8ec60fa9a 100644 --- a/source/blender/gpu/intern/gpu_shader_interface.c +++ b/source/blender/gpu/intern/gpu_shader_interface.c @@ -254,8 +254,11 @@ GPUShaderInterface *GPU_shaderinterface_create(int32_t program) } /* TODO: reject DOUBLE gl_types */ - input->location = glGetAttribLocation(program, name); + /* Ignore OpenGL names like `gl_BaseInstanceARB`, `gl_InstanceID` and `gl_VertexID`. */ + if (input->location == -1) { + continue; + } shaderface->enabled_attr_mask |= (1 << input->location); |