[FFmpeg-cvslog] lavfi/*vulkan: forward FFVulkanContext to SPIR-V compilers
Lynne
git at videolan.org
Fri Oct 4 11:28:37 EEST 2024
ffmpeg | branch: master | Lynne <dev at lynne.ee> | Thu Oct 3 07:27:37 2024 +0200| [0bc4e03322c7564572ed4f939ba5d1145d28d113] | committer: Lynne
lavfi/*vulkan: forward FFVulkanContext to SPIR-V compilers
We need to know what extensions are supported.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0bc4e03322c7564572ed4f939ba5d1145d28d113
---
libavfilter/vf_avgblur_vulkan.c | 2 +-
libavfilter/vf_blend_vulkan.c | 2 +-
libavfilter/vf_bwdif_vulkan.c | 2 +-
libavfilter/vf_chromaber_vulkan.c | 2 +-
libavfilter/vf_flip_vulkan.c | 2 +-
libavfilter/vf_gblur_vulkan.c | 2 +-
libavfilter/vf_nlmeans_vulkan.c | 4 ++--
libavfilter/vf_overlay_vulkan.c | 2 +-
libavfilter/vf_scale_vulkan.c | 2 +-
libavfilter/vf_transpose_vulkan.c | 2 +-
libavfilter/vf_xfade_vulkan.c | 2 +-
libavfilter/vsrc_testsrc_vulkan.c | 2 +-
libavfilter/vulkan_glslang.c | 20 ++++++++++----------
libavfilter/vulkan_shaderc.c | 8 ++++----
libavfilter/vulkan_spirv.h | 4 ++--
15 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c
index 3972ea0cbb..9214ebcc0f 100644
--- a/libavfilter/vf_avgblur_vulkan.c
+++ b/libavfilter/vf_avgblur_vulkan.c
@@ -137,7 +137,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
}
GLSLC(0, } );
- RET(spv->compile_shader(spv, ctx, &s->shd, &spv_data, &spv_len, "main",
+ RET(spv->compile_shader(vkctx, spv, &s->shd, &spv_data, &spv_len, "main",
&spv_opaque));
RET(ff_vk_shader_link(vkctx, &s->shd, spv_data, spv_len, "main"));
diff --git a/libavfilter/vf_blend_vulkan.c b/libavfilter/vf_blend_vulkan.c
index ccc025fe6b..406b087503 100644
--- a/libavfilter/vf_blend_vulkan.c
+++ b/libavfilter/vf_blend_vulkan.c
@@ -208,7 +208,7 @@ static av_cold int init_filter(AVFilterContext *avctx)
}
GLSLC(0, } );
- RET(spv->compile_shader(spv, avctx, shd, &spv_data, &spv_len, "main",
+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
&spv_opaque));
RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
diff --git a/libavfilter/vf_bwdif_vulkan.c b/libavfilter/vf_bwdif_vulkan.c
index 3164eb3395..2ea9512fcb 100644
--- a/libavfilter/vf_bwdif_vulkan.c
+++ b/libavfilter/vf_bwdif_vulkan.c
@@ -244,7 +244,7 @@ static av_cold int init_filter(AVFilterContext *ctx)
GLSLC(0, } );
- RET(spv->compile_shader(spv, ctx, &s->shd, &spv_data, &spv_len, "main",
+ RET(spv->compile_shader(vkctx, spv, &s->shd, &spv_data, &spv_len, "main",
&spv_opaque));
RET(ff_vk_shader_link(vkctx, &s->shd, spv_data, spv_len, "main"));
diff --git a/libavfilter/vf_chromaber_vulkan.c b/libavfilter/vf_chromaber_vulkan.c
index 450715b36c..8a62e514fa 100644
--- a/libavfilter/vf_chromaber_vulkan.c
+++ b/libavfilter/vf_chromaber_vulkan.c
@@ -148,7 +148,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
}
GLSLC(0, } );
- RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
&spv_opaque));
RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
diff --git a/libavfilter/vf_flip_vulkan.c b/libavfilter/vf_flip_vulkan.c
index 2b89a9a6a3..3e0a7ebc85 100644
--- a/libavfilter/vf_flip_vulkan.c
+++ b/libavfilter/vf_flip_vulkan.c
@@ -121,7 +121,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType
}
GLSLC(0, } );
- RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
&spv_opaque));
RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c
index a56a6ece00..9632a084e4 100644
--- a/libavfilter/vf_gblur_vulkan.c
+++ b/libavfilter/vf_gblur_vulkan.c
@@ -169,7 +169,7 @@ static int init_gblur_pipeline(GBlurVulkanContext *s,
}
GLSLC(0, } );
- RET(spv->compile_shader(spv, s, shd, &spv_data, &spv_len, "main",
+ RET(spv->compile_shader(&s->vkctx, spv, shd, &spv_data, &spv_len, "main",
&spv_opaque));
RET(ff_vk_shader_link(&s->vkctx, shd, spv_data, spv_len, "main"));
diff --git a/libavfilter/vf_nlmeans_vulkan.c b/libavfilter/vf_nlmeans_vulkan.c
index b413194035..9ad12eb7b6 100644
--- a/libavfilter/vf_nlmeans_vulkan.c
+++ b/libavfilter/vf_nlmeans_vulkan.c
@@ -402,7 +402,7 @@ static av_cold int init_weights_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e
GLSLC(0, } );
- RET(spv->compile_shader(spv, vkctx, shd, &spv_data, &spv_len, "main", &spv_opaque));
+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main", &spv_opaque));
RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
RET(ff_vk_shader_register_exec(vkctx, exec, shd));
@@ -553,7 +553,7 @@ static av_cold int init_denoise_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e
GLSLC(1, imageStore(output_img[plane], pos, r); );
GLSLC(0, } );
- RET(spv->compile_shader(spv, vkctx, shd, &spv_data, &spv_len, "main", &spv_opaque));
+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main", &spv_opaque));
RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
RET(ff_vk_shader_register_exec(vkctx, exec, shd));
diff --git a/libavfilter/vf_overlay_vulkan.c b/libavfilter/vf_overlay_vulkan.c
index f1ad27167e..3af2482772 100644
--- a/libavfilter/vf_overlay_vulkan.c
+++ b/libavfilter/vf_overlay_vulkan.c
@@ -163,7 +163,7 @@ static av_cold int init_filter(AVFilterContext *ctx)
GLSLC(1, } );
GLSLC(0, } );
- RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
&spv_opaque));
RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
index e39bc62aa8..95cc25f8d7 100644
--- a/libavfilter/vf_scale_vulkan.c
+++ b/libavfilter/vf_scale_vulkan.c
@@ -247,7 +247,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
s->opts.yuv_matrix[3][3] = 1.0;
}
- RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
&spv_opaque));
RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
diff --git a/libavfilter/vf_transpose_vulkan.c b/libavfilter/vf_transpose_vulkan.c
index c3282339af..8ab782cc79 100644
--- a/libavfilter/vf_transpose_vulkan.c
+++ b/libavfilter/vf_transpose_vulkan.c
@@ -113,7 +113,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
}
GLSLC(0, } );
- RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
&spv_opaque));
RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
diff --git a/libavfilter/vf_xfade_vulkan.c b/libavfilter/vf_xfade_vulkan.c
index c230f5d833..0b6f1350fb 100644
--- a/libavfilter/vf_xfade_vulkan.c
+++ b/libavfilter/vf_xfade_vulkan.c
@@ -393,7 +393,7 @@ static av_cold int init_vulkan(AVFilterContext *avctx)
GLSLC(1, } );
GLSLC(0, } );
- RET(spv->compile_shader(spv, avctx, shd, &spv_data, &spv_len, "main",
+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
&spv_opaque));
RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
diff --git a/libavfilter/vsrc_testsrc_vulkan.c b/libavfilter/vsrc_testsrc_vulkan.c
index bfef38ce51..0641beed5b 100644
--- a/libavfilter/vsrc_testsrc_vulkan.c
+++ b/libavfilter/vsrc_testsrc_vulkan.c
@@ -179,7 +179,7 @@ static av_cold int init_filter(AVFilterContext *ctx, enum TestSrcVulkanMode mode
}
GLSLC(0, } );
- RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
&spv_opaque));
RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
diff --git a/libavfilter/vulkan_glslang.c b/libavfilter/vulkan_glslang.c
index 3c1b0a8fe6..7ac7d6b2c4 100644
--- a/libavfilter/vulkan_glslang.c
+++ b/libavfilter/vulkan_glslang.c
@@ -136,7 +136,7 @@ static const glslang_resource_t glslc_resource_limits = {
}
};
-static int glslc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx,
+static int glslc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx,
FFVulkanShader *shd, uint8_t **data,
size_t *size, const char *entrypoint,
void **opaque)
@@ -183,8 +183,8 @@ static int glslc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx,
return AVERROR(ENOMEM);
if (!glslang_shader_preprocess(glslc_shader, &glslc_input)) {
- ff_vk_shader_print(avctx, shd, AV_LOG_WARNING);
- av_log(avctx, AV_LOG_ERROR, "Unable to preprocess shader: %s (%s)!\n",
+ ff_vk_shader_print(s, shd, AV_LOG_WARNING);
+ av_log(s, AV_LOG_ERROR, "Unable to preprocess shader: %s (%s)!\n",
glslang_shader_get_info_log(glslc_shader),
glslang_shader_get_info_debug_log(glslc_shader));
glslang_shader_delete(glslc_shader);
@@ -192,8 +192,8 @@ static int glslc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx,
}
if (!glslang_shader_parse(glslc_shader, &glslc_input)) {
- ff_vk_shader_print(avctx, shd, AV_LOG_WARNING);
- av_log(avctx, AV_LOG_ERROR, "Unable to parse shader: %s (%s)!\n",
+ ff_vk_shader_print(s, shd, AV_LOG_WARNING);
+ av_log(s, AV_LOG_ERROR, "Unable to parse shader: %s (%s)!\n",
glslang_shader_get_info_log(glslc_shader),
glslang_shader_get_info_debug_log(glslc_shader));
glslang_shader_delete(glslc_shader);
@@ -209,8 +209,8 @@ static int glslc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx,
if (!glslang_program_link(glslc_program, GLSLANG_MSG_SPV_RULES_BIT |
GLSLANG_MSG_VULKAN_RULES_BIT)) {
- ff_vk_shader_print(avctx, shd, AV_LOG_WARNING);
- av_log(avctx, AV_LOG_ERROR, "Unable to link shader: %s (%s)!\n",
+ ff_vk_shader_print(s, shd, AV_LOG_WARNING);
+ av_log(s, AV_LOG_ERROR, "Unable to link shader: %s (%s)!\n",
glslang_program_get_info_log(glslc_program),
glslang_program_get_info_debug_log(glslc_program));
glslang_program_delete(glslc_program);
@@ -222,10 +222,10 @@ static int glslc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx,
messages = glslang_program_SPIRV_get_messages(glslc_program);
if (messages) {
- ff_vk_shader_print(avctx, shd, AV_LOG_WARNING);
- av_log(avctx, AV_LOG_WARNING, "%s\n", messages);
+ ff_vk_shader_print(s, shd, AV_LOG_WARNING);
+ av_log(s, AV_LOG_WARNING, "%s\n", messages);
} else {
- ff_vk_shader_print(avctx, shd, AV_LOG_VERBOSE);
+ ff_vk_shader_print(s, shd, AV_LOG_VERBOSE);
}
glslang_shader_delete(glslc_shader);
diff --git a/libavfilter/vulkan_shaderc.c b/libavfilter/vulkan_shaderc.c
index d2bd60e7ef..56a2c0eef5 100644
--- a/libavfilter/vulkan_shaderc.c
+++ b/libavfilter/vulkan_shaderc.c
@@ -21,7 +21,7 @@
#include "libavutil/mem.h"
#include "vulkan_spirv.h"
-static int shdc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx,
+static int shdc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx,
FFVulkanShader *shd, uint8_t **data,
size_t *size, const char *entrypoint,
void **opaque)
@@ -71,11 +71,11 @@ static int shdc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx,
loglevel = err ? AV_LOG_ERROR : warn ? AV_LOG_WARNING : AV_LOG_VERBOSE;
- ff_vk_shader_print(avctx, shd, loglevel);
+ ff_vk_shader_print(s, shd, loglevel);
if (message && (err || warn))
- av_log(avctx, loglevel, "%s\n", message);
+ av_log(s, loglevel, "%s\n", message);
status = ret < FF_ARRAY_ELEMS(shdc_result) ? shdc_result[ret] : "unknown";
- av_log(avctx, loglevel, "shaderc compile status '%s' (%d errors, %d warnings)\n",
+ av_log(s, loglevel, "shaderc compile status '%s' (%d errors, %d warnings)\n",
status, err, warn);
if (err > 0)
diff --git a/libavfilter/vulkan_spirv.h b/libavfilter/vulkan_spirv.h
index c46c9e52da..d008804ab2 100644
--- a/libavfilter/vulkan_spirv.h
+++ b/libavfilter/vulkan_spirv.h
@@ -26,8 +26,8 @@
typedef struct FFVkSPIRVCompiler {
void *priv;
- int (*compile_shader)(struct FFVkSPIRVCompiler *ctx, void *avctx,
- struct FFVulkanShader *shd, uint8_t **data,
+ int (*compile_shader)(FFVulkanContext *s, struct FFVkSPIRVCompiler *ctx,
+ FFVulkanShader *shd, uint8_t **data,
size_t *size, const char *entrypoint, void **opaque);
void (*free_shader)(struct FFVkSPIRVCompiler *ctx, void **opaque);
void (*uninit)(struct FFVkSPIRVCompiler **ctx);
More information about the ffmpeg-cvslog
mailing list