HLSL: Manually configure descriptor set and binding number for resources
This commit is contained in:
@@ -168,6 +168,7 @@ std::array<unsigned int, EShLangCount> baseImageBinding;
|
||||
std::array<unsigned int, EShLangCount> baseUboBinding;
|
||||
std::array<unsigned int, EShLangCount> baseSsboBinding;
|
||||
std::array<unsigned int, EShLangCount> baseUavBinding;
|
||||
std::array<std::vector<std::string>, EShLangCount> baseResourceSetBinding;
|
||||
|
||||
//
|
||||
// Create the default name for saving a binary if -o is not provided.
|
||||
@@ -245,6 +246,45 @@ void ProcessBindingBase(int& argc, char**& argv, std::array<unsigned int, EShLan
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessResourceSetBindingBase(int& argc, char**& argv, std::array<std::vector<std::string>, EShLangCount>& base)
|
||||
{
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
||||
if (!isdigit(argv[1][0])) {
|
||||
if (argc < 5) // this form needs one more argument
|
||||
usage();
|
||||
|
||||
// Parse form: --argname stage base
|
||||
const EShLanguage lang = FindLanguage(argv[1], false);
|
||||
|
||||
base[lang].push_back(argv[2]);
|
||||
base[lang].push_back(argv[3]);
|
||||
base[lang].push_back(argv[4]);
|
||||
argc-= 4;
|
||||
argv+= 4;
|
||||
while(argv[1] != NULL) {
|
||||
if(argv[1][0] != '-') {
|
||||
base[lang].push_back(argv[1]);
|
||||
base[lang].push_back(argv[2]);
|
||||
base[lang].push_back(argv[3]);
|
||||
argc-= 3;
|
||||
argv+= 3;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Parse form: --argname base
|
||||
for (int lang=0; lang<EShLangCount; ++lang)
|
||||
base[lang].push_back(argv[1]);
|
||||
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Do all command-line argument parsing. This includes building up the work-items
|
||||
// to be processed later, and saving all the command-line options.
|
||||
@@ -297,6 +337,10 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
|
||||
lowerword == "shift-ssbo-binding" ||
|
||||
lowerword == "sbb") {
|
||||
ProcessBindingBase(argc, argv, baseSsboBinding);
|
||||
} else if (lowerword == "resource-set-bindings" || // synonyms
|
||||
lowerword == "resource-set-binding" ||
|
||||
lowerword == "rsb") {
|
||||
ProcessResourceSetBindingBase(argc, argv, baseResourceSetBinding);
|
||||
} else if (lowerword == "shift-uav-bindings" || // synonyms
|
||||
lowerword == "shift-uav-binding" ||
|
||||
lowerword == "suavb") {
|
||||
@@ -594,6 +638,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||
shader->setShiftUavBinding(baseUavBinding[compUnit.stage]);
|
||||
shader->setFlattenUniformArrays((Options & EOptionFlattenUniformArrays) != 0);
|
||||
shader->setNoStorageFormat((Options & EOptionNoStorageFormat) != 0);
|
||||
shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
|
||||
|
||||
if (Options & EOptionHlslIoMapping)
|
||||
shader->setHlslIoMapping(true);
|
||||
@@ -1006,6 +1051,9 @@ void usage()
|
||||
" --shift-ssbo-binding [stage] num set base binding number for SSBOs\n"
|
||||
" --sbb [stage] num synonym for --shift-ssbo-binding\n"
|
||||
"\n"
|
||||
" --resource-set-binding [stage] num set descriptor set and binding number for resources\n"
|
||||
" --rsb [stage] type set binding synonym for --resource-set-binding\n"
|
||||
"\n"
|
||||
" --shift-uav-binding [stage] num set base binding number for UAVs\n"
|
||||
" --suavb [stage] num synonym for --shift-uav-binding\n"
|
||||
"\n"
|
||||
|
||||
Reference in New Issue
Block a user