cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=6c580faad9712c15344c7531c11b6e0c4b5c822b
commit 6c580faad9712c15344c7531c11b6e0c4b5c822b Author: Oleksandr Shcherbina <[email protected]> Date: Mon Jun 6 16:39:38 2016 -0700 evas: fix order binding attributes to gl. Summary: In same cases(devices) can lead to mix up attributes in shaders. @fix Reviewers: cedric, Hermet, raster Subscribers: jpeg Differential Revision: https://phab.enlightenment.org/D4012 Signed-off-by: Cedric BAIL <[email protected]> --- .../evas/engines/gl_common/evas_gl_3d_shader.c | 74 +++++++++++----------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c b/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c index 7fef490..0ead38a 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c +++ b/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c @@ -216,6 +216,42 @@ _shader_compile(GLuint shader, const char *src) return EINA_TRUE; } +static inline void +_program_vertex_attrib_bind(E3D_Program *program) +{ + GLint index = 0; + + if (program->flags & E3D_SHADER_FLAG_VERTEX_POSITION) + glBindAttribLocation(program->prog, index++, "aPosition0"); + + if (program->flags & E3D_SHADER_FLAG_VERTEX_POSITION_BLEND) + glBindAttribLocation(program->prog, index++, "aPosition1"); + + if (program->flags & E3D_SHADER_FLAG_VERTEX_NORMAL) + glBindAttribLocation(program->prog, index++, "aNormal0"); + + if (program->flags & E3D_SHADER_FLAG_VERTEX_NORMAL_BLEND) + glBindAttribLocation(program->prog, index++, "aNormal1"); + + if (program->flags & E3D_SHADER_FLAG_VERTEX_TANGENT) + glBindAttribLocation(program->prog, index++, "aTangent0"); + + if (program->flags & E3D_SHADER_FLAG_VERTEX_TANGENT_BLEND) + glBindAttribLocation(program->prog, index++, "aTangent1"); + + if (program->flags & E3D_SHADER_FLAG_VERTEX_COLOR) + glBindAttribLocation(program->prog, index++, "aColor0"); + + if (program->flags & E3D_SHADER_FLAG_VERTEX_COLOR_BLEND) + glBindAttribLocation(program->prog, index++, "aColor1"); + + if (program->flags & E3D_SHADER_FLAG_VERTEX_TEXCOORD) + glBindAttribLocation(program->prog, index++, "aTexCoord0"); + + if (program->flags & E3D_SHADER_FLAG_VERTEX_TEXCOORD_BLEND) + glBindAttribLocation(program->prog, index++, "aTexCoord1"); +} + static inline Eina_Bool _program_build(E3D_Program *program, const char *vert_src, const char *frag_src) { @@ -246,6 +282,7 @@ _program_build(E3D_Program *program, const char *vert_src, const char *frag_src) glAttachShader(program->prog, program->vert); glAttachShader(program->prog, program->frag); + _program_vertex_attrib_bind(program); /* Link program. */ glLinkProgram(program->prog); @@ -269,42 +306,6 @@ _program_build(E3D_Program *program, const char *vert_src, const char *frag_src) return EINA_TRUE; } -static inline void -_program_vertex_attrib_bind(E3D_Program *program) -{ - GLint index = 0; - - if (program->flags & E3D_SHADER_FLAG_VERTEX_POSITION) - glBindAttribLocation(program->prog, index++, "aPosition0"); - - if (program->flags & E3D_SHADER_FLAG_VERTEX_POSITION_BLEND) - glBindAttribLocation(program->prog, index++, "aPosition1"); - - if (program->flags & E3D_SHADER_FLAG_VERTEX_NORMAL) - glBindAttribLocation(program->prog, index++, "aNormal0"); - - if (program->flags & E3D_SHADER_FLAG_VERTEX_NORMAL_BLEND) - glBindAttribLocation(program->prog, index++, "aNormal1"); - - if (program->flags & E3D_SHADER_FLAG_VERTEX_TANGENT) - glBindAttribLocation(program->prog, index++, "aTangent0"); - - if (program->flags & E3D_SHADER_FLAG_VERTEX_TANGENT_BLEND) - glBindAttribLocation(program->prog, index++, "aTangent1"); - - if (program->flags & E3D_SHADER_FLAG_VERTEX_COLOR) - glBindAttribLocation(program->prog, index++, "aColor0"); - - if (program->flags & E3D_SHADER_FLAG_VERTEX_COLOR_BLEND) - glBindAttribLocation(program->prog, index++, "aColor1"); - - if (program->flags & E3D_SHADER_FLAG_VERTEX_TEXCOORD) - glBindAttribLocation(program->prog, index++, "aTexCoord0"); - - if (program->flags & E3D_SHADER_FLAG_VERTEX_TEXCOORD_BLEND) - glBindAttribLocation(program->prog, index++, "aTexCoord1"); -} - static const char *uniform_names[] = { "uMatrixMvp", @@ -696,7 +697,6 @@ e3d_program_new(Evas_Canvas3D_Shader_Mode mode, E3D_Shader_Flag flags) if (! _program_build(program, vert.str, frag.str)) goto error; - _program_vertex_attrib_bind(program); _program_uniform_init(program); _shader_string_fini(&vert); --
