From 00e4d665f44ae63e6034b06b68729b78e9ac3131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 19 Nov 2021 19:24:22 +0100 Subject: 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. --- .../blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source/blender/draw') 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]; -- cgit v1.2.3