Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Invalid from the supported profile names in help #4822

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have Math::Min(...)


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());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't this be a lambda?


// 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 == "Invalid" ||
name.startsWith("spirv_1_") ||
name.startsWith("_"))
{
Expand Down
Loading