public Result GetFactory <T>(out T?factory) where T : IDXCoreAdapterFactory
    {
        Result result = GetFactory(typeof(T).GUID, out IntPtr factoryPtr);

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

        factory = MarshallingHelpers.FromPointer <T>(factoryPtr);
        return(result);
    }
    public Result BeginDraw <T>(RawRect?updateRect, out T?updateObject, out Int2 updateOffset) where T : ComObject
    {
        Result result = BeginDraw(updateRect, typeof(T).GUID, out IntPtr updateObjectPtr, out updateOffset);

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

        updateObject = MarshallingHelpers.FromPointer <T>(updateObjectPtr);
        return(result);
    }
    public Result GetParent <T>(out T? @object) where T : ComObject
    {
        Result result = GetParent(typeof(T).GUID, out IntPtr nativePtr);

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

        @object = MarshallingHelpers.FromPointer <T>(nativePtr);
        return(result);
    }
Example #4
0
        public Result CreateProtectedResourceSession <T>(ProtectedResourceSessionDescription description, out T?resource) where T : ID3D12ProtectedResourceSession
        {
            Result result = CreateProtectedResourceSession(description, typeof(T).GUID, out IntPtr nativePtr);

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

            resource = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }
Example #5
0
        public Result CreateCommandList1 <T>(int nodeMask, CommandListType type, CommandListFlags commandListFlags, out T?commandList) where T : ID3D12GraphicsCommandList1
        {
            Result result = CreateCommandList1(nodeMask, type, commandListFlags, typeof(T).GUID, out IntPtr nativePtr);

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

            commandList = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }
    public Result GetOutput <T>(DxcOutKind kind, out T? @object) where T : ComObject
    {
        Result result = GetOutput(kind, typeof(T).GUID, out IntPtr nativePtr, IntPtr.Zero);

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

        @object = MarshallingHelpers.FromPointer <T>(nativePtr);
        return(result);
    }
Example #7
0
    /// <summary>
    /// Try to create new instance of <see cref="IDWriteFactory"/>.
    /// </summary>
    /// <typeparam name="T">Type based on <see cref="IDWriteFactory"/>.</typeparam>
    /// <param name="factoryType">The type of factory.</param>
    /// <param name="factory">The <see cref="IDWriteFactory"/> being created.</param>
    /// <returns>Return the <see cref="Result"/>.</returns>
    public static Result DWriteCreateFactory <T>(FactoryType factoryType, out T?factory) where T : IDWriteFactory
    {
        Result result = DWriteCreateFactory(factoryType, typeof(T).GUID, out IntPtr nativePtr);

        if (result.Failure)
        {
            factory = null;
            return(result);
        }

        factory = MarshallingHelpers.FromPointer <T>(nativePtr);
        return(result);
    }
    public Result OpenSharedResourceByName <T>(string name, SharedResourceFlags access, out T?resource) where T : ID3D11Resource
    {
        Result result = OpenSharedResourceByName(name, (int)access, typeof(T).GUID, out IntPtr nativePtr);

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

        resource = default;
        return(result);
    }
Example #9
0
    /// <summary>
    /// Returns the static DStorage factory object used to create DStorage queues,
    /// open files for DStorage access, and other global operations.
    /// </summary>
    /// <param name="factory">Specifies the DStorage factory interface, such as <see cref="IDStorageFactory"/>.</param>
    /// <returns>Return the <see cref="Result"/>.</returns>
    public static Result DStorageGetFactory <T>(out T?factory) where T : ComObject
    {
        Result result = DStorageGetFactory(typeof(T).GUID, out IntPtr nativePtr);

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

        factory = null;
        return(result);
    }
    public Result AddToStateObject <T>(StateObjectDescription addition, ID3D12StateObject stateObjectToGrowFrom, out T?newStateObject) where T : ID3D12StateObject
    {
        Result result = AddToStateObject(addition, stateObjectToGrowFrom, typeof(T).GUID, out IntPtr nativePtr);

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

        newStateObject = MarshallingHelpers.FromPointer <T>(nativePtr);
        return(result);
    }
    public Result OpenSharedResource1 <T>(IntPtr handle, out T?resource) where T : ID3D11Resource
    {
        Result result = OpenSharedResource1(handle, typeof(T).GUID, out IntPtr nativePtr);

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

        resource = default;
        return(result);
    }
        public Result CreatePipelineLibrary <T>(Blob blob, out T?pipelineLibrary) where T : ID3D12PipelineLibrary
        {
            Result result = CreatePipelineLibrary(blob.BufferPointer, blob.BufferSize, typeof(T).GUID, out IntPtr nativePtr);

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

            pipelineLibrary = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }
Example #13
0
        public Result OpenExistingHeapFromFileMapping <T>(IntPtr fileMapping, out T?heap) where T : ID3D12Heap
        {
            Result result = OpenExistingHeapFromFileMapping(fileMapping, typeof(T).GUID, out IntPtr nativePtr);

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

            heap = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }
        public Result GetBuffer <T>(int index, out T?surface) where T : ComObject
        {
            Result result = GetBuffer(index, typeof(T).GUID, out IntPtr nativePtr);

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

            surface = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }
    public Result EnumAdapterByGpuPreference <T>(int index, GpuPreference gpuPreference, out T?adapter) where T : IDXGIAdapter
    {
        Result result = EnumAdapterByGpuPreference(index, gpuPreference, typeof(T).GUID, out IntPtr adapterPtr);

        if (result.Success)
        {
            adapter = MarshallingHelpers.FromPointer <T>(adapterPtr);
            return(result);
        }

        adapter = null;
        return(result);
    }
Example #16
0
    public Result GetProtectedResourceSession <T>(out T?protectedSession) where T : ID3D12ProtectedResourceSession
    {
        Result result = GetProtectedResourceSession(typeof(T).GUID, out IntPtr protectedSessionPtr);

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

        protectedSession = MarshallingHelpers.FromPointer <T>(protectedSessionPtr);
        return(result);
    }
Example #17
0
    public Result GetInterface <T>(out T? @interface) where T : ComObject
    {
        Result result = GetInterface(typeof(T).GUID, out IntPtr nativePtr);

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

        @interface = MarshallingHelpers.FromPointer <T>(nativePtr);
        return(result);
    }
Example #18
0
        public static Result DxilCreateInstance <T>(Guid classGuid, out T?instance) where T : ComObject
        {
            Result result = DxcCreateInstance(classGuid, typeof(T).GUID, out IntPtr nativePtr);

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

            instance = null;
            return(result);
        }
    public Result CreateWrappedResource <T>(IUnknown d3d12Resource, ResourceFlags flags, ResourceStates inState, ResourceStates outState, out T?resource11) where T : ID3D11Resource
    {
        Result result = CreateWrappedResource(d3d12Resource, flags, inState, outState, typeof(T).GUID, out IntPtr nativePtr);

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

        resource11 = null;
        return(result);
    }
Example #20
0
    /// <summary>
    /// Gets the adapter for the specified LUID.
    /// </summary>
    /// <param name="adapterLuid">A unique value that identifies the adapter.</param>
    /// <param name="adapter">The adapter instance of <see cref="IDXGIAdapter"/>, make sure to dispose the instance.</param>
    /// <returns>The <see cref="Result"/>.</returns>
    public Result EnumAdapterByLuid <T>(Luid adapterLuid, out T?adapter) where T : IDXGIAdapter
    {
        Result result = EnumAdapterByLuid(adapterLuid, typeof(T).GUID, out IntPtr nativePtr);

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

        adapter = null;
        return(result);
    }
Example #21
0
        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 Result GetOutput <T>(int index, out T? @object, out IDxcBlobUtf16 outputType, out IDxcBlobUtf16 outputName) where T : IDxcBlob
        {
            Result result = GetOutput(index, typeof(T).GUID, out IntPtr nativePtr, out outputType, out outputName);

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

            @object = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }
Example #23
0
        public Result CreateReservedResource1 <T>(ResourceDescription description, ResourceStates initialState, ID3D12ProtectedResourceSession protectedResourceSession, out T?resource) where T : ID3D12Resource1
        {
            Result result = CreateReservedResource1(ref description, initialState, null, protectedResourceSession, typeof(T).GUID, out IntPtr nativePtr);

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

            resource = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }
Example #24
0
        /// <summary>
        /// Creates a <see cref="ID3D12StateObject"/>.
        /// </summary>
        /// <param name="description">The description of the state object to create.</param>
        /// <param name="stateObject">An instance of <see cref="ID3D12StateObject"/>.</param>
        /// <returns>The result of operation.</returns>
        public Result CreateStateObject <T>(StateObjectDescription description, out T?stateObject) where T : ID3D12StateObject
        {
            Result result = CreateStateObject(description, typeof(T).GUID, out IntPtr nativePtr);

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

            stateObject = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }
    public Result GetDevice <T>(out T?device) where T : ID3D12Device
    {
        Result result = GetDevice(typeof(T).GUID, out IntPtr nativePtr);

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

        device = MarshallingHelpers.FromPointer <T>(nativePtr);
        return(result);
    }
Example #26
0
        /// <summary>
        /// Creates an instance of the specified meta command.
        /// </summary>
        /// <param name="commandId">A <see cref="Guid"/> of the meta command that you wish to instantiate.</param>
        /// <param name="nodeMask">For single-adapter operation, set this to zero. If there are multiple adapter nodes, set a bit to identify the node (one of the device's physical adapters) to which the meta command applies.
        /// Each bit in the mask corresponds to a single node. Only one bit must be set. </param>
        /// <param name="metaCommand">An instance of <see cref="ID3D12MetaCommand"/>.</param>
        /// <returns>The result of operation.</returns>
        public Result CreateMetaCommand <T>(Guid commandId, int nodeMask, out T?metaCommand) where T : ID3D12MetaCommand
        {
            Result result = CreateMetaCommand(commandId, nodeMask, IntPtr.Zero, 0, typeof(T).GUID, out IntPtr nativePtr);

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

            metaCommand = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }
Example #27
0
    /// <summary>
    /// Creates a new DirectComposition device object, which can be used to create other DirectComposition objects.
    /// </summary>
    /// <typeparam name="T">A generic type of <see cref="IDCompositionDevice"/>.</typeparam>
    /// <param name="renderingDevice">An optional instance to a DirectX device to be used to create DirectComposition surface objects. Must be a instance of an object implementing the <see cref="IDXGIDevice"/> or <see cref="ID2D1Device"/> interfaces.</param>
    /// <param name="compositionDevice">An instance of <see cref="IDCompositionDevice"/> interface or null if failure</param>
    /// <returns>The <see cref="Result"/> code.</returns>
    public static Result DCompositionCreateDevice3 <T>(IUnknown renderingDevice, out T?compositionDevice) where T : IDCompositionDevice
    {
        Result result = DCompositionCreateDevice3(renderingDevice, typeof(T).GUID, out IntPtr nativePtr);

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

        compositionDevice = MarshallingHelpers.FromPointer <T>(nativePtr);
        return(result);
    }
Example #28
0
        /// <summary>
        /// Creates an instance of the specified meta command.
        /// </summary>
        /// <param name="commandId">A <see cref="Guid"/> of the meta command that you wish to instantiate.</param>
        /// <param name="blob">Blob containing the values of the parameters for creating the meta command.</param>
        /// <param name="metaCommand">An instance of <see cref="ID3D12MetaCommand"/>.</param>
        /// <returns>The result of operation</returns>
        public Result CreateMetaCommand <T>(Guid commandId, Blob blob, out T?metaCommand) where T : ID3D12MetaCommand
        {
            Result result = CreateMetaCommand(commandId, 0, blob.BufferPointer, blob.BufferSize, typeof(T).GUID, out IntPtr nativePtr);

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

            metaCommand = MarshallingHelpers.FromPointer <T>(nativePtr);
            return(result);
        }
Example #29
0
    public Result CreateVideoDecoder1 <T>(VideoDecoderDescription description, ID3D12ProtectedResourceSession protectedResourceSession, out T?videoDecoder) where T : ID3D12VideoDecoder1
    {
        Result result = CreateVideoDecoder1(ref description, protectedResourceSession, typeof(T).GUID, out IntPtr nativePtr);

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

        videoDecoder = MarshallingHelpers.FromPointer <T>(nativePtr);
        return(result);
    }
Example #30
0
    public Result GetAdapter <T>(int index, out T?adapter) where T : IDXCoreAdapter
    {
        Result result = GetAdapter(index, typeof(T).GUID, out IntPtr adapterPtr);

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

        adapter = MarshallingHelpers.FromPointer <T>(adapterPtr);
        return(result);
    }