#10655: scale_vulkan filter failed to generate valid shader
----------------------------------+---------------------------------------
             Reporter:  Cyryl Ł   |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avfilter  |                  Version:  unspecified
             Keywords:  vulkan    |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+---------------------------------------
 How to reproduce:
 {{{
 % ffmpeg -f lavfi -i testsrc -t 1 -pix_fmt yuv420p -init_hw_device vulkan
 -vf "hwupload=derive_device=vulkan,scale_vulkan=640:480,hwdownload"
 out.mp4
 ffmpeg version git-2023-11-11-fa81de4 Copyright (c) 2000-2023 the FFmpeg
 developers
   built with gcc 13 (Ubuntu 13.2.0-4ubuntu3)
   configuration: --disable-doc --enable-libx264 --enable-libx265 --enable-
 gpl --enable-libmp3lame --enable-libfdk-aac --enable-cuda-nvcc --enable-
 nvdec --enable-nvenc --enable-cuvid --enable-nonfree --enable-libnpp
 --enable-libglslang --disable-optimizations --disable-stripping --enable-
 debug
   libavutil      58. 32.100 / 58. 32.100
   libavcodec     60. 33.100 / 60. 33.100
   libavformat    60. 17.100 / 60. 17.100
   libavdevice    60.  4.100 / 60.  4.100
   libavfilter     9. 13.100 /  9. 13.100
   libswscale      7.  6.100 /  7.  6.100
   libswresample   4. 13.100 /  4. 13.100
   libpostproc    57.  4.100 / 57.  4.100
 Input #0, lavfi, from 'testsrc':
   Duration: N/A, start: 0.000000, bitrate: N/A
   Stream #0:0: Video: wrapped_avframe, rgb24, 320x240 [SAR 1:1 DAR 4:3],
 25 fps, 25 tbr, 25 tbn
 File 'out.mp4' already exists. Overwrite? [y/N] y
 Stream mapping:
   Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (libx264))
 Press [q] to stop, [?] for help
 [Parsed_scale_vulkan_1 @ 0x558baed49fc0] Shader scale_compute:
 1       #version 460
 2       #define IS_WITHIN(v1, v2) ((v1.x < v2.x) && (v1.y < v2.y))
 3
 4       #extension GL_EXT_buffer_reference : require
 5       #extension GL_EXT_buffer_reference2 : require
 6       layout (local_size_x = 32, local_size_y = 32, local_size_z = 1)
 in;
 7
 8       layout(push_constant, std430) uniform pushConstants {
 9           mat4 yuv_matrix;
 10      };
 11
 12      layout (set = 0, binding = 0) uniform sampler2D input_img[3];
 13      layout (set = 0, binding = 1, rgba8) uniform writeonly image2D
 output_img[3];
 14
 15
 16      vec4 scale_bilinear(int idx, ivec2 pos, vec2 crop_range, vec2
 crop_off)
 17      {
 18          vec2 npos = (vec2(pos) + 0.5f) / imageSize(output_img[idx]);
 19          npos *= crop_range;
 20          npos += crop_off;
 21          return texture(input_img[idx], npos);
 22      }
 23
 24
 25      void write_420(vec4 src, ivec2 pos)
 26      {
 27          imageStore(output_img[0], pos, vec4(src.r, 0.0, 0.0, 0.0));
 28          pos /= ivec2(2);
 29          imageStore(output_img[1], pos, vec4(src.g, 0.0, 0.0, 0.0));
 30          imageStore(output_img[2], pos, vec4(src.b, 0.0, 0.0, 0.0));
 31      }
 32
 33      void main()
 34      {
 35          ivec2 size;
 36          ivec2 pos = ivec2(gl_GlobalInvocationID.xy);
 37          vec2 in_d = vec2(320, 240);
 38          vec2 c_r = vec2(320, 240) / in_d;
 39          vec2 c_o = vec2(0, 0) / in_d;
 40
 41          size = imageSize(output_img[0]);
 42          if (IS_WITHIN(pos, size)) {
 43              vec4 res = scale_bilinear(0, pos, c_r, c_o);
 44              imageStore(output_img[0], pos, res);
 45          }
 46          size = imageSize(output_img[1]);
 47          if (IS_WITHIN(pos, size)) {
 48              vec4 res = scale_bilinear(1, pos, c_r, c_o);
 49              imageStore(output_img[1], pos, res);
 50          }
 51          size = imageSize(output_img[2]);
 52          if (IS_WITHIN(pos, size)) {
 53              vec4 res = scale_bilinear(2, pos, c_r, c_o);
 54              imageStore(output_img[2], pos, res);
 55          }
 56          size = imageSize(output_img[3]);
 57          if (IS_WITHIN(pos, size)) {
 58              vec4 res = scale_bilinear(3, pos, c_r, c_o);
 59              imageStore(output_img[3], pos, res);
 60          }
 61          size = imageSize(output_img[4]);
 62          if (IS_WITHIN(pos, size)) {
 63              vec4 res = scale_bilinear(4, pos, c_r, c_o);
 64              imageStore(output_img[4], pos, res);
 65          }
 66          size = imageSize(output_img[5]);
 67          if (IS_WITHIN(pos, size)) {
 68              vec4 res = scale_bilinear(5, pos, c_r, c_o);
 69              imageStore(output_img[5], pos, res);
 70          }
 71          size = imageSize(output_img[6]);
 72          if (IS_WITHIN(pos, size)) {
 73              vec4 res = scale_bilinear(6, pos, c_r, c_o);
 74              imageStore(output_img[6], pos, res);
 75          }
 76      }
 [Parsed_scale_vulkan_1 @ 0x558baed49fc0] Unable to parse shader: ERROR:
 0:56: '[' :  array index out of range '3'
 ERROR: 0:56: '' : compilation terminated
 ERROR: 2 compilation errors.  No code generated.

  ()!
 [vf#0:0 @ 0x558baed49b00] Error while filtering: Invalid argument
 Failed to inject frame into filter network: Invalid argument
 Error while filtering: Invalid argument
 }}}
 {{{
 % vulkaninfo --summary
 'DISPLAY' environment variable not set... skipping surface info
 error: XDG_RUNTIME_DIR is invalid or not set in the environment.
 ==========
 VULKANINFO
 ==========

 Vulkan Instance Version: 1.3.268


 Instance Extensions: count = 21
 -------------------------------
 VK_EXT_acquire_drm_display             : extension revision 1
 VK_EXT_acquire_xlib_display            : extension revision 1
 VK_EXT_debug_report                    : extension revision 10
 VK_EXT_debug_utils                     : extension revision 2
 VK_EXT_direct_mode_display             : extension revision 1
 VK_EXT_display_surface_counter         : extension revision 1
 VK_KHR_device_group_creation           : extension revision 1
 VK_KHR_display                         : extension revision 23
 VK_KHR_external_fence_capabilities     : extension revision 1
 VK_KHR_external_memory_capabilities    : extension revision 1
 VK_KHR_external_semaphore_capabilities : extension revision 1
 VK_KHR_get_display_properties2         : extension revision 1
 VK_KHR_get_physical_device_properties2 : extension revision 2
 VK_KHR_get_surface_capabilities2       : extension revision 1
 VK_KHR_portability_enumeration         : extension revision 1
 VK_KHR_surface                         : extension revision 25
 VK_KHR_surface_protected_capabilities  : extension revision 1
 VK_KHR_wayland_surface                 : extension revision 6
 VK_KHR_xcb_surface                     : extension revision 6
 VK_KHR_xlib_surface                    : extension revision 6
 VK_LUNARG_direct_driver_loading        : extension revision 1

 Instance Layers: count = 1
 --------------------------
 VK_LAYER_NV_optimus NVIDIA Optimus layer 1.3.242  version 1

 Devices:
 ========
 GPU0:
         apiVersion         = 1.3.242
         driverVersion      = 535.129.3.0
         vendorID           = 0x10de
         deviceID           = 0x1f11
         deviceType         = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
         deviceName         = NVIDIA GeForce RTX 2060
         driverID           = DRIVER_ID_NVIDIA_PROPRIETARY
         driverName         = NVIDIA
         driverInfo         = 535.129.03
         conformanceVersion = 1.3.5.0
         deviceUUID         = 4eb9d46b-89f0-71ff-5646-fedaa9f1540b
         driverUUID         = 94b0ae56-adb8-502a-bb00-b4e608864495
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10655>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

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

Reply via email to