diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-05-03 19:00:12 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2022-05-03 19:02:10 +0300 |
commit | 947f8ba300090027304680c624c6257c41417a6b (patch) | |
tree | dba89119d7a20b72c6db67036e44af095176a8da /source/blender/draw/intern/draw_cache_impl_subdivision.cc | |
parent | 5962db093f2f1fcf735ceaaa1ba6bbd25efc397f (diff) |
Fix T96338: GPU subdiv crash switching to UV editing
The crash is caused as the data for the UV editor is requested before
the data for the mesh as a separate draw update. Since building the UV
stretch angle buffer requires the position buffer, the latter is not
created yet in this case.
To fix this, create a local position buffer from the subdivision data. An
alternate fix was considered to remove the dependency on the position
buffer by interpolating on the GPU the coarse stretch angle buffer but
this did work. Maybe this will be revisited.
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_subdivision.cc')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_subdivision.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc index 7c72b77af1f..19745304b2d 100644 --- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc +++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc @@ -366,6 +366,17 @@ static GPUVertFormat *get_origindex_format() return &format; } +GPUVertFormat *draw_subdiv_get_pos_nor_format() +{ + static GPUVertFormat format = {0}; + if (format.attr_len == 0) { + GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + GPU_vertformat_attr_add(&format, "nor", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); + GPU_vertformat_alias_add(&format, "vnor"); + } + return &format; +} + /** \} */ /* -------------------------------------------------------------------- */ |