public D3D12_HEAP_DESC([NativeTypeName("UINT64")] ulong size, D3D12_HEAP_TYPE type, [NativeTypeName("UINT64")] ulong alignment = 0, D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE) { SizeInBytes = size; Properties = new D3D12_HEAP_PROPERTIES(type); Alignment = alignment; Flags = flags; }
internal static void _ctor(ref D3D12MA_Pool pThis, ref D3D12MA_Allocator allocator, [NativeTypeName("const D3D12MA_POOL_DESC&")] D3D12MA_POOL_DESC *desc) { D3D12MA_IUnknownImpl._ctor(ref pThis.m_IUnknownImpl, Vtbl); pThis.m_Allocator = (D3D12MA_Allocator *)Unsafe.AsPointer(ref allocator); pThis.m_Desc = *desc; pThis.m_BlockVector = null; pThis.m_Name = null; pThis.m_PrevPool = null; pThis.m_NextPool = null; bool explicitBlockSize = desc->BlockSize != 0; ulong preferredBlockSize = explicitBlockSize ? desc->BlockSize : D3D12MA_DEFAULT_BLOCK_SIZE; D3D12_HEAP_FLAGS heapFlags = desc->HeapFlags; uint maxBlockCount = desc->MaxBlockCount != 0 ? desc->MaxBlockCount : uint.MaxValue; pThis.m_BlockVector = D3D12MA_NEW <D3D12MA_BlockVector>(allocator.GetAllocs()); D3D12MA_BlockVector._ctor( ref *pThis.m_BlockVector, (D3D12MA_Allocator *)Unsafe.AsPointer(ref allocator), &desc->HeapProperties, heapFlags, preferredBlockSize, desc->MinBlockCount, maxBlockCount, explicitBlockSize, D3D12MA_MAX(desc->MinAllocationAlignment, D3D12MA_DEBUG_ALIGNMENT) ); }
private static ulong GetAlignment(D3D12_HEAP_FLAGS heapFlags) { const D3D12_HEAP_FLAGS denyAllTexturesFlags = D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES; var canContainAnyTextures = (heapFlags & denyAllTexturesFlags) != denyAllTexturesFlags; return(canContainAnyTextures ? D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT : D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT); }
public D3D12_HEAP_DESC([NativeTypeName("UINT64")] ulong size, D3D12_CPU_PAGE_PROPERTY cpuPageProperty, D3D12_MEMORY_POOL memoryPoolPreference, [NativeTypeName("UINT64")] ulong alignment = 0, D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE) { SizeInBytes = size; Properties = new D3D12_HEAP_PROPERTIES(cpuPageProperty, memoryPoolPreference); Alignment = alignment; Flags = flags; }
/// <summary> /// Create a new upload buffer /// </summary> /// <param name="device">The device to create the buffer on</param> /// <param name="resourceDesc">The resource to create</param> /// <param name="state">The initial state of the buffer</param> /// <param name="flags">Any other heap flags</param> public UploadBuffer( ID3D12Device *device, D3D12_RESOURCE_DESC resourceDesc, D3D12_RESOURCE_STATES state, D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE) : base(device, resourceDesc, state, D3D12_HEAP_TYPE.D3D12_HEAP_TYPE_UPLOAD, flags) { }
/// <summary> /// Create a new default buffer /// </summary> /// <param name="device">The device to create the buffer on</param> /// <param name="resourceDesc">The resource to create</param> /// <param name="state">The initial state of the buffer</param> /// <param name="flags">Any other heap flags</param> /// <param name="optimizedClearValue">If not <code>null</code>, the optimized clear value for the buffer</param> public DefaultResource( ID3D12Device *device, D3D12_RESOURCE_DESC resourceDesc, D3D12_RESOURCE_STATES state, D3D12_HEAP_FLAGS flags = D3D12_HEAP_FLAG_NONE, D3D12_CLEAR_VALUE?optimizedClearValue = null ) : base(device, resourceDesc, state, D3D12_HEAP_TYPE.D3D12_HEAP_TYPE_DEFAULT, flags, optimizedClearValue) { }
public D3D12MA_MemoryBlock(D3D12MA_Allocator *allocator, [NativeTypeName("const D3D12_HEAP_PROPERTIES&")] D3D12_HEAP_PROPERTIES *heapProps, D3D12_HEAP_FLAGS heapFlags, [NativeTypeName("UINT64")] ulong size, [NativeTypeName("UINT")] uint id) { lpVtbl = Vtbl; m_Allocator = allocator; m_HeapProps = *heapProps; m_HeapFlags = heapFlags; m_Size = size; m_Id = id; m_Heap = null; }
public D3D12MA_MemoryBlock(D3D12MA_AllocatorPimpl *allocator, D3D12_HEAP_TYPE heapType, D3D12_HEAP_FLAGS heapFlags, [NativeTypeName("UINT64")] ulong size, [NativeTypeName("UINT")] uint id) { lpVtbl = Vtbl; m_Allocator = allocator; m_HeapType = heapType; m_HeapFlags = heapFlags; m_Size = size; m_Id = id; m_Heap = null; }
public virtual int GetHeapProperties( out D3D12_HEAP_PROPERTIES pHeapProperties, out D3D12_HEAP_FLAGS pHeapFlags ) { var fp = GetFunctionPointer(14); if (m_GetHeapPropertiesFunc == null) { m_GetHeapPropertiesFunc = (GetHeapPropertiesFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(GetHeapPropertiesFunc)); } return(m_GetHeapPropertiesFunc(m_ptr, out pHeapProperties, out pHeapFlags)); }
/// <summary> /// Creates a new <see cref="GpuResourceDesc"/> /// </summary> /// <param name="resourceFormat">The <see cref="GpuResourceFormat"/> describing the resource format and dimensions</param> /// <param name="gpuMemoryType">The type of GPU memory this resource will be on</param> /// <param name="initialState">The initial state of the resource</param> /// <param name="allocFlags">Any additional allocation flags passed to the allocator</param> /// <param name="clearValue">If this resource is a texture, the clear value for which it is optimised</param> /// <param name="heapFlags">Any additional flags used for creating or selecting the allocation heap</param> public GpuResourceDesc( GpuResourceFormat resourceFormat, GpuMemoryType gpuMemoryType, D3D12_RESOURCE_STATES initialState, GpuAllocFlags allocFlags = GpuAllocFlags.None, D3D12_CLEAR_VALUE?clearValue = null, D3D12_HEAP_FLAGS heapFlags = D3D12_HEAP_FLAGS.D3D12_HEAP_FLAG_NONE ) { ResourceFormat = resourceFormat; GpuMemoryType = gpuMemoryType; InitialState = initialState; AllocFlags = allocFlags; ClearValue = clearValue; HeapFlags = heapFlags; }
public virtual int CreateCommittedResource( ref D3D12_HEAP_PROPERTIES pHeapProperties, D3D12_HEAP_FLAGS HeapFlags, ref D3D12_RESOURCE_DESC pDesc, D3D12_RESOURCE_STATES InitialResourceState, ref D3D12_CLEAR_VALUE pOptimizedClearValue, ref Guid riidResource, out IntPtr ppvResource ) { var fp = GetFunctionPointer(27); if (m_CreateCommittedResourceFunc == null) { m_CreateCommittedResourceFunc = (CreateCommittedResourceFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(CreateCommittedResourceFunc)); } return(m_CreateCommittedResourceFunc(m_ptr, ref pHeapProperties, HeapFlags, ref pDesc, InitialResourceState, ref pOptimizedClearValue, ref riidResource, out ppvResource)); }
internal static void _ctor(ref D3D12MA_PoolPimpl pThis, D3D12MA_AllocatorPimpl *allocator, [NativeTypeName("const D3D12MA_POOL_DESC&")] D3D12MA_POOL_DESC *desc) { pThis.m_Allocator = allocator; pThis.m_Desc = *desc; pThis.m_BlockVector = null; pThis.m_Name = null; bool explicitBlockSize = desc->BlockSize != 0; ulong preferredBlockSize = explicitBlockSize ? desc->BlockSize : D3D12MA_DEFAULT_BLOCK_SIZE; D3D12_HEAP_FLAGS heapFlags = desc->HeapFlags; uint maxBlockCount = desc->MaxBlockCount != 0 ? desc->MaxBlockCount : uint.MaxValue; pThis.m_BlockVector = D3D12MA_NEW <D3D12MA_BlockVector>(allocator->GetAllocs()); D3D12MA_BlockVector._ctor( ref *pThis.m_BlockVector, allocator, desc->HeapType, heapFlags, preferredBlockSize, desc->MinBlockCount, maxBlockCount, explicitBlockSize ); }
internal static void _ctor(ref D3D12MA_BlockVector pThis, D3D12MA_AllocatorPimpl *hAllocator, D3D12_HEAP_TYPE heapType, D3D12_HEAP_FLAGS heapFlags, [NativeTypeName("UINT64")] ulong preferredBlockSize, [NativeTypeName("size_t")] nuint minBlockCount, [NativeTypeName("size_t")] nuint maxBlockCount, bool explicitBlockSize) { pThis.m_hAllocator = hAllocator; pThis.m_HeapType = heapType; pThis.m_HeapFlags = heapFlags; pThis.m_PreferredBlockSize = preferredBlockSize; pThis.m_MinBlockCount = minBlockCount; pThis.m_MaxBlockCount = maxBlockCount; pThis.m_ExplicitBlockSize = explicitBlockSize; pThis.m_MinBytes = 0; pThis.m_HasEmptyBlock = false; D3D12MA_Vector <Pointer <D3D12MA_NormalBlock> > ._ctor(ref pThis.m_Blocks, hAllocator->GetAllocs()); pThis.m_NextBlockId = 0; D3D12MA_RW_MUTEX._ctor(ref pThis.m_Mutex); }
internal D3D12GraphicsMemoryBlockCollection(D3D12GraphicsDevice device, D3D12GraphicsMemoryAllocator allocator, D3D12_HEAP_FLAGS d3d12HeapFlags, D3D12_HEAP_TYPE d3d12HeapType) : base(device, allocator) { _d3d12HeapFlags = d3d12HeapFlags; _d3d12HeapType = d3d12HeapType; }
public static void _ctor(ref D3D12MA_NormalBlock pThis, D3D12MA_AllocatorPimpl *allocator, ref D3D12MA_BlockVector blockVector, D3D12_HEAP_TYPE heapType, D3D12_HEAP_FLAGS heapFlags, [NativeTypeName("UINT64")] ulong size, [NativeTypeName("UINT")] uint id) { pThis.Base = new D3D12MA_MemoryBlock(allocator, heapType, heapFlags, size, id); pThis.Base.lpVtbl = Vtbl; pThis.m_pMetadata = null; pThis.m_BlockVector = (D3D12MA_BlockVector *)Unsafe.AsPointer(ref blockVector); }
public int CreateCommittedResource([NativeTypeName("const D3D12_HEAP_PROPERTIES *")] D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags, [NativeTypeName("const D3D12_RESOURCE_DESC *")] D3D12_RESOURCE_DESC *pDesc, D3D12_RESOURCE_STATES InitialResourceState, [NativeTypeName("const D3D12_CLEAR_VALUE *")] D3D12_CLEAR_VALUE *pOptimizedClearValue, [NativeTypeName("const IID &")] Guid *riidResource, [NativeTypeName("void **")] void **ppvResource) { return(((delegate * unmanaged <ID3D12Device *, D3D12_HEAP_PROPERTIES *, D3D12_HEAP_FLAGS, D3D12_RESOURCE_DESC *, D3D12_RESOURCE_STATES, D3D12_CLEAR_VALUE *, Guid *, void **, int>)(lpVtbl[27]))((ID3D12Device *)Unsafe.AsPointer(ref this), pHeapProperties, HeapFlags, pDesc, InitialResourceState, pOptimizedClearValue, riidResource, ppvResource)); }
internal static void _ctor(ref D3D12MA_BlockVector pThis, D3D12MA_Allocator *hAllocator, [NativeTypeName("const D3D12_HEAP_PROPERTIES&")] D3D12_HEAP_PROPERTIES *heapProps, D3D12_HEAP_FLAGS heapFlags, [NativeTypeName("UINT64")] ulong preferredBlockSize, [NativeTypeName("size_t")] nuint minBlockCount, [NativeTypeName("size_t")] nuint maxBlockCount, bool explicitBlockSize, [NativeTypeName("UINT64")] ulong minAllocationAlignment) { pThis.m_hAllocator = hAllocator; pThis.m_HeapProps = *heapProps; pThis.m_HeapFlags = heapFlags; pThis.m_PreferredBlockSize = preferredBlockSize; pThis.m_MinBlockCount = minBlockCount; pThis.m_MaxBlockCount = maxBlockCount; pThis.m_ExplicitBlockSize = explicitBlockSize; pThis.m_MinAllocationAlignment = minAllocationAlignment; pThis.m_HasEmptyBlock = false; D3D12MA_Vector <Pointer <D3D12MA_NormalBlock> > ._ctor(ref pThis.m_Blocks, hAllocator->GetAllocs()); pThis.m_NextBlockId = 0; D3D12MA_RW_MUTEX._ctor(ref pThis.m_Mutex); }
internal D3D12GraphicsMemoryBlockCollection(ulong blockMinimumSize, ulong blockPreferredSize, ulong blockMarginSize, ulong blockMinimumFreeRegionSizeToRegister, GraphicsMemoryAllocator allocator, nuint minimumBlockCount, nuint maximumBlockCount, D3D12_HEAP_FLAGS d3d12HeapFlags, D3D12_HEAP_TYPE d3d12HeapType) : base(blockMinimumSize, blockPreferredSize, blockMarginSize, blockMinimumFreeRegionSizeToRegister, allocator, minimumBlockCount, maximumBlockCount) { _d3d12HeapFlags = d3d12HeapFlags; _d3d12HeapType = d3d12HeapType; }
public int SetDefaultHeapMinBytes(D3D12_HEAP_TYPE heapType, D3D12_HEAP_FLAGS heapFlags, [NativeTypeName("UINT64")] ulong minBytes) { using var debugGlobalMutexLock = D3D12MA_DEBUG_GLOBAL_MUTEX_LOCK(); return(m_Pimpl->SetDefaultHeapMinBytes(heapType, heapFlags, minBytes)); }
public int CreateCommittedResource2([NativeTypeName("const D3D12_HEAP_PROPERTIES *")] D3D12_HEAP_PROPERTIES *pHeapProperties, D3D12_HEAP_FLAGS HeapFlags, [NativeTypeName("const D3D12_RESOURCE_DESC1 *")] D3D12_RESOURCE_DESC1 *pDesc, D3D12_RESOURCE_STATES InitialResourceState, [NativeTypeName("const D3D12_CLEAR_VALUE *")] D3D12_CLEAR_VALUE *pOptimizedClearValue, [NativeTypeName("ID3D12ProtectedResourceSession *")] ID3D12ProtectedResourceSession *pProtectedSession, [NativeTypeName("const IID &")] Guid *riidResource, [NativeTypeName("void **")] void **ppvResource) { return(((delegate * stdcall <ID3D12Device8 *, D3D12_HEAP_PROPERTIES *, D3D12_HEAP_FLAGS, D3D12_RESOURCE_DESC1 *, D3D12_RESOURCE_STATES, D3D12_CLEAR_VALUE *, ID3D12ProtectedResourceSession *, Guid *, void **, int>)(lpVtbl[69]))((ID3D12Device8 *)Unsafe.AsPointer(ref this), pHeapProperties, HeapFlags, pDesc, InitialResourceState, pOptimizedClearValue, pProtectedSession, riidResource, ppvResource)); }