mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
lavfi/*vulkan: forward FFVulkanContext to SPIR-V compilers
We need to know what extensions are supported.
This commit is contained in:
parent
356d1cc8ff
commit
0bc4e03322
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user