Skip to content

Commit 3871c0a

Browse files
authored
Don't use friendly names for SPIR-V validation errors (#1442)
Setting up friendly names requires parsing the entire module which costs a lot of time due to (1) scanning the whole module, and (2) creating string names for many IDs. This is a followup to KhronosGroup/SPIRV-Tools#5802 There, Blender was suffering long shader suite build times due to serialization on locale. But secondarily we noticed there was a lot of string manipulation when setting up the validator, all because the friendly name mapper is on by default for the optimizer. Turn off friendly names in the optimizer's use of the validator. The validation errors are only emitted when there is a compiler bug, so they should be rare. Don't make every compilation pay the cost.
1 parent 7bab426 commit 3871c0a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libshaderc_util/src/spirv_tools_wrapper.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ bool SpirvToolsOptimize(Compiler::TargetEnv env,
126126
val_opts.SetRelaxLogicalPointer(true);
127127
// This uses relaxed rules for pre-legalized HLSL.
128128
val_opts.SetBeforeHlslLegalization(true);
129+
// Don't use friendly names when printing validation errors.
130+
// It incurs a high startup cost whether or not there is an
131+
// error. Validation failures are compiler bugs, and so they
132+
// should be rare anyway.
133+
val_opts.SetFriendlyNames(false);
129134

130135
// Set additional optimizer options.
131136
optimizer_options.set_validator_options(val_opts);

0 commit comments

Comments
 (0)