mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 13:30:44 +00:00
Fix a shader editing issue - when copying fragdata bindings ignore dupes
* I'm not clear on if this is safe or sensible - somehow the source program can report multiple outputs bound to the same index (e.g. 0) but that's illegal to set explicitly ourselves. So we just ignore the subsequent variables and hope the first one we find is the valid one. * The other alternative is to set the subsequent variables to some bind higher than all of the rest, or fill in holes (e.g. if we see 0, 0, 1 then bind the second 0 to 2).
This commit is contained in:
@@ -2365,6 +2365,8 @@ void CopyProgramAttribBindings(const GLHookSet &gl, GLuint progsrc, GLuint progd
|
||||
void CopyProgramFragDataBindings(const GLHookSet &gl, GLuint progsrc, GLuint progdst,
|
||||
ShaderReflection *refl)
|
||||
{
|
||||
uint64_t used = 0;
|
||||
|
||||
// copy over fragdata bindings
|
||||
for(int32_t i = 0; i < refl->OutputSig.count; i++)
|
||||
{
|
||||
@@ -2375,6 +2377,17 @@ void CopyProgramFragDataBindings(const GLHookSet &gl, GLuint progsrc, GLuint pro
|
||||
GLint idx = gl.glGetFragDataLocation(progsrc, refl->OutputSig[i].varName.elems);
|
||||
if(idx >= 0)
|
||||
{
|
||||
uint64_t mask = 1ULL << idx;
|
||||
|
||||
if(used & mask)
|
||||
{
|
||||
RDCWARN("Multiple signatures bound to output %d, ignoring %s", i,
|
||||
refl->OutputSig[i].varName.elems);
|
||||
continue;
|
||||
}
|
||||
|
||||
used |= mask;
|
||||
|
||||
if(gl.glBindFragDataLocation)
|
||||
{
|
||||
gl.glBindFragDataLocation(progdst, (GLuint)idx, refl->OutputSig[i].varName.elems);
|
||||
|
||||
Reference in New Issue
Block a user