History

lavfi/*vulkan: forward FFVulkanContext to SPIR-V compilers

We need to know what extensions are supported.

Lynne committed 2 years ago

Commit 0bc4e031 parent 356d1cc15 files · +29 −29Browse files

Showing the changes to libavfilter (15 of 15 files). Show all

Unified · Split

15 files
  1. libavfilter/vf_avgblur_vulkan.c +1 −1
  2. libavfilter/vf_blend_vulkan.c +1 −1
  3. libavfilter/vf_bwdif_vulkan.c +1 −1
  4. libavfilter/vf_chromaber_vulkan.c +1 −1
  5. libavfilter/vf_flip_vulkan.c +1 −1
  6. libavfilter/vf_gblur_vulkan.c +1 −1
  7. libavfilter/vf_nlmeans_vulkan.c +2 −2
  8. libavfilter/vf_overlay_vulkan.c +1 −1
  9. libavfilter/vf_scale_vulkan.c +1 −1
  10. libavfilter/vf_transpose_vulkan.c +1 −1
  11. libavfilter/vf_xfade_vulkan.c +1 −1
  12. libavfilter/vsrc_testsrc_vulkan.c +1 −1
  13. libavfilter/vulkan_glslang.c +10 −10
  14. libavfilter/vulkan_shaderc.c +4 −4
  15. libavfilter/vulkan_spirv.h +2 −2
libavfilter/vf_avgblur_vulkan.c+1−1
@@ -137,7 +137,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 136 unmodified lines
137137 }
138138 GLSLC(0, } );
139139
140− RET(spv->compile_shader(spv, ctx, &s->shd, &spv_data, &spv_len, "main",
140+ RET(spv->compile_shader(vkctx, spv, &s->shd, &spv_data, &spv_len, "main",
141141 &spv_opaque));
142142 RET(ff_vk_shader_link(vkctx, &s->shd, spv_data, spv_len, "main"));
143143
libavfilter/vf_blend_vulkan.c+1−1
@@ -208,7 +208,7 @@ static av_cold int init_filter(AVFilterContext *avctx) · 207 unmodified lines
208208 }
209209 GLSLC(0, } );
210210
211− RET(spv->compile_shader(spv, avctx, shd, &spv_data, &spv_len, "main",
211+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
212212 &spv_opaque));
213213 RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
214214
libavfilter/vf_bwdif_vulkan.c+1−1
@@ -244,7 +244,7 @@ static av_cold int init_filter(AVFilterContext *ctx) · 243 unmodified lines
244244
245245 GLSLC(0, } );
246246
247− RET(spv->compile_shader(spv, ctx, &s->shd, &spv_data, &spv_len, "main",
247+ RET(spv->compile_shader(vkctx, spv, &s->shd, &spv_data, &spv_len, "main",
248248 &spv_opaque));
249249 RET(ff_vk_shader_link(vkctx, &s->shd, spv_data, spv_len, "main"));
250250
libavfilter/vf_chromaber_vulkan.c+1−1
@@ -148,7 +148,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 147 unmodified lines
148148 }
149149 GLSLC(0, } );
150150
151− RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
151+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
152152 &spv_opaque));
153153 RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
154154
libavfilter/vf_flip_vulkan.c+1−1
@@ -121,7 +121,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType · 120 unmodified lines
121121 }
122122 GLSLC(0, } );
123123
124− RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
124+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
125125 &spv_opaque));
126126 RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
127127
libavfilter/vf_gblur_vulkan.c+1−1
@@ -169,7 +169,7 @@ static int init_gblur_pipeline(GBlurVulkanContext *s, · 168 unmodified lines
169169 }
170170 GLSLC(0, } );
171171
172− RET(spv->compile_shader(spv, s, shd, &spv_data, &spv_len, "main",
172+ RET(spv->compile_shader(&s->vkctx, spv, shd, &spv_data, &spv_len, "main",
173173 &spv_opaque));
174174 RET(ff_vk_shader_link(&s->vkctx, shd, spv_data, spv_len, "main"));
175175
libavfilter/vf_nlmeans_vulkan.c+2−2
@@ -402,7 +402,7 @@ static av_cold int init_weights_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e · 401 unmodified lines
402402
403403 GLSLC(0, } );
404404
405− RET(spv->compile_shader(spv, vkctx, shd, &spv_data, &spv_len, "main", &spv_opaque));
405+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main", &spv_opaque));
406406 RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
407407
408408 RET(ff_vk_shader_register_exec(vkctx, exec, shd));
@@ -553,7 +553,7 @@ static av_cold int init_denoise_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e · 144 unmodified lines
553553 GLSLC(1, imageStore(output_img[plane], pos, r); );
554554 GLSLC(0, } );
555555
556− RET(spv->compile_shader(spv, vkctx, shd, &spv_data, &spv_len, "main", &spv_opaque));
556+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main", &spv_opaque));
557557 RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
558558
559559 RET(ff_vk_shader_register_exec(vkctx, exec, shd));
libavfilter/vf_overlay_vulkan.c+1−1
@@ -163,7 +163,7 @@ static av_cold int init_filter(AVFilterContext *ctx) · 162 unmodified lines
163163 GLSLC(1, } );
164164 GLSLC(0, } );
165165
166− RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
166+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
167167 &spv_opaque));
168168 RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
169169
libavfilter/vf_scale_vulkan.c+1−1
@@ -247,7 +247,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 246 unmodified lines
247247 s->opts.yuv_matrix[3][3] = 1.0;
248248 }
249249
250− RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
250+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
251251 &spv_opaque));
252252 RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
253253
libavfilter/vf_transpose_vulkan.c+1−1
@@ -113,7 +113,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 112 unmodified lines
113113 }
114114 GLSLC(0, } );
115115
116− RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
116+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
117117 &spv_opaque));
118118 RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
119119
libavfilter/vf_xfade_vulkan.c+1−1
@@ -393,7 +393,7 @@ static av_cold int init_vulkan(AVFilterContext *avctx) · 392 unmodified lines
393393 GLSLC(1, } );
394394 GLSLC(0, } );
395395
396− RET(spv->compile_shader(spv, avctx, shd, &spv_data, &spv_len, "main",
396+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
397397 &spv_opaque));
398398 RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
399399
libavfilter/vsrc_testsrc_vulkan.c+1−1
@@ -179,7 +179,7 @@ static av_cold int init_filter(AVFilterContext *ctx, enum TestSrcVulkanMode mode · 178 unmodified lines
179179 }
180180 GLSLC(0, } );
181181
182− RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
182+ RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main",
183183 &spv_opaque));
184184 RET(ff_vk_shader_link(vkctx, shd, spv_data, spv_len, "main"));
185185
libavfilter/vulkan_glslang.c+10−10
@@ -136,7 +136,7 @@ static const glslang_resource_t glslc_resource_limits = { · 135 unmodified lines
136136 }
137137 };
138138
139−static int glslc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx,
139+static int glslc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx,
140140 FFVulkanShader *shd, uint8_t **data,
141141 size_t *size, const char *entrypoint,
142142 void **opaque)
@@ -183,8 +183,8 @@ static int glslc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx, · 40 unmodified lines
183183 return AVERROR(ENOMEM);
184184
185185 if (!glslang_shader_preprocess(glslc_shader, &glslc_input)) {
186− ff_vk_shader_print(avctx, shd, AV_LOG_WARNING);
187− av_log(avctx, AV_LOG_ERROR, "Unable to preprocess shader: %s (%s)!\n",
186+ ff_vk_shader_print(s, shd, AV_LOG_WARNING);
187+ av_log(s, AV_LOG_ERROR, "Unable to preprocess shader: %s (%s)!\n",
188188 glslang_shader_get_info_log(glslc_shader),
189189 glslang_shader_get_info_debug_log(glslc_shader));
190190 glslang_shader_delete(glslc_shader);
@@ -192,8 +192,8 @@ static int glslc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx, · 1 unmodified line
192192 }
193193
194194 if (!glslang_shader_parse(glslc_shader, &glslc_input)) {
195− ff_vk_shader_print(avctx, shd, AV_LOG_WARNING);
196− av_log(avctx, AV_LOG_ERROR, "Unable to parse shader: %s (%s)!\n",
195+ ff_vk_shader_print(s, shd, AV_LOG_WARNING);
196+ av_log(s, AV_LOG_ERROR, "Unable to parse shader: %s (%s)!\n",
197197 glslang_shader_get_info_log(glslc_shader),
198198 glslang_shader_get_info_debug_log(glslc_shader));
199199 glslang_shader_delete(glslc_shader);
@@ -209,8 +209,8 @@ static int glslc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx, · 9 unmodified lines
209209
210210 if (!glslang_program_link(glslc_program, GLSLANG_MSG_SPV_RULES_BIT |
211211 GLSLANG_MSG_VULKAN_RULES_BIT)) {
212− ff_vk_shader_print(avctx, shd, AV_LOG_WARNING);
213− av_log(avctx, AV_LOG_ERROR, "Unable to link shader: %s (%s)!\n",
212+ ff_vk_shader_print(s, shd, AV_LOG_WARNING);
213+ av_log(s, AV_LOG_ERROR, "Unable to link shader: %s (%s)!\n",
214214 glslang_program_get_info_log(glslc_program),
215215 glslang_program_get_info_debug_log(glslc_program));
216216 glslang_program_delete(glslc_program);
@@ -222,10 +222,10 @@ static int glslc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx, · 5 unmodified lines
222222
223223 messages = glslang_program_SPIRV_get_messages(glslc_program);
224224 if (messages) {
225− ff_vk_shader_print(avctx, shd, AV_LOG_WARNING);
226− av_log(avctx, AV_LOG_WARNING, "%s\n", messages);
225+ ff_vk_shader_print(s, shd, AV_LOG_WARNING);
226+ av_log(s, AV_LOG_WARNING, "%s\n", messages);
227227 } else {
228− ff_vk_shader_print(avctx, shd, AV_LOG_VERBOSE);
228+ ff_vk_shader_print(s, shd, AV_LOG_VERBOSE);
229229 }
230230
231231 glslang_shader_delete(glslc_shader);
libavfilter/vulkan_shaderc.c+4−4
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #include "libavutil/mem.h"
2222 #include "vulkan_spirv.h"
2323
24−static int shdc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx,
24+static int shdc_shader_compile(FFVulkanContext *s, FFVkSPIRVCompiler *ctx,
2525 FFVulkanShader *shd, uint8_t **data,
2626 size_t *size, const char *entrypoint,
2727 void **opaque)
@@ -71,11 +71,11 @@ static int shdc_shader_compile(FFVkSPIRVCompiler *ctx, void *avctx, · 43 unmodified lines
7171
7272 loglevel = err ? AV_LOG_ERROR : warn ? AV_LOG_WARNING : AV_LOG_VERBOSE;
7373
74− ff_vk_shader_print(avctx, shd, loglevel);
74+ ff_vk_shader_print(s, shd, loglevel);
7575 if (message && (err || warn))
76− av_log(avctx, loglevel, "%s\n", message);
76+ av_log(s, loglevel, "%s\n", message);
7777 status = ret < FF_ARRAY_ELEMS(shdc_result) ? shdc_result[ret] : "unknown";
78− av_log(avctx, loglevel, "shaderc compile status '%s' (%d errors, %d warnings)\n",
78+ av_log(s, loglevel, "shaderc compile status '%s' (%d errors, %d warnings)\n",
7979 status, err, warn);
8080
8181 if (err > 0)
libavfilter/vulkan_spirv.h+2−2
@@ -26,8 +26,8 @@ · 25 unmodified lines
2626
2727 typedef struct FFVkSPIRVCompiler {
2828 void *priv;
29− int (*compile_shader)(struct FFVkSPIRVCompiler *ctx, void *avctx,
30− struct FFVulkanShader *shd, uint8_t **data,
29+ int (*compile_shader)(FFVulkanContext *s, struct FFVkSPIRVCompiler *ctx,
30+ FFVulkanShader *shd, uint8_t **data,
3131 size_t *size, const char *entrypoint, void **opaque);
3232 void (*free_shader)(struct FFVkSPIRVCompiler *ctx, void **opaque);
3333 void (*uninit)(struct FFVkSPIRVCompiler **ctx);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t