mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 23:25:46 +00:00
gl_rasterizer: Use transformed viewport for depth ranges
Implement depth ranges using the transformed viewport instead of the generic one. This matches the current Vulkan implementation but doesn't support negative depth ranges. An update to glad is required for this.
This commit is contained in:
parent
b2a4758420
commit
e800c76c4b
1 changed files with 6 additions and 4 deletions
|
@ -933,13 +933,15 @@ void RasterizerOpenGL::SyncViewport() {
|
||||||
}
|
}
|
||||||
flags[Dirty::Viewport0 + i] = false;
|
flags[Dirty::Viewport0 + i] = false;
|
||||||
|
|
||||||
const Common::Rectangle<f32> rect{regs.viewport_transform[i].GetRect()};
|
const auto& src = regs.viewport_transform[i];
|
||||||
|
const Common::Rectangle<f32> rect{src.GetRect()};
|
||||||
glViewportIndexedf(static_cast<GLuint>(i), rect.left, rect.bottom, rect.GetWidth(),
|
glViewportIndexedf(static_cast<GLuint>(i), rect.left, rect.bottom, rect.GetWidth(),
|
||||||
rect.GetHeight());
|
rect.GetHeight());
|
||||||
|
|
||||||
const auto& src = regs.viewports[i];
|
const GLdouble reduce_z = regs.depth_mode == Maxwell::DepthMode::MinusOneToOne;
|
||||||
glDepthRangeIndexed(static_cast<GLuint>(i), static_cast<GLdouble>(src.depth_range_near),
|
const GLdouble near_depth = src.translate_z - src.scale_z * reduce_z;
|
||||||
static_cast<GLdouble>(src.depth_range_far));
|
const GLdouble far_depth = src.translate_z + src.scale_z;
|
||||||
|
glDepthRangeIndexed(static_cast<GLuint>(i), near_depth, far_depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue