Update and document shader compilation scripts

Will no longer fail with certain shaderStages
Refs #1126
This commit is contained in:
Sascha Willems 2024-06-04 21:31:24 +02:00
parent 9c25dad12c
commit 196e6a4c6b
3 changed files with 20 additions and 4 deletions

View file

@ -1,3 +1,6 @@
# Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
# This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
import argparse
import fileinput
import os
@ -25,7 +28,7 @@ def findGlslang():
if isExe(full_path):
return full_path
sys.exit("Could not find DXC executable on PATH, and was not specified with --dxc")
sys.exit("Could not find glslangvalidator executable on PATH, and was not specified with --glslang")
glslang_path = findGlslang()
dir_path = os.path.dirname(os.path.realpath(__file__))
@ -40,10 +43,14 @@ for root, dirs, files in os.walk(dir_path):
if args.g:
add_params = "-g"
# Ray tracing shaders require a different target environment
if file.endswith(".rgen") or file.endswith(".rchit") or file.endswith(".rmiss"):
add_params = add_params + " --target-env vulkan1.2"
# Same goes for samples that use ray queries
if root.endswith("rayquery") and file.endswith(".frag"):
add_params = add_params + " --target-env vulkan1.2"
res = subprocess.call("%s -V %s -o %s %s" % (glslang_path, input_file, output_file, add_params), shell=True)
# res = subprocess.call([glslang_path, '-V', input_file, '-o', output_file, add_params], shell=True)
if res != 0:
sys.exit()
sys.exit(res)