ffmpeg | branch: master | IndecisiveTurtle <geoste...@gmail.com> | Sat Oct  5 
03:51:42 2024 +0300| [d80676117a80e8759c4f2ee44b613d2bf9e27d0b] | committer: 
Lynne

libavutil/vulkan: Prevent crash on shaders with no descriptors

 Needed to prevent crashes on vc2 vulkan encoder patch

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d80676117a80e8759c4f2ee44b613d2bf9e27d0b
---

 libavutil/vulkan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 44552e97b8..cd617496dc 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -2022,7 +2022,7 @@ static inline FFVulkanShaderData 
*get_shd_data(FFVkExecContext *e,
     for (int i = 0; i < e->parent->nb_reg_shd; i++)
         if (e->parent->reg_shd[i].shd == shd)
             return &e->parent->reg_shd[i];
-    av_assert0(0);
+    return NULL;
 }
 
 static inline void update_set_descriptor(FFVulkanContext *s, FFVkExecContext 
*e,
@@ -2239,7 +2239,7 @@ void ff_vk_exec_bind_shader(FFVulkanContext *s, 
FFVkExecContext *e,
         vk->CmdBindPipeline(e->buf, shd->bind_point, shd->pipeline);
     }
 
-    if (sd->nb_descriptor_sets) {
+    if (sd && sd->nb_descriptor_sets) {
         if (s->extensions & FF_VK_EXT_DESCRIPTOR_BUFFER) {
             for (int i = 0; i < sd->nb_descriptor_sets; i++)
                 offsets[i] = shd->desc_set[i].singular ? 0 : 
shd->desc_set[i].aligned_size*e->idx;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to