Fix T60684 Fourth and subsequent vertex color / UV layers displayed black

This commit is contained in:
Clément Foucault 2019-03-19 16:25:52 +01:00
parent 899fc0331c
commit bd80393995
Notes: blender-bot 2023-02-14 04:01:00 +01:00
Referenced by commit 87f07af737, Fix T63464: Multi UV Maps limited to three with eevee
Referenced by issue #63464, Multi UV Maps limited to three with eevee.
Referenced by issue #60684, Fourth and subsequent vertex color / UV layers displayed black
1 changed files with 7 additions and 1 deletions

View File

@ -889,11 +889,13 @@ static MeshRenderData *mesh_render_data_create_ex(
* to a safe glsl var name, but without name clash.
* NOTE 2 : Replicate changes to code_generate_vertex_new() in gpu_codegen.c */
if (rdata->cd.layers.vcol_len != 0) {
int act_vcol = rdata->cd.layers.vcol_active;
for (int i_src = 0, i_dst = 0; i_src < cd_layers_src.vcol_len; i_src++, i_dst++) {
if ((cd_lused[CD_MLOOPCOL] & (1 << i_src)) == 0) {
/* This is a non-used VCol slot. Skip. */
i_dst--;
if (rdata->cd.layers.vcol_active >= i_src) {
rdata->cd.layers.vcol_active--;
act_vcol--;
}
}
else {
@ -916,6 +918,10 @@ static MeshRenderData *mesh_render_data_create_ex(
}
}
}
if (rdata->cd.layers.vcol_active != -1) {
/* Actual active Vcol slot inside vcol layers used for shading. */
rdata->cd.layers.vcol_active = act_vcol;
}
}
/* Start Fresh */