Exemplo n.º 1
0
        public Result CreateCommittedResource1 <T>(
            HeapProperties heapProperties,
            HeapFlags heapFlags,
            ResourceDescription description,
            ResourceStates initialResourceState,
            ID3D12ProtectedResourceSession protectedSession,
            ClearValue optimizedClearValue,
            out T?resource) where T : ID3D12Resource1
        {
            Result result = CreateCommittedResource1(ref heapProperties, heapFlags,
                                                     ref description,
                                                     initialResourceState,
                                                     optimizedClearValue,
                                                     protectedSession,
                                                     typeof(T).GUID, out IntPtr nativePtr);

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

            resource = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }
Exemplo n.º 2
0
 public ID3D12Resource CreateCommittedResource(HeapProperties heapProperties, HeapFlags heapFlags,
                                               ResourceDescription description, ResourceStates initialResourceState,
                                               ClearValue?optimizedClearValue = null)
 {
     return(CreateCommittedResource(
                ref heapProperties,
                heapFlags,
                ref description,
                initialResourceState,
                optimizedClearValue,
                typeof(ID3D12Resource).GUID));
 }
Exemplo n.º 3
0
 public T CreateCommittedResource1 <T>(
     HeapProperties heapProperties,
     HeapFlags heapFlags,
     ResourceDescription description,
     ResourceStates initialResourceState,
     ID3D12ProtectedResourceSession protectedSession,
     ClearValue?optimizedClearValue = null) where T : ID3D12Resource1
 {
     CreateCommittedResource1(ref heapProperties, heapFlags,
                              ref description,
                              initialResourceState,
                              optimizedClearValue,
                              protectedSession,
                              typeof(T).GUID, out IntPtr nativePtr).CheckError();
     return(MarshallingHelpers.FromPointer <T>(nativePtr));
 }
Exemplo n.º 4
0
        public T CreateCommittedResource2 <T>(
            HeapProperties heapProperties,
            HeapFlags heapFlags,
            ResourceDescription1 description,
            ResourceStates initialResourceState,
            ClearValue?optimizedClearValue,
            ID3D12ProtectedResourceSession protectedSession) where T : ID3D12Resource
        {
            Result result = CreateCommittedResource2(
                ref heapProperties,
                heapFlags,
                ref description,
                initialResourceState,
                optimizedClearValue,
                protectedSession,
                typeof(T).GUID, out IntPtr nativePtr);

            if (result.Success)
            {
                return(FromPointer <T>(nativePtr));
            }

            return(default);