Add an option to set the base uniform location
This will be used to generate uniform locations with --aml
This commit is contained in:
committed by
Alejandro Piñeiro
parent
16f53474c8
commit
b0f3d794c8
@@ -174,6 +174,7 @@ std::vector<std::string> Processes; // what should be record
|
||||
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 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
} 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 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
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 @@ void usage()
|
||||
" 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"
|
||||
|
||||
Reference in New Issue
Block a user