Fix T61837: Assert in Eevee multiresolution modfier in sculpt mode

Note that this commit remove the support (that was not really working)
for shadows in sculpt mode.
This commit is contained in:
Clément Foucault 2019-02-22 17:14:08 +01:00
parent 3b132778de
commit 0ca623362d
Notes: blender-bot 2023-02-14 08:40:26 +01:00
Referenced by issue #61837, assign/create a material while in sculpt mode + multiresolution modfier = blender crash
1 changed files with 17 additions and 7 deletions

View File

@ -1518,14 +1518,19 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
char *auto_layer_names;
int *auto_layer_is_srgb;
int auto_layer_count;
struct GPUBatch **mat_geom = DRW_cache_object_surface_material_get(
ob, gpumat_array, materials_len,
&auto_layer_names,
&auto_layer_is_srgb,
&auto_layer_count);
if (mat_geom) {
struct GPUBatch **mat_geom = NULL;
if (!is_sculpt_mode_draw) {
mat_geom = DRW_cache_object_surface_material_get(
ob, gpumat_array, materials_len,
&auto_layer_names,
&auto_layer_is_srgb,
&auto_layer_count);
}
if (is_sculpt_mode_draw || mat_geom) {
for (int i = 0; i < materials_len; ++i) {
if (mat_geom[i] == NULL) {
if (!is_sculpt_mode_draw && mat_geom[i] == NULL) {
continue;
}
EEVEE_ObjectEngineData *oedata = NULL;
@ -1558,6 +1563,11 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld
ADD_SHGROUP_CALL_SAFE(shgrp_depth_array[i], ob, ma, mat_geom[i], oedata);
ADD_SHGROUP_CALL_SAFE(shgrp_depth_clip_array[i], ob, ma, mat_geom[i], oedata);
/* TODO(fclem): Don't support shadows in sculpt mode. */
if (is_sculpt_mode_draw) {
break;
}
char *name = auto_layer_names;
for (int j = 0; j < auto_layer_count; ++j) {
/* TODO don't add these uniform when not needed (default pass shaders). */