OpenGL Renderer: Fix a bug where the behavior of translucent polygons can become undefined if the frame contains nothing but translucent polygons. Fixes a graphical glitch in Grey's intro scene in Mega Man ZX Advent. (Regression from commit 1742114.)

This commit is contained in:
rogerman 2017-09-23 21:32:34 -07:00
parent 1742114fcd
commit 70c69a46d3
1 changed files with 11 additions and 2 deletions

View File

@ -3693,10 +3693,10 @@ Render3DError OpenGLRenderer_1_2::RenderGeometry(const GFX3D_State &renderState,
const POLY &firstPoly = polyList->list[indexList->list[0]];
u32 lastPolyAttr = firstPoly.polyAttr;
this->SetupPolygon(firstPoly, false, true);
if (polyList->opaqueCount > 0)
{
this->SetupPolygon(firstPoly, false, true);
this->DrawPolygonsForIndexRange<OGLPolyDrawMode_DrawOpaquePolys>(polyList, indexList, 0, polyList->opaqueCount - 1, indexOffset, lastPolyAttr);
}
@ -3704,6 +3704,11 @@ Render3DError OpenGLRenderer_1_2::RenderGeometry(const GFX3D_State &renderState,
{
if (this->_needsZeroDstAlphaPass)
{
if (polyList->opaqueCount == 0)
{
this->SetupPolygon(firstPoly, true, false);
}
this->ZeroDstAlphaPass(polyList, indexList, renderState.enableAlphaBlending, indexOffset, lastPolyAttr);
if (polyList->opaqueCount > 0)
@ -3712,7 +3717,11 @@ Render3DError OpenGLRenderer_1_2::RenderGeometry(const GFX3D_State &renderState,
lastPolyAttr = lastOpaquePoly.polyAttr;
this->SetupPolygon(lastOpaquePoly, false, true);
}
}
if (polyList->opaqueCount == 0)
{
this->SetupPolygon(firstPoly, true, true);
}
this->DrawPolygonsForIndexRange<OGLPolyDrawMode_DrawTranslucentPolys>(polyList, indexList, polyList->opaqueCount, polyList->count - 1, indexOffset, lastPolyAttr);