Skip to content

Commit

Permalink
[d3d9] Fix (most) cursor-related Wine tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterSnowfall committed Oct 5, 2024
1 parent f583b7f commit b030902
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/d3d9/d3d9_cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ namespace dxvk {


BOOL D3D9Cursor::ShowCursor(BOOL bShow) {
// Cursor visibility remains unchanged (typically FALSE) if the cursor isn't set.
if (unlikely(m_hCursor == nullptr && m_sCursor.Width == 0 && m_sCursor.Height == 0))
return m_visible;

if (likely(m_hCursor != nullptr))
::SetCursor(bShow ? m_hCursor : nullptr);

Expand Down
12 changes: 11 additions & 1 deletion src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,19 @@ namespace dxvk {
uint32_t inputWidth = cursorTex->Desc()->Width;
uint32_t inputHeight = cursorTex->Desc()->Height;

// Always use a hardware cursor when windowed.
// Check if surface dimensions are powers of two.
if ((inputWidth && (inputWidth & (inputWidth - 1)))
|| (inputHeight && (inputHeight & (inputHeight - 1))))
return D3DERR_INVALIDCALL;

D3DPRESENT_PARAMETERS params;
m_implicitSwapchain->GetPresentParameters(&params);

if (inputWidth > params.BackBufferWidth
|| inputHeight > params.BackBufferHeight)
return D3DERR_INVALIDCALL;

// Always use a hardware cursor when windowed.
bool hwCursor = params.Windowed;

// Always use a hardware cursor w/h <= 32 px
Expand Down

0 comments on commit b030902

Please sign in to comment.