Flip the viewport for lower-left origin when the viewport transform is disabled (#373)
The normal viewport path already flips Y when the window origin is lower left. The disabled-transform path did not, so the image was upside down in that case.
This commit is contained in:
parent
362dff4ba8
commit
da49c4c6e4
|
|
@ -1030,14 +1030,18 @@ void RasterizerVulkan::UpdateViewportsState(Tegra::Engines::Maxwell3D::Regs& reg
|
|||
}
|
||||
if (!regs.viewport_scale_offset_enabled) {
|
||||
const auto x = static_cast<float>(regs.surface_clip.x);
|
||||
const auto y = static_cast<float>(regs.surface_clip.y);
|
||||
const auto width = static_cast<float>(regs.surface_clip.width);
|
||||
const auto height = static_cast<float>(regs.surface_clip.height);
|
||||
float y = static_cast<float>(regs.surface_clip.y);
|
||||
const float width = std::max(1.0f, static_cast<float>(regs.surface_clip.width));
|
||||
float height = std::max(1.0f, static_cast<float>(regs.surface_clip.height));
|
||||
if (regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft) {
|
||||
y += height;
|
||||
height = -height;
|
||||
}
|
||||
VkViewport viewport{
|
||||
.x = x,
|
||||
.y = y,
|
||||
.width = width != 0.0f ? width : 1.0f,
|
||||
.height = height != 0.0f ? height : 1.0f,
|
||||
.width = width,
|
||||
.height = height,
|
||||
.minDepth = 0.0f,
|
||||
.maxDepth = 1.0f,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue