Skip to content
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

GDExtension API has changed ! (a bit) #19

Closed
touilleMan opened this issue Nov 8, 2022 · 5 comments · Fixed by #27
Closed

GDExtension API has changed ! (a bit) #19

touilleMan opened this issue Nov 8, 2022 · 5 comments · Fixed by #27
Labels
c: ffi Low-level components and interaction with GDExtension API quality-of-life No new functionality, but improves ergonomics/internals

Comments

@touilleMan
Copy link

This is friendly note so that you don't freak out when seeing this project it broken against Godot's master 😃

see godotengine/godot#67750 & godotengine/godot-cpp#896

Basically GDExtension API uses StringName (almost) everywhere instead of the char *. On top of that the way to register proerties has been simplified.

@Bromeon
Copy link
Member

Bromeon commented Nov 8, 2022

Thanks for the heads-up! 👍

No worries, change detection of the GDExtension header has already been automated, outputting a descriptive diff 😉

Nevertheless it's even nicer to have a descriptive changeset, so I appreciate being proactive! I also wrote a comment regarding godotengine/godot#61968, which might now be mitigated or even fully solved.

I might then use this issue to track the progress of implementing those changes.

@Bromeon Bromeon added quality-of-life No new functionality, but improves ergonomics/internals c: ffi Low-level components and interaction with GDExtension API labels Nov 8, 2022
@touilleMan
Copy link
Author

No worries, change detection of the GDExtension header has already been automated, outputting a descriptive diff wink

That's pretty sweet !

which might now be mitigated or even fully solved

I think the issue is fully solved, however it would be even better to entirely remove the get_property_list an replace it by an array passed where get_property_list function pointer is currently provided.
This would simplify the API and remove the ambiguity that get_property_list might get called multiple time and can return different result each time it is called (to support dynamically adding property, which is of course not a thing in Godot)

What do you think ?

@Bromeon
Copy link
Member

Bromeon commented Nov 9, 2022

however it would be even better to entirely remove the get_property_list an replace it by an array passed where get_property_list function pointer is currently provided.

You mean when the class is registered, one would provide an array of all properties?

I think that might be ideal, because then the extension library can forget (aka deallocate) the property meta-information once registered. I might need to check the implementation to make sure I'm not missing something though 🙂

@touilleMan
Copy link
Author

I think that might be ideal

I will try to find time to submit a PR to Godot then, and I'll ping you for the review then 😃

I might need to check the implementation to make sure I'm not missing something though

Please do ! My guess is the GDExtension API use this "function to pass constant values" pattern only because it leaks it C++ implementation where generics are implemented with templates and function argument specialization 😄

@touilleMan
Copy link
Author

@Bromeon see godotengine/godot#68479 ;-)

Hapenia-Lans pushed a commit to Hapenia-Lans/gdextension that referenced this issue May 26, 2023
# This is the 1st commit message:

Parse gdextension_interface.h declarations using regex

# This is the commit message #2:

AsUninit trait to convert FFI pointers to their uninitialized versions

# This is the commit message godot-rust#3:

GodotFfi::from_sys_init() now uses uninitialized pointer types

# This is the commit message godot-rust#4:

Introduce GDExtensionUninitialized*Ptr, without changing semantics

# This is the commit message godot-rust#5:

Adjust init code to new get_proc_address mechanism

# This is the commit message godot-rust#6:

Make `trace` feature available in godot-ffi, fix interface access before initialization

# This is the commit message godot-rust#7:

Compatibility layer between Godot 4.0 and 4.1 (different GDExtension APIs)

# This is the commit message godot-rust#8:

Add GdextBuild to access build/runtime metadata

# This is the commit message godot-rust#9:

Detect 4.0 <-> 4.1 mismatches in both directions + missing `compatibility_minimum = 4.1`

# This is the commit message godot-rust#10:

Detect legacy/modern version of C header (also without `custom-godot` feature)

# This is the commit message godot-rust#11:

CI: add jobs that use patched 4.0.x versions

# This is the commit message godot-rust#12:

Remove several memory leaks by constructing into uninitialized pointers

# This is the commit message godot-rust#13:

CI: memcheck jobs for both 4.0.3 and nightly

# This is the commit message godot-rust#14:

Remove ToVariant, FromVariant, and VariantMetadata impls for pointers

This commit splits SignatureTuple into two separate traits:
PtrcallSignatureTuple and VarcallSignatureTuple. The latter is a child
of the former. PtrcallSignatureTuple is used for ptrcall and only
demands GodotFuncMarshall of its arguments. VarcallSignatureTuple is
used for varcall and additionally demands ToVariant, FromVariant, and
VariantMetadata of its arguments, so pointers cannot benefit from the
optimizations provided by varcall over ptrcall.

# This is the commit message godot-rust#15:

Adds FromVariant and ToVariant proc macros

# This is the commit message godot-rust#16:

godot-core: builtin: reimplement Plane functions/methods

# This is the commit message godot-rust#17:

impl GodotFfi for Option<T> when T is pointer sized and nullable godot-rust#240

Additionally FromVariant and ToVariant are also implemented for Option<Gd<T>>
to satisfy all the requirements for ffi and godot_api.

# This is the commit message godot-rust#18:

Fix UB in virtual method calls that take objects
Fix incorrect incrementing of refcount when calling in to godot
Fix refcount not being incremented when we receive a refcounted object in virtual methods

# This is the commit message godot-rust#19:

fix UB caused by preload weirdness

# This is the commit message godot-rust#20:

Implements swizzle and converts from/to tuples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: ffi Low-level components and interaction with GDExtension API quality-of-life No new functionality, but improves ergonomics/internals
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants