From 977d1a24bc01ad2a9674f7bc749c6dc4adde0e13 Mon Sep 17 00:00:00 2001 From: Lynne Date: Fri, 23 May 2025 05:11:07 +0900 Subject: [PATCH] vulkan/ffv1: fix sync issue in cached bitstream reader/writer The issue is that there is an explicit lack of synchronization as only the very first invocation writes symbols and updates the state, which other invocations then store. --- libavcodec/vulkan/ffv1_dec.comp | 2 ++ libavcodec/vulkan/ffv1_enc.comp | 1 + 2 files changed, 3 insertions(+) diff --git a/libavcodec/vulkan/ffv1_dec.comp b/libavcodec/vulkan/ffv1_dec.comp index 1d33b32c6b..a90bac321b 100644 --- a/libavcodec/vulkan/ffv1_dec.comp +++ b/libavcodec/vulkan/ffv1_dec.comp @@ -110,6 +110,8 @@ void decode_line(inout SliceContext sc, ivec2 sp, int w, #ifdef CACHED_SYMBOL_READER } + + barrier(); sb.v = state[gl_LocalInvocationID.x]; #endif } diff --git a/libavcodec/vulkan/ffv1_enc.comp b/libavcodec/vulkan/ffv1_enc.comp index 65a7df1359..78372f5b3a 100644 --- a/libavcodec/vulkan/ffv1_enc.comp +++ b/libavcodec/vulkan/ffv1_enc.comp @@ -107,6 +107,7 @@ void encode_line(inout SliceContext sc, readonly uimage2D img, uint state_off, put_symbol(sc.c, context_off, d[1]); #ifdef CACHED_SYMBOL_READER + barrier(); sb.v = state[gl_LocalInvocationID.x]; #endif }