Graphics/RenderTechnique: Add uniform invalidation

Former-commit-id: 8f03073408a03854533d9911eb1a0605ebbb8767
This commit is contained in:
Lynix
2015-06-07 18:25:35 +02:00
parent 358fab7115
commit 0f4cf3c910
6 changed files with 36 additions and 4 deletions

View File

@@ -240,12 +240,20 @@ const NzDeferredGeometryPass::ShaderUniforms* NzDeferredGeometryPass::GetShaderU
if (it == m_shaderUniforms.end())
{
ShaderUniforms uniforms;
uniforms.shaderReleaseSlot.Connect(shader->OnShaderRelease, this, OnShaderInvalidated);
uniforms.shaderUniformInvalidatedSlot.Connect(shader->OnShaderUniformInvalidated, this, OnShaderInvalidated);
uniforms.eyePosition = shader->GetUniformLocation("EyePosition");
uniforms.sceneAmbient = shader->GetUniformLocation("SceneAmbient");
uniforms.textureOverlay = shader->GetUniformLocation("TextureOverlay");
it = m_shaderUniforms.emplace(shader, uniforms).first;
it = m_shaderUniforms.emplace(shader, std::move(uniforms)).first;
}
return &it->second;
}
void NzDeferredGeometryPass::OnShaderInvalidated(const NzShader* shader) const
{
m_shaderUniforms.erase(shader);
}