Skip to content

Commit 0268eaa

Browse files
authored
Vulkan spirv debug symbols
Differential Revision: D66778427 Pull Request resolved: #7182
1 parent f6bfa21 commit 0268eaa

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

backends/vulkan/runtime/gen_vulkan_spv.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ def main(argv: List[str]) -> int:
10521052
parser.add_argument("--replace-u16vecn", action="store_true", default=False)
10531053
parser.add_argument("--optimize_size", action="store_true", help="")
10541054
parser.add_argument("--optimize", action="store_true", help="")
1055+
parser.add_argument("--spv_debug", action="store_true", default=False)
10551056
parser.add_argument(
10561057
"--env", metavar="KEY=VALUE", nargs="*", help="Set a number of key-value pairs"
10571058
)
@@ -1070,17 +1071,22 @@ def main(argv: List[str]) -> int:
10701071
if not os.path.exists(options.tmp_dir_path):
10711072
os.makedirs(options.tmp_dir_path)
10721073

1073-
glslc_flags = ""
1074+
glslc_flags = []
10741075
if options.optimize_size:
1075-
glslc_flags += "-Os"
1076+
glslc_flags.append("-Os")
10761077
elif options.optimize:
1077-
glslc_flags += "-O"
1078+
glslc_flags.append("-O")
1079+
1080+
if options.spv_debug:
1081+
glslc_flags.append("-g")
1082+
1083+
glslc_flags_str = " ".join(glslc_flags)
10781084

10791085
shader_generator = SPVGenerator(
10801086
options.glsl_paths,
10811087
env,
10821088
options.glslc_path,
1083-
glslc_flags=glslc_flags,
1089+
glslc_flags=glslc_flags_str,
10841090
replace_u16vecn=options.replace_u16vecn,
10851091
)
10861092
output_spv_files = shader_generator.generateSPV(options.tmp_dir_path)

backends/vulkan/targets.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def vulkan_spv_shader_lib(name, spv_filegroups, is_fbcode = False, no_volk = Fal
4343
"DEFAULT": "",
4444
"ovr_config//os:android": "--optimize",
4545
"ovr_config//os:linux": "--replace-u16vecn",
46+
"ovr_config//os:windows": "--optimize --spv_debug",
4647
})
4748
)
4849

0 commit comments

Comments
 (0)