mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 21:30:53 +00:00
Use serialised program initial states to translate uniform locations
* If you're capturing and replaying on the same driver it's insanely unlikely that this translation will be anything other than the identity map, although it wouldn't be illegal to renumber locations. However this should allow moving captures between vendors/driver versions/platforms, which in the past wasn't possible because locations would change (quite validly) when the programs were recompiled. There might be other issues, but at least this one is fixed.
This commit is contained in:
@@ -422,7 +422,7 @@ ResourceFormat MakeResourceFormat(WrappedOpenGL &gl, GLenum target, GLenum fmt)
|
||||
}
|
||||
|
||||
template<const bool CopyUniforms, const bool SerialiseUniforms>
|
||||
static void ForAllProgramUniforms(const GLHookSet &gl, Serialiser *ser, GLuint progSrc, GLuint progDst, bool writing)
|
||||
static void ForAllProgramUniforms(const GLHookSet &gl, Serialiser *ser, GLuint progSrc, GLuint progDst, map<GLint, GLint> *locTranslate, bool writing)
|
||||
{
|
||||
const bool ReadSourceProgram = CopyUniforms || (SerialiseUniforms && writing);
|
||||
const bool WriteDestProgram = CopyUniforms || (SerialiseUniforms && !writing);
|
||||
@@ -520,7 +520,10 @@ static void ForAllProgramUniforms(const GLHookSet &gl, Serialiser *ser, GLuint p
|
||||
|
||||
GLint newloc = 0;
|
||||
if(WriteDestProgram)
|
||||
{
|
||||
newloc = gl.glGetUniformLocation(progDst, name.c_str());
|
||||
if(locTranslate) (*locTranslate)[srcLocation] = newloc;
|
||||
}
|
||||
|
||||
if(CopyUniforms && newloc == -1)
|
||||
continue;
|
||||
@@ -807,14 +810,14 @@ void CopyProgramUniforms(const GLHookSet &gl, GLuint progSrc, GLuint progDst)
|
||||
{
|
||||
const bool CopyUniforms = true;
|
||||
const bool SerialiseUniforms = false;
|
||||
ForAllProgramUniforms<CopyUniforms, SerialiseUniforms>(gl, NULL, progSrc, progDst, false);
|
||||
ForAllProgramUniforms<CopyUniforms, SerialiseUniforms>(gl, NULL, progSrc, progDst, NULL, false);
|
||||
}
|
||||
|
||||
void SerialiseProgramUniforms(const GLHookSet &gl, Serialiser *ser, GLuint prog, bool writing)
|
||||
void SerialiseProgramUniforms(const GLHookSet &gl, Serialiser *ser, GLuint prog, map<GLint, GLint> *locTranslate, bool writing)
|
||||
{
|
||||
const bool CopyUniforms = false;
|
||||
const bool SerialiseUniforms = true;
|
||||
ForAllProgramUniforms<CopyUniforms, SerialiseUniforms>(gl, ser, prog, prog, writing);
|
||||
ForAllProgramUniforms<CopyUniforms, SerialiseUniforms>(gl, ser, prog, prog, locTranslate, writing);
|
||||
}
|
||||
|
||||
template<>
|
||||
|
||||
Reference in New Issue
Block a user