mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[d3d8] Relax viewport validation in windowed mode
This commit is contained in:
parent
bb6d1b3b4c
commit
4fad20d77c
@ -1001,7 +1001,7 @@ namespace dxvk {
|
|||||||
D3D8DeviceLock lock = LockDevice();
|
D3D8DeviceLock lock = LockDevice();
|
||||||
|
|
||||||
if (likely(pViewport != nullptr)) {
|
if (likely(pViewport != nullptr)) {
|
||||||
// we need a valid render target to validate the viewport
|
// We need a valid render target to validate the viewport
|
||||||
if (unlikely(m_renderTarget == nullptr))
|
if (unlikely(m_renderTarget == nullptr))
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
@ -1012,9 +1012,21 @@ namespace dxvk {
|
|||||||
// current render target, although this apparently works in D3D9
|
// current render target, although this apparently works in D3D9
|
||||||
if (likely(SUCCEEDED(res)) &&
|
if (likely(SUCCEEDED(res)) &&
|
||||||
unlikely(pViewport->X + pViewport->Width > rtDesc.Width ||
|
unlikely(pViewport->X + pViewport->Width > rtDesc.Width ||
|
||||||
pViewport->Y + pViewport->Height > rtDesc.Height))
|
pViewport->Y + pViewport->Height > rtDesc.Height)) {
|
||||||
|
// On Linux/Wine and in windowed mode, we can get in situations
|
||||||
|
// where the actual render target dimensions are off by one
|
||||||
|
// pixel to what the game sets them to. Allow this corner case
|
||||||
|
// to skip the validation, in order to prevent issues.
|
||||||
|
bool isOnePixelWider = pViewport->X + pViewport->Width == rtDesc.Width + 1;
|
||||||
|
bool isOnePixelTaller = pViewport->Y + pViewport->Height == rtDesc.Height + 1;
|
||||||
|
|
||||||
|
if (m_presentParams.Windowed && (isOnePixelWider || isOnePixelTaller)) {
|
||||||
|
Logger::debug("Viewport exceeds render target dimensions by one pixel");
|
||||||
|
} else {
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StateChange();
|
StateChange();
|
||||||
return GetD3D9()->SetViewport(reinterpret_cast<const d3d9::D3DVIEWPORT9*>(pViewport));
|
return GetD3D9()->SetViewport(reinterpret_cast<const d3d9::D3DVIEWPORT9*>(pViewport));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user