yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

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
1 changed files with 9 additions and 3 deletions

View File

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