GDExtension: Convert validated_call()
to ptrcall()
(rather than call()
)
This commit is contained in:
parent
bfd78bb917
commit
55596eaac6
2 changed files with 8 additions and 14 deletions
|
@ -225,29 +225,23 @@ public:
|
||||||
// This is added here, but it's unlikely to be provided by most extensions.
|
// This is added here, but it's unlikely to be provided by most extensions.
|
||||||
validated_call_func(method_userdata, extension_instance, reinterpret_cast<GDExtensionConstVariantPtr *>(p_args), (GDExtensionVariantPtr)r_ret);
|
validated_call_func(method_userdata, extension_instance, reinterpret_cast<GDExtensionConstVariantPtr *>(p_args), (GDExtensionVariantPtr)r_ret);
|
||||||
} else {
|
} else {
|
||||||
#if 1
|
|
||||||
// Slow code-path, but works for the time being.
|
|
||||||
Callable::CallError ce;
|
|
||||||
call(p_object, p_args, argument_count, ce);
|
|
||||||
#else
|
|
||||||
// This is broken, because it needs more information to do the calling properly
|
|
||||||
|
|
||||||
// If not provided, go via ptrcall, which is faster than resorting to regular call.
|
// If not provided, go via ptrcall, which is faster than resorting to regular call.
|
||||||
const void **argptrs = (const void **)alloca(argument_count * sizeof(void *));
|
const void **argptrs = (const void **)alloca(argument_count * sizeof(void *));
|
||||||
for (uint32_t i = 0; i < argument_count; i++) {
|
for (uint32_t i = 0; i < argument_count; i++) {
|
||||||
argptrs[i] = VariantInternal::get_opaque_pointer(p_args[i]);
|
argptrs[i] = VariantInternal::get_opaque_pointer(p_args[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool returns = true;
|
void *ret_opaque = nullptr;
|
||||||
void *ret_opaque;
|
if (r_ret) {
|
||||||
if (returns) {
|
VariantInternal::initialize(r_ret, return_value_info.type);
|
||||||
ret_opaque = VariantInternal::get_opaque_pointer(r_ret);
|
ret_opaque = VariantInternal::get_opaque_pointer(r_ret);
|
||||||
} else {
|
|
||||||
ret_opaque = nullptr; // May be unnecessary as this is ignored, but just in case.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrcall(p_object, argptrs, ret_opaque);
|
ptrcall(p_object, argptrs, ret_opaque);
|
||||||
#endif
|
|
||||||
|
if (r_ret && r_ret->get_type() == Variant::OBJECT) {
|
||||||
|
VariantInternal::update_object_id(r_ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -418,7 +418,7 @@ public:
|
||||||
case Variant::PACKED_COLOR_ARRAY:
|
case Variant::PACKED_COLOR_ARRAY:
|
||||||
return get_color_array(v);
|
return get_color_array(v);
|
||||||
case Variant::OBJECT:
|
case Variant::OBJECT:
|
||||||
return v->_get_obj().obj;
|
return get_object(v);
|
||||||
case Variant::VARIANT_MAX:
|
case Variant::VARIANT_MAX:
|
||||||
ERR_FAIL_V(nullptr);
|
ERR_FAIL_V(nullptr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue