Merge branch 'master' into blender2.8
[blender.git] / source / blender / blenkernel / intern / editderivedmesh.c
index e57e9ffcd66d0de181b5b1f5928b94ae1459178e..5fba6c253a375e0be7d456d1c709335afca5936a 100644 (file)
@@ -57,6 +57,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "GPU_glew.h"
+#include "GPU_buffers.h"
 #include "GPU_shader.h"
 #include "GPU_basic_shader.h"
 
@@ -1427,6 +1428,7 @@ static void emdm_pass_attrib_vertex_glsl(const DMVertexAttribs *attribs, const B
                        glTexCoord3fv(orco);
                else
                        glVertexAttrib3fv(attribs->orco.gl_index, orco);
+               glUniform1i(attribs->orco.gl_info_index, 0);
        }
        for (i = 0; i < attribs->tottface; i++) {
                const float *uv;
@@ -1443,17 +1445,19 @@ static void emdm_pass_attrib_vertex_glsl(const DMVertexAttribs *attribs, const B
                        glTexCoord2fv(uv);
                else
                        glVertexAttrib2fv(attribs->tface[i].gl_index, uv);
+               glUniform1i(attribs->tface[i].gl_info_index, 0);
        }
        for (i = 0; i < attribs->totmcol; i++) {
-               GLubyte col[4];
+               float col[4];
                if (attribs->mcol[i].em_offset != -1) {
                        const MLoopCol *cp = BM_ELEM_CD_GET_VOID_P(loop, attribs->mcol[i].em_offset);
-                       copy_v4_v4_uchar(col, &cp->r);
+                       rgba_uchar_to_float(col, &cp->r);
                }
                else {
-                       col[0] = 0; col[1] = 0; col[2] = 0; col[3] = 0;
+                       col[0] = 0.0f; col[1] = 0.0f; col[2] = 0.0f; col[3] = 0.0f;
                }
-               glVertexAttrib4ubv(attribs->mcol[i].gl_index, col);
+               glVertexAttrib4fv(attribs->mcol[i].gl_index, col);
+               glUniform1i(attribs->mcol[i].gl_info_index, GPU_ATTR_INFO_SRGB);
        }
 
        for (i = 0; i < attribs->tottang; i++) {
@@ -1465,6 +1469,7 @@ static void emdm_pass_attrib_vertex_glsl(const DMVertexAttribs *attribs, const B
                        tang = zero;
                }
                glVertexAttrib4fv(attribs->tang[i].gl_index, tang);
+               glUniform1i(attribs->tang[i].gl_info_index, 0);
        }
 }