Fix T78845: Eevee wrong material selection.

In cases where the same node tree is used in different materials with
small changes, the wrong material could be selected.

Cause: Hair shaders GPU resources weren't updated and used the previous bound data.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D11036
This commit is contained in:
Jeroen Bakker 2021-04-23 10:02:53 +02:00 committed by Jeroen Bakker
parent dc1e98d8a0
commit 2f6219c48d
Notes: blender-bot 2023-02-14 11:18:07 +01:00
Referenced by issue #78845, Some hair particles are rendered the wrong material in EEVEE
2 changed files with 4 additions and 1 deletions

@ -1 +1 @@
Subproject commit 81815ea92c2071a08566dc66d4a871b6e2f5c868
Subproject commit 4cb833e84acfd2be5fa08ce75118ce9cb60643b8

View File

@ -765,12 +765,15 @@ static void eevee_hair_cache_populate(EEVEE_Data *vedata,
if (matcache.depth_grp) {
*matcache.depth_grp_p = DRW_shgroup_hair_create_sub(ob, psys, md, matcache.depth_grp);
DRW_shgroup_add_material_resources(*matcache.depth_grp_p, matcache.shading_gpumat);
}
if (matcache.shading_grp) {
*matcache.shading_grp_p = DRW_shgroup_hair_create_sub(ob, psys, md, matcache.shading_grp);
DRW_shgroup_add_material_resources(*matcache.shading_grp_p, matcache.shading_gpumat);
}
if (matcache.shadow_grp) {
*matcache.shadow_grp_p = DRW_shgroup_hair_create_sub(ob, psys, md, matcache.shadow_grp);
DRW_shgroup_add_material_resources(*matcache.shadow_grp_p, matcache.shading_gpumat);
*cast_shadow = true;
}