Merge pull request #78971 from kisg/fix_gdvirtual_native_ptr

Fix `GDVIRTUAL_NATIVE_PTR` by adding missing `VariantInternalAccessor` specializations
This commit is contained in:
Rémi Verschelde 2023-07-03 15:26:24 +02:00
commit b9dfb4968a
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -70,6 +70,11 @@ struct GDExtensionPtr {
} \
}; \
template <> \
struct VariantInternalAccessor<GDExtensionConstPtr<const m_type>> { \
static _FORCE_INLINE_ const GDExtensionConstPtr<const m_type> &get(const Variant *v) { return *reinterpret_cast<const GDExtensionConstPtr<const m_type> *>(VariantInternal::get_int(v)); } \
static _FORCE_INLINE_ void set(Variant *v, const GDExtensionConstPtr<const m_type> &p_value) { *VariantInternal::get_int(v) = uint64_t(p_value.data); } \
}; \
template <> \
struct GDExtensionPtr<m_type> { \
m_type *data = nullptr; \
GDExtensionPtr() {} \
@ -83,6 +88,11 @@ struct GDExtensionPtr {
static _FORCE_INLINE_ GDExtensionPtr<m_type> cast(const Variant &p_variant) { \
return GDExtensionPtr<m_type>((m_type *)p_variant.operator uint64_t()); \
} \
}; \
template <> \
struct VariantInternalAccessor<GDExtensionPtr<m_type>> { \
static _FORCE_INLINE_ const GDExtensionPtr<m_type> &get(const Variant *v) { return *reinterpret_cast<const GDExtensionPtr<m_type> *>(VariantInternal::get_int(v)); } \
static _FORCE_INLINE_ void set(Variant *v, const GDExtensionPtr<m_type> &p_value) { *VariantInternal::get_int(v) = uint64_t(p_value.data); } \
};
template <class T>