Przeglądaj źródła

Add an option to turn on/off debug iterators (#2879)

Add option to turn on/off debug iterators for more performant or more helpful debug builds
Minmin Gong 5 lat temu
rodzic
commit
318e625924
3 zmienionych plików z 8 dodań i 2 usunięć
  1. 2 0
      CMakeLists.txt
  2. 3 1
      cmake/modules/AddLLVM.cmake
  3. 3 1
      external/CMakeLists.txt

+ 2 - 0
CMakeLists.txt

@@ -93,6 +93,8 @@ option(HLSL_ENABLE_ANALYZE "Enables compiler analysis during compilation." OFF)
 option(HLSL_OPTIONAL_PROJS_IN_DEFAULT "Include optional projects in default build target." OFF) # HLSL Change
 option(HLSL_BUILD_DXILCONV "Include DXBC to DXIL converter and tools." ON) # HLSL Change
 
+option(HLSL_DISABLE_DEBUG_ITERATORS "Disable debug iterators for faster debug and to remove some additional allocations with improper noexcept attribution" ON) # HLSL Change
+
 # HLSL Change Starts - support commit querying
 option(HLSL_SUPPORT_QUERY_GIT_COMMIT_INFO "Supports querying Git commit info." ON)
 if ( HLSL_SUPPORT_QUERY_GIT_COMMIT_INFO )

+ 3 - 1
cmake/modules/AddLLVM.cmake

@@ -46,7 +46,9 @@ function(llvm_update_compile_flags name)
       # This is just the default exception handling on Linux
     endif (MSVC)
   endif (LLVM_ENABLE_EH)
-  add_definitions(/D_ITERATOR_DEBUG_LEVEL=0)
+  if (HLSL_DISABLE_DEBUG_ITERATORS)
+    add_definitions(/D_ITERATOR_DEBUG_LEVEL=0)
+  endif (HLSL_DISABLE_DEBUG_ITERATORS)
   # HLSL Changes End
 
   # Assume that;

+ 3 - 1
external/CMakeLists.txt

@@ -25,7 +25,9 @@ if (${ENABLE_SPIRV_CODEGEN})
     if (IS_DIRECTORY ${DXC_SPIRV_TOOLS_DIR})
       # We only need the library from SPIRV-Tools.
       set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "Skip building SPIRV-Tools executables")
-      set(SPIRV_TOOLS_EXTRA_DEFINITIONS /D_ITERATOR_DEBUG_LEVEL=0)
+      if (HLSL_DISABLE_DEBUG_ITERATORS)
+        set(SPIRV_TOOLS_EXTRA_DEFINITIONS /D_ITERATOR_DEBUG_LEVEL=0)
+      endif()
       add_subdirectory(${DXC_SPIRV_TOOLS_DIR} EXCLUDE_FROM_ALL)
     endif()
   endif()