Repository navigation
Fix YUV->RGB compute pipeline never executing on Godot 4.7 (push constant size) - #77
Merged
EIREXE merged 1 commit intoOct 7, 2026
Conversation
Godot 4.7's RenderingDevice now strictly validates the push constant
size against what the compute shader declares. yuv_to_rgb.glsl declares
a 4-byte push constant (bool use_alpha), but
FFmpegVideoStreamPlayback::draw() uploads the full 16-byte padded
struct (PushConstant { uint32_t use_alpha; uint8_t padding[11]; }).
compute_list_set_push_constant() is therefore rejected on every frame
("This compute pipeline requires (4) bytes of push constant data,
supplied: (16)") and the pipeline never executes, so decoded YUV frames
are never converted: video shows nothing under the Forward+/Mobile
renderers on Godot 4.7+ (Vulkan logs the error every frame; D3D12
fails silently). Reproduced on Godot 4.7.2 stable; see issue EIRTeam#76.
Pass only the 4 bytes the shader actually declares, skipping the
padding. This stays correct on older Godot versions, where the check
only requires the upload to be at least the declared size.
Verified on Godot 4.7.2 stable / Forward+ (Vulkan and D3D12, Intel
iGPU): 1440p@120 H.264 video renders correctly and the per-frame push
constant errors are gone (0 errors). Built via gdextension_build
SCons pipeline with mingw gcc 16.2.
|
This fix works great. |
Contributor
|
My apolocheese for the delay, I will review it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Godot 4.7's RenderingDevice now strictly validates the push constant size against what the compute shader declares.
yuv_to_rgb.glsldeclares a 4-byte push constant (bool use_alpha), butFFmpegVideoStreamPlayback::draw()uploads the full 16-byte padded struct (PushConstant { uint32_t use_alpha; uint8_t padding[11]; }).compute_list_set_push_constant()is therefore rejected on every frame:and the pipeline never executes, so decoded YUV frames are never converted: video shows nothing under the Forward+/Mobile renderers on Godot 4.7+ (Vulkan logs the error every frame; D3D12 fails silently).
This is the same issue reported in #76 — @EIREXE identified the breaking RD API change there, but the fix hasn't landed yet, so this PR proposes it.
Fix
Pass only the 4 bytes the shader actually declares, skipping the struct padding:
This stays correct on older Godot versions, where the check only requires the upload to be at least the declared size.
Verification
a 1440p@120 H.264 video renders correctly and the per-frame push constant errors are
gone (0 errors, previously 2 errors per rendered frame).
gdextension_buildSCons pipeline (mingw gcc 16.2,ffmpeg_pathpointingat the godot FFmpeg build);
both
template_debugandtemplate_releasedlls verified in a real project.