diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a674a832..97758ecd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,4 +3,5 @@ repos: rev: v5.0.0 hooks: - id: trailing-whitespace + exclude: \.patch$ - id: end-of-file-fixer diff --git a/cmake/filament-allow-clang-windows.patch b/cmake/filament-allow-clang-windows.patch index 54b8ff57..2abd6ddc 100644 --- a/cmake/filament-allow-clang-windows.patch +++ b/cmake/filament-allow-clang-windows.patch @@ -1,8 +1,22 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index e5475ef5..4eb8a68b 100644 +index 18f692b0..d871d95c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -247,57 +247,59 @@ if (WIN32) +@@ -11,12 +11,7 @@ cmake_minimum_required(VERSION 3.22.1) + # Unsupported environment + # ================================================================================================== + +-# Filament does not support MSYS2-based environment on Windows. See issue #9968. +-if(DEFINED ENV{MSYSTEM}) +- message(FATAL_ERROR +- "MSYS2 Subsystem detected($ENV{MSYSTEM}). " +- "Filament does not support MSYS2-based environment on Windows.") +-endif() ++ + + # ================================================================================================== + # Toolchain configuration +@@ -258,57 +253,59 @@ if (WIN32) # __declspec(dllexport) in front of each functions). set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) @@ -112,7 +126,7 @@ index e5475ef5..4eb8a68b 100644 endif() if (MSVC) -@@ -344,7 +346,7 @@ endif() +@@ -355,7 +352,7 @@ endif() # Detect use of the clang-cl.exe frontend, which does not support all of clangs normal options if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if ("${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") @@ -121,7 +135,7 @@ index e5475ef5..4eb8a68b 100644 endif() endif() -@@ -376,7 +378,7 @@ if (APPLE AND NOT IOS) +@@ -387,7 +384,7 @@ if (APPLE AND NOT IOS) endif() set(CXX_STANDARD "-std=c++20") @@ -130,7 +144,7 @@ index e5475ef5..4eb8a68b 100644 set(CXX_STANDARD "/std:c++20") endif() -@@ -770,9 +772,14 @@ function(combine_static_libs TARGET OUTPUT DEPS) +@@ -781,9 +778,14 @@ function(combine_static_libs TARGET OUTPUT DEPS) endforeach() if (WIN32) @@ -146,6 +160,35 @@ index e5475ef5..4eb8a68b 100644 COMMAND "${CMAKE_COMMAND}" -E rename temp.lib ${OUTPUT} COMMENT "Combining ${target} dependencies into single shared library" VERBATIM +diff --git a/filament/CMakeLists.txt b/filament/CMakeLists.txt +index 3a34ba4b..2bdf5a04 100644 +--- a/filament/CMakeLists.txt ++++ b/filament/CMakeLists.txt +@@ -797,6 +797,9 @@ else() + -Wover-aligned + -Werror + ) ++ if (WIN32) ++ list(APPEND FILAMENT_WARNINGS -Wno-error=cast-function-type-mismatch -Wno-error=unused-variable -Wno-error=microsoft-unqualified-friend) ++ endif() + endif() + + target_compile_options(${TARGET} PRIVATE +diff --git a/filament/backend/CMakeLists.txt b/filament/backend/CMakeLists.txt +index 78c05dd2..4f8c0bf3 100644 +--- a/filament/backend/CMakeLists.txt ++++ b/filament/backend/CMakeLists.txt +@@ -525,6 +525,10 @@ else() + ) + endif() + ++if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") ++ list(APPEND FILAMENT_WARNINGS -Wno-error=cast-function-type-mismatch -Wno-error=unused-variable -Wno-error=microsoft-unqualified-friend) ++endif() ++ + if (APPLE) + # Turn on Automatic Reference Counting. + target_compile_options(${TARGET} PRIVATE "-fobjc-arc") diff --git a/filament/backend/src/CommandStream.cpp b/filament/backend/src/CommandStream.cpp index 7146800f..d7973ffd 100644 --- a/filament/backend/src/CommandStream.cpp @@ -160,10 +203,10 @@ index 7146800f..d7973ffd 100644 auto pos = command.rfind(startPattern); auto end = command.rfind('('); diff --git a/filament/backend/src/opengl/platforms/PlatformWGL.cpp b/filament/backend/src/opengl/platforms/PlatformWGL.cpp -index 1cc84db0..aa3d24f8 100644 +index 31843028..8664ea3c 100644 --- a/filament/backend/src/opengl/platforms/PlatformWGL.cpp +++ b/filament/backend/src/opengl/platforms/PlatformWGL.cpp -@@ -241,7 +241,7 @@ Platform::SwapChain* PlatformWGL::createSwapChain(uint32_t width, uint32_t heigh +@@ -251,7 +251,7 @@ Platform::SwapChain* PlatformWGL::createSwapChain(uint32_t width, uint32_t heigh // WS_POPUP was chosen for the window style here after some experimentation. // For some reason, using other window styles resulted in corrupted pixel buffers when using // readPixels. @@ -357,7 +400,7 @@ index 9f83c6c6..6593581e 100644 #pragma pack(pop) diff --git a/libs/utils/include/utils/StructureOfArrays.h b/libs/utils/include/utils/StructureOfArrays.h -index d92a45f4..2e15150d 100644 +index 7ee9da70..956aa8ec 100644 --- a/libs/utils/include/utils/StructureOfArrays.h +++ b/libs/utils/include/utils/StructureOfArrays.h @@ -742,7 +742,7 @@ typename StructureOfArraysBase::IteratorValueRef& @@ -396,6 +439,19 @@ index d92a45f4..2e15150d 100644 (soa->elementAt(index) = std::move(std::get(rhs.elements)), 0)... }; return *this; } +diff --git a/libs/utils/include/utils/compiler.h b/libs/utils/include/utils/compiler.h +index ff73d43f..2b7824ec 100644 +--- a/libs/utils/include/utils/compiler.h ++++ b/libs/utils/include/utils/compiler.h +@@ -228,7 +228,7 @@ + // AND multi-threading is enabled (UTILS_HAS_THREADING is not 0). + // This prevents compile failures on single-threaded targets or builds where standard + // annotations are disabled by default in the platform's standard library headers. +-#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && UTILS_HAS_THREADING ++#if defined(_LIBCPP_VERSION) && defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && UTILS_HAS_THREADING && !defined(_WIN32) + #define UTILS_THREAD_ANNOTATION_ATTRIBUTE(x) __attribute__((x)) + #else + #define UTILS_THREAD_ANNOTATION_ATTRIBUTE(x) diff --git a/libs/utils/src/CallStack.cpp b/libs/utils/src/CallStack.cpp index 798fd642..be5f15d4 100644 --- a/libs/utils/src/CallStack.cpp @@ -429,6 +485,40 @@ index cf2984af..1dacef63 100644 #else #include #endif +diff --git a/third_party/spirv-cross/CMakeLists.txt b/third_party/spirv-cross/CMakeLists.txt +index 8e5129c8..76191108 100644 +--- a/third_party/spirv-cross/CMakeLists.txt ++++ b/third_party/spirv-cross/CMakeLists.txt +@@ -20,7 +20,11 @@ + # + + cmake_minimum_required(VERSION 3.10) +-set(CMAKE_CXX_STANDARD 11) ++if (WIN32) ++ set(CMAKE_CXX_STANDARD 17) ++else() ++ set(CMAKE_CXX_STANDARD 11) ++endif() + set(CMAKE_CXX_EXTENSIONS OFF) + + # Avoid a warning if parent project sets VERSION in project(). +diff --git a/third_party/spirv-cross/tnt/CMakeLists.txt b/third_party/spirv-cross/tnt/CMakeLists.txt +index 4cb9bdcc..086bec67 100644 +--- a/third_party/spirv-cross/tnt/CMakeLists.txt ++++ b/third_party/spirv-cross/tnt/CMakeLists.txt +@@ -37,7 +37,11 @@ endif() + # -DCMAKE_CXX_COMPILE_FLAGS + # However, we require the C++11 dialect. + if (NOT "${MSVC}") +- set(spirv-compiler-options ${spirv-compiler-options} -std=c++11 -Wall -Wextra -Werror -Wshadow) ++ if (WIN32) ++ set(spirv-compiler-options ${spirv-compiler-options} -std=c++17 -Wall -Wextra -Werror -Wshadow) ++ else() ++ set(spirv-compiler-options ${spirv-compiler-options} -std=c++11 -Wall -Wextra -Werror -Wshadow) ++ endif() + set(spirv-compiler-defines ${spirv-compiler-defines} __STDC_LIMIT_MACROS) + + if(SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) diff --git a/tools/cmgen/src/cmgen.cpp b/tools/cmgen/src/cmgen.cpp index 722e5737..288be3ce 100644 --- a/tools/cmgen/src/cmgen.cpp @@ -451,56 +541,3 @@ index 722e5737..288be3ce 100644 const std::unique_ptr& sh, size_t numBands) { // We assume a symetrical function (i.e. m!=0 terms are zero) for (ssize_t l = 0; l < numBands; l++) { - -diff --git a/third_party/spirv-cross/CMakeLists.txt b/third_party/spirv-cross/CMakeLists.txt ---- a/third_party/spirv-cross/CMakeLists.txt -+++ b/third_party/spirv-cross/CMakeLists.txt -@@ -30,3 +30,7 @@ - cmake_minimum_required(VERSION 3.10) --set(CMAKE_CXX_STANDARD 11) -+if (WIN32) -+ set(CMAKE_CXX_STANDARD 17) -+else() -+ set(CMAKE_CXX_STANDARD 11) -+endif() - set(CMAKE_CXX_EXTENSIONS OFF) - -diff --git a/third_party/spirv-cross/tnt/CMakeLists.txt b/third_party/spirv-cross/tnt/CMakeLists.txt ---- a/third_party/spirv-cross/tnt/CMakeLists.txt -+++ b/third_party/spirv-cross/tnt/CMakeLists.txt -@@ -38,4 +38,8 @@ - # However, we require the C++11 dialect. - if (NOT "${MSVC}") -- set(spirv-compiler-options ${spirv-compiler-options} -std=c++11 -Wall -Wextra -Werror -Wshadow) -+ if (WIN32) -+ set(spirv-compiler-options ${spirv-compiler-options} -std=c++17 -Wall -Wextra -Werror -Wshadow) -+ else() -+ set(spirv-compiler-options ${spirv-compiler-options} -std=c++11 -Wall -Wextra -Werror -Wshadow) -+ endif() - set(spirv-compiler-defines ${spirv-compiler-defines} __STDC_LIMIT_MACROS) - -diff --git a/filament/CMakeLists.txt b/filament/CMakeLists.txt ---- a/filament/CMakeLists.txt -+++ b/filament/CMakeLists.txt -@@ -793,5 +793,8 @@ - -Wweak-vtables -Wnon-virtual-dtor -Wclass-varargs -Wimplicit-fallthrough - -Wover-aligned - -Werror - ) -+ if (WIN32) -+ list(APPEND FILAMENT_WARNINGS -Wno-error=cast-function-type-mismatch -Wno-error=unused-variable -Wno-error=microsoft-unqualified-friend) -+ endif() - endif() - -diff --git a/filament/backend/CMakeLists.txt b/filament/backend/CMakeLists.txt ---- a/filament/backend/CMakeLists.txt -+++ b/filament/backend/CMakeLists.txt -@@ -525,3 +525,7 @@ - endif() - -+if (WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") -+ list(APPEND FILAMENT_WARNINGS -Wno-error=cast-function-type-mismatch -Wno-error=unused-variable -Wno-error=microsoft-unqualified-friend) -+endif() -+ - if (APPLE) - diff --git a/cmake/third_party_deps/dear_imgui.cmake b/cmake/third_party_deps/dear_imgui.cmake index 6eb32e50..45046f3a 100644 --- a/cmake/third_party_deps/dear_imgui.cmake +++ b/cmake/third_party_deps/dear_imgui.cmake @@ -13,7 +13,7 @@ # limitations under the License. set(MUJOCO_DEP_VERSION_dear_imgui - 3109131a882daec56a530aff540416983c240443 + 913a3c60561bb07e8fd410ec7d4a8f6f485defd6 CACHE STRING "Tag/version of `dear_imgui` to be fetched." ) mark_as_advanced(MUJOCO_DEP_VERSION_dear_imgui) diff --git a/cmake/third_party_deps/filament.cmake b/cmake/third_party_deps/filament.cmake index de0576a9..a1a73d00 100644 --- a/cmake/third_party_deps/filament.cmake +++ b/cmake/third_party_deps/filament.cmake @@ -13,7 +13,7 @@ # limitations under the License. set(MUJOCO_DEP_VERSION_filament - da22932b543b59810caf490d7f9e8859ec3fe204 + 10d2fc35128c2bc41ec4a1913c288d5df24afdaf CACHE STRING "Tag/version of `filament` to be fetched." ) mark_as_advanced(MUJOCO_DEP_VERSION_filament) @@ -39,6 +39,7 @@ endif() set(FILAMENT_ENABLE_EXPERIMENTAL_GCC_SUPPORT ON) set(FILAMENT_SKIP_SDL2 ON) +set(FILAMENT_SKIP_SAMPLES ON) set(FILAMENT_USE_EXTERNAL_ABSL ON) set(FILAMENT_USE_EXTERNAL_BENCHMARK ON) set(FILAMENT_USE_EXTERNAL_GTEST ON) diff --git a/cmake/third_party_deps/implot.cmake b/cmake/third_party_deps/implot.cmake index 6bd75fef..d14cae6c 100644 --- a/cmake/third_party_deps/implot.cmake +++ b/cmake/third_party_deps/implot.cmake @@ -13,7 +13,7 @@ # limitations under the License. set(MUJOCO_DEP_VERSION_implot - 0d4d87c3e005349c1aeb7ceacfd20a67f23c42b8 + ec7306ceb99d19ff193eb30dc74fa3598f5e7dc6 CACHE STRING "Tag/version of `implot` to be fetched." ) mark_as_advanced(MUJOCO_DEP_VERSION_implot) diff --git a/src/render/filament/core/material_manager.cc b/src/render/filament/core/material_manager.cc index f07d1aaa..6d75c195 100644 --- a/src/render/filament/core/material_manager.cc +++ b/src/render/filament/core/material_manager.cc @@ -17,6 +17,7 @@ #include #include #include +#include #include #include