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;
} 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)
uniOverride.second);
}
+ shader->setUniformLocationBase(uniformBase);
+
// Set up the environment, some subsettings take precedence over earlier
// ways of setting things.
if (Options & EOptionSpv) {
" 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"
{
intermediate->addUniformLocationOverride(name, loc);
}
+void TShader::setUniformLocationBase(int base)
+{
+ intermediate->setUniformLocationBase(base);
+}
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); }
void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); }
hlslIoMapping(false),
textureSamplerTransformMode(EShTexSampTransKeep),
needToLegalize(false),
- binaryDoubleOutput(false)
+ binaryDoubleOutput(false),
+ uniformLocationBase(0)
{
localSize[0] = 1;
localSize[1] = 1;
return pos->second;
}
+ void setUniformLocationBase(int base) { uniformLocationBase = base; }
+ int getUniformLocationBase() const { return uniformLocationBase; }
+
void setNeedsLegalization() { needToLegalize = true; }
bool needsLegalization() const { return needToLegalize; }
bool binaryDoubleOutput;
std::unordered_map<TString, int> uniformLocationOverrides;
+ int uniformLocationBase;
private:
void operator=(TIntermediate&); // prevent assignments
void setAutoMapBindings(bool map);
void setAutoMapLocations(bool map);
void addUniformLocationOverride(const char* name, int loc);
+ void setUniformLocationBase(int base);
void setInvertY(bool invert);
void setHlslIoMapping(bool hlslIoMap);
void setFlattenUniformArrays(bool flatten);