History

transpose_vulkan: port to imageLoad()

Lynne committed 1 year ago

Commit 379cfd11 parent b02f9151 file · +7 −13Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_transpose_vulkan.c+7−13
@@ -35,7 +35,6 @@ typedef struct TransposeVulkanContext { · 34 unmodified lines
3535 FFVkExecPool e;
3636 AVVulkanDeviceQueueFamily *qf;
3737 FFVulkanShader shd;
38− VkSampler sampler;
3938
4039 int dir;
4140 int passthrough;
@@ -69,7 +68,6 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 27 unmodified lines
6968 }
7069
7170 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
72− RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR));
7371 RET(ff_vk_shader_init(vkctx, &s->shd, "transpose",
7472 VK_SHADER_STAGE_COMPUTE_BIT,
7573 NULL, 0,
@@ -79,11 +77,12 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 3 unmodified lines
7977 desc = (FFVulkanDescriptorSetBinding []) {
8078 {
8179 .name = "input_images",
82− .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
80+ .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
81+ .mem_layout = ff_vk_shader_rep_fmt(s->vkctx.input_format, FF_VK_REP_FLOAT),
82+ .mem_quali = "readonly",
8383 .dimensions = 2,
8484 .elems = planes,
8585 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
86− .samplers = DUP_SAMPLER(s->sampler),
8786 },
8887 {
8988 .name = "output_images",
@@ -107,13 +106,13 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 17 unmodified lines
107106 GLSLF(1, size = imageSize(output_images[%i]); ,i);
108107 GLSLC(1, if (IS_WITHIN(pos, size)) { );
109108 if (s->dir == TRANSPOSE_CCLOCK)
110− GLSLF(2, vec4 res = texture(input_images[%i], ivec2(size.y - pos.y, pos.x)); ,i);
109+ GLSLF(2, vec4 res = imageLoad(input_images[%i], ivec2(size.y - pos.y, pos.x)); ,i);
111110 else if (s->dir == TRANSPOSE_CLOCK_FLIP || s->dir == TRANSPOSE_CLOCK) {
112− GLSLF(2, vec4 res = texture(input_images[%i], ivec2(size.yx - pos.yx)); ,i);
111+ GLSLF(2, vec4 res = imageLoad(input_images[%i], ivec2(size.yx - pos.yx)); ,i);
113112 if (s->dir == TRANSPOSE_CLOCK)
114113 GLSLC(2, pos = ivec2(pos.x, size.y - pos.y); );
115114 } else
116− GLSLF(2, vec4 res = texture(input_images[%i], pos.yx); ,i);
115+ GLSLF(2, vec4 res = imageLoad(input_images[%i], pos.yx); ,i);
117116 GLSLF(2, imageStore(output_images[%i], pos, res); ,i);
118117 GLSLC(1, } );
119118 }
@@ -157,7 +156,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 37 unmodified lines
157156 RET(init_filter(ctx, in));
158157
159158 RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd, out, in,
160− s->sampler, NULL, 0));
159+ VK_NULL_HANDLE, NULL, 0));
161160
162161 RET(av_frame_copy_props(out, in));
163162
@@ -182,15 +181,10 @@ static av_cold void transpose_vulkan_uninit(AVFilterContext *avctx) · 18 unmodified lines
182181 {
183182 TransposeVulkanContext *s = avctx->priv;
184183 FFVulkanContext *vkctx = &s->vkctx;
185− FFVulkanFunctions *vk = &vkctx->vkfn;
186184
187185 ff_vk_exec_pool_free(vkctx, &s->e);
188186 ff_vk_shader_free(vkctx, &s->shd);
189187
190− if (s->sampler)
191− vk->DestroySampler(vkctx->hwctx->act_dev, s->sampler,
192− vkctx->hwctx->alloc);
193−
194188 ff_vk_uninit(&s->vkctx);
195189
196190 s->initialized = 0;

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