Skip to content

Commit

Permalink
Merge branch 'slang-wip'
Browse files Browse the repository at this point in the history
  • Loading branch information
corporateshark committed Aug 17, 2024
2 parents bb7e843 + 6927516 commit 249b33b
Show file tree
Hide file tree
Showing 6 changed files with 377 additions and 3 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,23 @@ jobs:
matrix:
config:
- {
name: "Windows - MSVC 2022",
name: "Windows - MSVC 2022 (glslang)",
os: windows-latest,
build_type: "Debug",
cc: "cl",
cxx: "cl",
generators: "Visual Studio 17 2022",
cmake_args: "-DLVK_WITH_TRACY=ON"
}
- {
name: "Windows - MSVC 2022 (Slang)",
os: windows-latest,
build_type: "Debug",
cc: "cl",
cxx: "cl",
generators: "Visual Studio 17 2022",
cmake_args: "-DLVK_WITH_TRACY=ON -DLVK_WITH_SLANG=ON"
}
- {
name: "Ubuntu - Clang",
os: ubuntu-latest,
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ option(LVK_WITH_WAYLAND "Enable Wayland" OFF
option(LVK_WITH_IMPLOT "Enable ImPlot" ON)
option(LVK_WITH_OPENXR "Enable OpenXR" OFF)
option(LVK_WITH_ANDROID_VALIDATION "Enable validation layers on Android" ON)
option(LVK_WITH_SLANG "Enable Slang compiler" OFF)

cmake_dependent_option(LVK_WITH_VULKAN_PORTABILITY "Enable portability extension" ON "APPLE" OFF)

Expand All @@ -34,8 +35,9 @@ if(LVK_WITH_SAMPLES AND NOT LVK_WITH_GLFW)
endif()

if(ANDROID)
message(STATUS "WARNING: LVK_WITH_GLFW and LVK_WITH_SAMPLES were set to OFF for Android")
message(STATUS "WARNING: LVK_WITH_GLFW and LVK_WITH_SLANG were set to OFF for Android")
set(LVK_WITH_GLFW OFF)
set(LVK_WITH_SLANG OFF)
endif()

if(LVK_WITH_WAYLAND AND (ANDROID OR APPLE OR WIN32))
Expand Down Expand Up @@ -152,7 +154,7 @@ if(LVK_WITH_OPENXR)
endif()

# temporary
if(NOT LVK_USE_CUSTOM_MOLTENVK)
if(NOT LVK_USE_CUSTOM_MOLTENVK AND NOT LVK_WITH_SLANG)
find_package(Vulkan REQUIRED)
endif()

Expand Down
30 changes: 30 additions & 0 deletions lvk/vulkan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,32 @@ lvk_set_folder(SPIRV "third-party/glslang")
lvk_set_folder(glslang-default-resource-limits "third-party/glslang")
# cmake-format: on

# slang
# cmake-format: off
if(LVK_WITH_SLANG)
set(SLANG_ENABLE_CUDA OFF CACHE BOOL "")
set(SLANG_ENABLE_OPTIX OFF CACHE BOOL "")
set(SLANG_ENABLE_NVAPI OFF CACHE BOOL "")
set(SLANG_ENABLE_XLIB OFF CACHE BOOL "")
set(SLANG_ENABLE_AFTERMATH OFF CACHE BOOL "")
set(SLANG_ENABLE_DX_ON_VK OFF CACHE BOOL "")
set(SLANG_ENABLE_GFX OFF CACHE BOOL "")
set(SLANG_ENABLE_SLANGC OFF CACHE BOOL "")
set(SLANG_ENABLE_SLANGRT ON CACHE BOOL "")
set(SLANG_ENABLE_SLANG_GLSLANG OFF CACHE BOOL "")
set(SLANG_ENABLE_TESTS OFF CACHE BOOL "")
set(SLANG_ENABLE_EXAMPLES OFF CACHE BOOL "")
set(SLANG_ENABLE_REPLAYER OFF CACHE BOOL "")
set(SLANG_ENABLE_PREBUILT_BINARIES OFF CACHE BOOL "")
add_subdirectory(${LVK_ROOT_DIR}/third-party/deps/src/slang "slang")
lvk_set_folder(compiler-core "third-party/slang")
lvk_set_folder(core "third-party/slang")
lvk_set_folder(slang "third-party/slang")
lvk_set_folder(slangd "third-party/slang")
lvk_set_folder(slang-rt "third-party/slang")
endif()
# cmake-format: on

# SPIRV-Reflect
set(SPIRV_REFLECT_EXECUTABLE OFF CACHE BOOL "")
set(SPIRV_REFLECT_STATIC_LIB ON CACHE BOOL "")
Expand All @@ -52,6 +78,10 @@ endif()
target_link_libraries(LVKVulkan PRIVATE LVKLibrary)
target_link_libraries(LVKVulkan PRIVATE glslang SPIRV glslang-default-resource-limits)
target_link_libraries(LVKVulkan PRIVATE spirv-reflect-static)
if(LVK_WITH_SLANG)
target_link_libraries(LVKVulkan PRIVATE slang)
target_link_libraries(LVKVulkan PRIVATE slang-rt)
endif()

if(LVK_USE_CUSTOM_MOLTENVK)
target_include_directories(LVKVulkan PUBLIC "${LVK_CUSTOM_MOLTENVK_PATH}/include")
Expand Down
Loading

0 comments on commit 249b33b

Please sign in to comment.