Esempio n. 1
0
        public virtual int CreateHeap(
            ref D3D12_HEAP_DESC pDesc,
            ref Guid riid,
            out IntPtr ppvHeap
            )
        {
            var fp = GetFunctionPointer(28);

            if (m_CreateHeapFunc == null)
            {
                m_CreateHeapFunc = (CreateHeapFunc)Marshal.GetDelegateForFunctionPointer(fp, typeof(CreateHeapFunc));
            }

            return(m_CreateHeapFunc(m_ptr, ref pDesc, ref riid, out ppvHeap));
        }
Esempio n. 2
0
        public virtual int CreateHeap1(
            ref D3D12_HEAP_DESC pDesc,
            ID3D12ProtectedResourceSession pProtectedSession,
            ref Guid riid,
            out IntPtr ppvHeap
            )
        {
            var fp = GetFunctionPointer(54);

            if (m_CreateHeap1Func == null)
            {
                m_CreateHeap1Func = (CreateHeap1Func)Marshal.GetDelegateForFunctionPointer(fp, typeof(CreateHeap1Func));
            }

            return(m_CreateHeap1Func(m_ptr, ref pDesc, pProtectedSession != null ? pProtectedSession.Ptr : IntPtr.Zero, ref riid, out ppvHeap));
        }
        private Pointer <ID3D12Heap> CreateD3D12Heap()
        {
            _state.ThrowIfDisposedOrDisposing();

            ID3D12Heap *d3d12Heap;

            var collection  = Collection;
            var d3d12Device = collection.Allocator.Device.D3D12Device;

            var heapFlags = collection.D3D12HeapFlags;
            var heapType  = collection.D3D12HeapType;

            var heapDesc = new D3D12_HEAP_DESC(Size, heapType, GetAlignment(heapFlags), heapFlags);

            var iid = IID_ID3D12Heap;

            ThrowExternalExceptionIfFailed(nameof(ID3D12Device.CreateHeap), d3d12Device->CreateHeap(&heapDesc, &iid, (void **)&d3d12Heap));

            return(d3d12Heap);
        }
Esempio n. 4
0
        private Pointer <ID3D12Heap> CreateD3D12Heap()
        {
            _state.ThrowIfDisposedOrDisposing();

            ID3D12Heap *d3d12Heap;

            var heapType = CpuAccess switch {
                GraphicsHeapCpuAccess.Read => D3D12_HEAP_TYPE_READBACK,
                GraphicsHeapCpuAccess.Write => D3D12_HEAP_TYPE_UPLOAD,
                _ => D3D12_HEAP_TYPE_DEFAULT,
            };

            var heapDesc = new D3D12_HEAP_DESC(Size, heapType);
            var iid      = IID_ID3D12Heap;

            ThrowExternalExceptionIfFailed(nameof(ID3D12Device.CreateHeap), D3D12GraphicsDevice.D3D12Device->CreateHeap(
                                               &heapDesc,
                                               &iid,
                                               (void **)&d3d12Heap
                                               ));

            return(d3d12Heap);
        }