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

[d3d11] Implemented IDXGIVkInteropSurface for common textures

This commit is contained in:
Philip Rebohle 2018-04-20 10:38:39 +02:00
parent 62b0e34a73
commit 81a0fa4805
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 110 additions and 1 deletions

View File

@ -284,6 +284,74 @@ namespace dxvk {
}
D3D11VkInteropSurface::D3D11VkInteropSurface(
IDXGIObject* pContainer,
D3D11CommonTexture* pTexture)
: m_container (pContainer),
m_texture (pTexture) {
}
D3D11VkInteropSurface::~D3D11VkInteropSurface() {
}
ULONG STDMETHODCALLTYPE D3D11VkInteropSurface::AddRef() {
return m_container->AddRef();
}
ULONG STDMETHODCALLTYPE D3D11VkInteropSurface::Release() {
return m_container->Release();
}
HRESULT STDMETHODCALLTYPE D3D11VkInteropSurface::QueryInterface(
REFIID riid,
void** ppvObject) {
return m_container->QueryInterface(riid, ppvObject);
}
HRESULT STDMETHODCALLTYPE D3D11VkInteropSurface::GetVulkanImageInfo(
VkImage* pHandle,
VkImageLayout* pLayout,
VkImageCreateInfo* pInfo) {
const Rc<DxvkImage> image = m_texture->GetImage();
const DxvkImageCreateInfo& info = image->info();
if (pHandle != nullptr)
*pHandle = image->handle();
if (pLayout != nullptr)
*pLayout = info.layout;
if (pInfo != nullptr) {
// We currently don't support any extended structures
if (pInfo->sType != VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO
|| pInfo->pNext != nullptr)
return E_INVALIDARG;
pInfo->flags = 0;
pInfo->imageType = info.type;
pInfo->format = info.format;
pInfo->extent = info.extent;
pInfo->mipLevels = info.mipLevels;
pInfo->arrayLayers = info.numLayers;
pInfo->samples = info.sampleCount;
pInfo->tiling = info.tiling;
pInfo->usage = info.usage;
pInfo->sharingMode = VK_SHARING_MODE_EXCLUSIVE;
pInfo->queueFamilyIndexCount = 0;
pInfo->initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
}
return S_OK;
}
///////////////////////////////////////////
// D 3 D 1 1 T E X T U R E 1 D
D3D11Texture1D::D3D11Texture1D(

View File

@ -190,6 +190,43 @@ namespace dxvk {
};
/**
* \brief Common texture interop class
*
* Provides access to the underlying Vulkan
* texture to external Vulkan libraries.
*/
class D3D11VkInteropSurface : public IDXGIVkInteropSurface {
public:
D3D11VkInteropSurface(
IDXGIObject* pContainer,
D3D11CommonTexture* pTexture);
~D3D11VkInteropSurface();
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
HRESULT STDMETHODCALLTYPE GetVulkanImageInfo(
VkImage* pHandle,
VkImageLayout* pLayout,
VkImageCreateInfo* pInfo);
private:
IDXGIObject* m_container;
D3D11CommonTexture* m_texture;
};
///////////////////////////////////////////
// D 3 D 1 1 T E X T U R E 1 D
class D3D11Texture1D : public D3D11DeviceChild<ID3D11Texture1D> {

View File

@ -152,13 +152,17 @@ IDXGIVkInteropSurface : public IUnknown {
*
* 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
* - \c pInfo->pNext \e must be \c nullptr or point to 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.
*
* \note As of now, the sharing mode will always be
* \c VK_SHARING_MODE_EXCLUSIVE and no queue
* family indices will be written to the array.
*
* After the call, the structure pointed to by \c pInfo can
* be used to create an image with identical properties.
*