// allocationCallbacks externally owned, must outlive this object. public static void _ctor(ref D3D12MA_Vector <T> pThis, [NativeTypeName("const D3D12MA_ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks) { pThis.m_AllocationCallbacks = allocationCallbacks; pThis.m_pArray = null; pThis.m_Count = 0; pThis.m_Capacity = 0; }
internal static void *Malloc([NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocs, [NativeTypeName("size_t")] nuint size, [NativeTypeName("size_t")] nuint alignment) { void *result = allocs->pAllocate(size, alignment, allocs->pUserData); D3D12MA_ASSERT((D3D12MA_DEBUG_LEVEL > 0) && (result != null)); return(result); }
internal static void D3D12MA_DELETE_ARRAY <T>([NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocs, T *memory, [NativeTypeName("size_t")] nuint count) where T : unmanaged { if (memory != null) { Free(allocs, memory); } }
internal static void D3D12MA_DELETE <T>([NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocs, T *memory) where T : unmanaged, IDisposable { if (memory != null) { memory->Dispose(); Free(allocs, memory); } }
// allocationCallbacks externally owned, must outlive this object. public static void _ctor(ref D3D12MA_PoolAllocator <T> pThis, [NativeTypeName("D3D12MA_ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks, [NativeTypeName("UINT")] uint firstBlockCapacity) { pThis.m_AllocationCallbacks = allocationCallbacks; pThis.m_FirstBlockCapacity = firstBlockCapacity; D3D12MA_Vector <ItemBlock> ._ctor(ref pThis.m_ItemBlocks, allocationCallbacks); D3D12MA_ASSERT((D3D12MA_DEBUG_LEVEL > 0) && (pThis.m_FirstBlockCapacity > 1)); }
public D3D12MA_JsonWriter([NativeTypeName("const D3D12MA_ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks, [NativeTypeName("StringBuilder&")] D3D12MA_StringBuilder *stringBuilder) { m_SB = stringBuilder; Unsafe.SkipInit(out m_Stack); D3D12MA_Vector <StackItem> ._ctor(ref m_Stack, allocationCallbacks); m_InsideString = false; }
// allocationCallbacks externally owned, must outlive this object. public static void _ctor(ref D3D12MA_List <T> pThis, [NativeTypeName("const D3D12MA_ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks) { pThis.m_AllocationCallbacks = allocationCallbacks; D3D12MA_PoolAllocator <Item> ._ctor(ref pThis.m_ItemAllocator, allocationCallbacks, 128); pThis.m_pFront = null; pThis.m_pBack = null; pThis.m_Count = 0; }
public static void _ctor(ref D3D12MA_VirtualBlockPimpl pThis, D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks, [NativeTypeName("UINT64")] ulong size) { pThis.m_AllocationCallbacks = *allocationCallbacks; pThis.m_Size = size; D3D12MA_BlockMetadata_Generic._ctor(ref pThis.m_Metadata, (D3D12MA_ALLOCATION_CALLBACKS *)Unsafe.AsPointer(ref pThis.m_AllocationCallbacks), true); // isVirtual pThis.m_Metadata.Init(pThis.m_Size); }
public D3D12MA_BlockMetadata([NativeTypeName("const D3D12MA_ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks, bool isVirtual) { lpVtbl = Vtbl; m_Size = 0; m_IsVirtual = (byte)(isVirtual ? 1 : 0); m_pAllocationCallbacks = allocationCallbacks; D3D12MA_ASSERT((D3D12MA_DEBUG_LEVEL > 0) && (allocationCallbacks != null)); }
internal static T *D3D12MA_NEW <T>([NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocs) where T : unmanaged { T *p = Allocate <T>(allocs); if (p != null) { *p = default; return(p); } return(TRY_D3D12MA_NEW <T>(allocs)); }
internal static T *D3D12MA_NEW_ARRAY <T>([NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocs, nuint count) where T : unmanaged { T *p = AllocateArray <T>(allocs, count); if (p != null) { ZeroMemory(p, (nuint)sizeof(T) * count); return(p); } return(TRY_D3D12MA_NEW_ARRAY <T>(allocs, count)); }
internal static void SetupAllocationCallbacks([NativeTypeName("ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *outAllocs, [NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks) { if (allocationCallbacks != null) { *outAllocs = *allocationCallbacks; D3D12MA_ASSERT((D3D12MA_DEBUG_LEVEL > 0) && (outAllocs->pAllocate != null) && (outAllocs->pFree != null)); } else { outAllocs->pAllocate = &DefaultAllocate; outAllocs->pFree = &DefaultFree; outAllocs->pUserData = null; } }
internal static void _ctor(ref D3D12MA_BlockMetadata_Generic pThis, [NativeTypeName("const D3D12MA_ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks, bool isVirtual) { pThis.Base = new D3D12MA_BlockMetadata(allocationCallbacks, isVirtual); pThis.Base.lpVtbl = Vtbl; pThis.m_FreeCount = 0; pThis.m_SumFreeSize = 0; D3D12MA_List <D3D12MA_Suballocation> ._ctor(ref pThis.m_Suballocations, allocationCallbacks); D3D12MA_Vector <D3D12MA_List <D3D12MA_Suballocation> .iterator> ._ctor(ref pThis.m_FreeSuballocationsBySize, allocationCallbacks); Unsafe.SkipInit(out pThis.m_ZeroInitializedRange); D3D12MA_ASSERT((D3D12MA_DEBUG_LEVEL > 0) && (allocationCallbacks != null)); }
private static T *TRY_D3D12MA_NEW_ARRAY <T>(D3D12MA_ALLOCATION_CALLBACKS *allocs, nuint count) where T : unmanaged { T *p = null; while (p == null) { delegate * unmanaged[Cdecl] < void > h = win32_std_get_new_handler(); if (h == null) { Environment.Exit(ENOMEM); } h(); p = AllocateArray <T>(allocs, count); } Unsafe.InitBlock(p, 0, (uint)(sizeof(T) * (int)count)); return(p); }
private static T *TRY_D3D12MA_NEW <T>(D3D12MA_ALLOCATION_CALLBACKS *allocs) where T : unmanaged { T *p = null; while (p == null) { delegate * unmanaged[Cdecl] < void > h = win32_std_get_new_handler(); if (h == null) { Environment.Exit(ENOMEM); } h(); p = Allocate <T>(allocs); } *p = default; return(p); }
internal static void _ctor(ref D3D12MA_VirtualBlock pThis, [NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks, [NativeTypeName("const VIRTUAL_BLOCK_DESC&")] D3D12MA_VIRTUAL_BLOCK_DESC *desc) { pThis.m_Pimpl = D3D12MA_NEW <D3D12MA_VirtualBlockPimpl>(allocationCallbacks); D3D12MA_VirtualBlockPimpl._ctor(ref *pThis.m_Pimpl, allocationCallbacks, desc->Size); }
internal static T *AllocateArray <T>([NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocs, [NativeTypeName("size_t")] nuint count) where T : unmanaged { return((T *)Malloc(allocs, (nuint)sizeof(T) * count, __alignof <T>())); }
internal static void Free([NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocs, void *memory) { allocs->pFree(memory, allocs->pUserData); }
public D3D12MA_StringBuilder(D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks) { Unsafe.SkipInit(out m_Data); D3D12MA_Vector <ushort> ._ctor(ref m_Data, allocationCallbacks); }
public static void _ctor(ref D3D12MA_Vector <T> pThis, [NativeTypeName("size_t")] nuint count, [NativeTypeName("const D3D12MA_ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks) { pThis.m_AllocationCallbacks = allocationCallbacks; pThis.m_pArray = (count != 0) ? AllocateArray <T>(allocationCallbacks, count) : null; pThis.m_Count = count; pThis.m_Capacity = count; }
internal static void _ctor(ref D3D12MA_VirtualBlock pThis, [NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks, [NativeTypeName("const VIRTUAL_BLOCK_DESC&")] D3D12MA_VIRTUAL_BLOCK_DESC *desc) { _ctor(ref pThis, allocationCallbacks, desc->Size); }
internal static void _ctor(ref D3D12MA_Allocator pThis, [NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocationCallbacks, [NativeTypeName("const ALLOCATOR_DESC&")] D3D12MA_ALLOCATOR_DESC *desc) { pThis.m_Pimpl = D3D12MA_NEW <D3D12MA_AllocatorPimpl>(allocationCallbacks); D3D12MA_AllocatorPimpl._ctor(ref *pThis.m_Pimpl, allocationCallbacks, desc); }
internal static void D3D12MA_DELETE <T>([NativeTypeName("const ALLOCATION_CALLBACKS&")] D3D12MA_ALLOCATION_CALLBACKS *allocs, ref T memory) where T : unmanaged, IDisposable { D3D12MA_DELETE(allocs, (T *)Unsafe.AsPointer(ref memory)); }