Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2021-11-19 21:24:22 +0300
committerClément Foucault <foucault.clem@gmail.com>2021-11-19 21:24:22 +0300
commit00e4d665f44ae63e6034b06b68729b78e9ac3131 (patch)
treea2b92909cb92b1ed7455cccdece7515b227e9cdd /source/blender/draw/intern/mesh_extractors
parent1b686c60b5a7f7f7604d7ba5012aa5afa15f0d07 (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.
Diffstat (limited to 'source/blender/draw/intern/mesh_extractors')
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc9
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];