Skip to content

Commit

Permalink
[d3d9] Skip some validations when hDeviceWindow is NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterSnowfall committed Nov 6, 2024
1 parent 64b35c5 commit 809e217
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8309,9 +8309,12 @@ namespace dxvk {
" - Windowed: ", pPresentationParameters->Windowed ? "true" : "false", "\n",
" - Swap effect: ", pPresentationParameters->SwapEffect, "\n"));

if (!pPresentationParameters->Windowed &&
(pPresentationParameters->BackBufferWidth == 0
|| pPresentationParameters->BackBufferHeight == 0)) {
// 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)) {
return D3DERR_INVALIDCALL;
}

Expand Down
5 changes: 4 additions & 1 deletion src/d3d9/d3d9_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@ namespace dxvk {
}

// The swap effect value can not be 0.
if (unlikely(!pPresentationParameters->SwapEffect))
// Black Desert sets this to 0 with a NULL hDeviceWindow
// and expects device creation to succeed.
if (unlikely(pPresentationParameters->hDeviceWindow != nullptr
&& !pPresentationParameters->SwapEffect))
return D3DERR_INVALIDCALL;

// D3DSWAPEFFECT_COPY can not be used with more than one back buffer.
Expand Down

0 comments on commit 809e217

Please sign in to comment.