though if I just use the 2d to create the 3d we will end up with T*[][], will that still work?
though if I just use the 2d to create the 3d we will end up with T*[][], will that still work?
NullPtr. basically just go over the existing manual types and see if there's anything missing from the generated ones (as this is basically what i'm doing now)just realised this is not possible also (ref struct as generics, iirc this is why I included the very vague "unless the Silk.NET team deem it inappropriate or inapplicable" language)public static implicit operator PTRMUTPTR(Span<PTRMUT> span) => new(ref span.GetPinnableReference());
still implicitpublic static implicit operator void***(PTRMUTPTR<T> ptr) => (void***)Unsafe.AsPointer(ref Unsafe.AsRef(in ptr.Ref));
this doesn't feel correct, mainly because we're not using the value ofpublic static bool operator !=(object? lh, PTRMUTPTR<T> rh) => lh == null ? (void*)rh != null : true;
lh, we're just null checkingshould bepublic MUT(ref readonly T @Ref)
ref T IL.Emit.Ldarg_0();
IL.Emit.Ldc_I4_0();
IL.Emit.Ldelema(TypeRef.Type(typeof(T).MakePointerType()));
IL.Emit.Newobj(
MethodRef.Constructor(
TypeRef.Type(typeof(ConstPtr2D<>).MakeGenericType(typeof(T))),
TypeRef.Type(typeof(ConstPtr<>).MakeGenericType(typeof(T)).MakeByRefType())
)
);
IL.Emit.Ret();
throw IL.Unreachable(); NullPtr public static implicit operator PTRMUTPTR(Span<PTRMUT> span) => new(ref span.GetPinnableReference());Silk.NET.Everything.RunGame("a twin stick shooter where the player shoots cuboids and they explode into smaller cuboids"); public static implicit operator void***(PTRMUTPTR<T> ptr) => (void***)Unsafe.AsPointer(ref Unsafe.AsRef(in ptr.Ref)); public static bool operator !=(object? lh, PTRMUTPTR<T> rh) => lh == null ? (void*)rh != null : true;lh public MUT(ref readonly T @Ref)ref T- public static T*[] JaggedArrayToPointerArray<T>(ReadOnlySpan<T[]> array)
+ public static T**[] JaggedArrayToPointerArray<T>(ReadOnlySpan<T[][]> array)
where T : unmanaged
{
- var ret = new T*[array.Length];
+ var ret = new T**[array.Length];
for (var i = 0; i < array.Length; i++)
{
- var handle = GCHandle.Alloc(array[i], GCHandleType.Pinned);
+ var handle = GCHandle.Alloc(JaggedArrayToPointerArray(array[i]), GCHandleType.Pinned);
var sentinel = new GCHandleSentinel(handle);
var dep = new DependentHandle(ret, sentinel);
if (!dep.IsAllocated)
{
throw new InvalidOperationException(
"Failed to allocate dependent handle to keep string alive"
);
}
sentinel.DependentHandle = dep;
- ret[i] = (T*)handle.AddrOfPinnedObject();
+ ret[i] = (T**)handle.AddrOfPinnedObject();
}
return ret;
}Silk.NET.Everything.RunGame();