mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Offset the draws properly. Now just some texel clamping left to fix
This commit is contained in:
parent
70f7f74a05
commit
7186fc2c17
@ -581,8 +581,9 @@ void ConvertViewportAndScissor(bool useBufferedRendering, float renderWidth, flo
|
||||
renderHeightFactor = renderHeight / 272.0f;
|
||||
}
|
||||
|
||||
renderX = gstate_c.curRTOffsetX;
|
||||
renderY = gstate_c.curRTOffsetY;
|
||||
// negative offsets we take care of in the projection matrix.
|
||||
renderX = std::max(gstate_c.curRTOffsetX, 0);
|
||||
renderY = std::max(gstate_c.curRTOffsetY, 0);
|
||||
|
||||
// Scissor
|
||||
int scissorX1 = gstate.getScissorX1();
|
||||
@ -609,6 +610,9 @@ void ConvertViewportAndScissor(bool useBufferedRendering, float renderWidth, flo
|
||||
float offsetY = gstate.getOffsetY();
|
||||
|
||||
if (out.throughMode) {
|
||||
// If renderX/renderY are offset to compensate for a split framebuffer,
|
||||
// applying the offset to the viewport isn't enough, since the viewport clips.
|
||||
// We need to apply either directly to the vertices, or to the "through" projection matrix.
|
||||
out.viewportX = renderX * renderWidthFactor + displayOffsetX;
|
||||
out.viewportY = renderY * renderHeightFactor + displayOffsetY;
|
||||
out.viewportW = curRTWidth * renderWidthFactor;
|
||||
|
@ -152,6 +152,12 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView
|
||||
if (!useBufferedRendering && g_display_rotation != DisplayRotation::ROTATE_0) {
|
||||
proj_through = proj_through * g_display_rot_matrix;
|
||||
}
|
||||
if (gstate_c.curRTOffsetX < 0 || gstate_c.curRTOffsetY < 0) {
|
||||
Matrix4x4 xlate;
|
||||
xlate.setTranslation(Lin::Vec3(2.0f * gstate_c.curRTOffsetX / (int)gstate_c.curRTWidth, 2.0f * gstate_c.curRTOffsetY / (int)gstate_c.curRTHeight, 0.0f));
|
||||
proj_through = proj_through * xlate;
|
||||
}
|
||||
|
||||
CopyMatrix4x4(ub->proj_through, proj_through.getReadPtr());
|
||||
ub->rotation = useBufferedRendering ? 0 : (float)g_display_rotation;
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ struct GPUStateCache {
|
||||
if (xoff != curRTOffsetX || yoff != curRTOffsetY) {
|
||||
curRTOffsetX = xoff;
|
||||
curRTOffsetY = yoff;
|
||||
Dirty(DIRTY_VIEWPORTSCISSOR_STATE);
|
||||
Dirty(DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_PROJTHROUGHMATRIX);
|
||||
}
|
||||
}
|
||||
int curRTOffsetX;
|
||||
|
Loading…
Reference in New Issue
Block a user