Merge branch 'master' into blender2.8
[blender.git] / source / blender / gpu / intern / gpu_codegen.c
index 73d1f99079d577912f2de88924630fe94db0d894..9f41253b176e34ff08ab3a772cd9787cb067ce5e 100644 (file)
@@ -741,6 +741,7 @@ static char *code_generate_vertex(ListBase *nodes, const GPUMatType type)
                                BLI_dynstr_appendf(ds, "%s %s att%d;\n",
                                        GLEW_VERSION_3_0 ? "in" : "attribute",
                                        GPU_DATATYPE_STR[input->type], input->attribid);
+                               BLI_dynstr_appendf(ds, "uniform int att%d_info;\n",  input->attribid);
                                BLI_dynstr_appendf(ds, "%s %s var%d;\n",
                                        GLEW_VERSION_3_0 ? "out" : "varying",
                                        GPU_DATATYPE_STR[input->type], input->attribid);
@@ -793,7 +794,8 @@ static char *code_generate_vertex(ListBase *nodes, const GPUMatType type)
                                                BLI_dynstr_appendf(ds, "#ifndef USE_OPENSUBDIV\n");
                                        }
 #endif
-                                       BLI_dynstr_appendf(ds, "\tvar%d = att%d;\n", input->attribid, input->attribid);
+                                       BLI_dynstr_appendf(ds, "\tset_var_from_attr(att%d, att%d_info, var%d);\n",
+                                                          input->attribid, input->attribid, input->attribid);
 #ifdef WITH_OPENSUBDIV
                                        if (is_mtface) {
                                                BLI_dynstr_appendf(ds, "#endif\n");
@@ -1488,7 +1490,7 @@ bool GPU_link(GPUMaterial *mat, const char *name, ...)
        function = gpu_lookup_function(name);
        if (!function) {
                fprintf(stderr, "GPU failed to find function %s\n", name);
-               return 0;
+               return false;
        }
 
        node = GPU_node_begin(name);
@@ -1508,7 +1510,7 @@ bool GPU_link(GPUMaterial *mat, const char *name, ...)
 
        gpu_material_add_node(mat, node);
 
-       return 1;
+       return true;
 }
 
 bool GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNodeStack *out, ...)
@@ -1522,7 +1524,7 @@ bool GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNod
        function = gpu_lookup_function(name);
        if (!function) {
                fprintf(stderr, "GPU failed to find function %s\n", name);
-               return 0;
+               return false;
        }
 
        node = GPU_node_begin(name);
@@ -1569,7 +1571,7 @@ bool GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNod
 
        gpu_material_add_node(mat, node);
        
-       return 1;
+       return true;
 }
 
 int GPU_link_changed(GPUNodeLink *link)