Skip to content

Fix alignment on RID and other classes that use uint8_t opaque[SIZE]#1958

Open
dsnopek wants to merge 1 commit intogodotengine:masterfrom
dsnopek:rid-alignment
Open

Fix alignment on RID and other classes that use uint8_t opaque[SIZE]#1958
dsnopek wants to merge 1 commit intogodotengine:masterfrom
dsnopek:rid-alignment

Conversation

@dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Mar 24, 2026

Fixes #1956

Unfortunately, we don't actually have alignment information in extension_api.json, so this code has to "guess" (although, as far as I can tell the logic in here should be correct for all existing Godot builtin types).

On 64-bit builds, it appears that all of them have 8-byte alignment, but on 32-bit builds, a handful of them appear to have 4-byte alignment.

Ideally, it would be nice for the alignment to be part of the extension_api.json and for us to not change in Godot 4.x ever. An alternative would have been to standardize on an alignment of 8 for everything, but we can't do that because of the situation on 32-bit builds.

This is something we should probably discuss further with the whole GDExtension team

@dsnopek dsnopek added this to the 10.x milestone Mar 24, 2026
@dsnopek dsnopek requested a review from a team as a code owner March 24, 2026 19:37
@dsnopek dsnopek added bug This has been identified as a bug cherrypick:4.5 labels Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This has been identified as a bug cherrypick:4.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RID causes native structures to be misaligned

1 participant