mirror of
https://github.com/xenia-project/xenia.git
synced 2026-04-20 22:13:40 +00:00
[Build] Replace spirv-remap with spirv-opt --canonicalize-ids
`spirv-remap` is not present in modern Vulkan SDK versions, it was replaced with the `--canonicalize-ids` pass in `spirv-opt`. Overall, canonicalization provides a significant compression improvement, which is important considering that currently Xenia is distributed in a ZIP archive and contains many very similar shaders. With normal DEFLATE compression, canonicalization reduced the size of a ZIP with `xenia.exe` from 3.54 MB to 3.45 MB in a test done before committing. Also disable stripping of debug information from shaders, which apparently was among what `spirv-remap` was doing with `--do-everything`, as binding and uniform buffer member names heavily aid in debugging in RenderDoc. Partially integrated from #2329. Co-authored-by: Herman S. <429230+has207@users.noreply.github.com> Co-authored-by: Gliniak <Gliniak93@gmail.com>
This commit is contained in:
parent
dfa1b3fae1
commit
ca34a022a5
1 changed files with 7 additions and 14 deletions
21
xenia-build
21
xenia-build
|
|
@ -1016,10 +1016,6 @@ class BuildShadersCommand(Command):
|
|||
if not has_bin(spirv_opt):
|
||||
print('ERROR: could not find spirv-opt')
|
||||
return 1
|
||||
spirv_remap = os.path.join(vulkan_bin_path, 'spirv-remap')
|
||||
if not has_bin(spirv_remap):
|
||||
print('ERROR: could not find spirv-remap')
|
||||
return 1
|
||||
spirv_dis = os.path.join(vulkan_bin_path, 'spirv-dis')
|
||||
if not has_bin(spirv_dis):
|
||||
print('ERROR: could not find spirv-dis')
|
||||
|
|
@ -1079,27 +1075,24 @@ class BuildShadersCommand(Command):
|
|||
universal_newlines = True).returncode != 0:
|
||||
print('ERROR: failed to build a SPIR-V shader')
|
||||
return 1
|
||||
# Optimize the shader, and then improve the compression quality
|
||||
# for the application executable via ID canonicalization by
|
||||
# making IDs in similar shaders more likely to be the same.
|
||||
# Don't strip debug information such as binding and buffer
|
||||
# structure member names, however, as it's useful for
|
||||
# investigating issues in debuggers such as RenderDoc.
|
||||
# spirv-opt input and output files must be different.
|
||||
spirv_file_path = spirv_file_path_base + '.spv'
|
||||
if subprocess.call([
|
||||
spirv_opt,
|
||||
'-O',
|
||||
'--canonicalize-ids',
|
||||
spirv_glslang_file_path,
|
||||
'-o', spirv_file_path,
|
||||
]) != 0:
|
||||
print('ERROR: failed to optimize a SPIR-V shader')
|
||||
return 1
|
||||
os.remove(spirv_glslang_file_path)
|
||||
# spirv-remap takes the output directory, but it may be the same
|
||||
# as the one the input is stored in.
|
||||
if subprocess.call([
|
||||
spirv_remap,
|
||||
'--do-everything',
|
||||
'-i', spirv_file_path,
|
||||
'-o', spirv_dir_path,
|
||||
]) != 0:
|
||||
print('ERROR: failed to remap a SPIR-V shader')
|
||||
return 1
|
||||
spirv_dis_file_path = spirv_file_path_base + '.txt';
|
||||
if subprocess.call([
|
||||
spirv_dis,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue