-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PhysicsDirectSpaceState3D::RayResult
is not correctly bound
#80444
Comments
RayResult
is incompatible with extensions targeting 4.1PhysicsDirectSpaceState3D::RayResult
is incompatible with extensions targeting 4.1
PhysicsDirectSpaceState3D::RayResult
is incompatible with extensions targeting 4.1PhysicsDirectSpaceState3D::RayResult
is not correctly bound
Just to clarify, the MRP here does technically use an extension that targets 9704596 (4.1-stable), but this is not an issue of being incompatible with 4.1 (despite my previous poorly chosen title). Even if you update the extension to use the latest |
Would simply updating the binding be an acceptable short-term fix? |
It might be a good idea to do it just to get things to a somewhat correct state, although that will presumably introduce a CI failure (from To my knowledge the only extension affected by this is Godot Jolt, and even if the binding were to be updated it'd still be incompatible since Godot Jolt expects the |
Hm. Is If the former, then we can do as @mihe suggests and move the Do we also have an issue about how to handle the process side of this in the future? We need to come up with a way for these sort of breaking changes to not slip through so easily. |
For the problem of catching these sort of issues in the future, I wonder if we could put the Godot struct's size into the
This wouldn't catch re-ordering of the struct's fields (which would also break compatibility), but it would have caught the issue here when a new field is added. |
That specific struct is only ever instantiated from Godot and written to through a pointer from GDExtension, so the workaround would suffice in this particular case. However, this type of workaround wouldn't work for some imaginary future breakage of things like
That sounds like it would be an improvement at least, in terms of catching any added/removed fields.
Not that I'm aware of. |
This may be a silly idea, but could we somehow generate a hash from the type names in the struct, so it changes if fields are reordered, removed or added? |
I assume that means that you're feeding the types and names into some place for it to be hashed, at which point you might as well just replace |
This is exactly how we're planning on handling changes to structs in Doing this in the engine itself (ie not isolated to
I think we could maybe wrap the whole original |
We should revisit this ideally before beta 1, so we don't have to break compatibility further during beta. |
Eek, did we not actually fix the compatibility break here? At minimum, we should move the |
Yeah, I'm cooking up a PR for it as we speak. |
PR for moving |
Godot version
4.2.dev [f7bc653]
System information
Windows 11 (10.0.22621)
Issue description
#71233 introduced a new field to
RayResult
calledface_index
, as seen here:godot/servers/physics_server_3d.h
Lines 151 to 159 in f7bc653
... but unfortunately the binding for
RayResult
(aliased asPhysicsServer3DExtensionRayResult
) wasn't updated, as seen here:godot/servers/register_server_types.cpp
Line 160 in f7bc653
... which leads to
extension_api.json
being emitted with a different struct layout forPhysicsServer3DExtensionRayResult
compared to Godot'sRayResult
.Since
PhysicsDirectSpaceState3DExtension::_intersect_ray
directly manipulates a pointer to aRayResult
, you end up corrupting it when writing to anything past thenormal
field from a GDExtension, due to mismatching binary layouts.Steps to reproduce
Minimal reproduction project
RayResult_MRP.zip
The text was updated successfully, but these errors were encountered: