Fix #1468: Add command-line --entry-point support, same as existing -e.

This commit is contained in:
John Kessenich 2018-08-09 14:15:00 -06:00
Родитель 56a75975e3
Коммит 640bd0964f
2 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -446,6 +446,11 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
Error("--client expects vulkan100 or opengl100"); Error("--client expects vulkan100 or opengl100");
} }
bumpArg(); bumpArg();
} else if (lowerword == "entry-point") {
entryPointName = argv[1];
if (argc <= 1)
Error("no <name> provided for --entry-point");
bumpArg();
} else if (lowerword == "flatten-uniform-arrays" || // synonyms } else if (lowerword == "flatten-uniform-arrays" || // synonyms
lowerword == "flatten-uniform-array" || lowerword == "flatten-uniform-array" ||
lowerword == "fua") { lowerword == "fua") {
@ -610,8 +615,6 @@ void ProcessArguments(std::vector<std::unique_ptr<glslang::TWorkItem>>& workItem
Options |= EOptionDefaultDesktop; Options |= EOptionDefaultDesktop;
break; break;
case 'e': case 'e':
// HLSL todo: entry point handle needs much more sophistication.
// This is okay for one compilation unit with one entry point.
entryPointName = argv[1]; entryPointName = argv[1];
if (argc <= 1) if (argc <= 1)
Error("no <name> provided for -e"); Error("no <name> provided for -e");
@ -840,7 +843,7 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
const auto &compUnit = *it; const auto &compUnit = *it;
glslang::TShader* shader = new glslang::TShader(compUnit.stage); glslang::TShader* shader = new glslang::TShader(compUnit.stage);
shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count); shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count);
if (entryPointName) // HLSL todo: this needs to be tracked per compUnits if (entryPointName)
shader->setEntryPoint(entryPointName); shader->setEntryPoint(entryPointName);
if (sourceEntryPointName) { if (sourceEntryPointName) {
if (entryPointName == nullptr) if (entryPointName == nullptr)
@ -1352,7 +1355,8 @@ void usage()
" creates the default configuration file (redirect to a .conf file)\n" " creates the default configuration file (redirect to a .conf file)\n"
" -d default to desktop (#version 110) when there is no shader #version\n" " -d default to desktop (#version 110) when there is no shader #version\n"
" (default is ES version 100)\n" " (default is ES version 100)\n"
" -e <name> specify <name> as the entry-point name\n" " --entry-point <name>\n"
" -e <name> specify <name> as the entry-point function name\n"
" -f{hlsl_functionality1}\n" " -f{hlsl_functionality1}\n"
" 'hlsl_functionality1' enables use of the\n" " 'hlsl_functionality1' enables use of the\n"
" SPV_GOOGLE_hlsl_functionality1 extension\n" " SPV_GOOGLE_hlsl_functionality1 extension\n"

Просмотреть файл

@ -56,7 +56,7 @@ fi
# entry point renaming tests # entry point renaming tests
# #
echo Running entry-point renaming tests echo Running entry-point renaming tests
$EXE -i -H -V -D -Od -e main_in_spv --ku --source-entrypoint main -Od hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out $EXE -i -H -V -D -Od --entry-point main_in_spv --ku --source-entrypoint main -Od hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out
diff -b $BASEDIR/hlsl.entry.rename.frag.out $TARGETDIR/hlsl.entry.rename.frag.out || HASERROR=1 diff -b $BASEDIR/hlsl.entry.rename.frag.out $TARGETDIR/hlsl.entry.rename.frag.out || HASERROR=1
# #