From 8fd2bf1ded6df5136eecf41f634ab6ad65341e96 Mon Sep 17 00:00:00 2001 From: Bam4d Date: Wed, 4 Jan 2023 14:33:44 +0000 Subject: [PATCH 1/3] fixing shader compilation --- CMakeLists.txt | 3 +++ deps/conanfile.txt | 1 + 2 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a1ace72cf..636c848d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,8 +149,11 @@ if(NOT WASM) # ShaderC for compiling shaders find_package(shaderc REQUIRED) + endif() +include(${CMAKE_BINARY_DIR}/conan_paths.cmake) + include(${CMAKE_CONFIG_FOLDER}/targets/griddly.cmake) if(WASM) diff --git a/deps/conanfile.txt b/deps/conanfile.txt index 84a0212bb..8d4821078 100644 --- a/deps/conanfile.txt +++ b/deps/conanfile.txt @@ -14,5 +14,6 @@ tools.cmake.cmaketoolchain:generator=Ninja [generators] CMakeToolchain CMakeDeps +cmake_paths From 3627012b0f6b04b8ab04907ee195091de3b52ae8 Mon Sep 17 00:00:00 2001 From: Bam4d Date: Wed, 4 Jan 2023 15:19:08 +0000 Subject: [PATCH 2/3] shaders are broken again in latest version, fixing them --- CMakeLists.txt | 15 +++++++++++---- CMakeUserPresets.json | 6 ++++-- compile_shaders.sh | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 636c848d2..99413ac06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,6 +128,9 @@ find_package(yaml-cpp REQUIRED) find_package(spdlog REQUIRED) if(NOT WASM) + + include(${CMAKE_BINARY_DIR}/conan_paths.cmake) + # find the dependencies from conan set(PYBIND11_FINDPYTHON FALSE) @@ -152,8 +155,6 @@ if(NOT WASM) endif() -include(${CMAKE_BINARY_DIR}/conan_paths.cmake) - include(${CMAKE_CONFIG_FOLDER}/targets/griddly.cmake) if(WASM) @@ -166,9 +167,15 @@ else() set(ENV{GLSLC_BIN} ${CONAN_SHADERC_ROOT}/bin/glslc) if(MSVC) - execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.bat RESULT_VARIABLE rv) + execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.bat RESULT_VARIABLE STATUS) + if(STATUS AND NOT STATUS EQUAL 0) + message( FATAL_ERROR "Cannot compile shaders: ${STATUS}") + endif() else() - execute_process(COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.sh RESULT_VARIABLE rv) + execute_process(COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/compile_shaders.sh RESULT_VARIABLE STATUS) + if(STATUS AND NOT STATUS EQUAL 0) + message( FATAL_ERROR "Cannot compile shaders: ${STATUS}") + endif() endif() if(ENABLE_PYTHON_BINDINGS) diff --git a/CMakeUserPresets.json b/CMakeUserPresets.json index 38465a7e9..6baf625c0 100644 --- a/CMakeUserPresets.json +++ b/CMakeUserPresets.json @@ -35,11 +35,13 @@ "buildPresets": [ { "name": "Debug WASM", - "configurePreset": "Debug WASM" + "configurePreset": "Debug WASM", + "configuration": "Debug" }, { "name": "Debug Native", - "configurePreset": "Debug Native" + "configurePreset": "Debug Native", + "configuration": "Debug" } ] } \ No newline at end of file diff --git a/compile_shaders.sh b/compile_shaders.sh index 8123853e3..67225c0cb 100755 --- a/compile_shaders.sh +++ b/compile_shaders.sh @@ -1,5 +1,5 @@ #!/bin/bash - +set -e cd "$(dirname "$0")" compile_shaders_in_dir () { From 65be3ffaf7e7bf5b54b32f8318d2567787998de6 Mon Sep 17 00:00:00 2001 From: Bam4d Date: Wed, 4 Jan 2023 15:29:03 +0000 Subject: [PATCH 3/3] updating readme --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index b2e000f41..40fc9c8ba 100644 --- a/README.md +++ b/README.md @@ -235,6 +235,15 @@ You will need to set up a python environment of your choice and then install con pip install conan ``` +### Debug Layers for Vulkan + +When compiling using Debug, you will need the install vulkan validation layers which are part of the [vulkan sdk](https://vulkan.lunarg.com/). +Otherwise you will run into errors like: +``` +[2023-01-04 15:21:54.412] [warning] Required vulkan layer unavailable: VK_LAYER_KHRONOS_validation +[2023-01-04 15:21:54.412] [error] Missing vulkan extensions in driver. Please upgrade your vulkan drivers. +``` + ### Ubuntu ```