1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-02 09:03:37 +00:00

RE2 related fixes:

* fixed gSPModifyVertex for case when primitive depth enabled
* fixed GraphicsDrawer::isRejected for case when coordinates of vertex set by gSPModifyVertex
* fixed writeDepth() shader for RE2

Fixed various issues mentioned in #2152
This commit is contained in:
Sergey Lipskiy 2020-03-18 13:57:26 +07:00
parent be78f2d324
commit 022b375614
3 changed files with 9 additions and 5 deletions

View File

@ -1649,17 +1649,19 @@ public:
if ((config.generalEmulation.hacks & hack_RE2) != 0) {
m_part =
"uniform lowp usampler2D uZlutImage;\n"
"highp float writeDepth() \n"
"{ \n"
"highp float writeDepth() \n"
"{ \n"
;
if (_glinfo.isGLESX && _glinfo.noPerspective) {
m_part +=
" if (uClampMode == 1 && (vZCoord > 1.0)) discard; \n"
" highp float FragDepth = clamp((vZCoord - uPolygonOffset) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n"
" highp float FragDepth = (uDepthSource != 0) ? uPrimDepth : \n"
" clamp((vZCoord - uPolygonOffset) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n"
;
} else {
m_part +=
" highp float FragDepth = clamp((gl_FragCoord.z * 2.0 - 1.0) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n"
" highp float FragDepth = (uDepthSource != 0) ? uPrimDepth : \n"
" clamp((gl_FragCoord.z * 2.0 - 1.0) * uDepthScale.s + uDepthScale.t, 0.0, 1.0); \n"
;
}
m_part +=

View File

@ -1575,6 +1575,8 @@ bool GraphicsDrawer::isRejected(s32 _v0, s32 _v1, s32 _v2) const
const f32 ySign = GBI.isNegativeY() ? -1.0f : 1.0f;
for (u32 i = 0; i < 3; ++i) {
const SPVertex & v = triangles.vertices[verts[i]];
if ((v.modify & MODIFY_XY) != 0)
continue;
const f32 sx = gSP.viewport.vtrans[0] + (v.x / v.w) * gSP.viewport.vscale[0];
if (sx < rejectBox.ulx)
return true;

View File

@ -1677,7 +1677,7 @@ void gSPModifyVertex( u32 _vtx, u32 _where, u32 _val )
vtx0.y *= vtx0.w;
} else {
vtx0.modify |= MODIFY_XY;
if (vtx0.w == 0.0f) {
if (vtx0.w == 0.0f || gDP.otherMode.depthSource == G_ZS_PRIM) {
vtx0.w = 1.0f;
vtx0.clip &= ~(CLIP_W);
}