2017-10-11 15:31:36 +02:00
|
|
|
#pragma once
|
|
|
|
|
2017-12-04 11:33:04 +01:00
|
|
|
#include "../dxvk/dxvk_include.h"
|
|
|
|
|
2017-10-11 15:31:36 +02:00
|
|
|
#include "dxgi_include.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
class DxgiAdapter;
|
|
|
|
class DxvkAdapter;
|
2017-11-29 15:16:07 +01:00
|
|
|
class DxvkBuffer;
|
2017-10-11 15:31:36 +02:00
|
|
|
class DxvkDevice;
|
2017-11-29 15:16:07 +01:00
|
|
|
class DxvkImage;
|
2017-12-04 11:33:04 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Format pair
|
|
|
|
*
|
|
|
|
* For a DXGI format, this stores two Vulkan formats:
|
|
|
|
* The format that directly corresponds to the DXGI
|
|
|
|
* format, and a similar format that the device can
|
|
|
|
* use. If the device supports the desired format,
|
|
|
|
* both formats will be equal.
|
|
|
|
*/
|
|
|
|
struct DxgiFormatPair {
|
|
|
|
VkFormat wanted = VK_FORMAT_UNDEFINED;
|
|
|
|
VkFormat actual = VK_FORMAT_UNDEFINED;
|
|
|
|
};
|
2017-12-19 14:47:35 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Format lookup mode
|
|
|
|
*
|
|
|
|
* When looking up an image format, additional information
|
|
|
|
* might be needed on how the image is going to be used.
|
|
|
|
* This is used to properly map typeless formats and color
|
|
|
|
* formats to depth formats if they are used on depth images.
|
|
|
|
*/
|
|
|
|
enum class DxgiFormatMode : uint32_t {
|
|
|
|
Any = 0,
|
|
|
|
Color = 1,
|
|
|
|
Depth = 2,
|
|
|
|
};
|
2017-10-11 15:31:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-11-29 07:55:44 +01:00
|
|
|
* \brief Private DXGI adapter interface
|
2017-10-11 15:31:36 +02:00
|
|
|
*
|
|
|
|
* The implementation of \c IDXGIAdapter holds a
|
|
|
|
* \ref DxvkAdapter which can be retrieved using
|
|
|
|
* this interface.
|
|
|
|
*/
|
|
|
|
MIDL_INTERFACE("907bf281-ea3c-43b4-a8e4-9f231107b4ff")
|
2017-11-27 15:51:53 +01:00
|
|
|
IDXGIAdapterPrivate : public IDXGIAdapter1 {
|
2017-10-11 15:31:36 +02:00
|
|
|
static const GUID guid;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
virtual dxvk::Rc<dxvk::DxvkAdapter> STDMETHODCALLTYPE GetDXVKAdapter() = 0;
|
2017-12-04 11:33:04 +01:00
|
|
|
|
2017-12-19 14:47:35 +01:00
|
|
|
/**
|
|
|
|
* \brief Maps a DXGI format to a compatible Vulkan format
|
|
|
|
*
|
|
|
|
* For color formats, the returned Vulkan format has the
|
|
|
|
* same memory layout as the DXGI format so that it can
|
|
|
|
* be mapped and copied to buffers. For depth-stencil
|
|
|
|
* formats, this is not guaranteed.
|
|
|
|
* \param [in] format The DXGI format
|
|
|
|
* \param [in] mode Format lookup mode
|
|
|
|
* \returns Vulkan format pair
|
|
|
|
*/
|
2017-12-12 12:50:52 +01:00
|
|
|
virtual dxvk::DxgiFormatPair STDMETHODCALLTYPE LookupFormat(
|
2017-12-19 14:47:35 +01:00
|
|
|
DXGI_FORMAT format,
|
|
|
|
dxvk::DxgiFormatMode mode) = 0;
|
2017-10-11 15:31:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2017-11-29 07:55:44 +01:00
|
|
|
* \brief Private DXGI device interface
|
2017-10-11 15:31:36 +02:00
|
|
|
*
|
|
|
|
* The implementation of \c IDXGIDevice stores a
|
|
|
|
* \ref DxvkDevice which can be retrieved using
|
|
|
|
* this interface.
|
|
|
|
*/
|
|
|
|
MIDL_INTERFACE("7a622cf6-627a-46b2-b52f-360ef3da831c")
|
2017-12-09 14:45:52 +01:00
|
|
|
IDXGIDevicePrivate : public IDXGIDevice1 {
|
2017-10-11 15:31:36 +02:00
|
|
|
static const GUID guid;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
virtual void STDMETHODCALLTYPE SetDeviceLayer(
|
2017-10-11 15:31:36 +02:00
|
|
|
IUnknown* layer) = 0;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
virtual dxvk::Rc<dxvk::DxvkDevice> STDMETHODCALLTYPE GetDXVKDevice() = 0;
|
2017-10-11 15:31:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-11-29 15:16:07 +01:00
|
|
|
/**
|
2017-12-19 16:01:50 +01:00
|
|
|
* \brief Swap chain back buffer interface
|
|
|
|
*
|
|
|
|
* Allows the swap chain and presenter to query
|
|
|
|
* the underlying image while it is embedded in
|
|
|
|
* a texture object specified by the client API.
|
2017-11-29 15:16:07 +01:00
|
|
|
*/
|
|
|
|
MIDL_INTERFACE("5679becd-8547-4d93-96a1-e61a1ce7ef37")
|
2017-12-19 16:01:50 +01:00
|
|
|
IDXGIPresentBackBuffer : public IUnknown {
|
2017-11-29 15:16:07 +01:00
|
|
|
static const GUID guid;
|
|
|
|
|
2017-12-19 16:01:50 +01:00
|
|
|
virtual dxvk::Rc<dxvk::DxvkImage> GetDXVKImage() = 0;
|
2017-11-29 15:16:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-11-29 16:23:33 +01:00
|
|
|
/**
|
|
|
|
* \brief Private presentation device interface
|
|
|
|
*
|
|
|
|
* Allows a swap chain to communicate with the device
|
|
|
|
* in order to flush pending commands or create the
|
|
|
|
* back buffer interface.
|
|
|
|
*/
|
|
|
|
MIDL_INTERFACE("79352328-16f2-4f81-9746-9c2e2ccd43cf")
|
|
|
|
IDXGIPresentDevicePrivate : public IUnknown {
|
|
|
|
static const GUID guid;
|
|
|
|
|
|
|
|
/**
|
2017-12-19 16:01:50 +01:00
|
|
|
* \brief Creates a swap chain back buffer
|
2017-11-29 16:23:33 +01:00
|
|
|
*
|
|
|
|
* \returns \c S_OK on success
|
|
|
|
*/
|
2017-12-19 16:01:50 +01:00
|
|
|
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainBackBuffer(
|
2017-11-29 16:23:33 +01:00
|
|
|
const DXGI_SWAP_CHAIN_DESC* pSwapChainDesc,
|
2017-12-19 16:01:50 +01:00
|
|
|
IDXGIPresentBackBuffer** ppBackBuffer) = 0;
|
2017-11-29 16:23:33 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Flushes the immediate context
|
|
|
|
*
|
|
|
|
* Used by the swap chain's \c Present method to
|
|
|
|
* ensure that all rendering commands get dispatched
|
|
|
|
* before presenting the swap chain's back buffer.
|
|
|
|
* \returns \c S_OK on success
|
|
|
|
*/
|
2017-12-12 12:50:52 +01:00
|
|
|
virtual HRESULT STDMETHODCALLTYPE FlushRenderingCommands() = 0;
|
2017-11-29 16:23:33 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Underlying DXVK device
|
|
|
|
*
|
|
|
|
* \param [in] riid Device type
|
|
|
|
* \param [in] ppDevice device
|
|
|
|
* \returns DXVK device handle
|
|
|
|
*/
|
2017-12-12 12:50:52 +01:00
|
|
|
virtual HRESULT STDMETHODCALLTYPE GetDevice(
|
2017-11-29 16:23:33 +01:00
|
|
|
REFGUID riid,
|
|
|
|
void** ppDevice) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-11-29 15:16:07 +01:00
|
|
|
DXVK_DEFINE_GUID(IDXGIAdapterPrivate);
|
|
|
|
DXVK_DEFINE_GUID(IDXGIDevicePrivate);
|
2017-12-19 16:01:50 +01:00
|
|
|
DXVK_DEFINE_GUID(IDXGIPresentBackBuffer);
|
2017-11-29 16:23:33 +01:00
|
|
|
DXVK_DEFINE_GUID(IDXGIPresentDevicePrivate);
|