1
0
Fork 0
forked from suyu/suyu

vk_rasterizer: Fix scaling on Y_NEGATE

This commit is contained in:
ameerj 2021-09-19 00:03:14 -04:00 committed by Fernando Sahmkow
parent 16017ac450
commit 122ddeb7ff

View file

@ -60,12 +60,18 @@ struct DrawParams {
VkViewport GetViewportState(const Device& device, const Maxwell& regs, size_t index, float scale) {
const auto& src = regs.viewport_transform[index];
const float x = (src.translate_x - src.scale_x) * scale;
const float width = src.scale_x * 2.0f * scale;
const float height = src.scale_y * 2.0f * scale;
float y = (src.translate_y - src.scale_y) * scale;
float height = src.scale_y * 2.0f * scale;
if (regs.screen_y_control.y_negate) {
y += height;
height = -height;
}
const float reduce_z = regs.depth_mode == Maxwell::DepthMode::MinusOneToOne ? 1.0f : 0.0f;
VkViewport viewport{
.x = (src.translate_x - src.scale_x) * scale,
.y = (src.translate_y - src.scale_y) * scale,
.x = x,
.y = y,
.width = width != 0.0f ? width : 1.0f,
.height = height != 0.0f ? height : 1.0f,
.minDepth = src.translate_z - src.scale_z * reduce_z,