Reset disassembly/reflection of shaders when recompiled. Refs #470

* In GL various really really stupid options for changing shaders and
  recompiling and relinking is possible.
* We don't support the whole giant trash fire, but we can at least
  handle re-compiling a shader within the same program (so the original
  source isn't used anywhere and can be safely rewritten).
This commit is contained in:
baldurk
2017-01-02 11:28:06 +00:00
parent e494f13518
commit 057e36aefa
@@ -183,6 +183,21 @@ bool WrappedOpenGL::Serialise_glShaderSource(GLuint shader, GLsizei count,
m_Real.glShaderSource(GetResourceManager()->GetLiveResource(id).name, Count, strings, NULL);
// if we've already disassembled this shader, undo all that.
// Note this means we don't support compiling the same shader multiple times
// attached to different programs, but that is *utterly crazy* and anyone
// who tries to actually do that should be ashamed.
// Doing this means we support the case of recompiling a shader different ways
// and relinking a program before use, which is still moderately crazy and
// so people who do that should be moderately ashamed.
if(m_Shaders[liveId].prog)
{
m_Real.glDeleteProgram(m_Shaders[liveId].prog);
m_Shaders[liveId].prog = 0;
m_Shaders[liveId].spirv = SPVModule();
m_Shaders[liveId].reflection = ShaderReflection();
}
delete[] strings;
}