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:
authorJeroen Bakker <j.bakker@atmind.nl>2019-07-15 12:24:18 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2019-07-15 12:24:38 +0300
commit576963d7c1e46c0fb59ee4c8741098cf690d0f27 (patch)
tree29a8da5fd105c7f23f1162b2acc962ec04d3d735 /source/blender
parent872025c4e5825f155ee599a687be13078504c23c (diff)
Fix crash running GPU shader.format_calc() with attributes like gl_VertexID
When using opengl attributes such as gl_VertexID in a shader its location is set to -1. This location was used without checking in an attribute array. This fails big time when called from python. For example `print(shader.format_calc())` made python crash immediately. this fixes https://github.com/JacquesLucke/animation_nodes/issues/1141 Reviewed By: fclem, brecht Differential Revision: https://developer.blender.org/D5231
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/gpu/intern/gpu_vertex_format.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_vertex_format.c b/source/blender/gpu/intern/gpu_vertex_format.c
index 37e1f9cf9da..e745c525df6 100644
--- a/source/blender/gpu/intern/gpu_vertex_format.c
+++ b/source/blender/gpu/intern/gpu_vertex_format.c
@@ -365,6 +365,11 @@ void GPU_vertformat_from_interface(GPUVertFormat *format, const GPUShaderInterfa
input = next;
next = input->next;
+ /* OpenGL attributes such as `gl_VertexID` have a location of -1. */
+ if (input->location < 0) {
+ continue;
+ }
+
format->name_len++; /* multiname support */
format->attr_len++;