Fix T67033 EEVEE: Random Flickering Materials

This was a read after free error. This only fix the undefined behavior.
The result is still not correct in certain cases (see T67226).

We want to include this for 2.80
This commit is contained in:
Clément Foucault 2019-07-19 14:38:03 +02:00
parent 69ba3b98e4
commit d5c0a02f86
Notes: blender-bot 2023-02-14 01:47:05 +01:00
Referenced by issue #67033, EEVEE: Random Flickering Materials
1 changed files with 6 additions and 3 deletions

View File

@ -1659,14 +1659,17 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
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). */
/* FIXME: This is broken, as it overrides any autolayers srgb bool of the previous mesh
* that shares the same material. */
if (shgrp_array[i]) {
DRW_shgroup_uniform_bool(shgrp_array[i], name, &auto_layer_is_srgb[j], 1);
DRW_shgroup_uniform_bool_copy(shgrp_array[i], name, auto_layer_is_srgb[j]);
}
if (shgrp_depth_array[i]) {
DRW_shgroup_uniform_bool(shgrp_depth_array[i], name, &auto_layer_is_srgb[j], 1);
DRW_shgroup_uniform_bool_copy(shgrp_depth_array[i], name, auto_layer_is_srgb[j]);
}
if (shgrp_depth_clip_array[i]) {
DRW_shgroup_uniform_bool(shgrp_depth_clip_array[i], name, &auto_layer_is_srgb[j], 1);
DRW_shgroup_uniform_bool_copy(
shgrp_depth_clip_array[i], name, auto_layer_is_srgb[j]);
}
/* Go to next layer name. */
while (*name != '\0') {