Merge pull request #1996 from CookiePLMonster/viewport-clear-improvements
SetViewport & Clear improvements
This commit is contained in:
commit
6a70a08c59
|
@ -4117,6 +4117,8 @@ xbox::void_xt WINAPI xbox::EMUPATCH(D3DDevice_SetViewport)
|
|||
// Apply MSAA scale and offset
|
||||
HostViewPort.Width = static_cast<DWORD>(HostViewPort.Width * g_Xbox_MultiSampleXScale);
|
||||
HostViewPort.Height = static_cast<DWORD>(HostViewPort.Height * g_Xbox_MultiSampleYScale);
|
||||
HostViewPort.X = static_cast<DWORD>(HostViewPort.X * g_Xbox_MultiSampleXScale);
|
||||
HostViewPort.Y = static_cast<DWORD>(HostViewPort.Y * g_Xbox_MultiSampleYScale);
|
||||
// Since Width and Height are DWORD, adding GetMultiSampleOffset 0.0f or 0.5f makes no sense
|
||||
|
||||
HRESULT hRet = g_pD3DDevice->SetViewport(&HostViewPort);
|
||||
|
@ -4997,12 +4999,14 @@ xbox::void_xt WINAPI xbox::EMUPATCH(D3DDevice_Clear)
|
|||
|
||||
if (pRects != nullptr) {
|
||||
// Scale the fill based on our scale factor and MSAA scale
|
||||
D3DRECT rect;
|
||||
rect.x1 = static_cast<LONG>(pRects->x1 * g_Xbox_MultiSampleXScale * g_RenderScaleFactor);
|
||||
rect.x2 = static_cast<LONG>(pRects->x2 * g_Xbox_MultiSampleXScale * g_RenderScaleFactor);
|
||||
rect.y1 = static_cast<LONG>(pRects->y1 * g_Xbox_MultiSampleYScale * g_RenderScaleFactor);
|
||||
rect.y2 = static_cast<LONG>(pRects->y2 * g_Xbox_MultiSampleYScale * g_RenderScaleFactor);
|
||||
hRet = g_pD3DDevice->Clear(Count, &rect, HostFlags, Color, Z, Stencil);
|
||||
std::vector<D3DRECT> rects(Count);
|
||||
for (DWORD i = 0; i < Count; i++) {
|
||||
rects[i].x1 = static_cast<LONG>(pRects[i].x1 * g_Xbox_MultiSampleXScale * g_RenderScaleFactor);
|
||||
rects[i].x2 = static_cast<LONG>(pRects[i].x2 * g_Xbox_MultiSampleXScale * g_RenderScaleFactor);
|
||||
rects[i].y1 = static_cast<LONG>(pRects[i].y1 * g_Xbox_MultiSampleYScale * g_RenderScaleFactor);
|
||||
rects[i].y2 = static_cast<LONG>(pRects[i].y2 * g_Xbox_MultiSampleYScale * g_RenderScaleFactor);
|
||||
}
|
||||
hRet = g_pD3DDevice->Clear(Count, rects.data(), HostFlags, Color, Z, Stencil);
|
||||
} else {
|
||||
hRet = g_pD3DDevice->Clear(Count, pRects, HostFlags, Color, Z, Stencil);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue