GPUDevice: Support transpiling shaders at compile time

And use it for GLSL postprocessing shaders.
This commit is contained in:
Stenzek
2024-06-14 14:37:33 +10:00
parent f0c2832d03
commit ef69c31e9f
37 changed files with 918 additions and 470 deletions

View File

@ -34,21 +34,20 @@ if(ENABLE_WAYLAND)
find_package(Wayland REQUIRED Egl)
endif()
if(ENABLE_VULKAN OR APPLE)
if(ENABLE_VULKAN)
find_package(Shaderc REQUIRED)
find_package(spirv_cross_c_shared REQUIRED)
if(LINUX AND ENABLE_VULKAN)
if(LINUX)
# We need to add the rpath for shaderc to the executable.
get_filename_component(SHADERC_LIBRARY_DIRECTORY ${SHADERC_LIBRARY} DIRECTORY)
list(APPEND CMAKE_BUILD_RPATH ${SHADERC_LIBRARY_DIRECTORY})
get_target_property(SPIRV_CROSS_LIBRARY spirv-cross-c-shared IMPORTED_LOCATION)
get_filename_component(SPIRV_CROSS_LIBRARY_DIRECTORY ${SPIRV_CROSS_LIBRARY} DIRECTORY)
list(APPEND CMAKE_BUILD_RPATH ${SPIRV_CROSS_LIBRARY_DIRECTORY})
endif()
endif()
if(APPLE)
# SPIRV-Cross is currently only used on MacOS.
find_package(spirv_cross_c_shared REQUIRED)
endif()
if(LINUX)
find_package(UDEV REQUIRED)
endif()