This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit e9e698f482589285049a58ee7a3286f9af37405c
Author:     Lynne <[email protected]>
AuthorDate: Wed Sep 9 01:09:50 2026 +0900
Commit:     Lynne <[email protected]>
CommitDate: Sun Sep 20 17:19:11 2026 +0900

    vulkan: clamp GET_BITS_SMEM refills to the end of the bitstream
    
    FILL_SMEM read up to 16*GET_BITS_SMEM bytes past the end of the buffer.
    At the default depth of 4 that is exactly AV_INPUT_BUFFER_PADDING_SIZE,
    so it only worked by coincidence; deeper windows faulted.
    
    Clamp lines past the end onto the last line; nothing reads them. Issuing
    each line as its own load is also ~3% faster than one indexed fetch.
---
 libavcodec/vulkan/common.glsl | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vulkan/common.glsl b/libavcodec/vulkan/common.glsl
index c8057ba7ae..27a38531a9 100644
--- a/libavcodec/vulkan/common.glsl
+++ b/libavcodec/vulkan/common.glsl
@@ -276,13 +276,17 @@ struct GetBitContext {
 shared u32vec4 
gb_storage[gl_WorkGroupSize.x*gl_WorkGroupSize.y*gl_WorkGroupSize.z*GET_BITS_SMEM];
 
 /* Requires a line-aligned address; LOAD64() absorbs the origin's offset,
- * so refills land on line boundaries. */
+ * so refills land on line boundaries. Lines past the end of the buffer
+ * are clamped to the last one to avoid reading past the padding. */
 #define FILL_SMEM(addr)                                                        
 \
     {                                                                          
 \
-        u32vec4buf ptr = u32vec4buf(addr);                                     
 \
+        uint64_t gb_last_line = max(gb.buf_start & ~uint64_t(15),              
 \
+                                    (gb.buf_end - 1) & ~uint64_t(15));         
 \
         [[unroll]]                                                             
 \
-        for (uint i = 0; i < GET_BITS_SMEM; ++i)                               
 \
-            gb_storage[gl_LocalInvocationIndex * GET_BITS_SMEM + i] = 
ptr[i].v; \
+        for (uint i = 0; i < GET_BITS_SMEM; ++i) {                             
 \
+            u32vec4buf ptr = u32vec4buf(min((addr) + 16*i, gb_last_line));     
 \
+            gb_storage[gl_LocalInvocationIndex * GET_BITS_SMEM + i] = 
ptr[0].v; \
+        }                                                                      
 \
     }
 
 #define LOAD64()                                              \

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to