Add an option to set the base uniform location
This will be used to generate uniform locations with --aml
diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp
index e15994b..48fcb7f 100644
--- a/StandAlone/StandAlone.cpp
+++ b/StandAlone/StandAlone.cpp
@@ -174,6 +174,7 @@
typedef std::map<unsigned int, unsigned int> TPerSetBaseBinding;
std::vector<std::pair<std::string, int>> uniformLocationOverrides;
+int uniformBase = 0;
std::array<std::array<unsigned int, EShLangCount>, glslang::EResCount> baseBinding;
std::array<std::array<TPerSetBaseBinding, EShLangCount>, glslang::EResCount> baseBindingForSet;
@@ -465,6 +466,12 @@
} else if (lowerword == "auto-map-locations" || // synonyms
lowerword == "aml") {
Options |= EOptionAutoMapLocations;
+ } else if (lowerword == "uniform-base") {
+ if (argc <= 1)
+ Error("no <base> provided for --uniform-base");
+ uniformBase = ::strtol(argv[1], NULL, 10);
+ bumpArg();
+ break;
} else if (lowerword == "client") {
if (argc > 1) {
if (strcmp(argv[1], "vulkan100") == 0)
@@ -924,6 +931,8 @@
uniOverride.second);
}
+ shader->setUniformLocationBase(uniformBase);
+
// Set up the environment, some subsettings take precedence over earlier
// ways of setting things.
if (Options & EOptionSpv) {
@@ -1444,6 +1453,7 @@
" suppress GLSL warnings, except as required by \"#extension : warn\"\n"
" -x save binary output as text-based 32-bit hexadecimal numbers\n"
" -u<name>:<loc> specify a uniform location override for --aml\n"
+ " --uniform-base <base> set a base to use for generated uniform locations\n"
" --auto-map-bindings | --amb automatically bind uniform variables\n"
" without explicit bindings\n"
" --auto-map-locations | --aml automatically locate input/output lacking\n"