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"); Logger::info("Device reset");
m_deviceLostState = D3D9DeviceLostState::Ok; 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))) if (unlikely(FAILED(hr)))
return hr; return hr;
}
if (!IsExtended()) { if (!IsExtended()) {
// The internal references are always cleared, regardless of whether the Reset call succeeds. // 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", " - Windowed: ", pPresentationParameters->Windowed ? "true" : "false", "\n",
" - Swap effect: ", pPresentationParameters->SwapEffect, "\n")); " - Swap effect: ", pPresentationParameters->SwapEffect, "\n"));
// Black Desert creates a device with a NULL hDeviceWindow and // Black Desert creates a D3DDEVTYPE_NULLREF device and
// seemingly expects this validation to not prevent a swapchain reset. // expects this validation to not prevent a swapchain reset.
if (pPresentationParameters->hDeviceWindow != nullptr && if (likely(m_deviceType != D3DDEVTYPE_NULLREF) &&
!pPresentationParameters->Windowed && unlikely(!pPresentationParameters->Windowed &&
(pPresentationParameters->BackBufferWidth == 0 (pPresentationParameters->BackBufferWidth == 0
|| pPresentationParameters->BackBufferHeight == 0)) { || pPresentationParameters->BackBufferHeight == 0))) {
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
} }

View File

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