Add WIVRN_DEBUG_SHADERS option

This commit is contained in:
Guillaume Meunier
2026-02-13 17:15:21 +01:00
parent 2d45d53cc7
commit ed433905c0
2 changed files with 14 additions and 2 deletions
+6 -1
View File
@@ -39,7 +39,12 @@ option(WIVRN_BUILD_WIVRNCTL "Build wivrnctl" ON)
option(WIVRN_BUILD_DISSECTOR "Build Wireshark dissector" OFF)
option(WIVRN_BUILD_TEST "Build test binaries" OFF)
option(WIVRN_WERROR "Treat warnings as errors" OFF)
option(WIVRN_OPTIMIZE_SHADERS "Run siprv-opt on compiled shaders" ON)
option(WIVRN_OPTIMIZE_SHADERS "Run spirv-opt on compiled shaders" ON)
option(WIVRN_DEBUG_SHADERS "Compile shaders with debug information" OFF)
if(WIVRN_OPTIMIZE_SHADERS AND WIVRN_DEBUG_SHADERS)
message(FATAL_ERROR "WIVRN_OPTIMIZE_SHADERS and WIVRN_DEBUG_SHADERS are incompatible")
endif()
option(WIVRN_USE_NVENC "Enable nvenc (Nvidia) hardware encoder" ON)
option(WIVRN_USE_VAAPI "Enable vaapi (AMD/Intel) hardware encoder" ON)
+8 -1
View File
@@ -13,13 +13,20 @@ function(compile_glsl_aux shader_stage shader_name glsl_filename output target_e
}},
")
if (WIVRN_DEBUG_SHADERS)
set(SHADER_FLAGS -gVS)
else()
set(SHADER_FLAGS )
endif()
add_custom_command(
OUTPUT "${SPV_FILE}-nopt"
COMMAND Vulkan::glslangValidator -V --target-env ${target_env} -S ${shader_stage} -D${shader_stage_upper}_SHADER ${in_file} -o "${SPV_FILE}-nopt" --depfile "${SPV_FILE}.d"
COMMAND Vulkan::glslangValidator -V --target-env ${target_env} -S ${shader_stage} -D${shader_stage_upper}_SHADER ${in_file} ${SHADER_FLAGS} -o "${SPV_FILE}-nopt" --depfile "${SPV_FILE}.d"
DEPENDS "${glsl_filename}"
DEPFILE "${SPV_FILE}.d"
VERBATIM
)
if (WIVRN_OPTIMIZE_SHADERS)
add_custom_command(
OUTPUT "${SPV_FILE}-opt"