util/glsl2spirv: pass path to glslangValidator into the script

This allows users to override the location of glslang using normal meson
mechanisms.

Reviewed-by: Luis Felipe Strano Moraes <luis.strano@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19449>
This commit is contained in:
Dylan Baker
2022-11-01 13:37:06 -07:00
committed by Marge Bot
parent ae30c6c375
commit 41a929d94c
3 changed files with 5 additions and 2 deletions

View File

@@ -685,7 +685,7 @@ if vdpau_drivers_path == ''
vdpau_drivers_path = join_paths(get_option('libdir'), 'vdpau')
endif
if with_vulkan_overlay_layer or with_aco_tests or with_amd_vk
if with_vulkan_overlay_layer or with_aco_tests or with_amd_vk or with_intel_vk
prog_glslang = find_program('glslangValidator', native : true)
if run_command(prog_glslang, [ '--quiet', '--version' ], check : false).returncode() == 0
glslang_quiet = ['--quiet']

View File

@@ -49,6 +49,7 @@ float64_spv_h = custom_target(
output : 'float64_spv.h',
command : [
prog_python, '@INPUT@', '@OUTPUT@',
prog_glslang,
'--create-entry', 'main',
'--vn', 'float64_spv_source',
'--glsl-version', '450',

View File

@@ -33,6 +33,7 @@ if T.TYPE_CHECKING:
class Arguments(T.Protocol):
input: str
output: str
glslang: str
create_entry: T.Optional[str]
glsl_ver: T.Optional[str]
Olib: bool
@@ -45,6 +46,7 @@ def get_args() -> Arguments:
parser = argparse.ArgumentParser()
parser.add_argument('input', help="Name of input file.")
parser.add_argument('output', help="Name of output file.")
parser.add_argument('glslang', help="path to glslangValidator")
parser.add_argument("--create-entry",
dest="create_entry",
@@ -142,7 +144,7 @@ def process_file(args: Arguments) -> None:
with open(args.input, "r") as infile:
copy_file = preprocess_file(args, infile)
cmd_list = ["glslangValidator"]
cmd_list = [args.glslang]
if args.Olib:
cmd_list.append("--keep-uncalled")