mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-02 04:29:14 +01:00
[d3d11] Implemented IDXGIVkInteropSurface for common textures
This commit is contained in:
parent
62b0e34a73
commit
81a0fa4805
@ -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
|
// D 3 D 1 1 T E X T U R E 1 D
|
||||||
D3D11Texture1D::D3D11Texture1D(
|
D3D11Texture1D::D3D11Texture1D(
|
||||||
|
@ -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
|
// D 3 D 1 1 T E X T U R E 1 D
|
||||||
class D3D11Texture1D : public D3D11DeviceChild<ID3D11Texture1D> {
|
class D3D11Texture1D : public D3D11DeviceChild<ID3D11Texture1D> {
|
||||||
|
@ -152,13 +152,17 @@ IDXGIVkInteropSurface : public IUnknown {
|
|||||||
*
|
*
|
||||||
* If \c pInfo is not \c nullptr, the following rules apply:
|
* 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->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)
|
* extension-specific structure (currently none)
|
||||||
* - \c pInfo->queueFamilyIndexCount must be the length of the
|
* - \c pInfo->queueFamilyIndexCount must be the length of the
|
||||||
* \c pInfo->pQueueFamilyIndices array, in \c uint32_t units.
|
* \c pInfo->pQueueFamilyIndices array, in \c uint32_t units.
|
||||||
* - \c pInfo->pQueueFamilyIndices must point to a pre-allocated
|
* - \c pInfo->pQueueFamilyIndices must point to a pre-allocated
|
||||||
* array of \c uint32_t of size \c pInfo->pQueueFamilyIndices.
|
* 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
|
* After the call, the structure pointed to by \c pInfo can
|
||||||
* be used to create an image with identical properties.
|
* be used to create an image with identical properties.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user