public Result CreateHeap1 <T>(HeapDescription description, ID3D12ProtectedResourceSession protectedSession, out T?heap) where T : ID3D12Heap1
    {
        Result result = CreateHeap1(ref description, protectedSession, typeof(T).GUID, out IntPtr nativePtr);

        if (result.Failure)
        {
            heap = default;
            return(result);
        }

        heap = MarshallingHelpers.FromPointer <T>(nativePtr);
        return(result);
    }
 public T CreateHeap1 <T>(HeapDescription description, ID3D12ProtectedResourceSession protectedSession) where T : ID3D12Heap1
 {
     CreateHeap1(ref description, protectedSession, typeof(T).GUID, out IntPtr nativePtr).CheckError();
     return(MarshallingHelpers.FromPointer <T>(nativePtr));
 }
        public ID3D12Heap1 CreateHeap1(HeapDescription description, ID3D12ProtectedResourceSession protectedSession)
        {
            Guard.NotNull(protectedSession, nameof(protectedSession));

            return(CreateHeap1(ref description, protectedSession, typeof(ID3D12Heap1).GUID));
        }
Exemple #4
0
 public ID3D12Heap1 CreateHeap1(HeapDescription description, ID3D12ProtectedResourceSession protectedSession)
 {
     return(CreateHeap1(ref description, protectedSession, typeof(ID3D12Heap1).GUID));
 }
        protected Boolean CreateHeapPlatformDependent()
        {
            // get device ptr from the renderer
            Device deviceDX12 = H1Global <H1ManagedRenderer> .Instance.Device;

            // create dx12 heap description
            m_HeapDesc = new HeapDescription();

            // depending on H1GpuHeap type setting flags
            switch (m_Type)
            {
            case H1GpuHeapType.Buffers:
                m_HeapDesc.Flags |= HeapFlags.AllowOnlyBuffers;
                break;

            case H1GpuHeapType.GpuWriteableTexture:
                m_HeapDesc.Flags |= HeapFlags.AllowOnlyRtDomainShaderTextureS;
                break;

            case H1GpuHeapType.NonGpuWritableTextures:
                m_HeapDesc.Flags |= HeapFlags.AllowOnlyNonRtDomainShaderTextureS;
                break;
            }

            m_HeapDesc.Alignment   = 0;
            m_HeapDesc.SizeInBytes = m_TotalSizeInBytes;

            HeapType heapType = HeapType.Custom;

            switch (m_Owner.Type)
            {
            case H1GpuMemoryPoolType.Default:
                heapType = HeapType.Default;
                break;

            case H1GpuMemoryPoolType.Readback:
                heapType = HeapType.Readback;
                break;

            case H1GpuMemoryPoolType.Upload:
                heapType = HeapType.Upload;
                break;
            }

            if (heapType == HeapType.Custom)
            {
                throw new InvalidOperationException("you can not creat custom H1GpuHeap, please check owner's type!");
            }

            m_HeapDesc.Properties = new HeapProperties(heapType);

            // creat heap instance
            m_HeapInstance = deviceDX12.CreateHeap(m_HeapDesc);

            if (m_HeapInstance != null)
            {
                return(false);
            }

            return(true);
        }
Exemple #6
0
 public Heap1 CreateHeap1(HeapDescription desc, ProtectedResourceSession protectedSession)
 {
     return(CreateHeap1(ref desc, protectedSession, Utilities.GetGuidFromType(typeof(Heap1))));
 }