|
@@ -0,0 +1,313 @@
|
|
|
+using System.Runtime.CompilerServices;
|
|
|
+
|
|
|
+namespace Godot.NativeInterop;
|
|
|
+
|
|
|
+// Ref structs are not allowed as generic type parameters, so we can't use Unsafe.AsPointer<T>/AsRef<T>.
|
|
|
+// As a workaround we create our own overloads for our structs with some tricks under the hood.
|
|
|
+
|
|
|
+public static class CustomUnsafe
|
|
|
+{
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_ref* AsPointer(ref godot_ref value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_ref* ReadOnlyRefAsPointer(in godot_ref value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_ref AsRef(godot_ref* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_ref AsRef(in godot_ref source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_variant_call_error* AsPointer(ref godot_variant_call_error value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_variant_call_error* ReadOnlyRefAsPointer(in godot_variant_call_error value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_variant_call_error AsRef(godot_variant_call_error* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_variant_call_error AsRef(in godot_variant_call_error source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_variant* AsPointer(ref godot_variant value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_variant* ReadOnlyRefAsPointer(in godot_variant value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_variant AsRef(godot_variant* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_variant AsRef(in godot_variant source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_string* AsPointer(ref godot_string value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_string* ReadOnlyRefAsPointer(in godot_string value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_string AsRef(godot_string* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_string AsRef(in godot_string source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_string_name* AsPointer(ref godot_string_name value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_string_name* ReadOnlyRefAsPointer(in godot_string_name value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_string_name AsRef(godot_string_name* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_string_name AsRef(in godot_string_name source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_node_path* AsPointer(ref godot_node_path value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_node_path* ReadOnlyRefAsPointer(in godot_node_path value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_node_path AsRef(godot_node_path* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_node_path AsRef(in godot_node_path source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_signal* AsPointer(ref godot_signal value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_signal* ReadOnlyRefAsPointer(in godot_signal value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_signal AsRef(godot_signal* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_signal AsRef(in godot_signal source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_callable* AsPointer(ref godot_callable value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_callable* ReadOnlyRefAsPointer(in godot_callable value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_callable AsRef(godot_callable* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_callable AsRef(in godot_callable source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_array* AsPointer(ref godot_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_array* ReadOnlyRefAsPointer(in godot_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_array AsRef(godot_array* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_array AsRef(in godot_array source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_dictionary* AsPointer(ref godot_dictionary value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_dictionary* ReadOnlyRefAsPointer(in godot_dictionary value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_dictionary AsRef(godot_dictionary* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_dictionary AsRef(in godot_dictionary source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_byte_array* AsPointer(ref godot_packed_byte_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_byte_array* ReadOnlyRefAsPointer(in godot_packed_byte_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_byte_array AsRef(godot_packed_byte_array* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_byte_array AsRef(in godot_packed_byte_array source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_int32_array* AsPointer(ref godot_packed_int32_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_int32_array* ReadOnlyRefAsPointer(in godot_packed_int32_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_int32_array AsRef(godot_packed_int32_array* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_int32_array AsRef(in godot_packed_int32_array source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_int64_array* AsPointer(ref godot_packed_int64_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_int64_array* ReadOnlyRefAsPointer(in godot_packed_int64_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_int64_array AsRef(godot_packed_int64_array* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_int64_array AsRef(in godot_packed_int64_array source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_float32_array* AsPointer(ref godot_packed_float32_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_float32_array* ReadOnlyRefAsPointer(in godot_packed_float32_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_float32_array AsRef(godot_packed_float32_array* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_float32_array AsRef(in godot_packed_float32_array source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_float64_array* AsPointer(ref godot_packed_float64_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_float64_array* ReadOnlyRefAsPointer(in godot_packed_float64_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_float64_array AsRef(godot_packed_float64_array* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_float64_array AsRef(in godot_packed_float64_array source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_string_array* AsPointer(ref godot_packed_string_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_string_array* ReadOnlyRefAsPointer(in godot_packed_string_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_string_array AsRef(godot_packed_string_array* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_string_array AsRef(in godot_packed_string_array source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_vector2_array* AsPointer(ref godot_packed_vector2_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_vector2_array* ReadOnlyRefAsPointer(in godot_packed_vector2_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_vector2_array AsRef(godot_packed_vector2_array* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_vector2_array AsRef(in godot_packed_vector2_array source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_vector3_array* AsPointer(ref godot_packed_vector3_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_vector3_array* ReadOnlyRefAsPointer(in godot_packed_vector3_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_vector3_array AsRef(godot_packed_vector3_array* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_vector3_array AsRef(in godot_packed_vector3_array source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_color_array* AsPointer(ref godot_packed_color_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe godot_packed_color_array* ReadOnlyRefAsPointer(in godot_packed_color_array value)
|
|
|
+ => value.GetUnsafeAddress();
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_color_array AsRef(godot_packed_color_array* source)
|
|
|
+ => ref *source;
|
|
|
+
|
|
|
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
|
+ public static unsafe ref godot_packed_color_array AsRef(in godot_packed_color_array source)
|
|
|
+ => ref *ReadOnlyRefAsPointer(in source);
|
|
|
+}
|