Add a command-line option to override uniform locations

This commit is contained in:
Neil Roberts 2018-03-20 17:30:53 +01:00 committed by Alejandro Piñeiro
parent 4508a8170a
commit 16f53474c8
5 changed files with 54 additions and 2 deletions

View file

@ -434,7 +434,7 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
return 0;
}
int resolveUniformLocation(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override
int resolveUniformLocation(EShLanguage /*stage*/, const char* name, const glslang::TType& type, bool /*is_live*/) override
{
// kick out of not doing this
if (!doAutoLocationMapping())
@ -455,7 +455,11 @@ struct TDefaultIoResolverBase : public glslang::TIoMapResolver
return -1;
}
int location = nextUniformLocation;
int location = intermediate.getUniformLocationOverride(name);
if (location != -1)
return location;
location = nextUniformLocation;
nextUniformLocation += TIntermediate::computeTypeUniformLocationSize(type);