1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-11 10:24:10 +01:00

[dxgi] Added IDXGIVkInteropSurface interface

This commit is contained in:
Philip Rebohle 2018-04-19 20:13:53 +02:00
parent 478a87f6d2
commit c2854e1fb9
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 73 additions and 5 deletions

View File

@ -134,6 +134,49 @@ IDXGIVkPresenter : public IUnknown {
}; };
/**
* \brief DXGI surface interface for Vulkan interop
*
* Provides access to the backing resource of a
* DXGI surface, which is typically a D3D texture.
*/
MIDL_INTERFACE("5546cf8c-77e7-4341-b05d-8d4d5000e77d")
IDXGIVkInteropSurface : public IUnknown {
static const GUID guid;
/**
* \brief Retrieves Vulkan image info
*
* Retrieves both the image handle as well as the image's
* properties. Any of the given pointers may be \c nullptr.
*
* If \c pInfo is not \c nullptr, the following rules apply:
* - \c pInfo->sType \e must be \c VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
* - \c pInfo->pNext \e must be \c nullptr or point ti a supported
* extension-specific structure (currently none)
* - \c pInfo->queueFamilyIndexCount must be the length of the
* \c pInfo->pQueueFamilyIndices array, in \c uint32_t units.
* - \c pInfo->pQueueFamilyIndices must point to a pre-allocated
* array of \c uint32_t of size \c pInfo->pQueueFamilyIndices.
*
* After the call, the structure pointed to by \c pInfo can
* be used to create an image with identical properties.
*
* If \c pLayout is not \c nullptr, it will receive the
* layout that the image will be in after flushing any
* outstanding commands on the device.
* \param [out] pHandle The image handle
* \param [out] pLayout Image layout
* \param [out] pInfo Image properties
* \returns \c S_OK on success, or \c E_INVALIDARG
*/
virtual HRESULT STDMETHODCALLTYPE GetVulkanImageInfo(
VkImage* pHandle,
VkImageLayout* pLayout,
VkImageCreateInfo* pInfo) = 0;
};
/** /**
* \brief DXGI device interface for Vulkan interop * \brief DXGI device interface for Vulkan interop
* *
@ -166,6 +209,24 @@ IDXGIVkInteropDevice : public IUnknown {
VkQueue* pQueue, VkQueue* pQueue,
uint32_t* pQueueFamilyIndex) = 0; uint32_t* pQueueFamilyIndex) = 0;
/**
* \brief Transitions a surface to a given layout
*
* Executes an explicit image layout transition on the
* D3D device. Note that the image subresources \e must
* be transitioned back to its original layout before
* using it again from D3D11.
* \param [in] pSurface The image to transform
* \param [in] pSubresources Subresources to transform
* \param [in] OldLayout Current image layout
* \param [in] NewLayout Desired image layout
*/
virtual HRESULT STDMETHODCALLTYPE TransitionSurfaceLayout(
IDXGIVkInteropSurface* pSurface,
const VkImageSubresourceRange* pSubresources,
VkImageLayout OldLayout,
VkImageLayout NewLayout) = 0;
/** /**
* \brief Flushes outstanding D3D rendering commands * \brief Flushes outstanding D3D rendering commands
* *
@ -181,6 +242,10 @@ IDXGIVkInteropDevice : public IUnknown {
* Should be called immediately before submitting * Should be called immediately before submitting
* Vulkan commands to the rendering queue in order * Vulkan commands to the rendering queue in order
* to prevent DXVK from using the queue. * to prevent DXVK from using the queue.
*
* While the submission queue is locked, no D3D11
* methods must be called from the locking thread,
* or otherwise a deadlock might occur.
*/ */
virtual void STDMETHODCALLTYPE LockSubmissionQueue() = 0; virtual void STDMETHODCALLTYPE LockSubmissionQueue() = 0;
@ -201,10 +266,12 @@ struct __declspec(uuid("7a622cf6-627a-46b2-b52f-360ef3da831c")) IDXGIVkDevice;
struct __declspec(uuid("5679becd-8547-4d93-96a1-e61a1ce7ef37")) IDXGIVkBackBuffer; struct __declspec(uuid("5679becd-8547-4d93-96a1-e61a1ce7ef37")) IDXGIVkBackBuffer;
struct __declspec(uuid("79352328-16f2-4f81-9746-9c2e2ccd43cf")) IDXGIVkPresenter; struct __declspec(uuid("79352328-16f2-4f81-9746-9c2e2ccd43cf")) IDXGIVkPresenter;
struct __declspec(uuid("e2ef5fa5-dc21-4af7-90c4-f67ef6a09323")) IDXGIVkInteropDevice; struct __declspec(uuid("e2ef5fa5-dc21-4af7-90c4-f67ef6a09323")) IDXGIVkInteropDevice;
struct __declspec(uuid("5546cf8c-77e7-4341-b05d-8d4d5000e77d")) IDXGIVkInteropSurface;
#else #else
DXVK_DEFINE_GUID(IDXGIVkAdapter); DXVK_DEFINE_GUID(IDXGIVkAdapter);
DXVK_DEFINE_GUID(IDXGIVkDevice); DXVK_DEFINE_GUID(IDXGIVkDevice);
DXVK_DEFINE_GUID(IDXGIVkBackBuffer); DXVK_DEFINE_GUID(IDXGIVkBackBuffer);
DXVK_DEFINE_GUID(IDXGIVkPresenter); DXVK_DEFINE_GUID(IDXGIVkPresenter);
DXVK_DEFINE_GUID(IDXGIVkInteropDevice); DXVK_DEFINE_GUID(IDXGIVkInteropDevice);
DXVK_DEFINE_GUID(IDXGIVkInteropSurface);
#endif #endif

View File

@ -4,11 +4,12 @@
#include "../../dxgi/dxgi_interfaces.h" #include "../../dxgi/dxgi_interfaces.h"
const GUID IDXGIVkAdapter::guid = {0x907bf281,0xea3c,0x43b4,{0xa8,0xe4,0x9f,0x23,0x11,0x07,0xb4,0xff}}; const GUID IDXGIVkAdapter::guid = {0x907bf281,0xea3c,0x43b4,{0xa8,0xe4,0x9f,0x23,0x11,0x07,0xb4,0xff}};
const GUID IDXGIVkDevice::guid = {0x7a622cf6,0x627a,0x46b2,{0xb5,0x2f,0x36,0x0e,0xf3,0xda,0x83,0x1c}}; const GUID IDXGIVkDevice::guid = {0x7a622cf6,0x627a,0x46b2,{0xb5,0x2f,0x36,0x0e,0xf3,0xda,0x83,0x1c}};
const GUID IDXGIVkBackBuffer::guid = {0x5679becd,0x8547,0x4d93,{0x96,0xa1,0xe6,0x1a,0x1c,0xe7,0xef,0x37}}; const GUID IDXGIVkBackBuffer::guid = {0x5679becd,0x8547,0x4d93,{0x96,0xa1,0xe6,0x1a,0x1c,0xe7,0xef,0x37}};
const GUID IDXGIVkPresenter::guid = {0x79352328,0x16f2,0x4f81,{0x97,0x46,0x9c,0x2e,0x2c,0xcd,0x43,0xcf}}; const GUID IDXGIVkPresenter::guid = {0x79352328,0x16f2,0x4f81,{0x97,0x46,0x9c,0x2e,0x2c,0xcd,0x43,0xcf}};
const GUID IDXGIVkInteropDevice::guid = {0xe2ef5fa5,0xdc21,0x4af7,{0x90,0xc4,0xf6,0x7e,0xf6,0xa0,0x93,0x23}}; const GUID IDXGIVkInteropDevice::guid = {0xe2ef5fa5,0xdc21,0x4af7,{0x90,0xc4,0xf6,0x7e,0xf6,0xa0,0x93,0x23}};
const GUID IDXGIVkInteropSurface::guid = {0x5546cf8c,0x77e7,0x4341,{0xb0,0x5d,0x8d,0x4d,0x50,0x00,0xe7,0x7d}};
std::ostream& operator << (std::ostream& os, REFIID guid) { std::ostream& operator << (std::ostream& os, REFIID guid) {
os << std::hex << std::setfill('0') os << std::hex << std::setfill('0')