GDExtension: Convert validated_call()
to ptrcall()
(rather than call()
)
#82794
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.
Presently, if you do a
validated_call()
to a GDExtension method, and the GDExtension doesn't provide special support for validated calls (very unlikely), then it will convert that to acall()
. This will be much slower than necessary, since we know all the argument types match - it would be better to do aptrcall()
.Right now, this isn't that important, because GDScript will do
ptrcall()
s directly (when possible), but PR #79893 would switch GDScript to doingvalidated_call()
.So, this PR changes
validated_call()
to GDExtension methods to useptrcall()
.I've tested this PR, in combination with PR #79893, and it seems to be working fine (the automated godot-cpp tests pass).
It also fixes an issue in
Object::get_opaque_pointer()
that was missed in PR #77410. That PR made the same change to the const version ofObject::get_opaque_pointer()
, but missed it for the non-const version. We didn't notice, because we were only using it for function arguments (which are const), and in this PR we start using it for function return values as well (which are non-const).