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:
parent
99195c3f4c
commit
191f1c38df
|
@ -346,6 +346,9 @@ bool DX11Renderer::Process(TA_context* ctx)
|
||||||
|
|
||||||
bool DX11Renderer::Render()
|
bool DX11Renderer::Render()
|
||||||
{
|
{
|
||||||
|
matrices.CalcMatrices(&pvrrc, width, height);
|
||||||
|
if (!pvrrc.isRenderFramebuffer)
|
||||||
|
setBaseScissor();
|
||||||
bool is_rtt = pvrrc.isRTT;
|
bool is_rtt = pvrrc.isRTT;
|
||||||
|
|
||||||
u32 texAddress = FB_W_SOF1 & VRAM_MASK;
|
u32 texAddress = FB_W_SOF1 & VRAM_MASK;
|
||||||
|
@ -365,7 +368,6 @@ bool DX11Renderer::Render()
|
||||||
vp.MaxDepth = 1.f;
|
vp.MaxDepth = 1.f;
|
||||||
deviceContext->RSSetViewports(1, &vp);
|
deviceContext->RSSetViewports(1, &vp);
|
||||||
}
|
}
|
||||||
matrices.CalcMatrices(&pvrrc, width, height);
|
|
||||||
VertexConstants constant{};
|
VertexConstants constant{};
|
||||||
memcpy(&constant.transMatrix, &matrices.GetNormalMatrix(), sizeof(constant.transMatrix));
|
memcpy(&constant.transMatrix, &matrices.GetNormalMatrix(), sizeof(constant.transMatrix));
|
||||||
constant.leftPlane[0] = 1;
|
constant.leftPlane[0] = 1;
|
||||||
|
@ -453,8 +455,6 @@ bool DX11Renderer::Render()
|
||||||
ID3D11Buffer *buffers[] { pxlConstants, pxlPolyConstants };
|
ID3D11Buffer *buffers[] { pxlConstants, pxlPolyConstants };
|
||||||
deviceContext->PSSetConstantBuffers(0, ARRAY_SIZE(buffers), buffers);
|
deviceContext->PSSetConstantBuffers(0, ARRAY_SIZE(buffers), buffers);
|
||||||
|
|
||||||
setBaseScissor();
|
|
||||||
|
|
||||||
drawStrips();
|
drawStrips();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1009,7 +1009,7 @@ void DX11Renderer::setBaseScissor()
|
||||||
{
|
{
|
||||||
float scaled_offs_x = matrices.GetSidebarWidth();
|
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{};
|
D3D11_VIEWPORT vp{};
|
||||||
vp.MaxDepth = 1.f;
|
vp.MaxDepth = 1.f;
|
||||||
vp.Width = scaled_offs_x;
|
vp.Width = scaled_offs_x;
|
||||||
|
|
|
@ -57,10 +57,16 @@ bool DX11Context::init(bool keepCurrentWindow)
|
||||||
NOTICE_LOG(RENDERER, "HDMI resolution: %d x %d", displayMode->ResolutionWidthInRawPixels, displayMode->ResolutionHeightInRawPixels);
|
NOTICE_LOG(RENDERER, "HDMI resolution: %d x %d", displayMode->ResolutionWidthInRawPixels, displayMode->ResolutionHeightInRawPixels);
|
||||||
settings.display.width = displayMode->ResolutionWidthInRawPixels;
|
settings.display.width = displayMode->ResolutionWidthInRawPixels;
|
||||||
settings.display.height = displayMode->ResolutionHeightInRawPixels;
|
settings.display.height = displayMode->ResolutionHeightInRawPixels;
|
||||||
|
if (settings.display.width == 3840)
|
||||||
|
// 4K
|
||||||
|
scaling = 2.f;
|
||||||
|
else
|
||||||
|
scaling = 1.f;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
scaling = 1.f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +83,7 @@ bool DX11Context::init(bool keepCurrentWindow)
|
||||||
nullptr, // Specify nullptr to use the default adapter.
|
nullptr, // Specify nullptr to use the default adapter.
|
||||||
D3D_DRIVER_TYPE_HARDWARE,
|
D3D_DRIVER_TYPE_HARDWARE,
|
||||||
nullptr,
|
nullptr,
|
||||||
D3D11_CREATE_DEVICE_BGRA_SUPPORT, // | D3D11_CREATE_DEVICE_DEBUG, // FIXME
|
D3D11_CREATE_DEVICE_BGRA_SUPPORT, // | D3D11_CREATE_DEVICE_DEBUG,
|
||||||
featureLevels,
|
featureLevels,
|
||||||
ARRAYSIZE(featureLevels),
|
ARRAYSIZE(featureLevels),
|
||||||
D3D11_SDK_VERSION,
|
D3D11_SDK_VERSION,
|
||||||
|
|
Loading…
Reference in New Issue