mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-04 16:24:29 +01:00
[d3d11] Support just one handle type in D3D11DXGIResource::{Get|Create}SharedHandle
This commit is contained in:
parent
48557886de
commit
01ad79278b
@ -84,9 +84,15 @@ namespace dxvk {
|
||||
HRESULT STDMETHODCALLTYPE D3D11DXGIResource::GetSharedHandle(
|
||||
HANDLE* pSharedHandle) {
|
||||
auto texture = GetCommonTexture(m_resource);
|
||||
if (texture == nullptr || pSharedHandle == nullptr || !(texture->Desc()->MiscFlags & D3D11_RESOURCE_MISC_SHARED))
|
||||
if (texture == nullptr || pSharedHandle == nullptr ||
|
||||
(texture->Desc()->MiscFlags & D3D11_RESOURCE_MISC_SHARED_NTHANDLE))
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (!(texture->Desc()->MiscFlags & (D3D11_RESOURCE_MISC_SHARED | D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX))) {
|
||||
*pSharedHandle = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HANDLE kmtHandle = texture->GetImage()->sharedHandle();
|
||||
|
||||
if (kmtHandle == INVALID_HANDLE_VALUE)
|
||||
@ -143,8 +149,9 @@ namespace dxvk {
|
||||
LPCWSTR lpName,
|
||||
HANDLE* pHandle) {
|
||||
auto texture = GetCommonTexture(m_resource);
|
||||
if (pHandle) *pHandle = nullptr;
|
||||
if (texture == nullptr || pHandle == nullptr ||
|
||||
!(texture->Desc()->MiscFlags & (D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX | D3D11_RESOURCE_MISC_SHARED_NTHANDLE)))
|
||||
!(texture->Desc()->MiscFlags & D3D11_RESOURCE_MISC_SHARED_NTHANDLE))
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (lpName)
|
||||
@ -155,9 +162,6 @@ namespace dxvk {
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (texture->Desc()->MiscFlags & D3D11_RESOURCE_MISC_SHARED)
|
||||
handle = openKmtHandle( handle );
|
||||
|
||||
*pHandle = handle;
|
||||
return S_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user