PR #26179 opened by Forgejo_Fairy
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26179
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26179.patch

The compile-time SPIR-V conversion in 8483de2858aa removed the input binding's 
sampler initialization. Because `ff_vk_shader_add_descriptor_set()` passes the 
embedded sampler array as `pImmutableSamplers`, the zero-initialized handles 
cause `VUID-VkDescriptorSetLayoutBinding-descriptorType-00282` and a 
first-frame crash in `vkCreateDescriptorSetLayout()`.

Restore `.samplers = DUP_SAMPLER(s->sampler)` to supply the existing sampler 
for every input plane.

Fixes #26112.

Validation on Linux x86-64 with Mesa llvmpipe 25.2.8 and NVIDIA RTX 5090 driver 
595.99.02:

- Unmodified master 32a993bed1d3 crashes with the reported NV12 command on both 
drivers.
- Parent 8001b19dc8cd succeeds; 8483de2858aa crashes with the sampler VUID on 
both drivers.
- With this patch, three-frame runs using rgba, nv12, yuv420p, and yuva444p 
complete on both drivers, and the sampler VUID disappears.
- Other transfer-related validation messages also occur with the hflip_vulkan 
control; these runs are not entirely validation-clean.
- The patched NV12 command also succeeds without validation enabled, and git 
diff --check passes.

Release/9.0 and release/9.1 also reproduce the failure and are backport 
candidates after integration into master.


>From 99b6fa1dd4317d17b217d03f4e36666f54153e2d Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Wed, 18 Nov 2026 17:19:30 +0000
Subject: [PATCH] avfilter/chromaber_vulkan: restore immutable sampler binding

The compile-time SPIR-V conversion dropped the input descriptor's sampler
initialization. ff_vk_shader_add_descriptor_set() passes the embedded
samplers array as pImmutableSamplers, so leaving it zero-initialized
supplies invalid VkSampler handles to vkCreateDescriptorSetLayout().

Restore the existing sampler for every input plane. This fixes the
first-frame crash and VUID-VkDescriptorSetLayoutBinding-descriptorType-00282
on both lavapipe and NVIDIA.

Fixes: 8483de2858aa12f7c0d8274634da3e51bb2793da
Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/26112

Assisted-by: Fairy
---
 libavfilter/vf_chromaber_vulkan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_chromaber_vulkan.c 
b/libavfilter/vf_chromaber_vulkan.c
index 934aab0ee33..4dd4fa1d874 100644
--- a/libavfilter/vf_chromaber_vulkan.c
+++ b/libavfilter/vf_chromaber_vulkan.c
@@ -75,6 +75,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame 
*in)
     const FFVulkanDescriptorSetBinding desc[] = {
         { /* input_img */
             .type       = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
+            .samplers   = DUP_SAMPLER(s->sampler),
             .stages     = VK_SHADER_STAGE_COMPUTE_BIT,
             .elems      = planes,
         },
-- 
2.54.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to