Fix #120805: crash when using multiple curves attributes in shader
Currently, `cache.eval_cache.final.attributes_buf[i] != nullptr` is used as high level check to see if attributes need to be recomputed. However, this buffer was not freed when a related buffer was freed that has to be recomputed.
This commit is contained in:
@@ -706,6 +706,7 @@ static bool ensure_attributes(const Curves &curves,
|
||||
if (!drw_attributes_overlap(&final_cache.attr_used, &attrs_needed)) {
|
||||
/* Some new attributes have been added, free all and start over. */
|
||||
for (const int i : IndexRange(GPU_MAX_ATTR)) {
|
||||
GPU_VERTBUF_DISCARD_SAFE(final_cache.attributes_buf[i]);
|
||||
GPU_VERTBUF_DISCARD_SAFE(cache.eval_cache.proc_attributes_buf[i]);
|
||||
}
|
||||
drw_attributes_merge(&final_cache.attr_used, &attrs_needed, cache.render_mutex);
|
||||
|
||||
@@ -127,6 +127,8 @@ static void drw_curves_cache_update_compute(CurvesEvalCache *cache,
|
||||
gpu::VertBuf *output_buf,
|
||||
gpu::VertBuf *input_buf)
|
||||
{
|
||||
BLI_assert(input_buf != nullptr);
|
||||
BLI_assert(output_buf != nullptr);
|
||||
GPUShader *shader = DRW_shader_curves_refine_get(CURVES_EVAL_CATMULL_ROM);
|
||||
DRWShadingGroup *shgrp = DRW_shgroup_create(shader, g_tf_pass);
|
||||
drw_curves_cache_shgrp_attach_resources(shgrp, cache, input_buf);
|
||||
|
||||
Reference in New Issue
Block a user