History

libavutil/vulkan: Prevent crash on shaders with no descriptors

Needed to prevent crashes on vc2 vulkan encoder patch

IndecisiveTurtle committed 2 years ago

Commit d8067611 parent 969c2711 file · +2 −2Browse files

Unified · Split

libavutil/vulkan.c+2−2
@@ -2022,7 +2022,7 @@ static inline FFVulkanShaderData *get_shd_data(FFVkExecContext *e, · 2021 unmodified lines
2022 for (int i = 0; i < e->parent->nb_reg_shd; i++)2022 for (int i = 0; i < e->parent->nb_reg_shd; i++)
2023 if (e->parent->reg_shd[i].shd == shd)2023 if (e->parent->reg_shd[i].shd == shd)
2024 return &e->parent->reg_shd[i];2024 return &e->parent->reg_shd[i];
2025 av_assert0(0);2025 return NULL;
2026}2026}
2027 2027
2028static inline void update_set_descriptor(FFVulkanContext *s, FFVkExecContext *e,2028static inline void update_set_descriptor(FFVulkanContext *s, FFVkExecContext *e,
@@ -2239,7 +2239,7 @@ void ff_vk_exec_bind_shader(FFVulkanContext *s, FFVkExecContext *e, · 210 unmodified lines
2239 vk->CmdBindPipeline(e->buf, shd->bind_point, shd->pipeline);2239 vk->CmdBindPipeline(e->buf, shd->bind_point, shd->pipeline);
2240 }2240 }
2241 2241
2242 if (sd->nb_descriptor_sets) {2242 if (sd && sd->nb_descriptor_sets) {
2243 if (s->extensions & FF_VK_EXT_DESCRIPTOR_BUFFER) {2243 if (s->extensions & FF_VK_EXT_DESCRIPTOR_BUFFER) {
2244 for (int i = 0; i < sd->nb_descriptor_sets; i++)2244 for (int i = 0; i < sd->nb_descriptor_sets; i++)
2245 offsets[i] = shd->desc_set[i].singular ? 0 : shd->desc_set[i].aligned_size*e->idx;2245 offsets[i] = shd->desc_set[i].singular ? 0 : shd->desc_set[i].aligned_size*e->idx;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t