@@ -21,19 +21,16 @@ find_package(Vulkan COMPONENTS glslangValidator)
21
21
if (Vulkan_glslangValidator_FOUND )
22
22
# use the found glslangValidator from find_package()
23
23
set (SPVRC_GLSLANG_VALIDATOR ${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE} )
24
- set (SPVRC_GLSLANG_VALIDATOR_OPTIMIZER ON )
25
24
else ()
26
25
# try to find glslang validator on cmd line
27
26
find_program (GLSLANG_VALIDATOR_FOUND glslangValidator )
28
27
if (NOT ${GLSLANG_VALIDATOR_FOUND} STREQUAL "GLSLANG_VALIDATOR_FOUND-NOTFOUND" )
29
28
set (SPVRC_GLSLANG_VALIDATOR ${GLSLANG_VALIDATOR_FOUND} )
30
- # the optimizer likely won't be available
31
- set (SPVRC_GLSLANG_VALIDATOR_OPTIMIZER OFF )
32
29
endif ()
33
30
endif ()
34
31
35
32
# build glslangValidator if not found
36
- if (SPVRC_GLSLANG_VALIDATOR STREQUAL "" )
33
+ if (NOT DEFINED SPVRC_GLSLANG_VALIDATOR )
37
34
include (FetchContent )
38
35
# SPIRV-Tools for glslang compiler
39
36
set (SKIP_SPIRV_TOOLS_INSTALL ON )
@@ -51,14 +48,12 @@ if(SPVRC_GLSLANG_VALIDATOR STREQUAL "")
51
48
GIT_TAG "vulkan-sdk-1.3.290.0"
52
49
GIT_SHALLOW ON
53
50
OVERRIDE_FIND_PACKAGE
54
- EXCLUDE_FROM_ALL
55
51
SYSTEM )
56
52
FetchContent_Declare (spirv-tools
57
53
GIT_REPOSITORY "https://github.com/KhronosGroup/SPIRV-Tools.git"
58
54
GIT_TAG "vulkan-sdk-1.3.290.0"
59
55
GIT_SHALLOW ON
60
56
OVERRIDE_FIND_PACKAGE
61
- EXCLUDE_FROM_ALL
62
57
SYSTEM )
63
58
# glslangValidator for runtime/static shader compilation
64
59
set (ENABLE_OPT ON )
@@ -74,11 +69,9 @@ if(SPVRC_GLSLANG_VALIDATOR STREQUAL "")
74
69
GIT_TAG "vulkan-sdk-1.3.290.0"
75
70
GIT_SHALLOW ON
76
71
OVERRIDE_FIND_PACKAGE
77
- EXCLUDE_FROM_ALL
78
72
SYSTEM )
79
73
FetchContent_MakeAvailable (spirv-headers spirv-tools glslang )
80
74
set (SPVRC_GLSLANG_VALIDATOR glslang-standalone )
81
- set (SPVRC_GLSLANG_VALIDATOR_OPTIMIZER ON )
82
75
endif ()
83
76
84
77
# compile glsl to spirv
@@ -91,10 +84,8 @@ set(GLSLANG_CLI_PARAMS
91
84
# --spirv-val
92
85
--enhanced-msgs --quiet
93
86
--target-env "${SPVRC_SHADER_ENV} "
87
+ -Os
94
88
-I "${SPVRC_SHADER_DIR} " )
95
- if (SPVRC_GLSLANG_VALIDATOR_OPTIMIZER )
96
- list (APPEND GLSLANG_CLI_PARAMS -Os )
97
- endif ()
98
89
file (MAKE_DIRECTORY "${SPVRC_SHADER_DIR} " )
99
90
foreach (GLSL_FILE ${GLSL_SOURCE_FILES} )
100
91
# get shortened path relative to shader directory root
0 commit comments