[FFmpeg-cvslog] vulkan: enable using .elems field for buffer content definitions

Lynne git at videolan.org
Tue Jan 21 17:10:45 EET 2025


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Tue Jan 21 17:22:20 2025 +0900| [5c59e6ce19118a62e1b1fe183196e18e7cbe18a8] | committer: Lynne

vulkan: enable using .elems field for buffer content definitions

This avoids needing to snprintf when the buffer only contains an array of a struct,
while letting the validation layers detect errors more reliably.

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

 libavutil/vulkan.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 7315af928f..d3ada59334 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -2188,10 +2188,18 @@ print:
 
         GLSLA(" %s", desc[i].name);
 
-        if (prop->buf_content)
-            GLSLA(" {\n    %s\n}", desc[i].buf_content);
-        else if (desc[i].elems > 0)
+        if (prop->buf_content) {
+            GLSLA(" {\n    ");
+            if (desc[i].elems) {
+                GLSLA("%s", desc[i].buf_content);
+                GLSLA("[%i];", desc[i].elems);
+            } else {
+                GLSLA("%s", desc[i].buf_content);
+            }
+            GLSLA("\n}");
+        } else if (desc[i].elems > 0) {
             GLSLA("[%i]", desc[i].elems);
+        }
 
         GLSLA(";");
         GLSLA("\n");



More information about the ffmpeg-cvslog mailing list