1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-25 22:09:35 +00:00

Add CombinerInfo::update().

Call it in FrameBufferList::attachDepthBuffer() before currentCombiner()->updateDepthInfo
to avoid glError caused by wrong shader program set.

Fixed glError with MarioTennis character selection.
This commit is contained in:
Sergey Lipskiy 2014-09-30 10:53:47 +07:00
parent b6771dcf0a
commit 7548922cfd
4 changed files with 17 additions and 6 deletions

View File

@ -236,6 +236,20 @@ ShaderCombiner * CombinerInfo::_compile(u64 mux) const
return new ShaderCombiner( color, alpha, combine );
}
void CombinerInfo::update()
{
// TODO: find, why gDP.changed & CHANGED_COMBINE not always works (e.g. Mario Tennis).
// if (gDP.changed & CHANGED_COMBINE) {
if (gDP.otherMode.cycleType == G_CYC_COPY)
setCombine(EncodeCombineMode(0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0));
else if (gDP.otherMode.cycleType == G_CYC_FILL)
setCombine(EncodeCombineMode(0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE));
else
setCombine(gDP.combine.mux);
gDP.changed &= ~CHANGED_COMBINE;
// }
}
void CombinerInfo::setCombine(u64 _mux )
{
if (m_pCurrent != NULL && m_pCurrent->getMux() == _mux) {

View File

@ -119,6 +119,7 @@ class CombinerInfo
public:
void init();
void destroy();
void update();
void setCombine(u64 _mux);
ShaderCombiner * getCurrent() const {return m_pCurrent;}

View File

@ -302,6 +302,7 @@ void FrameBufferList::attachDepthBuffer()
#endif
assert(checkFBO());
}
CombinerInfo::get().update();
currentCombiner()->updateDepthInfo(true);
}

View File

@ -420,12 +420,7 @@ void OGLRender::_updateStates() const
{
OGLVideo & ogl = video();
if (gDP.otherMode.cycleType == G_CYC_COPY)
CombinerInfo::get().setCombine(EncodeCombineMode(0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0));
else if (gDP.otherMode.cycleType == G_CYC_FILL)
CombinerInfo::get().setCombine(EncodeCombineMode(0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE));
else
CombinerInfo::get().setCombine(gDP.combine.mux);
CombinerInfo::get().update();
if (gSP.changed & CHANGED_GEOMETRYMODE)
_updateCullFace();