Get rid of strange offset in Vulkan matrix converter
This commit is contained in:
parent
e45c24b75f
commit
a995dd2ff4
5 changed files with 26 additions and 33 deletions
|
@ -640,31 +640,33 @@ void ConvertViewportAndScissor(bool useBufferedRendering, float renderWidth, flo
|
|||
float hScale = 1.0f;
|
||||
float yOffset = 0.0f;
|
||||
|
||||
// If we're within the bounds, we want clipping the viewport way. So leave it be.
|
||||
if (left < 0.0f || right > renderWidth) {
|
||||
float overageLeft = std::max(-left, 0.0f);
|
||||
float overageRight = std::max(right - renderWidth, 0.0f);
|
||||
// Our center drifted by the difference in overages.
|
||||
float drift = overageRight - overageLeft;
|
||||
if (!gstate_c.Supports(GPU_SUPPORTS_LARGE_VIEWPORTS)) {
|
||||
// If we're within the bounds, we want clipping the viewport way. So leave it be.
|
||||
if (left < 0.0f || right > renderWidth) {
|
||||
float overageLeft = std::max(-left, 0.0f);
|
||||
float overageRight = std::max(right - renderWidth, 0.0f);
|
||||
// Our center drifted by the difference in overages.
|
||||
float drift = overageRight - overageLeft;
|
||||
|
||||
left += overageLeft;
|
||||
right -= overageRight;
|
||||
left += overageLeft;
|
||||
right -= overageRight;
|
||||
|
||||
wScale = vpWidth / (right - left);
|
||||
xOffset = drift / (right - left);
|
||||
}
|
||||
wScale = vpWidth / (right - left);
|
||||
xOffset = drift / (right - left);
|
||||
}
|
||||
|
||||
if (top < 0.0f || bottom > renderHeight) {
|
||||
float overageTop = std::max(-top, 0.0f);
|
||||
float overageBottom = std::max(bottom - renderHeight, 0.0f);
|
||||
// Our center drifted by the difference in overages.
|
||||
float drift = overageBottom - overageTop;
|
||||
if (top < 0.0f || bottom > renderHeight) {
|
||||
float overageTop = std::max(-top, 0.0f);
|
||||
float overageBottom = std::max(bottom - renderHeight, 0.0f);
|
||||
// Our center drifted by the difference in overages.
|
||||
float drift = overageBottom - overageTop;
|
||||
|
||||
top += overageTop;
|
||||
bottom -= overageBottom;
|
||||
top += overageTop;
|
||||
bottom -= overageBottom;
|
||||
|
||||
hScale = vpHeight / (bottom - top);
|
||||
yOffset = drift / (bottom - top);
|
||||
hScale = vpHeight / (bottom - top);
|
||||
yOffset = drift / (bottom - top);
|
||||
}
|
||||
}
|
||||
|
||||
out.viewportX = left + displayOffsetX;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue