Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -35,7 +35,6 @@ typedef struct TransposeVulkanContext { · 34 unmodified lines | |||
| 35 | FFVkExecPool e; | 35 | FFVkExecPool e; |
| 36 | AVVulkanDeviceQueueFamily *qf; | 36 | AVVulkanDeviceQueueFamily *qf; |
| 37 | FFVulkanShader shd; | 37 | FFVulkanShader shd; |
| 38 | VkSampler sampler; | ||
| 39 | 38 | ||
| 40 | int dir; | 39 | int dir; |
| 41 | int passthrough; | 40 | int passthrough; |
| @@ -69,7 +68,6 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 27 unmodified lines | |||
| 69 | } | 68 | } |
| 70 | 69 | ||
| 71 | RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL)); | 70 | 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)); | ||
| 73 | RET(ff_vk_shader_init(vkctx, &s->shd, "transpose", | 71 | RET(ff_vk_shader_init(vkctx, &s->shd, "transpose", |
| 74 | VK_SHADER_STAGE_COMPUTE_BIT, | 72 | VK_SHADER_STAGE_COMPUTE_BIT, |
| 75 | NULL, 0, | 73 | NULL, 0, |
| @@ -79,11 +77,12 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 3 unmodified lines | |||
| 79 | desc = (FFVulkanDescriptorSetBinding []) { | 77 | desc = (FFVulkanDescriptorSetBinding []) { |
| 80 | { | 78 | { |
| 81 | .name = "input_images", | 79 | .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", | ||
| 83 | .dimensions = 2, | 83 | .dimensions = 2, |
| 84 | .elems = planes, | 84 | .elems = planes, |
| 85 | .stages = VK_SHADER_STAGE_COMPUTE_BIT, | 85 | .stages = VK_SHADER_STAGE_COMPUTE_BIT, |
| 86 | .samplers = DUP_SAMPLER(s->sampler), | ||
| 87 | }, | 86 | }, |
| 88 | { | 87 | { |
| 89 | .name = "output_images", | 88 | .name = "output_images", |
| @@ -107,13 +106,13 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 17 unmodified lines | |||
| 107 | GLSLF(1, size = imageSize(output_images[%i]); ,i); | 106 | GLSLF(1, size = imageSize(output_images[%i]); ,i); |
| 108 | GLSLC(1, if (IS_WITHIN(pos, size)) { ); | 107 | GLSLC(1, if (IS_WITHIN(pos, size)) { ); |
| 109 | if (s->dir == TRANSPOSE_CCLOCK) | 108 | 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); |
| 111 | else if (s->dir == TRANSPOSE_CLOCK_FLIP || s->dir == TRANSPOSE_CLOCK) { | 110 | 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); |
| 113 | if (s->dir == TRANSPOSE_CLOCK) | 112 | if (s->dir == TRANSPOSE_CLOCK) |
| 114 | GLSLC(2, pos = ivec2(pos.x, size.y - pos.y); ); | 113 | GLSLC(2, pos = ivec2(pos.x, size.y - pos.y); ); |
| 115 | } else | 114 | } 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); |
| 117 | GLSLF(2, imageStore(output_images[%i], pos, res); ,i); | 116 | GLSLF(2, imageStore(output_images[%i], pos, res); ,i); |
| 118 | GLSLC(1, } ); | 117 | GLSLC(1, } ); |
| 119 | } | 118 | } |
| @@ -157,7 +156,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 37 unmodified lines | |||
| 157 | RET(init_filter(ctx, in)); | 156 | RET(init_filter(ctx, in)); |
| 158 | 157 | ||
| 159 | RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd, out, in, | 158 | 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)); |
| 161 | 160 | ||
| 162 | RET(av_frame_copy_props(out, in)); | 161 | RET(av_frame_copy_props(out, in)); |
| 163 | 162 | ||
| @@ -182,15 +181,10 @@ static av_cold void transpose_vulkan_uninit(AVFilterContext *avctx) · 18 unmodified lines | |||
| 182 | { | 181 | { |
| 183 | TransposeVulkanContext *s = avctx->priv; | 182 | TransposeVulkanContext *s = avctx->priv; |
| 184 | FFVulkanContext *vkctx = &s->vkctx; | 183 | FFVulkanContext *vkctx = &s->vkctx; |
| 185 | FFVulkanFunctions *vk = &vkctx->vkfn; | ||
| 186 | 184 | ||
| 187 | ff_vk_exec_pool_free(vkctx, &s->e); | 185 | ff_vk_exec_pool_free(vkctx, &s->e); |
| 188 | ff_vk_shader_free(vkctx, &s->shd); | 186 | ff_vk_shader_free(vkctx, &s->shd); |
| 189 | 187 | ||
| 190 | if (s->sampler) | ||
| 191 | vk->DestroySampler(vkctx->hwctx->act_dev, s->sampler, | ||
| 192 | vkctx->hwctx->alloc); | ||
| 193 | |||
| 194 | ff_vk_uninit(&s->vkctx); | 188 | ff_vk_uninit(&s->vkctx); |
| 195 | 189 | ||
| 196 | s->initialized = 0; | 190 | s->initialized = 0; |