diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index dc93c877c8..3be5d5554b 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -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: diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index 5d4a952404..65aabfdd81 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -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); } } diff --git a/GPU/GPUState.h b/GPU/GPUState.h index 4710856152..84d9d8dcea 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -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]; diff --git a/GPU/GeDisasm.cpp b/GPU/GeDisasm.cpp index 49d0c735f4..c75dc1ba93 100644 --- a/GPU/GeDisasm.cpp +++ b/GPU/GeDisasm.cpp @@ -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; diff --git a/native b/native index f22ad17d40..3caced8524 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit f22ad17d40c00d9a60bd21f53820012b302d7559 +Subproject commit 3caced8524c06cabcf968942a7780d80337de7bf