Skip to content

Commit 0a6f0d1

Browse files
authored
opt: Add TrimCapabilities pass to spirv-opt tool (KhronosGroup#5545)
Add an option to the spirv-opt tool to run the TrimCapabilitiesPass.
1 parent b951948 commit 0a6f0d1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

source/opt/optimizer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,8 @@ bool Optimizer::RegisterPassFromFlag(const std::string& flag,
623623
pass_args.c_str());
624624
return false;
625625
}
626+
} else if (pass_name == "trim-capabilities") {
627+
RegisterPass(CreateTrimCapabilitiesPass());
626628
} else {
627629
Errorf(consumer(), nullptr, {},
628630
"Unknown flag '--%s'. Use --help for a list of valid flags",

tools/opt/opt.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,10 @@ Options (in lexicographical order):)",
525525
USR/SYS time are returned by getrusage() and can have a small
526526
error.)");
527527
printf(R"(
528+
--trim-capabilities
529+
Remove unnecessary capabilities and extensions declared within the
530+
module.)");
531+
printf(R"(
528532
--upgrade-memory-model
529533
Upgrades the Logical GLSL450 memory model to Logical VulkanKHR.
530534
Transforms memory, image, atomic and barrier operations to conform

0 commit comments

Comments
 (0)