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

[d3d9] Skip some validations for D3DDEVTYPE_NULLREF devices

This commit is contained in:
WinterSnowfall 2024-11-19 13:51:40 +02:00 committed by Robin Kertels
parent 43b79bcb23
commit 4f98844f47
2 changed files with 23 additions and 16 deletions

View File

@ -476,10 +476,15 @@ namespace dxvk {
Logger::info("Device reset");
m_deviceLostState = D3D9DeviceLostState::Ok;
HRESULT hr = m_parent->ValidatePresentationParameters(pPresentationParameters);
HRESULT hr;
// Black Desert creates a D3DDEVTYPE_NULLREF device and
// expects reset to work despite passing invalid parameters.
if (likely(m_deviceType != D3DDEVTYPE_NULLREF)) {
hr = m_parent->ValidatePresentationParameters(pPresentationParameters);
if (unlikely(FAILED(hr)))
return hr;
if (unlikely(FAILED(hr)))
return hr;
}
if (!IsExtended()) {
// The internal references are always cleared, regardless of whether the Reset call succeeds.
@ -8304,12 +8309,12 @@ namespace dxvk {
" - Windowed: ", pPresentationParameters->Windowed ? "true" : "false", "\n",
" - Swap effect: ", pPresentationParameters->SwapEffect, "\n"));
// Black Desert creates a device with a NULL hDeviceWindow and
// seemingly expects this validation to not prevent a swapchain reset.
if (pPresentationParameters->hDeviceWindow != nullptr &&
!pPresentationParameters->Windowed &&
(pPresentationParameters->BackBufferWidth == 0
|| pPresentationParameters->BackBufferHeight == 0)) {
// Black Desert creates a D3DDEVTYPE_NULLREF device and
// expects this validation to not prevent a swapchain reset.
if (likely(m_deviceType != D3DDEVTYPE_NULLREF) &&
unlikely(!pPresentationParameters->Windowed &&
(pPresentationParameters->BackBufferWidth == 0
|| pPresentationParameters->BackBufferHeight == 0))) {
return D3DERR_INVALIDCALL;
}

View File

@ -360,10 +360,15 @@ namespace dxvk {
!(BehaviorFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING)))
return D3DERR_INVALIDCALL;
HRESULT hr = ValidatePresentationParameters(pPresentationParameters);
HRESULT hr;
// Black Desert creates a D3DDEVTYPE_NULLREF device and
// expects it be created despite passing invalid parameters.
if (likely(DeviceType != D3DDEVTYPE_NULLREF)) {
hr = ValidatePresentationParameters(pPresentationParameters);
if (unlikely(FAILED(hr)))
return hr;
if (unlikely(FAILED(hr)))
return hr;
}
auto* adapter = GetAdapter(Adapter);
@ -421,10 +426,7 @@ namespace dxvk {
}
// The swap effect value can not be 0.
// Black Desert sets this to 0 with a NULL hDeviceWindow
// and expects device creation to succeed.
if (unlikely(pPresentationParameters->hDeviceWindow != nullptr
&& !pPresentationParameters->SwapEffect))
if (unlikely(!pPresentationParameters->SwapEffect))
return D3DERR_INVALIDCALL;
// D3DSWAPEFFECT_COPY can not be used with more than one back buffer.