Skip to content

Commit

Permalink
Remove Invalid from the supported profile names in help
Browse files Browse the repository at this point in the history
This commit removes a keyword "Invalid" from the command-line help
message.
It also prints the profile names in an alphabetrically sorted order for
a better searchability.
  • Loading branch information
jkwak-work committed Aug 12, 2024
1 parent 9b580e5 commit ac4889c
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion source/slang/slang-options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,35 @@ void initCommandOptions(CommandOptions& options)
List<UnownedStringSlice> names;
getCapabilityNames(names);

// Sort them by name
struct CompareUnownedStringSlice
{
bool operator()(const UnownedStringSlice& lhs, const UnownedStringSlice& rhs)
{
Count lhsLength = lhs.getLength();
Count rhsLength = rhs.getLength();
Count minLength = std::min(lhsLength, rhsLength);

for (Count i = 0; i < minLength; i++)
{
auto l = lhs[i];
auto r = rhs[i];
if (l != r)
{
return l < r;
}
}
return (lhsLength < rhsLength);
}
};
names.sort(CompareUnownedStringSlice());

// We'll just add to keep the list more simple...
options.addValue("spirv_1_{ 0,1,2,3,4,5 }", "minimum supported SPIR - V version");

for (auto name : names)
{
if (name.startsWith("__") ||
if (name.startsWith("Invalid") ||
name.startsWith("spirv_1_") ||
name.startsWith("_"))
{
Expand Down

0 comments on commit ac4889c

Please sign in to comment.