dx11: scissoring fix. 4K UI scaling

Clearing of side columns in 4:3 uses the quad drawer so it needs to be
called early. Border color was wrong. Fixes GTA2.
Scale UI x2 in 4K mode.
This commit is contained in:
flyinghead 2021-12-03 15:48:42 +01:00
parent 99195c3f4c
commit 191f1c38df
2 changed files with 11 additions and 5 deletions

View File

@ -346,6 +346,9 @@ bool DX11Renderer::Process(TA_context* ctx)
bool DX11Renderer::Render()
{
matrices.CalcMatrices(&pvrrc, width, height);
if (!pvrrc.isRenderFramebuffer)
setBaseScissor();
bool is_rtt = pvrrc.isRTT;
u32 texAddress = FB_W_SOF1 & VRAM_MASK;
@ -365,7 +368,6 @@ bool DX11Renderer::Render()
vp.MaxDepth = 1.f;
deviceContext->RSSetViewports(1, &vp);
}
matrices.CalcMatrices(&pvrrc, width, height);
VertexConstants constant{};
memcpy(&constant.transMatrix, &matrices.GetNormalMatrix(), sizeof(constant.transMatrix));
constant.leftPlane[0] = 1;
@ -453,8 +455,6 @@ bool DX11Renderer::Render()
ID3D11Buffer *buffers[] { pxlConstants, pxlPolyConstants };
deviceContext->PSSetConstantBuffers(0, ARRAY_SIZE(buffers), buffers);
setBaseScissor();
drawStrips();
}
else
@ -1009,7 +1009,7 @@ void DX11Renderer::setBaseScissor()
{
float scaled_offs_x = matrices.GetSidebarWidth();
float borderColor[] { 1.f, VO_BORDER_COL.Red / 255.f, VO_BORDER_COL.Green / 255.f, VO_BORDER_COL.Blue / 255.f };
float borderColor[] { VO_BORDER_COL.Red / 255.f, VO_BORDER_COL.Green / 255.f, VO_BORDER_COL.Blue / 255.f, 1.f };
D3D11_VIEWPORT vp{};
vp.MaxDepth = 1.f;
vp.Width = scaled_offs_x;

View File

@ -57,10 +57,16 @@ bool DX11Context::init(bool keepCurrentWindow)
NOTICE_LOG(RENDERER, "HDMI resolution: %d x %d", displayMode->ResolutionWidthInRawPixels, displayMode->ResolutionHeightInRawPixels);
settings.display.width = displayMode->ResolutionWidthInRawPixels;
settings.display.height = displayMode->ResolutionHeightInRawPixels;
if (settings.display.width == 3840)
// 4K
scaling = 2.f;
else
scaling = 1.f;
}
break;
default:
scaling = 1.f;
break;
}
}
@ -77,7 +83,7 @@ bool DX11Context::init(bool keepCurrentWindow)
nullptr, // Specify nullptr to use the default adapter.
D3D_DRIVER_TYPE_HARDWARE,
nullptr,
D3D11_CREATE_DEVICE_BGRA_SUPPORT, // | D3D11_CREATE_DEVICE_DEBUG, // FIXME
D3D11_CREATE_DEVICE_BGRA_SUPPORT, // | D3D11_CREATE_DEVICE_DEBUG,
featureLevels,
ARRAYSIZE(featureLevels),
D3D11_SDK_VERSION,