mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-24 08:39:51 +00:00
Depth range should not be applied in through mode. Fixes sky in Wipeout Pure.
This commit is contained in:
parent
4868b5041c
commit
ca347da99c
@ -798,16 +798,8 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
|
||||
case GE_CMD_VIEWPORTY1:
|
||||
case GE_CMD_VIEWPORTX2:
|
||||
case GE_CMD_VIEWPORTY2:
|
||||
break;
|
||||
|
||||
case GE_CMD_VIEWPORTZ1:
|
||||
gstate_c.zScale = getFloat24(data) / 65535.f;
|
||||
break;
|
||||
|
||||
case GE_CMD_VIEWPORTZ2:
|
||||
gstate_c.zOff = getFloat24(data) / 65535.f;
|
||||
break;
|
||||
|
||||
case GE_CMD_LIGHTENABLE0:
|
||||
case GE_CMD_LIGHTENABLE1:
|
||||
case GE_CMD_LIGHTENABLE2:
|
||||
|
@ -208,10 +208,6 @@ void TransformDrawEngine::ApplyDrawState(int prim) {
|
||||
|
||||
bool wantDepthWrite = gstate.isModeClear() || gstate.isDepthWriteEnabled();
|
||||
glstate.depthWrite.set(wantDepthWrite ? GL_TRUE : GL_FALSE);
|
||||
|
||||
float depthRangeMin = gstate_c.zOff - gstate_c.zScale;
|
||||
float depthRangeMax = gstate_c.zOff + gstate_c.zScale;
|
||||
glstate.depthRange.set(depthRangeMin, depthRangeMax);
|
||||
}
|
||||
|
||||
void UpdateViewportAndProjection() {
|
||||
@ -241,14 +237,13 @@ void UpdateViewportAndProjection() {
|
||||
if (throughmode) {
|
||||
// No viewport transform here. Let's experiment with using region.
|
||||
glstate.viewport.set((0 + regionX1) * renderWidthFactor, (0 - regionY1) * renderHeightFactor, (regionX2 - regionX1) * renderWidthFactor, (regionY2 - regionY1) * renderHeightFactor);
|
||||
glstate.depthRange.set(1.0, 0.0);
|
||||
} else {
|
||||
// These we can turn into a glViewport call, offset by offsetX and offsetY. Math after.
|
||||
float vpXa = getFloat24(gstate.viewportx1);
|
||||
float vpXb = getFloat24(gstate.viewportx2);
|
||||
float vpYa = getFloat24(gstate.viewporty1);
|
||||
float vpYb = getFloat24(gstate.viewporty2);
|
||||
float vpZa = getFloat24(gstate.viewportz1); // / 65536.0f should map it to OpenGL's 0.0-1.0 Z range
|
||||
float vpZb = getFloat24(gstate.viewportz2); // / 65536.0f
|
||||
|
||||
// The viewport transform appears to go like this:
|
||||
// Xscreen = -offsetX + vpXb + vpXa * Xview
|
||||
@ -264,10 +259,6 @@ void UpdateViewportAndProjection() {
|
||||
float vpWidth = fabsf(gstate_c.vpWidth);
|
||||
float vpHeight = fabsf(gstate_c.vpHeight);
|
||||
|
||||
// TODO: These two should feed into glDepthRange somehow.
|
||||
float vpZ0 = (vpZb - vpZa) / 65536.0f;
|
||||
float vpZ1 = (vpZa * 2) / 65536.0f;
|
||||
|
||||
vpX0 *= renderWidthFactor;
|
||||
vpY0 *= renderHeightFactor;
|
||||
vpWidth *= renderWidthFactor;
|
||||
@ -278,5 +269,11 @@ void UpdateViewportAndProjection() {
|
||||
glstate.viewport.set(vpX0, vpY0, vpWidth, vpHeight);
|
||||
// Sadly, as glViewport takes integers, we will not be able to support sub pixel offsets this way. But meh.
|
||||
// shaderManager_->DirtyUniform(DIRTY_PROJMATRIX);
|
||||
|
||||
float zScale = getFloat24(gstate.viewportz1) / 65535.f;
|
||||
float zOff = getFloat24(gstate.viewportz2) / 65535.f;
|
||||
float depthRangeMin = zOff - zScale;
|
||||
float depthRangeMax = zOff + zScale;
|
||||
glstate.depthRange.set(depthRangeMin, depthRangeMax);
|
||||
}
|
||||
}
|
||||
|
@ -236,8 +236,8 @@ struct GPUStateCache
|
||||
|
||||
bool textureChanged;
|
||||
|
||||
float uScale,vScale,zScale;
|
||||
float uOff,vOff,zOff;
|
||||
float uScale,vScale;
|
||||
float uOff,vOff;
|
||||
float zMin, zMax;
|
||||
float lightpos[4][3];
|
||||
float lightdir[4][3];
|
||||
|
@ -521,13 +521,13 @@ void GeDisassembleOp(u32 pc, u32 op, u32 prev, char *buffer) {
|
||||
case GE_CMD_VIEWPORTZ1:
|
||||
{
|
||||
float zScale = getFloat24(data) / 65535.f;
|
||||
sprintf(buffer, "Z scale: %f", zScale);
|
||||
sprintf(buffer, "Viewport Z scale: %f", zScale);
|
||||
}
|
||||
break;
|
||||
case GE_CMD_VIEWPORTZ2:
|
||||
{
|
||||
float zOff = getFloat24(data) / 65535.f;
|
||||
sprintf(buffer, "Z pos: %f", zOff);
|
||||
sprintf(buffer, "Viewport Z pos: %f", zOff);
|
||||
}
|
||||
break;
|
||||
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit f22ad17d40c00d9a60bd21f53820012b302d7559
|
||||
Subproject commit 3caced8524c06cabcf968942a7780d80337de7bf
|
Loading…
Reference in New Issue
Block a user