diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2021-11-19 21:24:22 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2021-11-19 21:24:22 +0300 |
commit | 00e4d665f44ae63e6034b06b68729b78e9ac3131 (patch) | |
tree | a2b92909cb92b1ed7455cccdece7515b227e9cdd | |
parent | 1b686c60b5a7f7f7604d7ba5012aa5afa15f0d07 (diff) |
Fix T91838 Crash when toggling edit mode on object with geometry node modifier, but only if the instanced objects material has a normal map assigned.
This is only a workaround to avoid the crash. The underlying issue is left
unfixed.
New report for tracking the underlying issue is T93223.
-rw-r--r-- | source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc index 1f8776fc98e..7a3b2cf49ff 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc @@ -54,11 +54,18 @@ static void extract_tan_ex_init(const MeshRenderData *mr, uint32_t tan_layers = cache->cd_used.tan; float(*orco)[3] = (float(*)[3])CustomData_get_layer(cd_vdata, CD_ORCO); bool orco_allocated = false; - const bool use_orco_tan = cache->cd_used.tan_orco != 0; + bool use_orco_tan = cache->cd_used.tan_orco != 0; int tan_len = 0; char tangent_names[MAX_MTFACE][MAX_CUSTOMDATA_LAYER_NAME]; + /* FIXME(T91838): This is to avoid a crash when orco tangent was requested but there are valid + * uv layers. It would be better to fix the root cause. */ + if (tan_layers == 0 && use_orco_tan && CustomData_get_layer_index(cd_ldata, CD_MLOOPUV) != -1) { + tan_layers = 1; + use_orco_tan = false; + } + for (int i = 0; i < MAX_MTFACE; i++) { if (tan_layers & (1 << i)) { char attr_name[32], attr_safe_name[GPU_MAX_SAFE_ATTR_NAME]; |