// Copyright (c) Microsoft Corporation.  All Rights Reserved

import "dxgi1_3.idl";

cpp_quote("#include <winapifamily.h>")

#pragma region App Family
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)")

//+-----------------------------------------------------------------------------
//
//  Return flags from CheckColorSpaceSupport
//
//------------------------------------------------------------------------------
typedef enum DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG
{
    DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT         = 0x00000001,
    DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_OVERLAY_PRESENT = 0x00000002
} DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG;

//--------------------------------------------------------------------------------------------------------
// IDXGISwapChain3 interface
//--------------------------------------------------------------------------------------------------------
[
    object,
    uuid( 94d99bdb-f1f8-4ab0-b236-7da0170edab1 ),
    local,
    pointer_default(unique)
]
interface IDXGISwapChain3 :
    IDXGISwapChain2
{
    UINT GetCurrentBackBufferIndex();
    HRESULT CheckColorSpaceSupport( [in, annotation("_In_")] DXGI_COLOR_SPACE_TYPE ColorSpace, [out, annotation("_Out_")] UINT* pColorSpaceSupport );
    HRESULT SetColorSpace1( [in, annotation("_In_")] DXGI_COLOR_SPACE_TYPE ColorSpace );
    HRESULT ResizeBuffers1(
        [in, annotation("_In_")] UINT BufferCount,
        [in, annotation("_In_")] UINT Width,
        [in, annotation("_In_")] UINT Height,
        [in, annotation("_In_")] DXGI_FORMAT Format,
        [in, annotation("_In_")] UINT SwapChainFlags,
        [in, annotation("_In_reads_(BufferCount)")] const UINT* pCreationNodeMask,
        [in, annotation("_In_reads_(BufferCount)")] IUnknown* const* ppPresentQueue
        );

};

//+-----------------------------------------------------------------------------
//
//  Return flags from CheckOverlayColorSpaceSupport
//
//------------------------------------------------------------------------------
typedef enum DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG
{
    DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG_PRESENT = 0x00000001,
} DXGI_OVERLAY_COLOR_SPACE_SUPPORT_FLAG;

//--------------------------------------------------------------------------------------------------------
// IDXGIOutput4 interface
//--------------------------------------------------------------------------------------------------------
[
    object,
    uuid(dc7dca35-2196-414d-9F53-617884032a60),
    local,
    pointer_default(unique)
]
interface IDXGIOutput4 :
    IDXGIOutput3
{
    HRESULT CheckOverlayColorSpaceSupport( [in, annotation("_In_")] DXGI_FORMAT Format, [in, annotation("_In_")] DXGI_COLOR_SPACE_TYPE ColorSpace, [in, annotation("_In_")] IUnknown *pConcernedDevice, [out, annotation("_Out_")] UINT *pFlags );
};


//--------------------------------------------------------------------------------------------------------
// IDXGIFactory4 interface
//--------------------------------------------------------------------------------------------------------
[
    object,
    uuid(1bc6ea02-ef36-464f-bf0c-21ca39e5168a),
    local,
    pointer_default(unique)
]
interface IDXGIFactory4 :
    IDXGIFactory3
{
    HRESULT EnumAdapterByLuid(
        [annotation("_In_")] LUID AdapterLuid,
        [annotation("_In_")] REFIID riid,
        [annotation("_COM_Outptr_")] void** ppvAdapter
        );
    HRESULT EnumWarpAdapter(
        [annotation("_In_")] REFIID riid,
        [annotation("_COM_Outptr_")] void** ppvAdapter
        );
};

typedef enum DXGI_MEMORY_SEGMENT_GROUP
{
    DXGI_MEMORY_SEGMENT_GROUP_LOCAL = 0,
    DXGI_MEMORY_SEGMENT_GROUP_NON_LOCAL = 1
} DXGI_MEMORY_SEGMENT_GROUP;

typedef struct DXGI_QUERY_VIDEO_MEMORY_INFO
{
    UINT64  Budget;
    UINT64  CurrentUsage;
    UINT64  AvailableForReservation;
    UINT64  CurrentReservation;
} DXGI_QUERY_VIDEO_MEMORY_INFO;

//--------------------------------------------------------------------------------------------------------
// IDXGIAdapter3 interface
//--------------------------------------------------------------------------------------------------------
[
    object,
    uuid( 645967A4-1392-4310-A798-8053CE3E93FD ),
    local,
    pointer_default(unique)
]
interface IDXGIAdapter3 :
    IDXGIAdapter2
{
    HRESULT RegisterHardwareContentProtectionTeardownStatusEvent(
        [in, annotation("_In_")] HANDLE hEvent, 
        [out, annotation("_Out_")] DWORD *pdwCookie );

    void UnregisterHardwareContentProtectionTeardownStatus(
        [in, annotation("_In_")] DWORD dwCookie );

    HRESULT QueryVideoMemoryInfo(
        [in, annotation("_In_")] UINT NodeIndex,
        [in, annotation("_In_")] DXGI_MEMORY_SEGMENT_GROUP MemorySegmentGroup,
        [out, annotation("_Out_")] DXGI_QUERY_VIDEO_MEMORY_INFO *pVideoMemoryInfo );

    HRESULT SetVideoMemoryReservation(
        [in, annotation("_In_")] UINT NodeIndex,
        [in, annotation("_In_")] DXGI_MEMORY_SEGMENT_GROUP MemorySegmentGroup,
        [in, annotation("_In_")] UINT64 Reservation );

    HRESULT RegisterVideoMemoryBudgetChangeNotificationEvent(
        [in, annotation("_In_")] HANDLE hEvent, 
        [out, annotation("_Out_")] DWORD *pdwCookie );

    void UnregisterVideoMemoryBudgetChangeNotification(
        [in, annotation("_In_")] DWORD dwCookie );
};

cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */")
#pragma endregion

cpp_quote( "DEFINE_GUID(IID_IDXGISwapChain3,0x94d99bdb,0xf1f8,0x4ab0,0xb2,0x36,0x7d,0xa0,0x17,0x0e,0xda,0xb1);" )
cpp_quote( "DEFINE_GUID(IID_IDXGIOutput4,0xdc7dca35,0x2196,0x414d,0x9F,0x53,0x61,0x78,0x84,0x03,0x2a,0x60);" )
cpp_quote( "DEFINE_GUID(IID_IDXGIFactory4,0x1bc6ea02,0xef36,0x464f,0xbf,0x0c,0x21,0xca,0x39,0xe5,0x16,0x8a);" )
cpp_quote( "DEFINE_GUID(IID_IDXGIAdapter3,0x645967A4,0x1392,0x4310,0xA7,0x98,0x80,0x53,0xCE,0x3E,0x93,0xFD);" )
