mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-12 09:09:29 +01:00
Merge pull request #8168 from hrydgard/viewport-vertical-fix
Fix viewport vertical positioning, fixing #8165.
This commit is contained in:
commit
f5530bf3ee
4 files changed
+7
-10
No files matched your search
@@ -471,7 +471,7 @@ void SoftwareTransform(
|
||||
if (!throughmode) {
|
||||
memcpy(&flippedMatrix, gstate.projMatrix, 16 * sizeof(float));
|
||||
|
||||
const bool invertedY = useBufferedRendering ? (gstate_c.vpHeight > 0) : (gstate_c.vpHeight < 0);
|
||||
const bool invertedY = useBufferedRendering ? (gstate_c.vpHeight < 0) : (gstate_c.vpHeight > 0);
|
||||
if (invertedY) {
|
||||
flippedMatrix[1] = -flippedMatrix[1];
|
||||
flippedMatrix[5] = -flippedMatrix[5];
|
||||
|
||||
@@ -832,7 +832,7 @@ rotateVBO:
|
||||
SoftwareTransform(
|
||||
prim, decoded, indexGen.VertexCount(),
|
||||
dec_->VertexType(), inds, GE_VTYPE_IDX_16BIT, dec_->GetDecVtxFmt(),
|
||||
maxIndex, framebufferManager_, textureCache_, transformed, transformedExpanded, drawBuffer, numTrans, drawIndexed, &result, -1.0f);
|
||||
maxIndex, framebufferManager_, textureCache_, transformed, transformedExpanded, drawBuffer, numTrans, drawIndexed, &result, 1.0f);
|
||||
|
||||
ApplyDrawStateLate();
|
||||
vshader = shaderManager_->ApplyShader(prim, lastVType_);
|
||||
|
||||
@@ -410,7 +410,7 @@ void LinkedShader::UpdateUniforms(u32 vertType) {
|
||||
|
||||
bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
|
||||
|
||||
const bool invertedY = useBufferedRendering ? (gstate_c.vpHeight > 0) : (gstate_c.vpHeight < 0);
|
||||
const bool invertedY = useBufferedRendering ? (gstate_c.vpHeight < 0) : (gstate_c.vpHeight > 0);
|
||||
if (invertedY) {
|
||||
flippedMatrix[1] = -flippedMatrix[1];
|
||||
flippedMatrix[5] = -flippedMatrix[5];
|
||||
|
||||
@@ -835,22 +835,19 @@ void TransformDrawEngine::ApplyDrawState(int prim) {
|
||||
|
||||
// This means that to get the analogue glViewport we must:
|
||||
float vpX0 = vpXCenter - offsetX - fabsf(vpXScale);
|
||||
float vpY0 = vpYCenter - offsetY + fabsf(vpYScale); // Need to account for sign of Y
|
||||
float vpY0 = vpYCenter - offsetY - fabsf(vpYScale); // Need to account for sign of Y
|
||||
gstate_c.vpWidth = vpXScale * 2.0f;
|
||||
gstate_c.vpHeight = -vpYScale * 2.0f;
|
||||
gstate_c.vpHeight = vpYScale * 2.0f;
|
||||
|
||||
float vpWidth = fabsf(gstate_c.vpWidth);
|
||||
float vpHeight = fabsf(gstate_c.vpHeight);
|
||||
|
||||
// This multiplication should probably be done after viewport clipping. Would let us very slightly simplify the clipping logic?
|
||||
vpX0 *= renderWidthFactor;
|
||||
vpY0 *= renderHeightFactor;
|
||||
vpWidth *= renderWidthFactor;
|
||||
vpHeight *= renderHeightFactor;
|
||||
|
||||
// Flip vpY0 to match the OpenGL coordinate system.
|
||||
// TODO: This makes no sense anymore, in "flipped space".
|
||||
vpY0 = renderHeight - vpY0;
|
||||
|
||||
// We used to apply the viewport here via glstate, but there are limits which vary by driver.
|
||||
// This may mean some games won't work, or at least won't work at higher render resolutions.
|
||||
// So we apply it in the shader instead.
|
||||
@@ -882,7 +879,7 @@ void TransformDrawEngine::ApplyDrawState(int prim) {
|
||||
float overageTop = std::max(-top, 0.0f);
|
||||
float overageBottom = std::max(bottom - renderHeight, 0.0f);
|
||||
// Our center drifted by the difference in overages.
|
||||
float drift = overageTop - overageBottom;
|
||||
float drift = overageBottom - overageTop;
|
||||
|
||||
top += overageTop;
|
||||
bottom -= overageBottom;
|
||||
|
||||
Reference in new issue
Block a user