[Bf-blender-cvs] [e401e2d89c2] blender2.8: GWN: Fix attrib arrays giving incorrect name depending on the platform.

Clément Foucault noreply at git.blender.org
Thu Feb 15 19:16:13 CET 2018


Commit: e401e2d89c2a98ced3509fcc89b3dfb300158f9c
Author: Clément Foucault
Date:   Thu Feb 15 19:14:46 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBe401e2d89c2a98ced3509fcc89b3dfb300158f9c

GWN: Fix attrib arrays giving incorrect name depending on the platform.

It seems that some opengl implementations are returning "[0]" after array names but some others dont.

Remove the "[0]" so everything is consistent.

===================================================================

M	intern/gawain/src/gwn_shader_interface.c

===================================================================

diff --git a/intern/gawain/src/gwn_shader_interface.c b/intern/gawain/src/gwn_shader_interface.c
index 1fb941f9225..d18629736f2 100644
--- a/intern/gawain/src/gwn_shader_interface.c
+++ b/intern/gawain/src/gwn_shader_interface.c
@@ -222,6 +222,13 @@ Gwn_ShaderInterface* GWN_shaderinterface_create(GLint program)
 
 		glGetActiveAttrib(program, i, remaining_buffer, &name_len, &input->size, &input->gl_type, name);
 
+		// remove "[0]" from array name
+		if (name[name_len-1] == ']')
+			{
+			name[name_len-3] = '\0';
+			name_len -= 3;
+			}
+
 		// TODO: reject DOUBLE gl_types
 
 		input->location = glGetAttribLocation(program, name);



More information about the Bf-blender-cvs mailing list