Core: new blenlib library for implicit-sharing #105994

Merged
Jacques Lucke merged 17 commits from JacquesLucke/blender:implicit-sharing into main 2023-03-28 13:58:02 +02:00
11 changed files with 40 additions and 41 deletions
Showing only changes of commit 34f1b1e06e - Show all commits

View File

@ -80,6 +80,7 @@ set(_CLANG_FIND_COMPONENTS
clangAST
clangLex
clangBasic
clangSupport
)
set(_CLANG_LIBRARIES)
@ -94,7 +95,9 @@ foreach(COMPONENT ${_CLANG_FIND_COMPONENTS})
PATH_SUFFIXES
lib64 lib
)
list(APPEND _CLANG_LIBRARIES "${CLANG_${UPPERCOMPONENT}_LIBRARY}")
if(CLANG_${UPPERCOMPONENT}_LIBRARY)
list(APPEND _CLANG_LIBRARIES "${CLANG_${UPPERCOMPONENT}_LIBRARY}")
endif()
endforeach()

View File

@ -7,7 +7,7 @@ set(INC
)
set(INC_SYS
${X11_X11_INCLUDE_PATH}
)
set(SRC

View File

@ -19,12 +19,13 @@
# undef NOMINMAX
# endif
# endif
#else
# include <atomic>
# include <mutex>
# include "BLI_map.hh"
#endif
#include <atomic>
#include <mutex>
#include "BLI_map.hh"
#include "BLI_utility_mixins.hh"
namespace blender::threading {

View File

@ -35,7 +35,7 @@ namespace blender {
* e.g. a plain data array.
* - It can be embedded into another struct. For that it's best to use #ImplicitSharingMixin.
*/
class ImplicitSharingInfo : blender::NonCopyable, blender::NonMovable {
class ImplicitSharingInfo : NonCopyable, NonMovable {
private:
mutable std::atomic<int> users_;

View File

@ -64,6 +64,22 @@ template<typename T> class SharedCache {
BLI_assert(cache_->mutex.is_cached());
return cache_->data;
}
/**
* Return true if the cache currently does not exist or has been invalidated.
*/
bool is_dirty() const
{
return cache_->mutex.is_dirty();
}
/**
* Return true if the cache exists and is valid.
*/
bool is_cached() const
{
return cache_->mutex.is_cached();
}
};
} // namespace blender

View File

@ -161,8 +161,6 @@ class DeferredLayer {
class DeferredPipeline {
private:
Instance &inst_;
/* Gbuffer filling passes. We could have an arbitrary number of them but for now we just have
* a hardcoded number of them. */
DeferredLayer opaque_layer_;
@ -171,7 +169,7 @@ class DeferredPipeline {
public:
DeferredPipeline(Instance &inst)
: inst_(inst), opaque_layer_(inst), refraction_layer_(inst), volumetric_layer_(inst){};
: opaque_layer_(inst), refraction_layer_(inst), volumetric_layer_(inst){};
void begin_sync();
void end_sync();

View File

@ -155,8 +155,6 @@ class AbstractGridView : public AbstractView {
* \{ */
class GridViewBuilder {
uiBlock &block_;
public:
GridViewBuilder(uiBlock &block);

View File

@ -389,7 +389,7 @@ uiLayout *GridViewLayoutBuilder::current_layout() const
/* ---------------------------------------------------------------------- */
GridViewBuilder::GridViewBuilder(uiBlock &block) : block_(block)
GridViewBuilder::GridViewBuilder(uiBlock & /*block*/)
{
}

View File

@ -98,7 +98,7 @@ void initialize_volume_component_from_points(GeoNodeExecParams &params,
return;
}
float voxel_size;
float voxel_size = 0.0f;
if (storage.resolution_mode == GEO_NODE_POINTS_TO_VOLUME_RESOLUTION_MODE_SIZE) {
voxel_size = params.get_input<float>("Voxel Size");
}
@ -107,6 +107,9 @@ void initialize_volume_component_from_points(GeoNodeExecParams &params,
const float max_radius = *std::max_element(radii.begin(), radii.end());
voxel_size = compute_voxel_size_from_amount(voxel_amount, positions, max_radius);
}
else {
BLI_assert_msg(0, "Unknown volume resolution mode");
}
const double determinant = std::pow(double(voxel_size), 3.0);
if (!BKE_volume_grid_determinant_valid(determinant)) {

View File

@ -414,6 +414,7 @@ if(WITH_PYTHON)
DESTINATION ${TARGETDIR_VER}
PATTERN ".git" EXCLUDE
PATTERN ".gitignore" EXCLUDE
PATTERN ".gitea" EXCLUDE
PATTERN ".github" EXCLUDE
PATTERN ".arcconfig" EXCLUDE
PATTERN "__pycache__" EXCLUDE
@ -535,6 +536,9 @@ macro(install_dir from to)
DESTINATION ${to}
# Irrelevant files and caches.
PATTERN ".git" EXCLUDE
PATTERN ".gitignore" EXCLUDE
PATTERN ".gitea" EXCLUDE
PATTERN ".github" EXCLUDE
PATTERN ".svn" EXCLUDE
PATTERN "*.pyc" EXCLUDE
PATTERN "*.pyo" EXCLUDE
@ -1294,33 +1298,6 @@ elseif(APPLE)
set_target_properties(blender PROPERTIES OUTPUT_NAME Blender)
endif()
# Handy install macro to exclude files, we use \$ escape for the "to"
# argument when calling so `${BUILD_TYPE}` does not get expanded.
macro(install_dir from to)
install(
DIRECTORY ${from}
DESTINATION ${to}
PATTERN ".git" EXCLUDE
PATTERN ".svn" EXCLUDE
PATTERN "*.pyc" EXCLUDE
PATTERN "*.pyo" EXCLUDE
PATTERN "*.orig" EXCLUDE
PATTERN "*.rej" EXCLUDE
PATTERN "__pycache__" EXCLUDE
PATTERN "__MACOSX" EXCLUDE
PATTERN ".DS_Store" EXCLUDE
PATTERN "config-${PYTHON_VERSION}/*.a" EXCLUDE # static lib
PATTERN "lib2to3" EXCLUDE # ./lib2to3
PATTERN "tkinter" EXCLUDE # ./tkinter
PATTERN "lib-dynload/_tkinter.*" EXCLUDE # ./lib-dynload/_tkinter.co
PATTERN "idlelib" EXCLUDE # ./idlelib
PATTERN "test" EXCLUDE # ./test
PATTERN "turtledemo" EXCLUDE # ./turtledemo
PATTERN "turtle.py" EXCLUDE # ./turtle.py
PATTERN "wininst*.exe" EXCLUDE # from distutils, avoid malware false positive
)
endmacro()
set(OSX_APP_SOURCEDIR ${CMAKE_SOURCE_DIR}/release/darwin/Blender.app)
# Setup `Info.plist`.

View File

@ -39,6 +39,9 @@ global:
realpath;
sched_*;
valloc;
/* needed on FreeBSD */
__progname;
environ;
local:
*;
};