diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-07-19 15:38:03 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-07-19 15:38:09 +0300 |
commit | d5c0a02f8677211e4857c9d446b23c8561defb62 (patch) | |
tree | 4b2fe26151f9f2e020364c4392bfec185b1a5c2e | |
parent | 69ba3b98e4dc84e40fcb623fcdbc7214361466e7 (diff) |
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
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_materials.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index f5f3a7a70e3..61da9e21cc8 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -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') { |