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

Force update shader unifirms only after shader creation.

This commit is contained in:
Sergey Lipskiy 2015-02-14 15:08:09 +06:00
parent dc5a57239c
commit 4e6416d6d4
3 changed files with 18 additions and 17 deletions

View File

@ -217,17 +217,18 @@ void CombinerInfo::setCombine(u64 _mux )
{
if (m_pCurrent != NULL && m_pCurrent->getMux() == _mux) {
m_bChanged = false;
m_pCurrent->update();
m_pCurrent->update(false);
return;
}
Combiners::const_iterator iter = m_combiners.find(_mux);
if (iter != m_combiners.end())
if (iter != m_combiners.end()) {
m_pCurrent = iter->second;
else {
m_pCurrent->update(false);
} else {
m_pCurrent = _compile(_mux);
m_pCurrent->update(true);
m_combiners[_mux] = m_pCurrent;
}
m_pCurrent->update();
m_bChanged = true;
gDP.changed |= CHANGED_COMBINE_COLORS;
}

View File

@ -610,21 +610,21 @@ void ShaderCombiner::_locate_attributes() const {
glBindAttribLocation(m_program, SC_NUMLIGHTS, "aNumLights");
}
void ShaderCombiner::update() {
void ShaderCombiner::update(bool _bForce) {
glUseProgram(m_program);
_setIUniform(m_uniforms.uTex0, 0, true);
_setIUniform(m_uniforms.uTex1, 1, true);
_setFUniform(m_uniforms.uScreenWidth, (float)video().getWidth(), true);
_setFUniform(m_uniforms.uScreenHeight, (float)video().getHeight(), true);
_setIUniform(m_uniforms.uTex0, 0, _bForce);
_setIUniform(m_uniforms.uTex1, 1, _bForce);
_setFUniform(m_uniforms.uScreenWidth, (float)video().getWidth(), _bForce);
_setFUniform(m_uniforms.uScreenHeight, (float)video().getHeight(), _bForce);
updateRenderState(true);
updateColors(true);
updateTextureInfo(true);
updateAlphaTestInfo(true);
updateFBInfo(true);
updateDepthInfo(true);
updateLight(true);
updateRenderState(_bForce);
updateColors(_bForce);
updateTextureInfo(_bForce);
updateAlphaTestInfo(_bForce);
updateFBInfo(_bForce);
updateDepthInfo(_bForce);
updateLight(_bForce);
}
void ShaderCombiner::updateRenderState(bool _bForce) {

View File

@ -9,7 +9,7 @@ public:
ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCombine & _combine);
~ShaderCombiner();
void update();
void update(bool _bForce);
void updateColors(bool _bForce = false);
void updateFBInfo(bool _bForce = false);
void updateDepthInfo(bool _bForce = false);