Skip to content

Commit

Permalink
Copy config when creating a TIntermediate for a compilation unit
Browse files Browse the repository at this point in the history
Without this --auto-map-locations effectively gets disabled when there
are more than one compilations units for a stage.

This is kind of a hacky fix and I think there should be a better way
to do it.

See: KhronosGroup#1309
  • Loading branch information
bpeel authored and antiapuentes committed May 28, 2018
1 parent ad1fd81 commit f0b5583
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions glslang/MachineIndependent/ShaderLang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1860,6 +1860,14 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages)
}
intermediate[stage]->setSpv(firstIntermediate->getSpv());

if (firstIntermediate->getAutoMapBindings())
intermediate[stage]->setAutoMapBindings(true);
if (firstIntermediate->getAutoMapLocations())
intermediate[stage]->setAutoMapLocations(true);
int base = firstIntermediate->getUniformLocationBase();
intermediate[stage]->setUniformLocationBase(base);
intermediate[stage]->copyUniformLocationOverrides(*firstIntermediate);

newedIntermediate[stage] = true;
}

Expand Down
5 changes: 5 additions & 0 deletions glslang/MachineIndependent/localintermediate.h
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,11 @@ class TIntermediate {
return pos->second;
}

void copyUniformLocationOverrides(const TIntermediate& other)
{
uniformLocationOverrides = other.uniformLocationOverrides;
}

void setUniformLocationBase(int base) { uniformLocationBase = base; }
int getUniformLocationBase() const { return uniformLocationBase; }

Expand Down

0 comments on commit f0b5583

Please sign in to comment.