From 240ddbda57d480176f71f0c6d76c5200930a60f1 Mon Sep 17 00:00:00 2001 From: narzoul Date: Tue, 12 Jan 2021 21:06:32 +0100 Subject: [PATCH] Discard invalid bits from D3DDDIRS_WRAP render state values Fixes rendering issues in Thief 2 on Intel GMA 3600 (issue #81). --- DDrawCompat/D3dDdi/DeviceState.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/DDrawCompat/D3dDdi/DeviceState.cpp b/DDrawCompat/D3dDdi/DeviceState.cpp index 54f4777..5789793 100644 --- a/DDrawCompat/D3dDdi/DeviceState.cpp +++ b/DDrawCompat/D3dDdi/DeviceState.cpp @@ -98,6 +98,12 @@ namespace D3dDdi HRESULT DeviceState::pfnSetRenderState(const D3DDDIARG_RENDERSTATE* data) { + if (data->State >= D3DDDIRS_WRAP0 && data->State <= D3DDDIRS_WRAP7) + { + auto d = *data; + d.Value &= D3DWRAPCOORD_0 | D3DWRAPCOORD_1 | D3DWRAPCOORD_2 | D3DWRAPCOORD_3; + return setStateArray(&d, m_renderState, m_device.getOrigVtable().pfnSetRenderState); + } return setStateArray(data, m_renderState, m_device.getOrigVtable().pfnSetRenderState); }