Skip to content

Commit 3d1f5c7

Browse files
committed
Merge branch 'master' into cad_shaders_work
# Conflicts: # 3rdparty/CMakeLists.txt # 3rdparty/boost/CMakeLists.txt # include/nbl/builtin/hlsl/cpp_compat/vector.hlsl
2 parents 1891622 + 47a27e3 commit 3d1f5c7

File tree

838 files changed

+260153
-742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

838 files changed

+260153
-742
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ android-sample/bin/*
2828
# shader debug sideeffects
2929
preprocessed.hlsl
3030
compiled.spv
31+
.vs/*

3rdparty/CMakeLists.txt

Lines changed: 36 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -160,24 +160,34 @@ add_subdirectory(libpng libpng EXCLUDE_FROM_ALL)
160160
add_dependencies(png_static zlibstatic)
161161

162162

163-
#openexr
163+
# OpenEXR
164164
option(_NBL_COMPILE_WITH_OPEN_EXR_ "Build with OpenEXR library" ON)
165-
if (_NBL_COMPILE_WITH_OPEN_EXR_)
166-
set(_OLD_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
167-
set(_OLD_BUILD_STATIC_LIBS ${BUILD_STATIC_LIBS})
168-
set(_OLD_BUILD_TESTING ${BUILD_TESTING})
169-
set(BUILD_SHARED_LIBS OFF)
170-
set(BUILD_STATIC_LIBS OFF)
171-
set(BUILD_TESTING OFF)
172-
set(PYILMBASE_ENABLE OFF CACHE STRING "" FORCE)
173-
set(OPENEXR_BUILD_UTILS OFF CACHE STRING "" FORCE)
174-
set(OPENEXR_VIEWERS_ENABLE OFF CACHE STRING "" FORCE)
175-
add_subdirectory(openexr openexr EXCLUDE_FROM_ALL)
176-
set(BUILD_SHARED_LIBS ${_OLD_BUILD_SHARED_LIBS})
177-
set(BUILD_STATIC_LIBS ${_OLD_BUILD_STATIC_LIBS})
178-
set(BUILD_TESTING ${_OLD_BUILD_TESTING})
179-
endif()
180165

166+
# Note we are adding it anyway regardless _NBL_COMPILE_WITH_OPEN_EXR_, its because we need Half dependecy
167+
# it generates on fly in its build directory which doesnt have to be linked (class with inline methods),
168+
# here is where _NBL_COMPILE_WITH_OPEN_EXR_ plays a role - when disabled OpenEXR won't be built and linked
169+
# but it's core
170+
171+
set(_OLD_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
172+
set(_OLD_BUILD_STATIC_LIBS ${BUILD_STATIC_LIBS})
173+
set(_OLD_BUILD_TESTING ${BUILD_TESTING})
174+
set(BUILD_SHARED_LIBS OFF)
175+
set(BUILD_STATIC_LIBS OFF)
176+
set(BUILD_TESTING OFF)
177+
set(PYILMBASE_ENABLE OFF CACHE STRING "" FORCE)
178+
set(OPENEXR_BUILD_UTILS OFF CACHE STRING "" FORCE)
179+
set(OPENEXR_FORCE_INTERNAL_IMATH ON CACHE STRING "" FORCE) # TODO: make it a submodule and force using it maybe instead of letting OpenEXR download it from it's github repository
180+
set(OPENEXR_BUILD_TOOLS OFF CACHE STRING "" FORCE)
181+
set(OPENEXR_INSTALL OFF CACHE STRING "" FORCE)
182+
set(OPENEXR_INSTALL_DOCS OFF CACHE STRING "" FORCE)
183+
set(OPENEXR_INSTALL_EXAMPLES OFF CACHE STRING "" FORCE)
184+
set(OPENEXR_INSTALL_PKG_CONFIG OFF CACHE STRING "" FORCE)
185+
set(OPENEXR_INSTALL_TOOLS OFF CACHE STRING "" FORCE)
186+
187+
add_subdirectory(openexr openexr EXCLUDE_FROM_ALL)
188+
set(BUILD_SHARED_LIBS ${_OLD_BUILD_SHARED_LIBS})
189+
set(BUILD_STATIC_LIBS ${_OLD_BUILD_STATIC_LIBS})
190+
set(BUILD_TESTING ${_OLD_BUILD_TESTING})
181191

182192
#gli
183193
option(_NBL_COMPILE_WITH_GLI_ "Build with GLI library" ON)
@@ -194,10 +204,6 @@ if(_NBL_COMPILE_WITH_GLI_)
194204
set(BUILD_TESTING ${_OLD_BUILD_TESTING})
195205
endif()
196206

197-
198-
nbl_adjust_flags()
199-
200-
201207
add_library(lzma OBJECT
202208
lzma/C/Alloc.c
203209
lzma/C/LzFind.c
@@ -295,12 +301,7 @@ option(GLM_TEST_ENABLE "Build unit tests" OFF)
295301
set(BUILD_SHARED_LIBS ${_OLD_BUILD_SHARED_LIBS})
296302
set(BUILD_STATIC_LIBS ${_OLD_BUILD_STATIC_LIBS})
297303

298-
299304
if (NBL_BUILD_MITSUBA_LOADER)
300-
if(NBL_UPDATE_GIT_SUBMODULE)
301-
update_git_submodule(./libexpat)
302-
endif()
303-
304305
option(BUILD_tools "EXPAT: build the xmlwf tool for expat library" OFF)
305306
option(BUILD_examples "EXPAT: build the examples for expat library" OFF)
306307
option(BUILD_tests "EXPAT: build the tests for expat library" OFF)
@@ -321,26 +322,14 @@ if (NBL_BUILD_MITSUBA_LOADER)
321322
set(MITSUBA_LOADER_DEPENDENT_LIBS ${MITSUBA_LOADER_DEPENDENT_LIBS} PARENT_SCOPE)
322323
endif()
323324

324-
325325
if (NBL_BUILD_BULLET)
326-
if(NBL_UPDATE_GIT_SUBMODULE)
327-
update_git_submodule(./bullet3)
328-
endif()
329326
set(BULLET_INCLUDE_PATH
330327
${CMAKE_CURRENT_SOURCE_DIR}/bullet3/src
331328
)
332329

333330
set(BULLET_INCLUDE_PATH ${BULLET_INCLUDE_PATH} PARENT_SCOPE)
334331
endif()
335332

336-
337-
if (NBL_COMPILE_WITH_CUDA)
338-
if(NBL_UPDATE_GIT_SUBMODULE)
339-
update_git_submodule(./jitify)
340-
endif()
341-
endif()
342-
343-
344333
# Final gather
345334
set(NBL_3RDPARTY_TARGETS
346335
lzma
@@ -362,18 +351,15 @@ set(NBL_3RDPARTY_TARGETS
362351
SPIRV
363352
SPIRV-Tools-static # SPIRV-Tools-shared in case of SHARED lib
364353
SPIRV-Tools-opt
354+
Imath
355+
OpenEXRCore
365356
${NBL_BOOST_TARGETS}
366357
)
367358
if (_NBL_COMPILE_WITH_OPEN_EXR_)
368359
list(APPEND NBL_3RDPARTY_TARGETS
369-
IlmBaseConfig
370-
IlmImfConfig
371-
Imath
372-
IlmThread
373-
IlmImf
374-
Half
360+
OpenEXR
375361
Iex
376-
IexMath
362+
IlmThread
377363
)
378364
endif()
379365
if(ANDROID AND NOT ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
@@ -398,11 +384,17 @@ foreach(trgt IN LISTS NBL_3RDPARTY_TARGETS)
398384
else()
399385
set_property(TARGET ${trgt} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
400386
endif()
387+
388+
if(MSVC AND NBL_SANITIZE_ADDRESS)
389+
set_property(TARGET ${trgt} PROPERTY COMPILE_OPTIONS /fsanitize=address)
390+
endif()
401391
endforeach()
402392

403393
add_custom_target(3rdparty)
404394
add_dependencies(3rdparty ${NBL_3RDPARTY_TARGETS})
405395

396+
nbl_adjust_flags()
397+
406398
set(_NBL_3RDPARTY_TARGETS_ ${NBL_3RDPARTY_TARGETS} PARENT_SCOPE)
407399

408400
## REMINDER / NOTE : This is how we install 3rdparty headers we need !

3rdparty/boost/CMakeLists.txt

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,70 @@ if(NBL_EMBED_BUILTIN_RESOURCES)
1717
ADD_CUSTOM_BUILTIN_RESOURCES(boostBuiltinResourceData BOOST_RESOURCES_TO_EMBED "${_BOOST_PREPROCESSOR_BR_BUNDLE_SEARCH_DIRECTORY_}" "boost" "boost::builtin" "${_BOOST_PREPROCESSOR_BR_OUTPUT_DIRECTORY_HEADER_}" "${_BOOST_PREPROCESSOR_BR_OUTPUT_DIRECTORY_HEADER_}" "STATIC" "INTERNAL")
1818
endif()
1919

20-
set(BOOST_INCLUDE_LIBRARIES wave)
20+
get_filename_component(NBL_BOOST_WAVE_DEP_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dep/wave.cmake" ABSOLUTE)
21+
22+
if(NOT EXISTS "${NBL_BOOST_WAVE_DEP_FILE}")
23+
message(FATAL_ERROR "Internal error, generate NBL_BOOST_WAVE_DEP_FILE by enabling NBL_BOOST_GENERATE_DEP_LIST!")
24+
endif()
25+
2126
set(BOOST_STAGEDIR "${CMAKE_CURRENT_BINARY_DIR}/boost/superproject/stage")
22-
add_subdirectory(superproject superproject EXCLUDE_FROM_ALL)
27+
include("${NBL_BOOST_WAVE_DEP_FILE}")
28+
29+
foreach(BOOST_LIB IN LISTS NBL_BOOST_LIBS)
30+
add_subdirectory(superproject/libs/${BOOST_LIB} EXCLUDE_FROM_ALL)
31+
endforeach()
2332

24-
set(NBL_BOOST_LIBS wave;assert;concept_check;config;core;filesystem;format;iterator;lexical_cast;mpl;multi_index;optional;pool;preprocessor;serialization;smart_ptr;spirit;static_assert;throw_exception;type_traits;atomic;container_hash;detail;io;predef;system;winapi;utility;conversion;function_types;fusion;container;integer;numeric/conversion;bind;move;tuple;array;function;mp11;variant;variant2;endian;phoenix;proto;range;regex;thread;typeof;unordered;align;intrusive;describe;functional;chrono;date_time;exception;type_index;ratio;algorithm;tokenizer)
33+
add_subdirectory(superproject/libs/wave EXCLUDE_FROM_ALL)
2534

2635
foreach(BOOST_LIB IN LISTS NBL_BOOST_LIBS)
27-
if(TARGET boost_${BOOST_LIB})
28-
list(APPEND NBL_BOOST_TARGETS boost_${BOOST_LIB})
29-
endif()
36+
if(TARGET boost_${BOOST_LIB})
37+
list(APPEND NBL_BOOST_TARGETS boost_${BOOST_LIB})
38+
endif()
3039
endforeach()
3140

3241
set(NBL_BOOST_TARGETS
3342
${NBL_BOOST_TARGETS}
3443
PARENT_SCOPE)
44+
45+
# Boost uses it's own tool for generating dependency list for targets, therefore we
46+
# can make sure manually added dependnecy subdirectories for a library are valid
47+
# https://www.boost.org/doc/libs/1_83_0/tools/boostdep/doc/html/index.html#boostdep.introduction.building_boostdep
48+
49+
if(NBL_BOOST_GENERATE_DEP_LIST) # internal, for Nabla devs
50+
if(WIN32)
51+
set(NBL_BOOSTDEP_EXE "boostdep.exe")
52+
else()
53+
set(NBL_BOOSTDEP_EXE "boostdep")
54+
endif()
55+
56+
set(NBL_BOOSTDEP_EXE_FILEPATH "${CMAKE_CURRENT_BINARY_DIR}/superproject/tools/boostdep/bin/${NBL_BOOSTDEP_EXE}")
57+
58+
if(NOT EXISTS "${NBL_BOOSTDEP_EXE_FILEPATH}")
59+
macro(NBL_BOOST_EXECUTE)
60+
execute_process(COMMAND ${ARGV}
61+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/superproject"
62+
)
63+
endmacro()
64+
65+
NBL_BOOST_EXECUTE(cmd /C bootstrap.bat)
66+
NBL_BOOST_EXECUTE(cmd /C b2.exe tools/boostdep/build)
67+
NBL_BOOST_EXECUTE("${CMAKE_COMMAND}" -E copy "./dist/bin/${NBL_BOOSTDEP_EXE}" "${NBL_BOOSTDEP_EXE_FILEPATH}")
68+
NBL_BOOST_EXECUTE(git clean -fdx)
69+
NBL_BOOST_EXECUTE(git reset --hard)
70+
endif()
71+
72+
execute_process(COMMAND "${NBL_BOOSTDEP_EXE_FILEPATH}" --boost-root "${CMAKE_CURRENT_SOURCE_DIR}/superproject" --brief wave
73+
OUTPUT_VARIABLE NBL_OUTPUT_VAR
74+
)
75+
76+
file(WRITE "${NBL_BOOST_WAVE_DEP_FILE}" "${NBL_OUTPUT_VAR}")
77+
78+
file(STRINGS "${NBL_BOOST_WAVE_DEP_FILE}" NBL_BOOST_LIBS)
79+
set(NBL_BOOST_LIBS ${NBL_BOOST_LIBS})
80+
list(POP_FRONT NBL_BOOST_LIBS)
81+
list(FILTER NBL_BOOST_LIBS EXCLUDE REGEX "#")
82+
list(FILTER NBL_BOOST_LIBS EXCLUDE REGEX "(unknown)")
83+
string(REPLACE "~" "/" NBL_BOOST_LIBS "${NBL_BOOST_LIBS}")
84+
85+
file(WRITE "${NBL_BOOST_WAVE_DEP_FILE}" "set(NBL_BOOST_LIBS ${NBL_BOOST_LIBS})")
86+
endif()

3rdparty/boost/dep/wave.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(NBL_BOOST_LIBS assert;concept_check;config;core;filesystem;format;iterator;lexical_cast;mpl;multi_index;optional;pool;preprocessor;serialization;smart_ptr;spirit;static_assert;throw_exception;type_traits;atomic;container_hash;detail;io;predef;system;winapi;utility;conversion;function_types;fusion;container;integer;numeric/conversion;bind;move;tuple;array;function;mp11;variant;variant2;endian;phoenix;proto;range;regex;thread;typeof;unordered;align;intrusive;describe;functional;chrono;date_time;exception;type_index;ratio;algorithm;tokenizer)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
Bullet Continuous Collision Detection and Physics Library
3+
Copyright (c) 2003-2013 Erwin Coumans http://bulletphysics.org
4+
5+
This software is provided 'as-is', without any express or implied warranty.
6+
In no event will the authors be held liable for any damages arising from the use of this software.
7+
Permission is granted to anyone to use this software for any purpose,
8+
including commercial applications, and to alter it and redistribute it freely,
9+
subject to the following restrictions:
10+
11+
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12+
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13+
3. This notice may not be removed or altered from any source distribution.
14+
*/
15+
16+
#ifndef B3_BROADPHASE_CALLBACK_H
17+
#define B3_BROADPHASE_CALLBACK_H
18+
19+
#include "Bullet3Common/b3Vector3.h"
20+
struct b3BroadphaseProxy;
21+
22+
struct b3BroadphaseAabbCallback
23+
{
24+
virtual ~b3BroadphaseAabbCallback() {}
25+
virtual bool process(const b3BroadphaseProxy* proxy) = 0;
26+
};
27+
28+
struct b3BroadphaseRayCallback : public b3BroadphaseAabbCallback
29+
{
30+
///added some cached data to accelerate ray-AABB tests
31+
b3Vector3 m_rayDirectionInverse;
32+
unsigned int m_signs[3];
33+
b3Scalar m_lambda_max;
34+
35+
virtual ~b3BroadphaseRayCallback() {}
36+
};
37+
38+
#endif //B3_BROADPHASE_CALLBACK_H

0 commit comments

Comments
 (0)