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

[d3d11] Validate texture sharing parameters at texture creation

This commit is contained in:
Paul Gofman 2023-07-05 18:01:19 -06:00 committed by Philip Rebohle
parent 01ad79278b
commit fc952a3ca3

View File

@ -48,7 +48,16 @@ namespace dxvk {
if (hSharedHandle == nullptr)
hSharedHandle = INVALID_HANDLE_VALUE;
if (m_desc.MiscFlags & (D3D11_RESOURCE_MISC_SHARED|D3D11_RESOURCE_MISC_SHARED_NTHANDLE)) {
const auto sharingFlags = D3D11_RESOURCE_MISC_SHARED|D3D11_RESOURCE_MISC_SHARED_NTHANDLE|D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
if (m_desc.MiscFlags & sharingFlags) {
if (pDevice->GetFeatureLevel() < D3D_FEATURE_LEVEL_10_0 ||
(m_desc.MiscFlags & (D3D11_RESOURCE_MISC_SHARED|D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX)) == (D3D11_RESOURCE_MISC_SHARED|D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) ||
(m_desc.MiscFlags & sharingFlags) == D3D11_RESOURCE_MISC_SHARED_NTHANDLE)
throw DxvkError(str::format("D3D11: Cannot create shared texture:",
"\n MiscFlags: ", m_desc.MiscFlags,
"\n FeatureLevel: ", pDevice->GetFeatureLevel()));
if (m_desc.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX)
Logger::warn("D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX: not supported.");