[Bf-blender-cvs] [2dcdfab94c7] master: Realtime Compositor: Warn about unsupported MacOS
Commit: 2dcdfab94c72ef092d281d415704f75953349d11 Author: Omar Emara Date: Thu Nov 24 09:25:44 2022 +0200 Branches: master https://developer.blender.org/rB2dcdfab94c72ef092d281d415704f75953349d11 Realtime Compositor: Warn about unsupported MacOS This patch warns the user that MacOS is not supported for the viewport compositor in the shading panel. See T102353. === M release/scripts/startup/bl_ui/space_view3d.py === diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 656ef6663e4..cea5df69bf8 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -6211,10 +6211,14 @@ class VIEW3D_PT_shading_compositor(Panel): def draw(self, context): shading = context.space_data.shading -row = self.layout.row() import sys -row.active = sys.platform != "darwin" +is_macos = sys.platform == "darwin" + +row = self.layout.row() +row.active = not is_macos row.prop(shading, "use_compositor", expand=True) +if is_macos and shading.use_compositor != "DISABLED": +self.layout.label(text="Compositor not supported on MacOS.", icon="ERROR") class VIEW3D_PT_gizmo_display(Panel): ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [38573d515e4] master: Cleanup: Remove unused IMB tile cache code
Commit: 38573d515e49f3e0b22b0e58c7b0357bae107a4d Author: Jesse Yurkovich Date: Wed Nov 23 19:31:10 2022 -0800 Branches: master https://developer.blender.org/rB38573d515e49f3e0b22b0e58c7b0357bae107a4d Cleanup: Remove unused IMB tile cache code This removes the unused code for the IBM tile cache APIs. These have been unused for as far back as I could manage to search. Since TIFF was used for the cached images, this removal will allow for an easier review when it comes time to move TIFF to OIIO as part of T101413. Differential Revision: https://developer.blender.org/D16587 === M source/blender/imbuf/CMakeLists.txt M source/blender/imbuf/IMB_imbuf.h M source/blender/imbuf/IMB_imbuf_types.h M source/blender/imbuf/intern/IMB_filetype.h M source/blender/imbuf/intern/allocimbuf.c D source/blender/imbuf/intern/cache.c M source/blender/imbuf/intern/filetype.c M source/blender/imbuf/intern/module.c M source/blender/imbuf/intern/readimage.c M source/blender/imbuf/intern/tiff.c === diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index 1309e3810be..823866c75bb 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -24,7 +24,6 @@ set(SRC intern/allocimbuf.c intern/anim_movie.c intern/bmp.c - intern/cache.c intern/colormanagement.c intern/colormanagement_inline.c intern/divers.c diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index a05bc51fcea..a5bb34392b1 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -452,17 +452,6 @@ void IMB_makemipmap(struct ImBuf *ibuf, int use_filter); void IMB_remakemipmap(struct ImBuf *ibuf, int use_filter); struct ImBuf *IMB_getmipmap(struct ImBuf *ibuf, int level); -/** - * \attention Defined in cache.c - */ - -/** - * Presumed to be called when no threads are running. - */ -void IMB_tile_cache_params(int totthread, int maxmem); -unsigned int *IMB_gettile(struct ImBuf *ibuf, int tx, int ty, int thread); -void IMB_tiles_to_rect(struct ImBuf *ibuf); - /** * \attention Defined in filter.c */ @@ -816,9 +805,6 @@ bool imb_addrectfloatImBuf(struct ImBuf *ibuf, const unsigned int channels); void imb_freerectfloatImBuf(struct ImBuf *ibuf); void imb_freemipmapImBuf(struct ImBuf *ibuf); -bool imb_addtilesImBuf(struct ImBuf *ibuf); -void imb_freetilesImBuf(struct ImBuf *ibuf); - /** Free all pixel data (associated with image size). */ void imb_freerectImbuf_all(struct ImBuf *ibuf); diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h index 81e9420c8ba..0851aaa8669 100644 --- a/source/blender/imbuf/IMB_imbuf_types.h +++ b/source/blender/imbuf/IMB_imbuf_types.h @@ -144,8 +144,7 @@ typedef enum eImBufFlags { IB_multilayer = 1 << 7, IB_metadata = 1 << 8, IB_animdeinterlace = 1 << 9, - IB_tiles = 1 << 10, - IB_tilecache = 1 << 11, + /** indicates whether image on disk have premul alpha */ IB_alphamode_premul = 1 << 12, /** if this flag is set, alpha mode would be guessed from file */ @@ -202,11 +201,6 @@ typedef struct ImBuf { /** Resolution in pixels per meter. Multiply by `0.0254` for DPI. */ double ppm[2]; - /* tiled pixel storage */ - int tilex, tiley; - int xtiles, ytiles; - unsigned int **tiles; - /* zbuffer */ /** z buffer data, original zbuffer */ int *zbuf; diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h index bd17316d173..8252b0dd0b3 100644 --- a/source/blender/imbuf/intern/IMB_filetype.h +++ b/source/blender/imbuf/intern/IMB_filetype.h @@ -49,12 +49,6 @@ typedef struct ImFileType { size_t *r_height); /** Save to a file (or memory if #IB_mem is set in `flags` and the format supports it). */ bool (*save)(struct ImBuf *ibuf, const char *filepath, int flags); - void (*load_tile)(struct ImBuf *ibuf, -const unsigned char *mem, -size_t size, -int tx, -int ty, -unsigned int *rect); int flag; @@ -73,15 +67,6 @@ const ImFileType *IMB_file_type_from_ibuf(const struct ImBuf *ibuf); void imb_filetypes_init(void); void imb_filetypes_exit(void); -void imb_tile_cache_init(void); -void imb_tile_cache_exit(void); - -void imb_loadtile(struct ImBuf *ibuf, int tx, int ty, unsigned int *rect); -/** - * External free. - */ -void imb_tile_cache_tile_free(struct ImBuf *ibuf, int tx, int ty); - /** \} */ /* Type Specific Functions */ @@ -235,8 +220,6 @@ struct ImBuf *imb_loadtiff(const unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE]); -v
[Bf-blender-cvs] [7ad2b93ec46] geometry-nodes-simulation: More semi-working sockets, lazyness, more TODOs, RNA
Commit: 7ad2b93ec46ecb5c670dcd463b97aff15cb1fe65 Author: Hans Goudey Date: Wed Nov 23 16:02:39 2022 -0600 Branches: geometry-nodes-simulation https://developer.blender.org/rB7ad2b93ec46ecb5c670dcd463b97aff15cb1fe65 More semi-working sockets, lazyness, more TODOs, RNA === M source/blender/blenkernel/BKE_compute_cache.hh M source/blender/makesdna/DNA_node_types.h M source/blender/makesrna/intern/rna_nodetree.c M source/blender/modifiers/intern/MOD_nodes.cc M source/blender/nodes/NOD_static_types.h M source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc M source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc === diff --git a/source/blender/blenkernel/BKE_compute_cache.hh b/source/blender/blenkernel/BKE_compute_cache.hh index d48ca1254bb..7fd0d6225c7 100644 --- a/source/blender/blenkernel/BKE_compute_cache.hh +++ b/source/blender/blenkernel/BKE_compute_cache.hh @@ -13,35 +13,124 @@ namespace blender::bke { struct GeometryCacheValue { int frame; + float time; GeometrySet geometry_set; }; -struct CacheData { +struct SimulationCache { Vector geometry_per_frame; - GeometrySet *first_item_before(const int frame) + const GeometryCacheValue *value_at_or_before_time(const int frame) const { -if (geometry_per_frame.is_empty()) { +const int index = this->index_at_or_before_time(frame); +if (index >= geometry_per_frame.size()) { return nullptr; } -if (frame < geometry_per_frame.first().frame) { +return &geometry_per_frame[index]; + } + + const GeometryCacheValue *value_before_time(const int frame) const + { +const int index = this->index_before_time(frame); +if (index >= geometry_per_frame.size()) { return nullptr; } +return &geometry_per_frame[index]; + } -GeometryCacheValue *last_value = nullptr; -for (int i = geometry_per_frame.size() - 1; i > 0; i--) { + GeometryCacheValue *value_at_time(const int frame) + { +for (const int i : geometry_per_frame.index_range()) { + if (geometry_per_frame[i].frame == frame) { +return &geometry_per_frame[i]; + } +} +return nullptr; + } + + GeometryCacheValue &value_at_time_ensure(const int frame) + { +for (const int i : geometry_per_frame.index_range()) { + if (geometry_per_frame[i].frame == frame) { +return geometry_per_frame[i]; + } +} +const int index = this->index_before_time(frame); +GeometryCacheValue value{}; +geometry_per_frame.insert(index, value); +return geometry_per_frame[index]; + } + + void insert(GeometrySet &geometry_set, const int frame, const float time) + { +BLI_assert(!this->value_at_time(frame)); +GeometryCacheValue value{}; +value.frame = frame; +value.time = time; +value.geometry_set = geometry_set; +const int index = this->index_before_time(frame); +geometry_per_frame.insert(index, value); + } + + private: + int index_at_or_before_time(const int frame) const + { +if (geometry_per_frame.is_empty()) { + return 0; +} +int insert_index = 0; +for (const int i : geometry_per_frame.index_range()) { + if (geometry_per_frame[i].frame >= frame) { +break; + } + insert_index++; +} +return insert_index; + } + int index_before_time(const int frame) const + { +if (geometry_per_frame.is_empty()) { + return 0; +} +int insert_index = 0; +for (const int i : geometry_per_frame.index_range()) { if (geometry_per_frame[i].frame > frame) { break; } - last_value = &geometry_per_frame[i]; + insert_index++; } - -return last_value ? &last_value->geometry_set : nullptr; +return insert_index; } }; struct ComputeCaches { - Map cache_per_context; + private: + mutable std::mutex mutex; + Map cache_per_context; + + public: + ComputeCaches() = default; + ComputeCaches(const ComputeCaches &other) + { +cache_per_context = other.cache_per_context; + } + + const SimulationCache *lookup_context(const ComputeContextHash &context_hash) const + { +std::scoped_lock lock{mutex}; +return cache_per_context.lookup_ptr(context_hash); + } + + SimulationCache &ensure_for_context(const ComputeContextHash &context_hash) + { +std::scoped_lock lock{mutex}; +return cache_per_context.lookup_or_add_default(context_hash); + } + + bool is_empty() const + { +return cache_per_context.is_empty(); + } }; } // namespace blender::bke diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 616c8b6f141..5834794782f 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -1534,6 +1534,14 @@ typedef struct NodeGeometryUVUnwrap { uint8_t method; } NodeGeometryUVUnw
[Bf-blender-cvs] [5aaa435ac73] geometry-nodes-simulation: Simulation output and input nodes
Commit: 5aaa435ac73e89ceae6843c8f82b93547f501d2f Author: Hans Goudey Date: Tue Nov 22 18:23:26 2022 -0600 Branches: geometry-nodes-simulation https://developer.blender.org/rB5aaa435ac73e89ceae6843c8f82b93547f501d2f Simulation output and input nodes === M release/scripts/startup/bl_ui/node_add_menu_geometry.py A source/blender/blenkernel/BKE_compute_cache.hh M source/blender/blenkernel/BKE_node.h M source/blender/blenkernel/intern/node.cc M source/blender/makesdna/DNA_modifier_types.h M source/blender/modifiers/intern/MOD_nodes.cc M source/blender/nodes/NOD_geometry.h M source/blender/nodes/NOD_geometry_nodes_lazy_function.hh M source/blender/nodes/NOD_static_types.h M source/blender/nodes/geometry/CMakeLists.txt A source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc A source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc === diff --git a/release/scripts/startup/bl_ui/node_add_menu_geometry.py b/release/scripts/startup/bl_ui/node_add_menu_geometry.py index 83448f8e32a..bf014e52634 100644 --- a/release/scripts/startup/bl_ui/node_add_menu_geometry.py +++ b/release/scripts/startup/bl_ui/node_add_menu_geometry.py @@ -291,6 +291,17 @@ class NODE_MT_category_GEO_POINT(Menu): node_add_menu.draw_assets_for_catalog(layout, self.bl_label) +class NODE_MT_category_simulation(Menu): +bl_idname = "NODE_MT_category_simulation" +bl_label = "Simulation" + +def draw(self, _context): +layout = self.layout +node_add_menu.add_node_type(layout, "GeometryNodeSimulationInput") +node_add_menu.add_node_type(layout, "GeometryNodeSimulationOutput") +node_add_menu.draw_assets_for_catalog(layout, self.bl_label) + + class NODE_MT_category_GEO_TEXT(Menu): bl_idname = "NODE_MT_category_GEO_TEXT" bl_label = "Text" @@ -428,6 +439,7 @@ class NODE_MT_geometry_node_add_all(Menu): layout.menu("NODE_MT_geometry_node_mesh_topology") layout.menu("NODE_MT_category_GEO_OUTPUT") layout.menu("NODE_MT_category_GEO_POINT") +layout.menu("NODE_MT_category_simulation") layout.menu("NODE_MT_category_GEO_TEXT") layout.menu("NODE_MT_category_GEO_TEXTURE") layout.menu("NODE_MT_category_GEO_UTILITIES") @@ -455,6 +467,7 @@ classes = ( NODE_MT_geometry_node_mesh_topology, NODE_MT_category_GEO_OUTPUT, NODE_MT_category_GEO_POINT, +NODE_MT_category_simulation, NODE_MT_category_GEO_TEXT, NODE_MT_category_GEO_TEXTURE, NODE_MT_category_GEO_UTILITIES, diff --git a/source/blender/blenkernel/BKE_compute_cache.hh b/source/blender/blenkernel/BKE_compute_cache.hh new file mode 100644 index 000..2dc07594a5c --- /dev/null +++ b/source/blender/blenkernel/BKE_compute_cache.hh @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +#include "BLI_compute_context.hh" +#include "BLI_map.hh" + +#include "BKE_geometry_set.hh" + +namespace blender::bke { + +struct CacheData { + Map geometry_per_frame; +}; + +struct ComputeCaches { + Map cache_per_context; +}; + +} // namespace blender::bke diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index dd035dbf537..96adbbef507 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1396,6 +1396,9 @@ struct TexResult; /** \name Geometry Nodes * \{ */ +#define GEO_NODE_SIMULATION_INPUT 1198 +#define GEO_NODE_SIMULATION_OUTPUT 1199 + #define GEO_NODE_TRIANGULATE 1000 #define GEO_NODE_TRANSFORM 1002 #define GEO_NODE_MESH_BOOLEAN 1003 diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index d8451cab0f5..958f532eb28 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -2213,7 +2213,7 @@ bNode *nodeAddNode(const struct bContext *C, bNodeTree *ntree, const char *idnam BKE_ntree_update_tag_node_new(ntree, node); - if (ELEM(node->type, GEO_NODE_INPUT_SCENE_TIME, GEO_NODE_SELF_OBJECT)) { + if (ELEM(node->type, GEO_NODE_INPUT_SCENE_TIME, GEO_NODE_SELF_OBJECT, GEO_NODE_SIMULATION_INPUT)) { DEG_relations_tag_update(CTX_data_main(C)); } @@ -3061,7 +3061,10 @@ void nodeRemoveNode(Main *bmain, bNodeTree *ntree, bNode *node, bool do_id_user) /* Also update relations for the scene time node, which causes a dependency * on time that users expect to be removed when the node is removed. */ - if (node_has_id || ELEM(node->type, GEO_NODE_INPUT_SCENE_TIME, GEO_NODE_SELF_OBJECT)) { + if (node_has_id || ELEM(node->type, + GEO_NODE_INPUT_SCENE_TIME, + GEO_NODE_SELF_OBJECT, + GEO_NODE_SIMULATION_INPUT)) { if (bmain != nullptr) { DEG_relations
[Bf-blender-cvs] [f55f2b5ff46] geometry-nodes-simulation: Add some input sockets
Commit: f55f2b5ff465e27b35cba5b5aa7c07e772314c4c Author: Hans Goudey Date: Tue Nov 22 21:57:06 2022 -0600 Branches: geometry-nodes-simulation https://developer.blender.org/rBf55f2b5ff465e27b35cba5b5aa7c07e772314c4c Add some input sockets === M source/blender/blenkernel/BKE_compute_cache.hh M source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc M source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc === diff --git a/source/blender/blenkernel/BKE_compute_cache.hh b/source/blender/blenkernel/BKE_compute_cache.hh index 2dc07594a5c..d48ca1254bb 100644 --- a/source/blender/blenkernel/BKE_compute_cache.hh +++ b/source/blender/blenkernel/BKE_compute_cache.hh @@ -2,6 +2,8 @@ #pragma once +#include + #include "BLI_compute_context.hh" #include "BLI_map.hh" @@ -9,8 +11,33 @@ namespace blender::bke { +struct GeometryCacheValue { + int frame; + GeometrySet geometry_set; +}; + struct CacheData { - Map geometry_per_frame; + Vector geometry_per_frame; + + GeometrySet *first_item_before(const int frame) + { +if (geometry_per_frame.is_empty()) { + return nullptr; +} +if (frame < geometry_per_frame.first().frame) { + return nullptr; +} + +GeometryCacheValue *last_value = nullptr; +for (int i = geometry_per_frame.size() - 1; i > 0; i--) { + if (geometry_per_frame[i].frame > frame) { +break; + } + last_value = &geometry_per_frame[i]; +} + +return last_value ? &last_value->geometry_set : nullptr; + } }; struct ComputeCaches { diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc index 5f5bc2c9908..354f6190405 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc @@ -10,7 +10,11 @@ namespace blender::nodes::node_geo_simulation_input_cc { static void node_declare(NodeDeclarationBuilder &b) { + b.add_input(N_("Run")); b.add_input(N_("Geometry")); + + b.add_output(N_("Delta Time")); + b.add_output(N_("Elapsed Time")); b.add_output(N_("Geometry")); } @@ -32,7 +36,11 @@ static void node_geo_exec(GeoNodeExecParams params) if (cache->geometry_per_frame.contains(previous_frame)) { GeometrySet geometry_set = cache->geometry_per_frame.lookup(previous_frame); params.set_output("Geometry", std::move(geometry_set)); -// params.set_input_unused("Geometry"); +params.set_input_unused("Geometry"); +return; + } + + if (params.lazy_require_input("Geometry")) { return; } @@ -51,5 +59,6 @@ void register_node_type_geo_simulation_input() geo_node_type_base(&ntype, GEO_NODE_SIMULATION_INPUT, "Simulation Input", NODE_CLASS_INTERFACE); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; + ntype.geometry_node_execute_supports_laziness = true; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc index 0726ae6d59f..6b280510163 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc @@ -10,7 +10,11 @@ namespace blender::nodes::node_geo_simulation_output_cc { static void node_declare(NodeDeclarationBuilder &b) { + b.add_input(N_("Stop")); b.add_input(N_("Geometry")); + b.add_output(N_("Started")); + b.add_output(N_("Ended")); + b.add_output(N_("Elapsed Time")); b.add_output(N_("Geometry")); } @@ -27,7 +31,11 @@ static void node_geo_exec(GeoNodeExecParams params) if (cache.geometry_per_frame.contains(scene_frame)) { params.set_output("Geometry", cache.geometry_per_frame.lookup(scene_frame)); -// params.set_input_unused("Geometry"); +params.set_input_unused("Geometry"); +return; + } + + if (params.lazy_require_input("Geometry")) { return; } @@ -36,6 +44,7 @@ static void node_geo_exec(GeoNodeExecParams params) cache.geometry_per_frame.add_new(scene_frame, geometry_set); params.set_output("Geometry", std::move(geometry_set)); + params.set_default_remaining_outputs(); } } // namespace blender::nodes::node_geo_simulation_output_cc @@ -50,5 +59,6 @@ void register_node_type_geo_simulation_output() &ntype, GEO_NODE_SIMULATION_OUTPUT, "Simulation Output", NODE_CLASS_INTERFACE); ntype.geometry_node_execute = file_ns::node_geo_exec; ntype.declare = file_ns::node_declare; + ntype.geometry_node_execute_supports_laziness = true; nodeRegisterType(&ntype); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists
[Bf-blender-cvs] [c2a632cd410] geometry-nodes-simulation: Basic working simulation and in-memory caching
Commit: c2a632cd4103eba2a7db7b191d4a80589639921b Author: Hans Goudey Date: Wed Nov 23 17:19:25 2022 -0600 Branches: geometry-nodes-simulation https://developer.blender.org/rBc2a632cd4103eba2a7db7b191d4a80589639921b Basic working simulation and in-memory caching === M source/blender/blenkernel/BKE_compute_cache.hh M source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc M source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc === diff --git a/source/blender/blenkernel/BKE_compute_cache.hh b/source/blender/blenkernel/BKE_compute_cache.hh index 7fd0d6225c7..33b7f7f3b59 100644 --- a/source/blender/blenkernel/BKE_compute_cache.hh +++ b/source/blender/blenkernel/BKE_compute_cache.hh @@ -17,6 +17,7 @@ struct GeometryCacheValue { GeometrySet geometry_set; }; +/* TODO: Clear cache when editing nodes? Only sometimes, when persistent caching is turned off. */ struct SimulationCache { Vector geometry_per_frame; @@ -29,6 +30,15 @@ struct SimulationCache { return &geometry_per_frame[index]; } + GeometryCacheValue *value_at_or_before_time(const int frame) + { +const int index = this->index_at_or_before_time(frame); +if (index >= geometry_per_frame.size()) { + return nullptr; +} +return &geometry_per_frame[index]; + } + const GeometryCacheValue *value_before_time(const int frame) const { const int index = this->index_before_time(frame); @@ -80,7 +90,7 @@ struct SimulationCache { } int insert_index = 0; for (const int i : geometry_per_frame.index_range()) { - if (geometry_per_frame[i].frame >= frame) { + if (geometry_per_frame[i].frame <= frame) { break; } insert_index++; @@ -94,7 +104,7 @@ struct SimulationCache { } int insert_index = 0; for (const int i : geometry_per_frame.index_range()) { - if (geometry_per_frame[i].frame > frame) { + if (geometry_per_frame[i].frame < frame) { break; } insert_index++; @@ -121,6 +131,10 @@ struct ComputeCaches { return cache_per_context.lookup_ptr(context_hash); } + /* TODO: Do we need to use the same context for multiple simulation inputs and outputs in the + * same node group? If so this won't work at all-- we would need some way to link the two nodes, + * which might be necessary for the "Run" socket anyway, since it needs to know whether the + * simulation is running in order to know whether to use the last cache or request a new one. */ SimulationCache &ensure_for_context(const ComputeContextHash &context_hash) { std::scoped_lock lock{mutex}; diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc index fc3901f359e..2d6a13de980 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "BKE_compute_cache.hh" #include "BKE_scene.h" #include "DEG_depsgraph_query.h" @@ -34,7 +35,8 @@ static void node_geo_exec(GeoNodeExecParams params) const float scene_ctime = BKE_scene_ctime_get(scene); const int scene_frame = int(scene_ctime); - /* TODO: Somehow use "Run" input. */ + /* TODO: Somehow use "Run" input. We also need to pass through the simulation state directly to + * the output node on the first frame the "Run" input is true. */ const GeoNodesLFUserData &lf_data = *params.user_data(); bke::ComputeCaches &all_caches = *lf_data.modifier_data->cache_per_frame; diff --git a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc index 5a0331cc2f1..a72d1f31983 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "BKE_compute_cache.hh" #include "BKE_scene.h" #include "DEG_depsgraph_query.h" @@ -94,15 +95,19 @@ static void node_geo_exec(GeoNodeExecParams params) GeometrySet geometry_set = params.extract_input("Geometry"); geometry_set.ensure_owns_direct_data(); - if (storage.use_cache) { + /* TODO: The "Use cache" input should probably become a "Persistent Cache" option. */ + if (storage.use_cache || cache.geometry_per_frame.is_empty()) { +/* If using the cache or there is no cached data yet, write the input in a new cache value. */ cache.insert(geometry_set, scene_frame, scene_ctime); } else { -bke::GeometryCacheValue &data = cache.value_at_time_ensure(scene_frame); -data.frame = scene_frame; -data.geometry_set = geometry_set; +/* If we aren't using the cache, ove
[Bf-blender-cvs] [6d930d0b4ab] geometry-nodes-simulation: Merge branch 'master' into geometry-nodes-simulation
Commit: 6d930d0b4abe72c438d64e49c1812feb1775deb6 Author: Hans Goudey Date: Wed Nov 23 12:04:46 2022 -0600 Branches: geometry-nodes-simulation https://developer.blender.org/rB6d930d0b4abe72c438d64e49c1812feb1775deb6 Merge branch 'master' into geometry-nodes-simulation === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [90f1d1f4b66] universal-scene-description: USD Import: Support multiple prim path masks.
Commit: 90f1d1f4b665fff57da774ced961fadd5424e0db Author: Michael Kowalski Date: Wed Nov 23 14:13:17 2022 -0500 Branches: universal-scene-description https://developer.blender.org/rB90f1d1f4b665fff57da774ced961fadd5424e0db USD Import: Support multiple prim path masks. Extended the Prim Path option to support multiple path entries, delimited by commas, spaces or semicolons. === M source/blender/io/usd/intern/usd_capi_import.cc M source/blender/io/usd/intern/usd_reader_stage.cc === diff --git a/source/blender/io/usd/intern/usd_capi_import.cc b/source/blender/io/usd/intern/usd_capi_import.cc index 9ed0e4cb69f..22b9eb2186d 100644 --- a/source/blender/io/usd/intern/usd_capi_import.cc +++ b/source/blender/io/usd/intern/usd_capi_import.cc @@ -383,8 +383,21 @@ static void import_startjob(void *customdata, short *stop, short *do_update, flo *data->do_update = true; *data->progress = 0.1f; - pxr::UsdStageRefPtr stage = pxr::UsdStage::Open(data->filepath); + std::string prim_path_mask(data->params.prim_path_mask); + pxr::UsdStagePopulationMask pop_mask; + if (!prim_path_mask.empty()) { +const std::vector mask_tokens = pxr::TfStringTokenize(prim_path_mask, " ,;"); +for (const std::string &tok : mask_tokens) { + pxr::SdfPath prim_path(tok); + if (!prim_path.IsEmpty()) { +pop_mask.Add(prim_path); + } +} + } + pxr::UsdStageRefPtr stage = pop_mask.IsEmpty() ? + pxr::UsdStage::Open(data->filepath) : + pxr::UsdStage::OpenMasked(data->filepath, pop_mask); if (!stage) { WM_reportf(RPT_ERROR, "USD Import: unable to open stage to read %s", data->filepath); data->import_ok = false; diff --git a/source/blender/io/usd/intern/usd_reader_stage.cc b/source/blender/io/usd/intern/usd_reader_stage.cc index 6c29a5e01b0..052b71bfcc5 100644 --- a/source/blender/io/usd/intern/usd_reader_stage.cc +++ b/source/blender/io/usd/intern/usd_reader_stage.cc @@ -353,19 +353,6 @@ void USDStageReader::collect_readers(Main *bmain) /* Iterate through the stage. */ pxr::UsdPrim root = stage_->GetPseudoRoot(); - std::string prim_path_mask(params_.prim_path_mask); - - if (!prim_path_mask.empty()) { -pxr::UsdPrim prim = stage_->GetPrimAtPath(pxr::SdfPath(prim_path_mask)); -if (prim.IsValid()) { - root = prim; -} -else { - std::cerr << "WARNING: Prim Path Mask " << prim_path_mask -<< " does not specify a valid prim.\n"; -} - } - stage_->SetInterpolationType(pxr::UsdInterpolationType::UsdInterpolationTypeHeld); pxr::UsdGeomXformCache xf_cache; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f4e1f62c62e] master: Merge branch 'blender-v3.4-release'
Commit: f4e1f62c62e6dae96d865d1fe0a47c1fb8b7a950 Author: Brecht Van Lommel Date: Wed Nov 23 19:35:39 2022 +0100 Branches: master https://developer.blender.org/rBf4e1f62c62e6dae96d865d1fe0a47c1fb8b7a950 Merge branch 'blender-v3.4-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [dc1ed9c1aa0] blender-v3.4-release: Cycles: add OSL support for hiding input socket value
Commit: dc1ed9c1aa0d25ba39ba5b5a8819f4318f829227 Author: Brecht Van Lommel Date: Wed Nov 23 18:02:45 2022 +0100 Branches: blender-v3.4-release https://developer.blender.org/rBdc1ed9c1aa0d25ba39ba5b5a8819f4318f829227 Cycles: add OSL support for hiding input socket value When either initializing with a non-constant value, or using the standard [[ string widget = "null" ]] metadata. This can be used for inputs like normals and texture coordinates, where you don't want to default to a constant value. In previous OSL versions the input value was automatically ignore when it was left unchanged for such inputs. However that's no longer the case in the latest version, breaking existing nodes. There is no good entirely backwards compatible fix, but I believe the new behavior is better and will keep most existing cases working. Fix T102450: OSL node with normal input not working === M intern/cycles/blender/python.cpp M intern/cycles/graph/node_type.h M intern/cycles/scene/osl.cpp M intern/cycles/scene/shader_nodes.cpp M intern/cycles/scene/shader_nodes.h === diff --git a/intern/cycles/blender/python.cpp b/intern/cycles/blender/python.cpp index 9e42f6b8b60..1e9478ea32d 100644 --- a/intern/cycles/blender/python.cpp +++ b/intern/cycles/blender/python.cpp @@ -478,6 +478,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) /* Read metadata. */ bool is_bool_param = false; +bool hide_value = !param->validdefault; ustring param_label = param->name; for (const OSL::OSLQuery::Parameter &metadata : param->metadata) { @@ -487,6 +488,9 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) if (metadata.sdefault[0] == "boolean" || metadata.sdefault[0] == "checkBox") { is_bool_param = true; } + else if (metadata.sdefault[0] == "null") { +hide_value = true; + } } else if (metadata.name == "label") { /* Socket label. */ @@ -596,6 +600,9 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) if (b_sock.name() != param_label) { b_sock.name(param_label.string()); } +if (b_sock.hide_value() != hide_value) { + b_sock.hide_value(hide_value); +} used_sockets.insert(b_sock.ptr.data); found_existing = true; } @@ -635,6 +642,8 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) set_boolean(b_sock.ptr, "default_value", default_boolean); } + b_sock.hide_value(hide_value); + used_sockets.insert(b_sock.ptr.data); } } diff --git a/intern/cycles/graph/node_type.h b/intern/cycles/graph/node_type.h index 9101b51bb9f..7725396e4f1 100644 --- a/intern/cycles/graph/node_type.h +++ b/intern/cycles/graph/node_type.h @@ -66,7 +66,9 @@ struct SocketType { LINK_NORMAL = (1 << 8), LINK_POSITION = (1 << 9), LINK_TANGENT = (1 << 10), -DEFAULT_LINK_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) | (1 << 8) | (1 << 9) | (1 << 10) +LINK_OSL_INITIALIZER = (1 << 11), +DEFAULT_LINK_MASK = (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) | (1 << 8) | (1 << 9) | +(1 << 10) | (1 << 11) }; ustring name; diff --git a/intern/cycles/scene/osl.cpp b/intern/cycles/scene/osl.cpp index 93839facdbe..2ff36ff7fca 100644 --- a/intern/cycles/scene/osl.cpp +++ b/intern/cycles/scene/osl.cpp @@ -525,6 +525,7 @@ OSLNode *OSLShaderManager::osl_node(ShaderGraph *graph, SocketType::Type socket_type; +/* Read type and default value. */ if (param->isclosure) { socket_type = SocketType::CLOSURE; } @@ -579,7 +580,21 @@ OSLNode *OSLShaderManager::osl_node(ShaderGraph *graph, node->add_output(param->name, socket_type); } else { - node->add_input(param->name, socket_type); + /* Detect if we should leave parameter initialization to OSL, either though + * not constant default or widget metadata. */ + int socket_flags = 0; + if (!param->validdefault) { +socket_flags |= SocketType::LINK_OSL_INITIALIZER; + } + for (const OSL::OSLQuery::Parameter &metadata : param->metadata) { +if (metadata.type == TypeDesc::STRING) { + if (metadata.name == "widget" && metadata.sdefault[0] == "null") { +socket_flags |= SocketType::LINK_OSL_INITIALIZER; + } +} + } + + node->add_input(param->name, socket_type, socket_flags); } } @@ -702,8 +717,12 @@ void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath) foreach (ShaderInput *input, node->inputs) { if (!input->link) { /* checks to untangle graphs */ - if (node_skip_input(node, input)) +
[Bf-blender-cvs] [584089879c5] master: BLI: Follow up and fix recent span slicing change
Commit: 584089879c57747251578db073b876c03d74f60b Author: Hans Goudey Date: Wed Nov 23 11:35:59 2022 -0600 Branches: master https://developer.blender.org/rB584089879c57747251578db073b876c03d74f60b BLI: Follow up and fix recent span slicing change a5e7657ceeb6cc didn't account for slices of zero sizes, and the asserts were slightly incorrect otherwise. Also, the change didn't apply to `Span`, only `MutableSpan`, which was a mistake. This also adds "safe" methods to `IndexMask`, and switches function calls where necessary. === M source/blender/blenkernel/intern/curves_geometry.cc M source/blender/blenlib/BLI_index_mask.hh M source/blender/blenlib/BLI_span.hh M source/blender/blenlib/intern/index_mask.cc M source/blender/blenlib/tests/BLI_span_test.cc M source/blender/functions/FN_multi_function_builder.hh M source/blender/geometry/intern/resample_curves.cc === diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index 16b2bd1b3af..9612930b4f3 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -654,7 +654,7 @@ Span CurvesGeometry::evaluated_positions() const case CURVE_TYPE_NURBS: { curves::nurbs::interpolate_to_evaluated(this->runtime->nurbs_basis_cache[curve_index], nurbs_orders[curve_index], - nurbs_weights.slice(points), + nurbs_weights.slice_safe(points), positions.slice(points), evaluated_positions.slice(evaluated_points)); break; @@ -812,7 +812,7 @@ void CurvesGeometry::interpolate_to_evaluated(const int curve_index, case CURVE_TYPE_NURBS: curves::nurbs::interpolate_to_evaluated(this->runtime->nurbs_basis_cache[curve_index], this->nurbs_orders()[curve_index], - this->nurbs_weights().slice(points), + this->nurbs_weights().slice_safe(points), src, dst); return; @@ -853,7 +853,7 @@ void CurvesGeometry::interpolate_to_evaluated(const GSpan src, GMutableSpan dst) case CURVE_TYPE_NURBS: curves::nurbs::interpolate_to_evaluated(this->runtime->nurbs_basis_cache[curve_index], nurbs_orders[curve_index], - nurbs_weights.slice(points), + nurbs_weights.slice_safe(points), src.slice(points), dst.slice(evaluated_points)); continue; diff --git a/source/blender/blenlib/BLI_index_mask.hh b/source/blender/blenlib/BLI_index_mask.hh index 22bdf090181..6fa3fdb963e 100644 --- a/source/blender/blenlib/BLI_index_mask.hh +++ b/source/blender/blenlib/BLI_index_mask.hh @@ -236,6 +236,9 @@ class IndexMask { IndexMask slice(int64_t start, int64_t size) const; IndexMask slice(IndexRange slice) const; + + IndexMask slice_safe(int64_t start, int64_t size) const; + IndexMask slice_safe(IndexRange slice) const; /** * Create a sub-mask that is also shifted to the beginning. * The shifting to the beginning allows code to work with smaller indices, diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh index a513c58d6ac..94464ef5088 100644 --- a/source/blender/blenlib/BLI_span.hh +++ b/source/blender/blenlib/BLI_span.hh @@ -141,8 +141,8 @@ template class Span { { BLI_assert(start >= 0); BLI_assert(size >= 0); -const int64_t new_size = std::max(0, std::min(size, size_ - start)); -return Span(data_ + start, new_size); +BLI_assert(start + size <= size_ || size == 0); +return Span(data_ + start, size); } constexpr Span slice(IndexRange range) const @@ -150,6 +150,23 @@ template class Span { return this->slice(range.start(), range.size()); } + /** + * Returns a contiguous part of the array. This invokes undefined behavior when the start or size + * is negative. Clamps the size of the new new span so it fits in the current one. + */ + constexpr Span slice_safe(const int64_t start, const int64_t size) const + { +BLI_assert(start >= 0); +BLI_assert(size >= 0); +const int64_t new_size = std::max(0, std::min(size, size_ - start)); +return Span(data_ + start, new_size); + } + + conste
[Bf-blender-cvs] [38cf48f62b1] master: Fix: Missing caches in curves bounds evaluation
Commit: 38cf48f62b1a83508f6ba602148d0d05ce317ec5 Author: Hans Goudey Date: Wed Nov 23 10:55:44 2022 -0600 Branches: master https://developer.blender.org/rB38cf48f62b1a83508f6ba602148d0d05ce317ec5 Fix: Missing caches in curves bounds evaluation === M source/blender/blenkernel/intern/curves_geometry.cc === diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index e4bd0527b6a..16b2bd1b3af 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -1020,6 +1020,7 @@ bool CurvesGeometry::bounds_min_max(float3 &min, float3 &max) const if (this->attributes().contains("radius")) { const VArraySpan radii = this->attributes().lookup("radius"); Array evaluated_radii(this->evaluated_points_num()); + this->ensure_can_interpolate_to_evaluated(); this->interpolate_to_evaluated(radii, evaluated_radii.as_mutable_span()); r_bounds = *bounds::min_max_with_radii(positions, evaluated_radii.as_span()); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [50aad904b38] master: Merge branch 'blender-v3.4-release'
Commit: 50aad904b38b44a7d7c9491649476380bb2fab80 Author: Germano Cavalcante Date: Wed Nov 23 14:15:22 2022 -0300 Branches: master https://developer.blender.org/rB50aad904b38b44a7d7c9491649476380bb2fab80 Merge branch 'blender-v3.4-release' === === diff --cc source/blender/editors/transform/transform_snap.cc index 7f73dee760d,4a26a736351..78752ec7846 --- a/source/blender/editors/transform/transform_snap.cc +++ b/source/blender/editors/transform/transform_snap.cc @@@ -612,16 -609,26 +612,26 @@@ static bool bm_face_is_snap_target(BMFa static eSnapFlag snap_flag_from_spacetype(TransInfo *t) { ToolSettings *ts = t->settings; - if (t->spacetype == SPACE_NODE) { - return eSnapFlag(ts->snap_flag_node); - } - if (t->spacetype == SPACE_IMAGE) { - return eSnapFlag(ts->snap_uv_flag); - } - if (t->spacetype == SPACE_SEQ) { - return eSnapFlag(ts->snap_flag_seq); - } - return eSnapFlag(ts->snap_flag); + switch (t->spacetype) { + case SPACE_VIEW3D: - return ts->snap_flag; ++ return eSnapFlag(ts->snap_flag); + case SPACE_NODE: - return ts->snap_flag_node; ++ return eSnapFlag(ts->snap_flag_node); + case SPACE_IMAGE: - return ts->snap_uv_flag; ++ return eSnapFlag(ts->snap_uv_flag); + case SPACE_SEQ: - return ts->snap_flag_seq; ++ return eSnapFlag(ts->snap_flag_seq); + case SPACE_GRAPH: + case SPACE_ACTION: + case SPACE_NLA: + /* These editors have their own "Auto-Snap" activation option. +* See #getAnimEdit_SnapMode. */ - return 0; ++ return eSnapFlag(0); + default: + BLI_assert(false); + break; + } - return 0; ++ return eSnapFlag(0); } static eSnapMode snap_mode_from_spacetype(TransInfo *t) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [962e221cd32] blender-v3.4-release: Fix T102720: Snapping in 3dViewport affects Graph, Action and NLA editors
Commit: 962e221cd32cfad7759eb7f0485799dce2f57424 Author: Germano Cavalcante Date: Wed Nov 23 14:06:21 2022 -0300 Branches: blender-v3.4-release https://developer.blender.org/rB962e221cd32cfad7759eb7f0485799dce2f57424 Fix T102720: Snapping in 3dViewport affects Graph, Action and NLA editors These editors have their own "Auto-Snap" activation option. So ignore the option in the 3D View in these cases. The generic incremental snap function doesn't seem really useful in these cases. If an incremental snap needs to be implemented, this should be a new option of `eAnimEdit_AutoSnap`. === M source/blender/editors/transform/transform_snap.c === diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 11cb57dc911..4a26a736351 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -609,16 +609,26 @@ static bool bm_face_is_snap_target(BMFace *f, void *UNUSED(user_data)) static eSnapFlag snap_flag_from_spacetype(TransInfo *t) { ToolSettings *ts = t->settings; - if (t->spacetype == SPACE_NODE) { -return ts->snap_flag_node; - } - if (t->spacetype == SPACE_IMAGE) { -return ts->snap_uv_flag; - } - if (t->spacetype == SPACE_SEQ) { -return ts->snap_flag_seq; + switch (t->spacetype) { +case SPACE_VIEW3D: + return ts->snap_flag; +case SPACE_NODE: + return ts->snap_flag_node; +case SPACE_IMAGE: + return ts->snap_uv_flag; +case SPACE_SEQ: + return ts->snap_flag_seq; +case SPACE_GRAPH: +case SPACE_ACTION: +case SPACE_NLA: + /* These editors have their own "Auto-Snap" activation option. + * See #getAnimEdit_SnapMode. */ + return 0; +default: + BLI_assert(false); + break; } - return ts->snap_flag; + return 0; } static eSnapMode snap_mode_from_spacetype(TransInfo *t) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [f13160d188a] master: Cleanup: quiet deprecation warnings
Commit: f13160d188ab60aa757da278ffefcca4bf14d371 Author: Jacques Lucke Date: Wed Nov 23 17:15:33 2022 +0100 Branches: master https://developer.blender.org/rBf13160d188ab60aa757da278ffefcca4bf14d371 Cleanup: quiet deprecation warnings This fixes these warnings: P3340. === M source/blender/editors/sculpt_paint/paint_image_proj.cc M source/blender/editors/space_view3d/view3d_draw.cc M source/blender/makesdna/DNA_view3d_types.h === diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.cc b/source/blender/editors/sculpt_paint/paint_image_proj.cc index 95fcaa4ea1c..107c592a10c 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.cc +++ b/source/blender/editors/sculpt_paint/paint_image_proj.cc @@ -6264,7 +6264,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) /* Create a copy of the overlays where they are all turned off, except the * texture paint overlay opacity */ View3D *v3d = static_cast(area->spacedata.first); - View3D v3d_copy = *v3d; + View3D v3d_copy = blender::dna::shallow_copy(*v3d); v3d_copy.gridflag = 0; v3d_copy.flag2 = 0; v3d_copy.flag = V3D_HIDE_HELPLINES; diff --git a/source/blender/editors/space_view3d/view3d_draw.cc b/source/blender/editors/space_view3d/view3d_draw.cc index 6400a015ef1..04fa875c3f8 100644 --- a/source/blender/editors/space_view3d/view3d_draw.cc +++ b/source/blender/editors/space_view3d/view3d_draw.cc @@ -1761,7 +1761,7 @@ void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph, GPUOffScreen *ofs, GPUViewport *viewport) { - View3D v3d = {nullptr}; + View3D v3d = blender::dna::shallow_zero_initialize(); ARegion ar = {nullptr}; RegionView3D rv3d = {{{0}}}; @@ -2011,7 +2011,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph, GPUOffScreen *ofs, char err_out[256]) { - View3D v3d = {nullptr}; + View3D v3d = blender::dna::shallow_zero_initialize(); ARegion region = {nullptr}; RegionView3D rv3d = {{{0}}}; diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index c09868b44fb..8e44588bb34 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -258,6 +258,8 @@ typedef struct View3D_Runtime { /** 3D ViewPort Struct. */ typedef struct View3D { + DNA_DEFINE_CXX_METHODS(View3D) + struct SpaceLink *next, *prev; /** Storage of regions for inactive spaces. */ ListBase regionbase; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [583f19d692b] master: Merge branch 'blender-v3.4-release'
Commit: 583f19d692b4b5b1224d19a842de7dfc4c047b44 Author: Jacques Lucke Date: Wed Nov 23 17:03:17 2022 +0100 Branches: master https://developer.blender.org/rB583f19d692b4b5b1224d19a842de7dfc4c047b44 Merge branch 'blender-v3.4-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a4eab80c224] soc-2022-many-lights-sampling: Fix back face being sampling despite disabled via EmissionSampling
Commit: a4eab80c224ba3c4a12b66e148c764c389df1b9d Author: Weizhen Huang Date: Wed Nov 23 17:01:07 2022 +0100 Branches: soc-2022-many-lights-sampling https://developer.blender.org/rBa4eab80c224ba3c4a12b66e148c764c389df1b9d Fix back face being sampling despite disabled via EmissionSampling === M intern/cycles/kernel/light/tree.h === diff --git a/intern/cycles/kernel/light/tree.h b/intern/cycles/kernel/light/tree.h index e1498486f84..dc7c1b3219a 100644 --- a/intern/cycles/kernel/light/tree.h +++ b/intern/cycles/kernel/light/tree.h @@ -267,6 +267,10 @@ ccl_device void light_tree_emitter_importance(KernelGlobals kg, } theta_o = 0.0f; +if (dot(bcone_axis, point_to_centroid) > 0) { + return; +} + for (int i = 0; i < 3; i++) { const float3 corner = vertices[i]; float distance_point_to_corner; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a87d78860b3] blender-v3.4-release: Fix T102693: adding shader node group to geometry nodes crashes
Commit: a87d78860b3c5a5ba89b0c05c59201997dac6350 Author: Jacques Lucke Date: Wed Nov 23 17:01:49 2022 +0100 Branches: blender-v3.4-release https://developer.blender.org/rBa87d78860b3c5a5ba89b0c05c59201997dac6350 Fix T102693: adding shader node group to geometry nodes crashes This is not supported currently, so just cancelling the operation solves it. This might be supported in the future. === M source/blender/nodes/intern/node_common.cc === diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc index d7cc0b6065a..f58b102ed3e 100644 --- a/source/blender/nodes/intern/node_common.cc +++ b/source/blender/nodes/intern/node_common.cc @@ -101,6 +101,10 @@ bool nodeGroupPoll(const bNodeTree *nodetree, } return false; } + if (nodetree->type != grouptree->type) { +*r_disabled_hint = TIP_("Node group has different type"); +return false; + } LISTBASE_FOREACH (const bNode *, node, &grouptree->nodes) { if (node->typeinfo->poll_instance && ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c1eeb38f7c8] master: Cleanup: Move poly normal calculation to mesh_normals.cc
Commit: c1eeb38f7c823bf8cf090b98ead117a3d22a06ab Author: Hans Goudey Date: Wed Nov 23 09:49:04 2022 -0600 Branches: master https://developer.blender.org/rBc1eeb38f7c823bf8cf090b98ead117a3d22a06ab Cleanup: Move poly normal calculation to mesh_normals.cc === M source/blender/blenkernel/BKE_mesh.h M source/blender/blenkernel/intern/mesh_evaluate.cc M source/blender/blenkernel/intern/mesh_normals.cc === diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 2a06409429e..1b327e11a53 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -432,6 +432,15 @@ bool BKE_mesh_vertex_normals_are_dirty(const struct Mesh *mesh); */ bool BKE_mesh_poly_normals_are_dirty(const struct Mesh *mesh); +void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly, + const struct MLoop *loopstart, + const struct MVert *mvarray, + float r_no[3]); +void BKE_mesh_calc_poly_normal_coords(const struct MPoly *mpoly, + const struct MLoop *loopstart, + const float (*vertex_coords)[3], + float r_no[3]); + /** * Calculate face normals directly into a result array. * @@ -694,14 +703,6 @@ void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_ /* *** mesh_evaluate.cc *** */ -void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly, - const struct MLoop *loopstart, - const struct MVert *mvarray, - float r_no[3]); -void BKE_mesh_calc_poly_normal_coords(const struct MPoly *mpoly, - const struct MLoop *loopstart, - const float (*vertex_coords)[3], - float r_no[3]); void BKE_mesh_calc_poly_center(const struct MPoly *mpoly, const struct MLoop *loopstart, const struct MVert *mvarray, diff --git a/source/blender/blenkernel/intern/mesh_evaluate.cc b/source/blender/blenkernel/intern/mesh_evaluate.cc index 9a199c9c768..de080c9dff2 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.cc +++ b/source/blender/blenkernel/intern/mesh_evaluate.cc @@ -38,113 +38,6 @@ using blender::VArray; /** \name Polygon Calculations * \{ */ -/* - * COMPUTE POLY NORMAL - * - * Computes the normal of a planar - * polygon See Graphics Gems for - * computing newell normal. - */ -static void mesh_calc_ngon_normal(const MPoly *mpoly, - const MLoop *loopstart, - const MVert *mvert, - float normal[3]) -{ - const int nverts = mpoly->totloop; - const float *v_prev = mvert[loopstart[nverts - 1].v].co; - const float *v_curr; - - zero_v3(normal); - - /* Newell's Method */ - for (int i = 0; i < nverts; i++) { -v_curr = mvert[loopstart[i].v].co; -add_newell_cross_v3_v3v3(normal, v_prev, v_curr); -v_prev = v_curr; - } - - if (UNLIKELY(normalize_v3(normal) == 0.0f)) { -normal[2] = 1.0f; /* other axis set to 0.0 */ - } -} - -void BKE_mesh_calc_poly_normal(const MPoly *mpoly, - const MLoop *loopstart, - const MVert *mvarray, - float r_no[3]) -{ - if (mpoly->totloop > 4) { -mesh_calc_ngon_normal(mpoly, loopstart, mvarray, r_no); - } - else if (mpoly->totloop == 3) { -normal_tri_v3( -r_no, mvarray[loopstart[0].v].co, mvarray[loopstart[1].v].co, mvarray[loopstart[2].v].co); - } - else if (mpoly->totloop == 4) { -normal_quad_v3(r_no, - mvarray[loopstart[0].v].co, - mvarray[loopstart[1].v].co, - mvarray[loopstart[2].v].co, - mvarray[loopstart[3].v].co); - } - else { /* horrible, two sided face! */ -r_no[0] = 0.0; -r_no[1] = 0.0; -r_no[2] = 1.0; - } -} -/* duplicate of function above _but_ takes coords rather than mverts */ -static void mesh_calc_ngon_normal_coords(const MPoly *mpoly, - const MLoop *loopstart, - const float (*vertex_coords)[3], - float r_normal[3]) -{ - const int nverts = mpoly->totloop; - const float *v_prev = vertex_coords[loopstart[nverts - 1].v]; - const float *v_curr; - - zero_v3(r_normal); - - /* Newell's Method */ - for (int i = 0; i < nverts; i++) { -v_curr = vertex_coords[loopstart[i].v]; -add_newell_cross_v3_v3v3(r_normal, v_prev, v_curr); -v_prev = v_curr; - } - - if (UNLIKE
[Bf-blender-cvs] [c3d6f5ecf3b] master: Merge branch 'blender-v3.4-release'
Commit: c3d6f5ecf3b8398a4ae9e4ba3568172d471228e8 Author: Brecht Van Lommel Date: Wed Nov 23 16:39:09 2022 +0100 Branches: master https://developer.blender.org/rBc3d6f5ecf3b8398a4ae9e4ba3568172d471228e8 Merge branch 'blender-v3.4-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ea57c011de4] blender-v3.4-release: Fix T102579: object mode wireframe overlay not shown on geometry node primitive
Commit: ea57c011de495009c1810a10f0228c36b2b3b186 Author: Brecht Van Lommel Date: Wed Nov 23 15:39:57 2022 +0100 Branches: blender-v3.4-release https://developer.blender.org/rBea57c011de495009c1810a10f0228c36b2b3b186 Fix T102579: object mode wireframe overlay not shown on geometry node primitive After a recent refactor in b247588dc0f4, object mode would not show wireframe edges that do not exist in the original mesh. Now only hide such edges while in edit mode, where they would otherwise look as if they can be selected. Before the refactor, edit and paint modes would sometimes show wireframes and sometimes not, depending on the modifier stack in unpredictable ways. === M source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc === diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc index 56e8baaca22..14467023f0f 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc @@ -58,13 +58,14 @@ static void extract_lines_iter_poly_mesh(const MeshRenderData *mr, GPUIndexBufBuilder *elb = static_cast(data); /* Using poly & loop iterator would complicate accessing the adjacent loop. */ const MLoop *mloop = mr->mloop; - if (mr->use_hide || (mr->e_origindex != nullptr)) { + const int *e_origindex = (mr->edit_bmesh) ? mr->e_origindex : nullptr; + if (mr->use_hide || (e_origindex != nullptr)) { const int ml_index_last = mp->loopstart + (mp->totloop - 1); int ml_index = ml_index_last, ml_index_next = mp->loopstart; do { const MLoop *ml = &mloop[ml_index]; if (!((mr->use_hide && mr->hide_edge && mr->hide_edge[ml->e]) || -((mr->e_origindex) && (mr->e_origindex[ml->e] == ORIGINDEX_NONE { +((e_origindex) && (e_origindex[ml->e] == ORIGINDEX_NONE { GPU_indexbuf_set_line_verts(elb, ml->e, ml_index, ml_index_next); } else { @@ -108,8 +109,9 @@ static void extract_lines_iter_ledge_mesh(const MeshRenderData *mr, GPUIndexBufBuilder *elb = static_cast(data); const int l_index_offset = mr->edge_len + ledge_index; const int e_index = mr->ledges[ledge_index]; + const int *e_origindex = (mr->edit_bmesh) ? mr->e_origindex : nullptr; if (!((mr->use_hide && mr->hide_edge && mr->hide_edge[med - mr->medge]) || -((mr->e_origindex) && (mr->e_origindex[e_index] == ORIGINDEX_NONE { +((e_origindex) && (e_origindex[e_index] == ORIGINDEX_NONE { const int l_index = mr->loop_len + ledge_index * 2; GPU_indexbuf_set_line_verts(elb, l_index_offset, l_index, l_index + 1); } @@ -181,6 +183,7 @@ static void extract_lines_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache, switch (mr->extract_type) { case MR_EXTRACT_MESH: { + const int *e_origindex = (mr->edit_bmesh) ? mr->e_origindex : nullptr; if (mr->e_origindex == nullptr) { const bool *hide_edge = mr->hide_edge; if (hide_edge) { @@ -205,7 +208,7 @@ static void extract_lines_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache, for (DRWSubdivLooseEdge edge : loose_edges) { int e = edge.coarse_edge_index; - if (mr->e_origindex && mr->e_origindex[e] != ORIGINDEX_NONE) { + if (e_origindex && e_origindex[e] != ORIGINDEX_NONE) { *flags_data++ = hide_edge[edge.coarse_edge_index]; } else { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [fe1b8b671a2] blender-v3.4-release: Fix part of T102696: Cycles Python error with macOS version 13.0.1
Commit: fe1b8b671a296cd32f33af3df05794e6caaf6270 Author: Brecht Van Lommel Date: Tue Nov 22 17:11:32 2022 +0100 Branches: blender-v3.4-release https://developer.blender.org/rBfe1b8b671a296cd32f33af3df05794e6caaf6270 Fix part of T102696: Cycles Python error with macOS version 13.0.1 === M intern/cycles/blender/addon/ui.py === diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index c61ae37c215..33a65c6cc8f 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -154,8 +154,9 @@ def use_mnee(context): # The MNEE kernel doesn't compile on macOS < 13. if use_metal(context): import platform -v, _, _ = platform.mac_ver() -if float(v) < 13.0: +version, _, _ = platform.mac_ver() +major_version = version.split(".")[0] +if int(major_version) < 13: return False return True ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [687272c4091] blender-v3.4-release: Cleanup: compiler warnings
Commit: 687272c40911a4ac7245ed272c861e421ef11305 Author: Brecht Van Lommel Date: Wed Nov 23 15:43:26 2022 +0100 Branches: blender-v3.4-release https://developer.blender.org/rB687272c40911a4ac7245ed272c861e421ef11305 Cleanup: compiler warnings === M source/blender/blenkernel/BKE_pbvh.h === diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 7f31179777f..9dc59f2719a 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -691,11 +691,6 @@ typedef struct PBVHFaceIter { PBVHVertRef *verts; int verts_num; - /* Private. */ -#ifdef __cplusplus - private: -#endif - PBVHVertRef verts_reserved_[PBVH_FACE_ITER_VERTS_RESERVED]; const PBVHNode *node_; PBVHType pbvh_type_; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c0c091d2f51] gpencil-new-data-proposal: Define flags for layers and frames
Commit: c0c091d2f5188ed6500abcff2b39e60c28203066 Author: Falk David Date: Wed Nov 23 16:28:14 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rBc0c091d2f5188ed6500abcff2b39e60c28203066 Define flags for layers and frames === M source/blender/blenkernel/intern/gpencil_new_proposal.hh === diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh b/source/blender/blenkernel/intern/gpencil_new_proposal.hh index d98e2d647ab..c8414713353 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh @@ -47,6 +47,13 @@ typedef struct GPLayerGroup { /* ... */ } GPLayerGroup; +/** GPLayer.flag */ +typedef enum eGPLayerFlag { + LAYER_SELECT = (1 << 0), + LAYER_HIDE = (1 << 1), + LAYER_LOCK = (1 << 2), +} eGPLayerFlag; + typedef struct GPLayer { /** * The name of the layer. @@ -54,13 +61,18 @@ typedef struct GPLayer { char name[128]; /** - * The layer flag. + * The layer flag (see `eGPLayerFlag`). */ int flag; /* ... */ } GPLayer; +/** GPFrame.flag */ +typedef enum eGPFrameFlag { + FRAME_SELECT = (1 << 0), +} eGPFrameFlag; + typedef struct GPFrame { /** * The curves in this frame. Each individual curve is a single stroke. The CurvesGeometry @@ -69,7 +81,7 @@ typedef struct GPFrame { CurvesGeometry *strokes; /** - * The frame flag. + * The frame flag (see `eGPFrameFlag`). */ int flag; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [737d363e028] master: Cleanup: remove unused node type
Commit: 737d363e02851d2bac968d3d1a695920358dfbde Author: Jacques Lucke Date: Wed Nov 23 16:15:15 2022 +0100 Branches: master https://developer.blender.org/rB737d363e02851d2bac968d3d1a695920358dfbde Cleanup: remove unused node type This wasn't used for backwards compatibility, because Blender does not read from the `nodetype` anywhere. It also wasn't used for forward compatibility, because it was not initialized for new node groups. === M source/blender/blenloader/intern/versioning_250.c M source/blender/makesdna/DNA_node_types.h === diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 0b543ad735b..f87034548df 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -2272,18 +2272,6 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) } FOREACH_NODETREE_END; } - -{ - /* Initialize group tree nodetypes. - * These are used to distinguish tree types and - * associate them with specific node types for polling. - */ - bNodeTree *ntree; - /* all node trees in bmain->nodetree are considered groups */ - for (ntree = bmain->nodetrees.first; ntree; ntree = ntree->id.next) { -ntree->nodetype = NODE_GROUP; - } -} } if (!MAIN_VERSION_ATLEAST(bmain, 259, 4)) { diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 3178fe1ebd2..616c8b6f141 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -511,11 +511,6 @@ typedef struct bNodeTree { int cur_index; int flag; - char _pad1[4]; - - /** Specific node type this tree is used for. */ - int nodetype DNA_DEPRECATED; - /** Quality setting when editing. */ short edit_quality; /** Quality setting when rendering. */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4911529f1b4] gpencil-new-data-proposal: Move GPDataRuntime function implementations to .cc file
Commit: 4911529f1b48313f5e23d1a7acd9e1cda658357d Author: Amelie Fondevilla Date: Wed Nov 23 15:11:05 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rB4911529f1b48313f5e23d1a7acd9e1cda658357d Move GPDataRuntime function implementations to .cc file === M source/blender/blenkernel/intern/gpencil_new_proposal.cc M source/blender/blenkernel/intern/gpencil_new_proposal.hh === diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc b/source/blender/blenkernel/intern/gpencil_new_proposal.cc index 52a0a253c51..e826a07d4a1 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.cc +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc @@ -48,6 +48,11 @@ IndexMask GPLayerGroup::layers_index_mask() return {reinterpret_cast(this->layer_indices), this->layer_indices_size}; } +IndexMask GPDataRuntime::frame_index_masks_cache_for_layer(int layer_index) +{ + return frame_index_masks_cache.lookup(layer_index).as_span(); +} + Span GPStroke::points_positions() const { return {geometry_->positions().begin() + offset_, points_num_}; diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh b/source/blender/blenkernel/intern/gpencil_new_proposal.hh index 27850f0e5df..0f6afefa692 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh @@ -170,10 +170,7 @@ class GPDataRuntime { mutable Map> frame_index_masks_cache; mutable std::mutex frame_index_masks_cache_mutex; - IndexMask frame_index_masks_cache_for_layer(int layer_index) - { -return frame_index_masks_cache.lookup(layer_index).as_span(); - } + IndexMask frame_index_masks_cache_for_layer(int layer_index); }; /** ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [b338b7c2b6e] gpencil-new-data-proposal: Move GPLayer function implementations to .cc file
Commit: b338b7c2b6e052cd6be113c5069b1e30311ffc2d Author: Amelie Fondevilla Date: Wed Nov 23 15:32:57 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rBb338b7c2b6e052cd6be113c5069b1e30311ffc2d Move GPLayer function implementations to .cc file === M source/blender/blenkernel/intern/gpencil_new_proposal.cc M source/blender/blenkernel/intern/gpencil_new_proposal.hh === diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc b/source/blender/blenkernel/intern/gpencil_new_proposal.cc index 2cc5cdf8275..e424cd32d37 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.cc +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc @@ -209,6 +209,17 @@ GPStroke GPFrame::add_new_stroke(int new_points_num) return {reinterpret_cast(this->strokes), new_points_num, orig_last_offset}; } +/* GPLayer */ +GPLayer::GPLayer(const StringRefNull name) +{ + strcpy(this->name, name.c_str()); +} + +bool GPLayer::operator==(const GPLayer &other) const +{ + return STREQ(this->name, other.name); +} + /* GPData */ GPData::GPData(const int layers_size, const int frame_size) { diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh b/source/blender/blenkernel/intern/gpencil_new_proposal.hh index 71b54f6b133..d98e2d647ab 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh @@ -246,17 +246,11 @@ class GPLayer : public ::GPLayer { { } - GPLayer(const StringRefNull name) - { -strcpy(this->name, name.c_str()); - } + GPLayer(const StringRefNull name); ~GPLayer() = default; - bool operator==(const GPLayer &other) const - { -return STREQ(this->name, other.name); - } + bool operator==(const GPLayer &other) const; }; class GPData : public ::GPData { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [20d88e2e6a7] gpencil-new-data-proposal: Adding some comments
Commit: 20d88e2e6a7e77eac0db0c8e2272279aecbb85d0 Author: Amelie Fondevilla Date: Wed Nov 23 15:21:57 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rB20d88e2e6a7e77eac0db0c8e2272279aecbb85d0 Adding some comments === M source/blender/blenkernel/intern/gpencil_new_proposal.cc === diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc b/source/blender/blenkernel/intern/gpencil_new_proposal.cc index e826a07d4a1..2cc5cdf8275 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.cc +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc @@ -18,6 +18,7 @@ namespace blender::bke { +/* GPLayerGroup */ GPLayerGroup::GPLayerGroup() { this->children = nullptr; @@ -48,11 +49,13 @@ IndexMask GPLayerGroup::layers_index_mask() return {reinterpret_cast(this->layer_indices), this->layer_indices_size}; } +/* GPDataRuntime */ IndexMask GPDataRuntime::frame_index_masks_cache_for_layer(int layer_index) { return frame_index_masks_cache.lookup(layer_index).as_span(); } +/* GPStroke */ Span GPStroke::points_positions() const { return {geometry_->positions().begin() + offset_, points_num_}; @@ -73,6 +76,7 @@ void GPStroke::transform(float4x4 matrix) }); } +/* GPFrame */ GPFrame::GPFrame(int start_frame, int end_frame) { this->start_time = start_frame; @@ -205,6 +209,7 @@ GPStroke GPFrame::add_new_stroke(int new_points_num) return {reinterpret_cast(this->strokes), new_points_num, orig_last_offset}; } +/* GPData */ GPData::GPData(const int layers_size, const int frame_size) { BLI_assert(layers_size >= 0); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7485e8f9aa6] gpencil-new-data-proposal: Move GPLayerGroup function implementations to .cc file
Commit: 7485e8f9aa6cd077ddd545249ed979c4855a86d9 Author: Amelie Fondevilla Date: Wed Nov 23 15:09:29 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rB7485e8f9aa6cd077ddd545249ed979c4855a86d9 Move GPLayerGroup function implementations to .cc file === M source/blender/blenkernel/intern/gpencil_new_proposal.cc M source/blender/blenkernel/intern/gpencil_new_proposal.hh === diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc b/source/blender/blenkernel/intern/gpencil_new_proposal.cc index fefccfc101c..52a0a253c51 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.cc +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc @@ -18,6 +18,36 @@ namespace blender::bke { +GPLayerGroup::GPLayerGroup() +{ + this->children = nullptr; + this->children_size = 0; + this->layer_indices = nullptr; + this->layer_indices_size = 0; +} + +GPLayerGroup::GPLayerGroup(const StringRefNull name) : GPLayerGroup() +{ + BLI_assert(name.size() < 128); + strcpy(this->name, name.c_str()); +} + +GPLayerGroup::~GPLayerGroup() +{ + /* Recursivly free the children of this layer group first. */ + for (int i = 0; i < this->children_size; i++) { +MEM_delete(&this->children[i]); + } + /* Then free its data. */ + MEM_SAFE_FREE(this->children); + MEM_SAFE_FREE(this->layer_indices); +} + +IndexMask GPLayerGroup::layers_index_mask() +{ + return {reinterpret_cast(this->layer_indices), this->layer_indices_size}; +} + Span GPStroke::points_positions() const { return {geometry_->positions().begin() + offset_, points_num_}; diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh b/source/blender/blenkernel/intern/gpencil_new_proposal.hh index 70692148e01..27850f0e5df 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh @@ -152,35 +152,12 @@ namespace blender::bke { class GPLayerGroup : ::GPLayerGroup { /* Unused for now. Placeholder class. */ public: - GPLayerGroup() - { -this->children = nullptr; -this->children_size = 0; -this->layer_indices = nullptr; -this->layer_indices_size = 0; - } - - GPLayerGroup(const StringRefNull name) : GPLayerGroup() - { -BLI_assert(name.size() < 128); -strcpy(this->name, name.c_str()); - } + GPLayerGroup(); + GPLayerGroup(const StringRefNull name); - ~GPLayerGroup() - { -/* Recursivly free the children of this layer group first. */ -for (int i = 0; i < this->children_size; i++) { - MEM_delete(&this->children[i]); -} -/* Then free its data. */ -MEM_SAFE_FREE(this->children); -MEM_SAFE_FREE(this->layer_indices); - } + ~GPLayerGroup(); - IndexMask layers_index_mask() - { -return {reinterpret_cast(this->layer_indices), this->layer_indices_size}; - } + IndexMask layers_index_mask(); }; class GPDataRuntime { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0691684beb7] gpencil-new-data-proposal: Remove unused import
Commit: 0691684beb7acda6b75d9d1975da73b2b5197691 Author: Amelie Fondevilla Date: Wed Nov 23 15:28:40 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rB0691684beb7acda6b75d9d1975da73b2b5197691 Remove unused import === M source/blender/blenkernel/intern/gpencil_new_proposal.hh === diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh b/source/blender/blenkernel/intern/gpencil_new_proposal.hh index 0f6afefa692..71b54f6b133 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh @@ -8,8 +8,6 @@ #include "BKE_curves.hh" -#include "BLI_index_mask_ops.hh" - #include "DNA_ID.h" #include "DNA_curves_types.h" #include "DNA_customdata_types.h" ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [87778317b0d] gpencil-new-data-proposal: Move GPData function implementations to .cc file
Commit: 87778317b0db6f660b754b9bc144a2b5dfd9a988 Author: Amelie Fondevilla Date: Wed Nov 23 15:02:57 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rB87778317b0db6f660b754b9bc144a2b5dfd9a988 Move GPData function implementations to .cc file === M source/blender/blenkernel/intern/gpencil_new_proposal.cc M source/blender/blenkernel/intern/gpencil_new_proposal.hh === diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc b/source/blender/blenkernel/intern/gpencil_new_proposal.cc index 7bab439fe8e..fefccfc101c 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.cc +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc @@ -170,4 +170,419 @@ GPStroke GPFrame::add_new_stroke(int new_points_num) return {reinterpret_cast(this->strokes), new_points_num, orig_last_offset}; } +GPData::GPData(const int layers_size, const int frame_size) +{ + BLI_assert(layers_size >= 0); + BLI_assert(frame_size >= 0); + + this->frames_size = frame_size; + this->layers_size = layers_size; + + if (this->frames_size > 0) { +this->frames_array = reinterpret_cast<::GPFrame *>( +MEM_malloc_arrayN(this->frames_size, sizeof(::GPFrame), __func__)); +default_construct_n(reinterpret_cast(this->frames_array), this->frames_size); + } + else { +this->frames_array = nullptr; + } + CustomData_reset(&this->frame_data); + + if (this->layers_size > 0) { +this->layers_array = reinterpret_cast<::GPLayer *>( +MEM_malloc_arrayN(this->layers_size, sizeof(::GPLayer), __func__)); +default_construct_n(reinterpret_cast(this->layers_array), this->layers_size); +this->active_layer_index = 0; + } + else { +this->layers_array = nullptr; +this->active_layer_index = -1; + } + + this->default_group = MEM_new<::GPLayerGroup>(__func__); + + this->runtime = MEM_new(__func__); +} + +GPData::GPData(const GPData &other) : GPData(other.layers_size, other.frames_size) +{ + copy_gpdata(*this, other); +} + +GPData &GPData::operator=(const GPData &other) +{ + if (this != &other) { +copy_gpdata(*this, other); + } + return *this; +} + +GPData::GPData(GPData &&other) : GPData(other.layers_size, other.frames_size) +{ + move_gpdata(*this, other); +} + +GPData &GPData::operator=(GPData &&other) +{ + if (this != &other) { +move_gpdata(*this, other); + } + return *this; +} + +GPData::~GPData() +{ + /* Free frames and frame custom data. */ + destruct_n(reinterpret_cast(this->frames_array), this->frames_size); + MEM_SAFE_FREE(this->frames_array); + CustomData_free(&this->frame_data, this->frames_size); + + /* Free layer and layer groups. */ + destruct_n(reinterpret_cast(this->layers_array), this->layers_size); + MEM_SAFE_FREE(this->layers_array); + MEM_delete(reinterpret_cast(this->default_group)); + this->default_group = nullptr; + + /* Free the runtime structure. */ + MEM_delete(this->runtime); + this->runtime = nullptr; +} + +Span GPData::frames() const +{ + return {reinterpret_cast(this->frames_array), this->frames_size}; +} + +const GPFrame &GPData::frames(int index) const +{ + return this->frames()[index]; +} + +MutableSpan GPData::frames_for_write() +{ + return {reinterpret_cast(this->frames_array), this->frames_size}; +} + +GPFrame &GPData::frames_for_write(int index) +{ + return this->frames_for_write()[index]; +} + +IndexMask GPData::frames_on_layer(int layer_index) const +{ + if (layer_index < 0 || layer_index > this->layers_size) { +return IndexMask(); + } + + /* If the indices are cached for this layer, use the cache. */ + if (this->runtime->frame_index_masks_cache.contains(layer_index)) { +return this->runtime->frame_index_masks_cache_for_layer(layer_index); + } + + /* A double checked lock. */ + std::scoped_lock{this->runtime->frame_index_masks_cache_mutex}; + if (this->runtime->frame_index_masks_cache.contains(layer_index)) { +return this->runtime->frame_index_masks_cache_for_layer(layer_index); + } + + Vector indices; + const IndexMask mask = index_mask_ops::find_indices_based_on_predicate( + IndexMask(this->frames_size), 1024, indices, [&](const int index) { +return this->frames()[index].layer_index == layer_index; + }); + + /* Cache the resulting index mask. */ + this->runtime->frame_index_masks_cache.add(layer_index, std::move(indices)); + return mask; +} + +IndexMask GPData::frames_on_layer(GPLayer &layer) const +{ + int index = this->layers().first_index_try(layer); + if (index == -1) { +return IndexMask(); + } + return frames_on_layer(index); +} + +IndexMask GPData::frames_on_active_layer() const +{ + return frames_on_layer(this->active_layer_index); +} + +Span GPData::layers() const +{ + return {reinterpret_cast(this->layers_array), this->layers_size}; +} + +const GPLayer &GPData::layers(int inde
[Bf-blender-cvs] [ecac4ce93e9] gpencil-new-data-proposal: Move GPFrame function implementations to .cc file
Commit: ecac4ce93e96fc96b3068fe572f878fcc69525dc Author: Amelie Fondevilla Date: Wed Nov 23 14:38:40 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rBecac4ce93e96fc96b3068fe572f878fcc69525dc Move GPFrame function implementations to .cc file === M source/blender/blenkernel/intern/gpencil_new_proposal.cc M source/blender/blenkernel/intern/gpencil_new_proposal.hh === diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc b/source/blender/blenkernel/intern/gpencil_new_proposal.cc index 1a3825ef9ca..7bab439fe8e 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.cc +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc @@ -38,4 +38,136 @@ void GPStroke::transform(float4x4 matrix) }); } +GPFrame::GPFrame(int start_frame, int end_frame) +{ + this->start_time = start_frame; + this->end_time = end_frame; + this->strokes = nullptr; +} + +GPFrame::GPFrame(const GPFrame &other) : GPFrame(other.start_time, other.end_time) +{ + if (other.strokes != nullptr) { +/* Make sure old strokes are freed before copying. */ +MEM_SAFE_FREE(this->strokes); +this->strokes = MEM_new(__func__); + +*reinterpret_cast(this->strokes) = CurvesGeometry::wrap(*other.strokes); + } + this->layer_index = other.layer_index; +} + +GPFrame &GPFrame::operator=(const GPFrame &other) +{ + if (this != &other && other.strokes != nullptr) { +/* Make sure old strokes are freed before copying. */ +MEM_SAFE_FREE(this->strokes); +this->strokes = MEM_new(__func__); + +*reinterpret_cast(this->strokes) = CurvesGeometry::wrap(*other.strokes); + } + this->layer_index = other.layer_index; + this->start_time = other.start_time; + this->end_time = other.end_time; + return *this; +} + +GPFrame::GPFrame(GPFrame &&other) : GPFrame(other.start_time, other.end_time) +{ + if (this != &other) { +std::swap(this->strokes, other.strokes); +other.strokes = nullptr; + } + this->layer_index = other.layer_index; +} + +GPFrame &GPFrame::operator=(GPFrame &&other) +{ + if (this != &other) { +std::swap(this->strokes, other.strokes); +other.strokes = nullptr; + } + this->layer_index = other.layer_index; + this->start_time = other.start_time; + this->end_time = other.end_time; + return *this; +} + +GPFrame::~GPFrame() +{ + MEM_delete(reinterpret_cast(this->strokes)); + this->strokes = nullptr; +} + +bool GPFrame::operator<(const GPFrame &other) const +{ + if (this->start_time == other.start_time) { +return this->layer_index < other.layer_index; + } + return this->start_time < other.start_time; +} + +bool GPFrame::operator<(const std::pair elem) const +{ + if (this->start_time == elem.second) { +return this->layer_index < elem.first; + } + return this->start_time < elem.second; +} + +bool GPFrame::operator==(const GPFrame &other) const +{ + return this->layer_index == other.layer_index && this->start_time == other.start_time; +} + +CurvesGeometry &GPFrame::strokes_as_curves() +{ + return CurvesGeometry::wrap(*this->strokes); +} + +int GPFrame::strokes_num() const +{ + if (this->strokes == nullptr) { +return 0; + } + return this->strokes->curve_num; +} + +int GPFrame::points_num() const +{ + if (this->strokes == nullptr) { +return 0; + } + return this->strokes->point_num; +} + +Vector GPFrame::strokes_for_write() +{ + Vector strokes; + for (const int i : this->strokes_as_curves().offsets().drop_back(1).index_range()) { +int offset = this->strokes_as_curves().offsets()[i]; +int length = this->strokes_as_curves().offsets()[i + 1] - offset; +strokes.append({reinterpret_cast(this->strokes), length, offset}); + } + return strokes; +} + +GPStroke GPFrame::add_new_stroke(int new_points_num) +{ + if (this->strokes == nullptr) { +this->strokes = MEM_new(__func__); + } + CurvesGeometry &strokes = this->strokes_as_curves(); + int orig_last_offset = strokes.offsets().last(); + + strokes.resize(strokes.points_num() + new_points_num, strokes.curves_num() + 1); + strokes.offsets_for_write().last() = strokes.points_num(); + + /* Use poly type by default. */ + strokes.curve_types_for_write().last() = CURVE_TYPE_POLY; + + strokes.tag_topology_changed(); + return {reinterpret_cast(this->strokes), new_points_num, orig_last_offset}; +} + } // namespace blender::bke \ No newline at end of file diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh b/source/blender/blenkernel/intern/gpencil_new_proposal.hh index 80f23169115..1ee5da8550c 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh @@ -125,8 +125,8 @@ typedef struct GPData { } GPData; /** - * This would be the new Grease Pencil ID structure. This is where the animation data, materials, etc. ar
[Bf-blender-cvs] [460f7ec7aac] master: Windows: Run blender-launcher.exe instead of blender.exe
Commit: 460f7ec7aacf23f391dacd7839c8c160679ad62d Author: Thomas Dinges Date: Wed Nov 23 15:14:13 2022 +0100 Branches: master https://developer.blender.org/rB460f7ec7aacf23f391dacd7839c8c160679ad62d Windows: Run blender-launcher.exe instead of blender.exe With this change Blender, delivered via the Microsoft store, will launch without the console window flashing. Ref T88613 Differential Revision: https://developer.blender.org/D16589 === M release/windows/msix/AppxManifest.xml.template === diff --git a/release/windows/msix/AppxManifest.xml.template b/release/windows/msix/AppxManifest.xml.template index e1b267472a3..5bf56f5a50a 100644 --- a/release/windows/msix/AppxManifest.xml.template +++ b/release/windows/msix/AppxManifest.xml.template @@ -17,7 +17,7 @@ - + - + - + ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [2b8f717be6b] soc-2022-many-lights-sampling: Cleanup: make distant lights part of the light tree
Commit: 2b8f717be6b5a0b28731a566ae0b3f0a7210bd55 Author: Weizhen Huang Date: Wed Nov 23 14:45:23 2022 +0100 Branches: soc-2022-many-lights-sampling https://developer.blender.org/rB2b8f717be6b5a0b28731a566ae0b3f0a7210bd55 Cleanup: make distant lights part of the light tree === M intern/cycles/kernel/data_arrays.h M intern/cycles/kernel/data_template.h M intern/cycles/kernel/light/sample.h M intern/cycles/kernel/light/tree.h M intern/cycles/kernel/types.h M intern/cycles/scene/light.cpp M intern/cycles/scene/light_tree.cpp M intern/cycles/scene/light_tree.h M intern/cycles/scene/scene.cpp M intern/cycles/scene/scene.h === diff --git a/intern/cycles/kernel/data_arrays.h b/intern/cycles/kernel/data_arrays.h index 9c57a0176b8..6914a4642e9 100644 --- a/intern/cycles/kernel/data_arrays.h +++ b/intern/cycles/kernel/data_arrays.h @@ -63,7 +63,6 @@ KERNEL_DATA_ARRAY(float2, light_background_conditional_cdf) /* light tree */ KERNEL_DATA_ARRAY(KernelLightTreeNode, light_tree_nodes) KERNEL_DATA_ARRAY(KernelLightTreeEmitter, light_tree_emitters) -KERNEL_DATA_ARRAY(KernelLightTreeDistantEmitter, light_tree_distant_group) KERNEL_DATA_ARRAY(uint, light_to_tree) KERNEL_DATA_ARRAY(uint, object_lookup_offset) KERNEL_DATA_ARRAY(uint, triangle_to_tree) diff --git a/intern/cycles/kernel/data_template.h b/intern/cycles/kernel/data_template.h index 7d6c1fd6804..994e7f7446c 100644 --- a/intern/cycles/kernel/data_template.h +++ b/intern/cycles/kernel/data_template.h @@ -155,8 +155,6 @@ KERNEL_STRUCT_MEMBER(integrator, int, num_distribution) KERNEL_STRUCT_MEMBER(integrator, float, distribution_pdf_triangles) KERNEL_STRUCT_MEMBER(integrator, float, distribution_pdf_lights) KERNEL_STRUCT_MEMBER(integrator, float, light_inv_rr_threshold) -/* Light tree. */ -KERNEL_STRUCT_MEMBER(integrator, int, num_tree_lights) /* Bounces. */ KERNEL_STRUCT_MEMBER(integrator, int, min_bounce) KERNEL_STRUCT_MEMBER(integrator, int, max_bounce) @@ -210,6 +208,7 @@ KERNEL_STRUCT_MEMBER(integrator, int, use_guiding_mis_weights) /* Padding */ KERNEL_STRUCT_MEMBER(integrator, int, pad1) KERNEL_STRUCT_MEMBER(integrator, int, pad2) +KERNEL_STRUCT_MEMBER(integrator, int, pad3) KERNEL_STRUCT_END(KernelIntegrator) /* SVM. For shader specialization. */ diff --git a/intern/cycles/kernel/light/sample.h b/intern/cycles/kernel/light/sample.h index 5f6b981a369..a462d0e01ac 100644 --- a/intern/cycles/kernel/light/sample.h +++ b/intern/cycles/kernel/light/sample.h @@ -463,20 +463,8 @@ ccl_device_inline float light_sample_mis_weight_forward_distant(KernelGlobals kg const uint32_t path_flag, const ccl_private LightSample *ls) { - const float mis_ray_pdf = INTEGRATOR_STATE(state, path, mis_ray_pdf); - float pdf = ls->pdf; - - /* Light selection pdf. */ - if (kernel_data.integrator.use_light_tree) { -const float3 ray_P = INTEGRATOR_STATE(state, ray, P); -const float3 N = INTEGRATOR_STATE(state, path, mis_origin_n); -pdf *= light_tree_pdf_distant(kg, ray_P, N, path_flag, ls->lamp); - } - else { -pdf *= light_distribution_pdf_lamp(kg); - } - - return light_sample_mis_weight_forward(kg, mis_ray_pdf, pdf); + const float3 ray_P = INTEGRATOR_STATE(state, ray, P); + return light_sample_mis_weight_forward_lamp(kg, state, path_flag, ls, ray_P); } ccl_device_inline float light_sample_mis_weight_forward_background(KernelGlobals kg, @@ -492,7 +480,7 @@ ccl_device_inline float light_sample_mis_weight_forward_background(KernelGlobals /* Light selection pdf. */ if (kernel_data.integrator.use_light_tree) { const float3 N = INTEGRATOR_STATE(state, path, mis_origin_n); -pdf *= light_tree_pdf_distant(kg, ray_P, N, path_flag, kernel_data.background.light_index); +pdf *= light_tree_pdf(kg, ray_P, N, path_flag, ~kernel_data.background.light_index); } else { pdf *= light_distribution_pdf_lamp(kg); diff --git a/intern/cycles/kernel/light/tree.h b/intern/cycles/kernel/light/tree.h index c762f2b4cbf..e1498486f84 100644 --- a/intern/cycles/kernel/light/tree.h +++ b/intern/cycles/kernel/light/tree.h @@ -181,6 +181,8 @@ ccl_device void light_tree_emitter_importance(KernelGlobals kg, ccl_global const KernelLightTreeEmitter *kemitter = &kernel_data_fetch(light_tree_emitters, emitter_index); + max_importance = 0.0f; + min_importance = 0.0f; float theta_o = kemitter->theta_o; float min_distance, distance; float max_distance = 0.0f; @@ -191,7 +193,7 @@ ccl_device void light_tree_emitter_importance(KernelGlobals kg, const int prim = kemitter->prim_id; /* TODO: pack in functions and move to header files fo
[Bf-blender-cvs] [a819523dffe] master: Vulkan: Add VK memory allocator 3.0.1 to extern.
Commit: a819523dffebc9cc3865107c2c426a298d8154fd Author: Jeroen Bakker Date: Wed Nov 23 14:42:11 2022 +0100 Branches: master https://developer.blender.org/rBa819523dffebc9cc3865107c2c426a298d8154fd Vulkan: Add VK memory allocator 3.0.1 to extern. Vulkan doesn't have a memory allocator builtin. The application should provide the memory allocator at runtime. Vulkan Memory Allocator is a widely used implementation. Vulkan Memory Allocator is a header only implementation, but the using application should compile a part in a CPP compile unit. The file `vk_mem_alloc_impl.cc` and `extern_vulkan_memory_allocator` library is therefore introduced. Reviewed By: fclem Differential Revision: https://developer.blender.org/D16572 === M extern/CMakeLists.txt A extern/vulkan_memory_allocator/CMakeLists.txt A extern/vulkan_memory_allocator/LICENSE.txt A extern/vulkan_memory_allocator/README.blender A extern/vulkan_memory_allocator/README.md A extern/vulkan_memory_allocator/vk_mem_alloc.h A extern/vulkan_memory_allocator/vk_mem_alloc_impl.cc M source/blender/gpu/CMakeLists.txt M source/blender/gpu/vulkan/vk_backend.cc M source/blender/gpu/vulkan/vk_context.cc M source/blender/gpu/vulkan/vk_context.hh === diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index 57a8f977517..9723fe92ff9 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -91,3 +91,7 @@ endif() if(WITH_COMPOSITOR_CPU) add_subdirectory(smaa_areatex) endif() + +if(WITH_VULKAN_BACKEND) + add_subdirectory(vulkan_memory_allocator) +endif() diff --git a/extern/vulkan_memory_allocator/CMakeLists.txt b/extern/vulkan_memory_allocator/CMakeLists.txt new file mode 100644 index 000..0b709e8dda1 --- /dev/null +++ b/extern/vulkan_memory_allocator/CMakeLists.txt @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright 2022 Blender Foundation. All rights reserved. + +set(INC + . +) + +set(INC_SYS + ${VULKAN_INCLUDE_DIRS} +) + +set(SRC + vk_mem_alloc_impl.cc + + vk_mem_alloc.h +) + +blender_add_lib(extern_vulkan_memory_allocator "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") + +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") + target_compile_options(extern_vulkan_memory_allocator +PRIVATE "-Wno-nullability-completeness" + ) +endif() diff --git a/extern/vulkan_memory_allocator/LICENSE.txt b/extern/vulkan_memory_allocator/LICENSE.txt new file mode 100644 index 000..b74bf4a854d --- /dev/null +++ b/extern/vulkan_memory_allocator/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2017-2022 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/extern/vulkan_memory_allocator/README.blender b/extern/vulkan_memory_allocator/README.blender new file mode 100644 index 000..7877ccf3f7b --- /dev/null +++ b/extern/vulkan_memory_allocator/README.blender @@ -0,0 +1,5 @@ +Project: VulkanMemoryAllocator +URL: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator +License: MIT +Upstream version: a6bfc23 +Local modifications: None diff --git a/extern/vulkan_memory_allocator/README.md b/extern/vulkan_memory_allocator/README.md new file mode 100644 index 000..0096ab68141 --- /dev/null +++ b/extern/vulkan_memory_allocator/README.md @@ -0,0 +1,175 @@ +# Vulkan Memory Allocator + +Easy to integrate Vulkan memory allocation library. + +**Documentation:** Browse online: [Vulkan Memory Allocator](https://gpuopen-librariesandsdks.github.io/VulkanMemoryAllocator/html/) (generated from Doxygen-style comments in [include/vk_mem_alloc.h](include/vk_mem_alloc.h)) + +**License:** MIT. See [LICENSE.txt](LICENSE.txt) + +**Changelog:** See [CHANGELOG.md](CHANGELOG.md) + +**Product page:** [Vulkan Memory Allocator on GPUOpen](https://gpuopen.co
[Bf-blender-cvs] [68a450cbe49] master: Cleanup: Remove unused parameter in node draw
Commit: 68a450cbe4947cfe8b74b4a970293d0213525c5a Author: Omar Emara Date: Wed Nov 23 15:05:34 2022 +0200 Branches: master https://developer.blender.org/rB68a450cbe4947cfe8b74b4a970293d0213525c5a Cleanup: Remove unused parameter in node draw === M source/blender/editors/space_node/node_draw.cc === diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index d5bf36ee00a..67adf3865be 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -1657,12 +1657,10 @@ static char *node_errors_tooltip_fn(bContext * /*C*/, void *argN, const char * / #define NODE_HEADER_ICON_SIZE (0.8f * U.widget_unit) -static void node_add_unsupported_compositor_operation_error_message_button( -TreeDrawContext &tree_draw_ctx, -bNode &node, -uiBlock &block, -const rctf &rect, -float &icon_offset) +static void node_add_unsupported_compositor_operation_error_message_button(bNode &node, + uiBlock &block, + const rctf &rect, + float &icon_offset) { icon_offset -= NODE_HEADER_ICON_SIZE; UI_block_emboss_set(&block, UI_EMBOSS_NONE); @@ -1691,8 +1689,7 @@ static void node_add_error_message_button(TreeDrawContext &tree_draw_ctx, { if (tree_draw_ctx.used_by_realtime_compositor && node.typeinfo->realtime_compositor_unsupported_message) { -node_add_unsupported_compositor_operation_error_message_button( -tree_draw_ctx, node, block, rect, icon_offset); +node_add_unsupported_compositor_operation_error_message_button(node, block, rect, icon_offset); return; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [aa0c2c0f47c] master: Cleanup: move some data from bNodeTree to run-time data
Commit: aa0c2c0f47cfee729d5aa8dccaff0b73f1837dc4 Author: Jacques Lucke Date: Wed Nov 23 14:05:30 2022 +0100 Branches: master https://developer.blender.org/rBaa0c2c0f47cfee729d5aa8dccaff0b73f1837dc4 Cleanup: move some data from bNodeTree to run-time data No functional changes are expected. === M source/blender/blenkernel/BKE_node_runtime.hh M source/blender/blenkernel/intern/node.cc M source/blender/blenkernel/intern/texture.cc M source/blender/compositor/intern/COM_ExecutionGroup.cc M source/blender/compositor/intern/COM_ExecutionSystem.cc M source/blender/compositor/intern/COM_FullFrameExecutionModel.cc M source/blender/compositor/intern/COM_NodeOperation.h M source/blender/compositor/intern/COM_TiledExecutionModel.cc M source/blender/compositor/intern/COM_compositor.cc M source/blender/compositor/operations/COM_OutputFileOperation.cc M source/blender/compositor/operations/COM_TextureOperation.cc M source/blender/editors/sculpt_paint/paint_cursor.cc M source/blender/editors/sculpt_paint/paint_image.cc M source/blender/editors/sculpt_paint/sculpt.cc M source/blender/editors/space_node/node_edit.cc M source/blender/editors/space_node/node_relationships.cc M source/blender/makesdna/DNA_node_types.h M source/blender/nodes/shader/node_shader_tree.cc M source/blender/nodes/texture/node_texture_tree.cc M source/blender/render/intern/pipeline.cc === diff --git a/source/blender/blenkernel/BKE_node_runtime.hh b/source/blender/blenkernel/BKE_node_runtime.hh index 3e712ea6523..9fddd4ec4b9 100644 --- a/source/blender/blenkernel/BKE_node_runtime.hh +++ b/source/blender/blenkernel/BKE_node_runtime.hh @@ -46,6 +46,30 @@ class bNodeTreeRuntime : NonCopyable, NonMovable { */ uint8_t runtime_flag = 0; + /** Flag to prevent re-entrant update calls. */ + short is_updating = 0; + /** Generic temporary flag for recursion check (DFS/BFS). */ + short done = 0; + + /** Execution data. + * + * XXX It would be preferable to completely move this data out of the underlying node tree, + * so node tree execution could finally run independent of the tree itself. + * This would allow node trees to be merely linked by other data (materials, textures, etc.), + * as ID data is supposed to. + * Execution data is generated from the tree once at execution start and can then be used + * as long as necessary, even while the tree is being modified. + */ + struct bNodeTreeExec *execdata = nullptr; + + /* Callbacks. */ + void (*progress)(void *, float progress) = nullptr; + /** \warning may be called by different threads */ + void (*stats_draw)(void *, const char *str) = nullptr; + bool (*test_break)(void *) = nullptr; + void (*update_draw)(void *) = nullptr; + void *tbh = nullptr, *prh = nullptr, *sdh = nullptr, *udh = nullptr; + /** Information about how inputs and outputs of the node group interact with fields. */ std::unique_ptr field_inferencing_interface; diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 2dde8ccba39..adb1b5c2d3c 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -138,7 +138,7 @@ static void ntree_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, cons ntree_dst->runtime = MEM_new(__func__); /* in case a running nodetree is copied */ - ntree_dst->execdata = nullptr; + ntree_dst->runtime->execdata = nullptr; BLI_listbase_clear(&ntree_dst->nodes); BLI_listbase_clear(&ntree_dst->links); @@ -225,14 +225,14 @@ static void ntree_free_data(ID *id) * This should be removed when old tree types no longer require it. * Currently the execution data for texture nodes remains in the tree * after execution, until the node tree is updated or freed. */ - if (ntree->execdata) { + if (ntree->runtime->execdata) { switch (ntree->type) { case NTREE_SHADER: -ntreeShaderEndExecTree(ntree->execdata); +ntreeShaderEndExecTree(ntree->runtime->execdata); break; case NTREE_TEXTURE: -ntreeTexEndExecTree(ntree->execdata); -ntree->execdata = nullptr; +ntreeTexEndExecTree(ntree->runtime->execdata); +ntree->runtime->execdata = nullptr; break; } } @@ -615,10 +615,8 @@ static void ntree_blend_write(BlendWriter *writer, ID *id, const void *id_addres bNodeTree *ntree = (bNodeTree *)id; /* Clean up, important in undo case to reduce false detection of changed datablocks. */ - ntree->is_updating = false; ntree->typeinfo = nullptr; - ntree->progress = nullptr; - ntree->execdata = nullptr; + ntree->runtime->execdata = nullptr; BLO_write_id_struct(writer, bNodeTree, id_address, &ntree->id); @@ -668,11 +666,8 @@
[Bf-blender-cvs] [4f02817367d] master: Nodes: remove bNodeTree->interface_type
Commit: 4f02817367d435b5d0f7b95940c55c91449e86a9 Author: Jacques Lucke Date: Wed Nov 23 13:48:53 2022 +0100 Branches: master https://developer.blender.org/rB4f02817367d435b5d0f7b95940c55c91449e86a9 Nodes: remove bNodeTree->interface_type This is not used for anything in practice currently. The original intention was probably to generate different socket subtypes, but that is solved differently now (e.g. using `NodeSocketFloatDistance`). It's possible that an addon tried to use this but it's rather unlikely. Differential Revision: https://developer.blender.org/D13188 === M source/blender/blenkernel/BKE_node.h M source/blender/blenkernel/intern/node.cc M source/blender/blenkernel/intern/node_tree_update.cc M source/blender/makesdna/DNA_node_types.h M source/blender/makesrna/intern/rna_nodetree.c === diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index d4e37e29505..a22df9cc673 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -171,9 +171,6 @@ typedef struct bNodeSocketType { void (*interface_draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr); void (*interface_draw_color)(struct bContext *C, struct PointerRNA *ptr, float *r_color); - void (*interface_register_properties)(struct bNodeTree *ntree, -struct bNodeSocket *interface_socket, -struct StructRNA *data_srna); void (*interface_init_socket)(struct bNodeTree *ntree, const struct bNodeSocket *interface_socket, struct bNode *node, @@ -583,10 +580,6 @@ struct bNodeSocket *ntreeInsertSocketInterfaceFromSocket(struct bNodeTree *ntree struct bNodeSocket *from_sock); void ntreeRemoveSocketInterface(struct bNodeTree *ntree, struct bNodeSocket *sock); -struct StructRNA *ntreeInterfaceTypeGet(struct bNodeTree *ntree, bool create); -void ntreeInterfaceTypeFree(struct bNodeTree *ntree); -void ntreeInterfaceTypeUpdate(struct bNodeTree *ntree); - /** \} */ /* */ diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index e17c5e31a46..2dde8ccba39 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -203,8 +203,6 @@ static void ntree_copy_data(Main * /*bmain*/, ID *id_dst, const ID *id_src, cons new_node->parent = node_map.lookup(new_node->parent); } } - /* node tree will generate its own interface type */ - ntree_dst->interface_type = nullptr; if (ntree_src->runtime->field_inferencing_interface) { ntree_dst->runtime->field_inferencing_interface = std::make_unique( @@ -242,9 +240,6 @@ static void ntree_free_data(ID *id) /* XXX not nice, but needed to free localized node groups properly */ free_localized_node_groups(ntree); - /* Unregister associated RNA types. */ - ntreeInterfaceTypeFree(ntree); - BLI_freelistN(&ntree->links); LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) { @@ -622,7 +617,6 @@ static void ntree_blend_write(BlendWriter *writer, ID *id, const void *id_addres /* Clean up, important in undo case to reduce false detection of changed datablocks. */ ntree->is_updating = false; ntree->typeinfo = nullptr; - ntree->interface_type = nullptr; ntree->progress = nullptr; ntree->execdata = nullptr; @@ -676,7 +670,6 @@ void ntreeBlendReadData(BlendDataReader *reader, ID *owner_id, bNodeTree *ntree) /* NOTE: writing and reading goes in sync, for speed. */ ntree->is_updating = false; ntree->typeinfo = nullptr; - ntree->interface_type = nullptr; ntree->progress = nullptr; ntree->execdata = nullptr; @@ -3442,127 +3435,6 @@ void ntreeRemoveSocketInterface(bNodeTree *ntree, bNodeSocket *sock) BKE_ntree_update_tag_interface(ntree); } -/* generates a valid RNA identifier from the node tree name */ -static void ntree_interface_identifier_base(bNodeTree *ntree, char *base) -{ - /* generate a valid RNA identifier */ - BLI_sprintf(base, "NodeTreeInterface_%s", ntree->id.name + 2); - RNA_identifier_sanitize(base, false); -} - -/* check if the identifier is already in use */ -static bool ntree_interface_unique_identifier_check(void * /*data*/, const char *identifier) -{ - return (RNA_struct_find(identifier) != nullptr); -} - -/* generates the actual unique identifier and ui name and description */ -static void ntree_interface_identifier(bNodeTree *ntree, - const char *base, - char *identifier, - int maxlen, -
[Bf-blender-cvs] [247d75d2b1d] master: Realtime Compositor: Warn about unsupported setups
Commit: 247d75d2b1d285e0ff57fed883515305c387cb44 Author: Omar Emara Date: Wed Nov 23 14:34:31 2022 +0200 Branches: master https://developer.blender.org/rB247d75d2b1d285e0ff57fed883515305c387cb44 Realtime Compositor: Warn about unsupported setups This patch warns the user that the compositor setup is not fully supported when an unsupported node is used. The warning is displayed as an engine warning overlay and in the node header itself. See T102353. Differential Revision: https://developer.blender.org/D16508 Reviewed By: Clement Foucault === M source/blender/blenkernel/BKE_node.h M source/blender/editors/space_node/node_draw.cc M source/blender/nodes/composite/nodes/node_composite_antialiasing.cc M source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc M source/blender/nodes/composite/nodes/node_composite_cornerpin.cc M source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc M source/blender/nodes/composite/nodes/node_composite_defocus.cc M source/blender/nodes/composite/nodes/node_composite_denoise.cc M source/blender/nodes/composite/nodes/node_composite_displace.cc M source/blender/nodes/composite/nodes/node_composite_double_edge_mask.cc M source/blender/nodes/composite/nodes/node_composite_id_mask.cc M source/blender/nodes/composite/nodes/node_composite_image.cc M source/blender/nodes/composite/nodes/node_composite_inpaint.cc M source/blender/nodes/composite/nodes/node_composite_keying.cc M source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc M source/blender/nodes/composite/nodes/node_composite_map_uv.cc M source/blender/nodes/composite/nodes/node_composite_mask.cc M source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc M source/blender/nodes/composite/nodes/node_composite_output_file.cc M source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc M source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc M source/blender/nodes/composite/nodes/node_composite_sunbeams.cc M source/blender/nodes/composite/nodes/node_composite_texture.cc M source/blender/nodes/composite/nodes/node_composite_vec_blur.cc M source/blender/nodes/composite/nodes/node_composite_zcombine.cc === diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 9e85282ab42..d4e37e29505 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -330,6 +330,11 @@ typedef struct bNodeType { * responsibility of the caller. */ NodeGetCompositorShaderNodeFunction get_compositor_shader_node; + /* A message to display in the node header for unsupported realtime compositor nodes. The message + * is assumed to be static and thus require no memory handling. This field is to be removed when + * all nodes are supported. */ + const char *realtime_compositor_unsupported_message; + /* Build a multi-function for this node. */ NodeMultiFunctionBuildFunction build_multi_function; diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 71ff840bd1d..d5bf36ee00a 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -107,6 +107,10 @@ struct TreeDrawContext { * currently drawn node tree can be retrieved from the log below. */ geo_log::GeoTreeLog *geo_tree_log = nullptr; + /** + * True if there is an active realtime compositor using the node tree, false otherwise. + */ + bool used_by_realtime_compositor = false; }; float ED_node_grid_size() @@ -1653,12 +1657,45 @@ static char *node_errors_tooltip_fn(bContext * /*C*/, void *argN, const char * / #define NODE_HEADER_ICON_SIZE (0.8f * U.widget_unit) +static void node_add_unsupported_compositor_operation_error_message_button( +TreeDrawContext &tree_draw_ctx, +bNode &node, +uiBlock &block, +const rctf &rect, +float &icon_offset) +{ + icon_offset -= NODE_HEADER_ICON_SIZE; + UI_block_emboss_set(&block, UI_EMBOSS_NONE); + uiDefIconBut(&block, + UI_BTYPE_BUT, + 0, + ICON_ERROR, + icon_offset, + rect.ymax - NODE_DY, + NODE_HEADER_ICON_SIZE, + UI_UNIT_Y, + nullptr, + 0, + 0, + 0, + 0, + TIP_(node.typeinfo->realtime_compositor_unsupported_message)); + UI_block_emboss_set(&block, UI_EMBOSS); +} + static void node_add_error_message_button(TreeDrawContext &tree_draw_ctx, bNode &node, uiBlock &block,
[Bf-blender-cvs] [6396d297796] master: Merge branch 'blender-v3.4-release'
Commit: 6396d2977968cb9376ab9edcfbfab4a6dcbdc044 Author: Julian Eisel Date: Wed Nov 23 13:25:12 2022 +0100 Branches: master https://developer.blender.org/rB6396d2977968cb9376ab9edcfbfab4a6dcbdc044 Merge branch 'blender-v3.4-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ff9606ddc4e] blender-v3.4-release: Fix use-after-free of asset catalog data in node add menu
Commit: ff9606ddc4e2681903e484afd7c16e8f20a8ebc2 Author: Julian Eisel Date: Fri Nov 18 17:20:07 2022 +0100 Branches: blender-v3.4-release https://developer.blender.org/rBff9606ddc4e2681903e484afd7c16e8f20a8ebc2 Fix use-after-free of asset catalog data in node add menu (Probably requires ASan for a reliable crash.) Steps to reproduce were: * Enter Geometry Nodes Workspace * Press "New" button in the geometry nodes editor header * Right-click the data-block selector -> "Mark as Asset" * Change 3D View to Asset Browser * Create a catalog * Drag new Geometry Nodes asset into the catalog * Save the file * Press Shift+A in the geometry nodes editor There was a general issue here with keeping catalog pointers around during the add menu building. The way it does things, catalogs may be reloaded in between. Since the Current File asset library isn't loaded in a separate thread, the use-after-free would always happen in between. For other libraries it could still happen, but apparently didn't by chance. === M source/blender/blenkernel/BKE_asset_catalog.hh M source/blender/blenkernel/BKE_asset_library.hh M source/blender/editors/asset/ED_asset_list.h M source/blender/editors/space_node/add_menu_assets.cc === diff --git a/source/blender/blenkernel/BKE_asset_catalog.hh b/source/blender/blenkernel/BKE_asset_catalog.hh index 73c2e00c4c4..3e1a73c23c4 100644 --- a/source/blender/blenkernel/BKE_asset_catalog.hh +++ b/source/blender/blenkernel/BKE_asset_catalog.hh @@ -424,8 +424,14 @@ class AssetCatalogDefinitionFile { bool ensure_directory_exists(const CatalogFilePath directory_path) const; }; -/** Asset Catalog definition, containing a symbolic ID and a path that points to a node in the - * catalog hierarchy. */ +/** + * Asset Catalog definition, containing a symbolic ID and a path that points to a node in the + * catalog hierarchy. + * + * \warning The asset system may reload catalogs, invalidating pointers. Thus it's not recommended + * to store pointers to asset catalogs. Store the #CatalogID instead and do a lookup when + * needed. + */ class AssetCatalog { public: AssetCatalog() = default; diff --git a/source/blender/blenkernel/BKE_asset_library.hh b/source/blender/blenkernel/BKE_asset_library.hh index 2058df71f6a..243c8218509 100644 --- a/source/blender/blenkernel/BKE_asset_library.hh +++ b/source/blender/blenkernel/BKE_asset_library.hh @@ -61,6 +61,10 @@ Vector all_valid_asset_library_refs(); } // namespace blender::bke +/** + * \warning Catalogs are reloaded, invalidating catalog pointers. Do not store catalog pointers, + * store CatalogIDs instead and lookup the catalog where needed. + */ blender::bke::AssetLibrary *BKE_asset_library_load(const Main *bmain, const AssetLibraryReference &library_reference); diff --git a/source/blender/editors/asset/ED_asset_list.h b/source/blender/editors/asset/ED_asset_list.h index 3d2aaa3bda1..bcd5dbca8d4 100644 --- a/source/blender/editors/asset/ED_asset_list.h +++ b/source/blender/editors/asset/ED_asset_list.h @@ -20,6 +20,9 @@ struct wmNotifier; /** * Invoke asset list reading, potentially in a parallel job. Won't wait until the job is done, * and may return earlier. + * + * \warning: Asset list reading involves an #AS_asset_library_load() call which may reload asset + * library data like catalogs (invalidating pointers). Refer to its warning for details. */ void ED_assetlist_storage_fetch(const struct AssetLibraryReference *library_reference, const struct bContext *C); diff --git a/source/blender/editors/space_node/add_menu_assets.cc b/source/blender/editors/space_node/add_menu_assets.cc index 5458a25d74a..f361f70c265 100644 --- a/source/blender/editors/space_node/add_menu_assets.cc +++ b/source/blender/editors/space_node/add_menu_assets.cc @@ -49,7 +49,9 @@ struct LibraryAsset { struct LibraryCatalog { bke::AssetLibrary *library; - const bke::AssetCatalog *catalog; + /* Catalog pointers are not save to store. Use the catalog ID instead and lookup the catalog when + * needed. */ + const bke::CatalogID catalog_id; }; struct AssetItemTree { @@ -88,7 +90,7 @@ static AssetItemTree build_catalog_tree(const bContext &C, const bNodeTree *node const bke::CatalogID &id = item.get_catalog_id(); bke::AssetCatalog *catalog = library->catalog_service->find_catalog(id); catalogs_from_all_libraries.insert_item(*catalog); - id_to_catalog_map.add(item.get_catalog_id(), LibraryCatalog{library, catalog}); + id_to_catalog_map.add(item.get_catalog_id(), LibraryCatalog{library, id}); }); } } @@ -118,7 +120,9 @@ static AssetItemTree build_catalog_tree(const bContext &C, const bNodeTree *
[Bf-blender-cvs] [609d0ef05b1] gpencil-new-data-proposal: Move GPStroke function implementations to .cc file
Commit: 609d0ef05b15101f9cefe383cf3a4404652bf641 Author: Falk David Date: Wed Nov 23 13:04:13 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rB609d0ef05b15101f9cefe383cf3a4404652bf641 Move GPStroke function implementations to .cc file === M source/blender/blenkernel/intern/gpencil_new_proposal.cc M source/blender/blenkernel/intern/gpencil_new_proposal.hh === diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc b/source/blender/blenkernel/intern/gpencil_new_proposal.cc index 0199b5b57fe..1a3825ef9ca 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.cc +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc @@ -18,4 +18,24 @@ namespace blender::bke { +Span GPStroke::points_positions() const +{ + return {geometry_->positions().begin() + offset_, points_num_}; +} + +MutableSpan GPStroke::points_positions_for_write() const +{ + return {geometry_->positions_for_write().begin() + offset_, points_num_}; +} + +void GPStroke::transform(float4x4 matrix) +{ + threading::parallel_for( + points_positions_for_write().index_range(), 512, [&](const IndexRange range) { +for (float3 &position : points_positions_for_write().slice(range)) { + position = matrix * position; +} + }); +} + } // namespace blender::bke \ No newline at end of file diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh b/source/blender/blenkernel/intern/gpencil_new_proposal.hh index c918237b726..80f23169115 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh @@ -224,25 +224,9 @@ class GPStroke { return offset_; } - Span points_positions() const - { -return {geometry_->positions().begin() + offset_, points_num_}; - } - - MutableSpan points_positions_for_write() const - { -return {geometry_->positions_for_write().begin() + offset_, points_num_}; - } - - void transform(float4x4 matrix) - { -threading::parallel_for( -points_positions_for_write().index_range(), 512, [&](const IndexRange range) { - for (float3 &position : points_positions_for_write().slice(range)) { -position = matrix * position; - } -}); - } + Span points_positions() const; + MutableSpan points_positions_for_write() const; + void transform(float4x4 matrix); private: CurvesGeometry *geometry_ = nullptr; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [1c00b2ef70e] master: Cleanup: move paint_cursor.c and paint_image_proj.c to C++
Commit: 1c00b2ef70ed145e4715821c9fa7d3b2ef9df8f7 Author: Jacques Lucke Date: Wed Nov 23 12:56:34 2022 +0100 Branches: master https://developer.blender.org/rB1c00b2ef70ed145e4715821c9fa7d3b2ef9df8f7 Cleanup: move paint_cursor.c and paint_image_proj.c to C++ This makes it easier to use c++ when improving the internal node api. === M source/blender/editors/sculpt_paint/CMakeLists.txt R096source/blender/editors/sculpt_paint/paint_cursor.c source/blender/editors/sculpt_paint/paint_cursor.cc R092source/blender/editors/sculpt_paint/paint_image_proj.c source/blender/editors/sculpt_paint/paint_image_proj.cc === diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index b29fc0e9e7d..393f9a376af 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -42,7 +42,7 @@ set(SRC curves_sculpt_smooth.cc curves_sculpt_snake_hook.cc paint_canvas.cc - paint_cursor.c + paint_cursor.cc paint_curve.c paint_curve_undo.c paint_hide.c @@ -50,7 +50,7 @@ set(SRC paint_image_2d.c paint_image_2d_curve_mask.cc paint_image_ops_paint.cc - paint_image_proj.c + paint_image_proj.cc paint_mask.c paint_ops.c paint_stroke.c diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.cc similarity index 96% rename from source/blender/editors/sculpt_paint/paint_cursor.c rename to source/blender/editors/sculpt_paint/paint_cursor.cc index b6e83187c86..85f52c73ca5 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.cc @@ -64,21 +64,21 @@ * There is also some ugliness with sculpt-specific code. */ -typedef struct TexSnapshot { +struct TexSnapshot { GPUTexture *overlay_texture; int winx; int winy; int old_size; float old_zoom; bool old_col; -} TexSnapshot; +}; -typedef struct CursorSnapshot { +struct CursorSnapshot { GPUTexture *overlay_texture; int size; int zoom; int curve_preset; -} CursorSnapshot; +}; static TexSnapshot primary_snap = {0}; static TexSnapshot secondary_snap = {0}; @@ -140,7 +140,7 @@ static void load_tex_task_cb_ex(void *__restrict userdata, const int j, const TaskParallelTLS *__restrict tls) { - LoadTexData *data = userdata; + LoadTexData *data = static_cast(userdata); Brush *br = data->br; ViewContext *vc = data->vc; @@ -154,14 +154,14 @@ static void load_tex_task_cb_ex(void *__restrict userdata, const float radius = data->radius; bool convert_to_linear = false; - struct ColorSpace *colorspace = NULL; + struct ColorSpace *colorspace = nullptr; const int thread_id = BLI_task_parallel_thread_id(tls); if (mtex->tex && mtex->tex->type == TEX_IMAGE && mtex->tex->ima) { ImBuf *tex_ibuf = BKE_image_pool_acquire_ibuf(mtex->tex->ima, &mtex->tex->iuser, pool); /* For consistency, sampling always returns color in linear space. */ -if (tex_ibuf && tex_ibuf->rect_float == NULL) { +if (tex_ibuf && tex_ibuf->rect_float == nullptr) { convert_to_linear = true; colorspace = tex_ibuf->rect_colorspace; } @@ -239,7 +239,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima MTex *mtex = (primary) ? &br->mtex : &br->mask_mtex; ePaintOverlayControlFlags overlay_flags = BKE_paint_get_overlay_flags(); - uchar *buffer = NULL; + uchar *buffer = nullptr; int size; bool refresh; @@ -254,7 +254,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima init = (target->overlay_texture != 0); if (refresh) { -struct ImagePool *pool = NULL; +struct ImagePool *pool = nullptr; /* Stencil is rotated later. */ const float rotation = (mtex->brush_map_mode != MTEX_MAP_MODE_STENCIL) ? -mtex->rot : 0.0f; const float radius = BKE_brush_size_get(vc->scene, br) * zoom; @@ -286,7 +286,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima if (target->old_size != size || target->old_col != col) { if (target->overlay_texture) { GPU_texture_free(target->overlay_texture); -target->overlay_texture = NULL; +target->overlay_texture = nullptr; } init = false; @@ -294,10 +294,10 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima target->old_col = col; } if (col) { - buffer = MEM_mallocN(sizeof(uchar) * size * size * 4, "load_tex"); + buffer = static_cast(MEM_mallocN(sizeof(uchar) * size * size * 4, "load_tex")); } else { - buffer = MEM_mallocN(sizeof(uchar) * size * size, "load_tex"); + buffer
[Bf-blender-cvs] [0ac9bbc98fe] gpencil-new-data-proposal: Move classes to header and add conversion file
Commit: 0ac9bbc98fe231a6a9b1616c482d050816ef63dd Author: Falk David Date: Wed Nov 23 12:55:02 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rB0ac9bbc98fe231a6a9b1616c482d050816ef63dd Move classes to header and add conversion file === M source/blender/blenkernel/CMakeLists.txt A source/blender/blenkernel/intern/gpencil_new_proposal.cc M source/blender/blenkernel/intern/gpencil_new_proposal.hh A source/blender/blenkernel/intern/gpencil_new_proposal_conversion.cc M source/blender/blenkernel/intern/gpencil_new_proposal_test.cc === diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 8d3e7022770..60bb4ad0b0e 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -147,6 +147,8 @@ set(SRC intern/gpencil_curve.c intern/gpencil_geom.cc intern/gpencil_modifier.c + intern/gpencil_new_proposal.cc + intern/gpencil_new_proposal_conversion.cc intern/gpencil_update_cache.c intern/icons.cc intern/icons_rasterize.c diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.cc b/source/blender/blenkernel/intern/gpencil_new_proposal.cc new file mode 100644 index 000..0199b5b57fe --- /dev/null +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.cc @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/** \file + * \ingroup bke + */ + +#include + +#include "BKE_curves.hh" +#include "BKE_gpencil.h" + +#include "BLI_index_mask_ops.hh" +#include "BLI_math_vec_types.hh" + +#include "DNA_gpencil_types.h" + +#include "gpencil_new_proposal.hh" + +namespace blender::bke { + +} // namespace blender::bke \ No newline at end of file diff --git a/source/blender/blenkernel/intern/gpencil_new_proposal.hh b/source/blender/blenkernel/intern/gpencil_new_proposal.hh index 3f328ee36e6..c918237b726 100644 --- a/source/blender/blenkernel/intern/gpencil_new_proposal.hh +++ b/source/blender/blenkernel/intern/gpencil_new_proposal.hh @@ -6,6 +6,10 @@ #pragma once +#include "BKE_curves.hh" + +#include "BLI_index_mask_ops.hh" + #include "DNA_ID.h" #include "DNA_curves_types.h" #include "DNA_customdata_types.h" @@ -144,6 +148,701 @@ typedef struct GreasePencil { /* ... */ } GreasePencil; +namespace blender::bke { + +class GPLayerGroup : ::GPLayerGroup { /* Unused for now. Placeholder class. */ + public: + GPLayerGroup() + { +this->children = nullptr; +this->children_size = 0; +this->layer_indices = nullptr; +this->layer_indices_size = 0; + } + + GPLayerGroup(const StringRefNull name) : GPLayerGroup() + { +BLI_assert(name.size() < 128); +strcpy(this->name, name.c_str()); + } + + ~GPLayerGroup() + { +/* Recursivly free the children of this layer group first. */ +for (int i = 0; i < this->children_size; i++) { + MEM_delete(&this->children[i]); +} +/* Then free its data. */ +MEM_SAFE_FREE(this->children); +MEM_SAFE_FREE(this->layer_indices); + } + + IndexMask layers_index_mask() + { +return {reinterpret_cast(this->layer_indices), this->layer_indices_size}; + } +}; + +class GPDataRuntime { + public: + /* mutable void *sbuffer */ + + /** + * Cache that maps the index of a layer to the index mask of the frames in that layer. + */ + mutable Map> frame_index_masks_cache; + mutable std::mutex frame_index_masks_cache_mutex; + + IndexMask frame_index_masks_cache_for_layer(int layer_index) + { +return frame_index_masks_cache.lookup(layer_index).as_span(); + } +}; + +/** + * A wrapper class around a single curve in GPFrame.strokes (CurvesGeometry). It holds the offset + * of where to find the stroke in the frame and it's size. + * This class is only meant to facilitate the handling of individual strokes. + */ +class GPStroke { + public: + GPStroke(CurvesGeometry *geometry, int num_points, int offset) + : geometry_(geometry), points_num_(num_points), offset_(offset){}; + + ~GPStroke() = default; + + int points_num() const + { +return points_num_; + } + + /** + * Start index of this stroke in the points array of geometry_. + */ + int points_offset() const + { +return offset_; + } + + Span points_positions() const + { +return {geometry_->positions().begin() + offset_, points_num_}; + } + + MutableSpan points_positions_for_write() const + { +return {geometry_->positions_for_write().begin() + offset_, points_num_}; + } + + void transform(float4x4 matrix) + { +threading::parallel_for( +points_positions_for_write().index_range(), 512, [&](const IndexRange range) { + for (float3 &position : points_positions_for_write().slice(range)) { +position = matrix * position; + } +}); + } + + private: + CurvesGeometry *geometry_ = nullptr; +
[Bf-blender-cvs] [30bd9c2760e] gpencil-new-data-proposal: Merge branch 'master' into gpencil-new-data-proposal
Commit: 30bd9c2760eb03ba6f40e26f368d3fbe11397efc Author: Falk David Date: Wed Nov 23 11:27:34 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rB30bd9c2760eb03ba6f40e26f368d3fbe11397efc Merge branch 'master' into gpencil-new-data-proposal === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [559d73b8481] gpencil-new-data-proposal: Merge branch 'master' into gpencil-new-data-proposal
Commit: 559d73b84812b8bf15d5cd633ca5beec1b921228 Author: Falk David Date: Wed Nov 23 12:55:23 2022 +0100 Branches: gpencil-new-data-proposal https://developer.blender.org/rB559d73b84812b8bf15d5cd633ca5beec1b921228 Merge branch 'master' into gpencil-new-data-proposal === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [106277be436] master: Merge branch 'blender-v3.4-release'
Commit: 106277be43675285a7754630d858515119cdae1b Author: Sergey Sharybin Date: Wed Nov 23 12:54:15 2022 +0100 Branches: master https://developer.blender.org/rB106277be43675285a7754630d858515119cdae1b Merge branch 'blender-v3.4-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [3250ab31cd5] blender-v3.4-release: Cleanup: Remove debug print
Commit: 3250ab31cd55d6745c0e1bb55414b6dde70bad91 Author: Sergey Sharybin Date: Wed Nov 23 12:53:35 2022 +0100 Branches: blender-v3.4-release https://developer.blender.org/rB3250ab31cd55d6745c0e1bb55414b6dde70bad91 Cleanup: Remove debug print Was introduced in 0e6d893d07f9. === M source/blender/blenkernel/intern/object_dupli.cc === diff --git a/source/blender/blenkernel/intern/object_dupli.cc b/source/blender/blenkernel/intern/object_dupli.cc index a8512036566..16efa05d3e2 100644 --- a/source/blender/blenkernel/intern/object_dupli.cc +++ b/source/blender/blenkernel/intern/object_dupli.cc @@ -245,7 +245,6 @@ static DupliObject *make_dupli(const DupliContext *ctx, dob->ob = ob; dob->ob_data = const_cast(object_data); mul_m4_m4m4(dob->mat, (float(*)[4])ctx->space_mat, mat); - std::cout << "Use\n"; dob->type = ctx->gen == nullptr ? 0 : ctx->dupli_gen_type_stack->last(); dob->preview_base_geometry = ctx->preview_base_geometry; dob->preview_instance_index = ctx->preview_instance_index; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [7d44676b5f2] master: Realtime Compositor: Disable on MacOS
Commit: 7d44676b5f22bb07f94631f13d40b317fbc5114d Author: Omar Emara Date: Wed Nov 23 13:34:31 2022 +0200 Branches: master https://developer.blender.org/rB7d44676b5f22bb07f94631f13d40b317fbc5114d Realtime Compositor: Disable on MacOS This patch disables the realtime compositor on MacOS until Metal is supported. This is because MacOS doesn't support the necessary GPU features to make it work. An engine error overlay is displayed if it is enabled and the option itself is greyed out. See T102353. Differential Revision: https://developer.blender.org/D16510 Reviewed By: Clement Foucault === M release/scripts/startup/bl_ui/space_view3d.py M source/blender/draw/engines/compositor/compositor_engine.cc === diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index dda5e8beb10..656ef6663e4 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -6212,6 +6212,8 @@ class VIEW3D_PT_shading_compositor(Panel): shading = context.space_data.shading row = self.layout.row() +import sys +row.active = sys.platform != "darwin" row.prop(shading, "use_compositor", expand=True) diff --git a/source/blender/draw/engines/compositor/compositor_engine.cc b/source/blender/draw/engines/compositor/compositor_engine.cc index 2c9e5182b01..3b7378f280b 100644 --- a/source/blender/draw/engines/compositor/compositor_engine.cc +++ b/source/blender/draw/engines/compositor/compositor_engine.cc @@ -163,7 +163,14 @@ static void compositor_engine_free(void *instance_data) static void compositor_engine_draw(void *data) { - const COMPOSITOR_Data *compositor_data = static_cast(data); + COMPOSITOR_Data *compositor_data = static_cast(data); + +#if defined(__APPLE__) + blender::StringRef("Viewport compositor not supported on MacOS") + .copy(compositor_data->info, GPU_INFO_SIZE); + return; +#endif + compositor_data->instance_data->draw(); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [11275b73636] master: Realtime Compositor: Extend option to enable compositor
Commit: 11275b736366f6df9b8314b65940001c57736523 Author: Omar Emara Date: Wed Nov 23 13:26:46 2022 +0200 Branches: master https://developer.blender.org/rB11275b736366f6df9b8314b65940001c57736523 Realtime Compositor: Extend option to enable compositor This patch turns the checkbox option to enable the viewport compositor into a 3-option enum that allows: - Disabled. - Enabled. - Enabled only in camera view. See T102353. Differential Revision: https://developer.blender.org/D16509 Reviewed By: Clement Foucault === M release/scripts/startup/bl_ui/space_view3d.py M source/blender/draw/intern/draw_manager.c M source/blender/makesdna/DNA_view3d_types.h M source/blender/makesrna/intern/rna_space.c === diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 38b277a1337..dda5e8beb10 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -6211,8 +6211,8 @@ class VIEW3D_PT_shading_compositor(Panel): def draw(self, context): shading = context.space_data.shading -layout = self.layout -layout.prop(shading, "use_compositor") +row = self.layout.row() +row.prop(shading, "use_compositor", expand=True) class VIEW3D_PT_gizmo_display(Panel): diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 5e87751a9d4..b4c4c5c8d47 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -45,6 +45,7 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_userdef_types.h" +#include "DNA_view3d_types.h" #include "DNA_world_types.h" #include "ED_gpencil.h" @@ -1247,7 +1248,7 @@ static bool is_compositor_enabled(void) return false; } - if (!(DST.draw_ctx.v3d->shading.flag & V3D_SHADING_COMPOSITOR)) { + if (DST.draw_ctx.v3d->shading.use_compositor == V3D_SHADING_USE_COMPOSITOR_DISABLED) { return false; } @@ -1263,6 +1264,11 @@ static bool is_compositor_enabled(void) return false; } + if (DST.draw_ctx.v3d->shading.use_compositor == V3D_SHADING_USE_COMPOSITOR_CAMERA && + DST.draw_ctx.rv3d->persp != RV3D_CAMOB) { +return false; + } + return true; } diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index f3e56ba7039..c09868b44fb 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -147,7 +147,11 @@ typedef struct View3DShading { char background_type; char cavity_type; char wire_color_type; - char _pad[2]; + + /** When to preview the compositor output in the viewport. View3DShadingUseCompositor. */ + char use_compositor; + + char _pad; /** FILE_MAXFILE. */ char studio_light[256]; @@ -491,7 +495,6 @@ enum { V3D_SHADING_SCENE_LIGHTS_RENDER = (1 << 12), V3D_SHADING_SCENE_WORLD_RENDER = (1 << 13), V3D_SHADING_STUDIOLIGHT_VIEW_ROTATION = (1 << 14), - V3D_SHADING_COMPOSITOR = (1 << 15), }; /** #View3D.debug_flag */ @@ -516,6 +519,15 @@ enum { V3D_SHADING_CAVITY_BOTH = 2, }; +/** #View3DShading.use_compositor */ +typedef enum View3DShadingUseCompositor { + V3D_SHADING_USE_COMPOSITOR_DISABLED = 0, + /** The compositor is enabled only in camera view. */ + V3D_SHADING_USE_COMPOSITOR_CAMERA = 1, + /** The compositor is always enabled regardless of the view. */ + V3D_SHADING_USE_COMPOSITOR_ALWAYS = 2, +} View3DShadingUseCompositor; + /** #View3DOverlay.flag */ enum { V3D_OVERLAY_FACE_ORIENTATION = (1 << 0), diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index e0341e76667..17c373f2924 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -3959,6 +3959,25 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; + static const EnumPropertyItem use_compositor_items[] = { + {V3D_SHADING_USE_COMPOSITOR_DISABLED, + "DISABLED", + 0, + "Disabled", + "The compositor is disabled"}, + {V3D_SHADING_USE_COMPOSITOR_CAMERA, + "CAMERA", + 0, + "Camera", + "The compositor is enabled only in camera view"}, + {V3D_SHADING_USE_COMPOSITOR_ALWAYS, + "ALWAYS", + 0, + "Always", + "The compositor is always enabled regardless of the view"}, + {0, NULL, 0, NULL, NULL}, + }; + /* Note these settings are used for both 3D viewport and the OpenGL render * engine in the scene, so can't assume to always be part of a screen. */ srna = RNA_def_struct(brna, "View3DShading", NULL); @@ -4245,12 +4264,12 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) RNA_def_property_
[Bf-blender-cvs] [80249ce6e4f] master: Asset Browser: Allow changing active catalog from Python
Commit: 80249ce6e4f9a031277f1b12af923c23128165a7 Author: Julian Eisel Date: Wed Nov 23 11:44:18 2022 +0100 Branches: master https://developer.blender.org/rB80249ce6e4f9a031277f1b12af923c23128165a7 Asset Browser: Allow changing active catalog from Python The active catalog ID (UUID) was a read only property. From a studio I got the request to make this editable, so their pipeline tooling can make certain assets visible. Differential Revision: https://developer.blender.org/D16356 Reviewed by: Sybren Stüvel === M source/blender/makesrna/intern/rna_space.c === diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 20ef064af39..e0341e76667 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -3325,6 +3325,26 @@ static int rna_FileAssetSelectParams_catalog_id_length(PointerRNA *UNUSED(ptr)) return UUID_STRING_LEN - 1; } +static void rna_FileAssetSelectParams_catalog_id_set(PointerRNA *ptr, const char *value) +{ + FileAssetSelectParams *params = ptr->data; + + if (value[0] == '\0') { +params->catalog_id = BLI_uuid_nil(); +params->asset_catalog_visibility = FILE_SHOW_ASSETS_ALL_CATALOGS; +return; + } + + bUUID new_uuid; + if (!BLI_uuid_parse_string(&new_uuid, value)) { +printf("UUID %s not formatted correctly, ignoring new value\n", value); +return; + } + + params->catalog_id = new_uuid; + params->asset_catalog_visibility = FILE_SHOW_ASSETS_FROM_CATALOG; +} + #else static const EnumPropertyItem dt_uv_items[] = { @@ -6870,9 +6890,9 @@ static void rna_def_fileselect_asset_params(BlenderRNA *brna) RNA_def_property_string_funcs(prop, "rna_FileAssetSelectParams_catalog_id_get", "rna_FileAssetSelectParams_catalog_id_length", -NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); +"rna_FileAssetSelectParams_catalog_id_set"); RNA_def_property_ui_text(prop, "Catalog UUID", "The UUID of the catalog shown in the browser"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); prop = RNA_def_property(srna, "filter_asset_id", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [e0c5ff87b70] master: Realtime Compositor: Implement Track Position node
Commit: e0c5ff87b702209c3d893051889bf09a8cd35919 Author: Omar Emara Date: Wed Nov 23 12:55:16 2022 +0200 Branches: master https://developer.blender.org/rBe0c5ff87b702209c3d893051889bf09a8cd35919 Realtime Compositor: Implement Track Position node This patch implements the Track Position node for the realtime compositor. Differential Revision: https://developer.blender.org/D16387 Reviewed By: Clement Foucault === M source/blender/blenkernel/BKE_node.h M source/blender/compositor/nodes/COM_TrackPositionNode.cc M source/blender/compositor/operations/COM_TrackPositionOperation.cc M source/blender/compositor/operations/COM_TrackPositionOperation.h M source/blender/makesdna/DNA_node_types.h M source/blender/makesrna/intern/rna_nodetree.c M source/blender/nodes/composite/nodes/node_composite_trackpos.cc === diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index dd035dbf537..9e85282ab42 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1337,12 +1337,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, i #define CMP_CHAN_RGB 1 #define CMP_CHAN_A 2 -/* track position node, in custom1 */ -#define CMP_TRACKPOS_ABSOLUTE 0 -#define CMP_TRACKPOS_RELATIVE_START 1 -#define CMP_TRACKPOS_RELATIVE_FRAME 2 -#define CMP_TRACKPOS_ABSOLUTE_FRAME 3 - /* Cryptomatte source. */ #define CMP_CRYPTOMATTE_SRC_RENDER 0 #define CMP_CRYPTOMATTE_SRC_IMAGE 1 diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.cc b/source/blender/compositor/nodes/COM_TrackPositionNode.cc index da12f72b451..25daf3306a1 100644 --- a/source/blender/compositor/nodes/COM_TrackPositionNode.cc +++ b/source/blender/compositor/nodes/COM_TrackPositionNode.cc @@ -30,7 +30,7 @@ static TrackPositionOperation *create_motion_operation(NodeConverter &converter, operation->set_track_name(trackpos_data->track_name); operation->set_framenumber(frame_number); operation->set_axis(axis); - operation->set_position(CMP_TRACKPOS_ABSOLUTE); + operation->set_position(CMP_NODE_TRACK_POSITION_ABSOLUTE); operation->set_relative_frame(frame_number + delta); operation->set_speed_output(true); converter.add_operation(operation); @@ -49,7 +49,7 @@ void TrackPositionNode::convert_to_operations(NodeConverter &converter, NodeOutput *output_speed = this->get_output_socket(2); int frame_number; - if (editor_node->custom1 == CMP_TRACKPOS_ABSOLUTE_FRAME) { + if (editor_node->custom1 == CMP_NODE_TRACK_POSITION_ABSOLUTE_FRAME) { frame_number = editor_node->custom2; } else { @@ -62,7 +62,7 @@ void TrackPositionNode::convert_to_operations(NodeConverter &converter, operationX->set_track_name(trackpos_data->track_name); operationX->set_framenumber(frame_number); operationX->set_axis(0); - operationX->set_position(editor_node->custom1); + operationX->set_position(static_cast(editor_node->custom1)); operationX->set_relative_frame(editor_node->custom2); converter.add_operation(operationX); converter.map_output_socket(outputX, operationX->get_output_socket()); @@ -73,7 +73,7 @@ void TrackPositionNode::convert_to_operations(NodeConverter &converter, operationY->set_track_name(trackpos_data->track_name); operationY->set_framenumber(frame_number); operationY->set_axis(1); - operationY->set_position(editor_node->custom1); + operationX->set_position(static_cast(editor_node->custom1)); operationY->set_relative_frame(editor_node->custom2); converter.add_operation(operationY); converter.map_output_socket(outputY, operationY->get_output_socket()); diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cc b/source/blender/compositor/operations/COM_TrackPositionOperation.cc index 3e7a2d3cbd9..6763293b519 100644 --- a/source/blender/compositor/operations/COM_TrackPositionOperation.cc +++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cc @@ -19,7 +19,7 @@ TrackPositionOperation::TrackPositionOperation() tracking_object_name_[0] = 0; track_name_[0] = 0; axis_ = 0; - position_ = CMP_TRACKPOS_ABSOLUTE; + position_ = CMP_NODE_TRACK_POSITION_ABSOLUTE; relative_frame_ = 0; speed_output_ = false; flags_.is_set_operation = true; @@ -80,7 +80,7 @@ void TrackPositionOperation::calc_track_position() swap_v2_v2(relative_pos_, marker_pos_); } } - else if (position_ == CMP_TRACKPOS_RELATIVE_START) { + else if (position_ == CMP_NODE_TRACK_POSITION_RELATIVE_START) { int i; for (i = 0; i < track->markersnr; i++) { @@ -93,7 +93,7 @@ void TrackPositionOperation::calc_track_position() } } } - else if (position_ == CMP_TRACKPOS_RELATIVE_FRAME) { + else if (position_ == CMP_NODE_TRACK_POSI
[Bf-blender-cvs] [571f373155c] master: UI: Don't render missing linked material previews, avoids UI freezing
Commit: 571f373155cb34d6b27f454e6a6fe28d80134593 Author: Julian Eisel Date: Wed Nov 23 11:37:02 2022 +0100 Branches: master https://developer.blender.org/rB571f373155cb34d6b27f454e6a6fe28d80134593 UI: Don't render missing linked material previews, avoids UI freezing Opening the material selector after reloading files could cause long UI freezes, because some linked in materials don't have the preview stored in the source file. So Blender would keep rerendering it after every file load, which may involve compiling OpenGL shaders, which again freezes the UI typically. This was reported as quite an issue for the Heist Production by the Blender Studio. Don't render these missing material previews from linked data-blocks anymore. Differential Revision: https://developer.blender.org/D16538 Reviewed by: Brecht Van Lommel, Jeroen Bakker === M source/blender/editors/render/render_preview.cc === diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc index 09394ea33be..ecc29c56836 100644 --- a/source/blender/editors/render/render_preview.cc +++ b/source/blender/editors/render/render_preview.cc @@ -1605,6 +1605,14 @@ static void icon_preview_startjob_all_sizes(void *customdata, continue; } +/* Workaround: Skip preview renders for linked IDs. Preview rendering can be slow and even + * freeze the UI (e.g. on Eevee shader compilation). And since the result will never be stored + * in a file, it's done every time the file is reloaded, so this becomes a frequent annoyance. + */ +if (!use_solid_render_mode && ip->id && ID_IS_LINKED(ip->id)) { + continue; +} + #ifndef NDEBUG { int size_index = icon_previewimg_size_index_get(cur_size, prv); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c464fd724b8] master: Fix T102697: Gpencil Subdiv modifier level increased
Commit: c464fd724b897eedade88bdf285546a9db08b3dc Author: Antonio Vazquez Date: Wed Nov 23 11:23:38 2022 +0100 Branches: master https://developer.blender.org/rBc464fd724b897eedade88bdf285546a9db08b3dc Fix T102697: Gpencil Subdiv modifier level increased The old hard limit was 5, but now it's possible set to a max value of 16. UI limit remains to 5. This extreme value is only used in some corner case, but it was a request by some artists. Warning: Using very high values could produce a long calculation time, especially in strokes with a high density of points. === M source/blender/makesrna/intern/rna_gpencil_modifier.c === diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index 320ef169ae5..6d5f52e0d73 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -1228,7 +1228,8 @@ static void rna_def_modifier_gpencilsubdiv(BlenderRNA *brna) prop = RNA_def_property(srna, "level", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "level"); - RNA_def_property_range(prop, 0, 5); + RNA_def_property_range(prop, 0, 16); + RNA_def_property_ui_range(prop, 0.0, 5.0, 1, 0); RNA_def_property_ui_text(prop, "Level", "Number of subdivisions"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [356373ff7af] master: Cleanup: move some data from bNodeSocket to run-time data
Commit: 356373ff7af9dcc976a0258e18e71fc13de545b9 Author: Jacques Lucke Date: Wed Nov 23 10:42:03 2022 +0100 Branches: master https://developer.blender.org/rB356373ff7af9dcc976a0258e18e71fc13de545b9 Cleanup: move some data from bNodeSocket to run-time data No functional changes are expected. === M source/blender/blenkernel/BKE_node_runtime.hh M source/blender/blenkernel/intern/node.cc M source/blender/editors/space_node/drawnode.cc M source/blender/editors/space_node/node_draw.cc M source/blender/editors/space_node/node_edit.cc M source/blender/editors/space_node/node_relationships.cc M source/blender/makesdna/DNA_node_types.h M source/blender/nodes/composite/node_composite_tree.cc M source/blender/nodes/composite/node_composite_util.cc M source/blender/nodes/intern/node_util.cc === diff --git a/source/blender/blenkernel/BKE_node_runtime.hh b/source/blender/blenkernel/BKE_node_runtime.hh index ea523da0c55..3e712ea6523 100644 --- a/source/blender/blenkernel/BKE_node_runtime.hh +++ b/source/blender/blenkernel/BKE_node_runtime.hh @@ -104,6 +104,19 @@ class bNodeSocketRuntime : NonCopyable, NonMovable { /** #eNodeTreeChangedFlag. */ uint32_t changed_flag = 0; + /** + * The location of the sockets, in the view-space of the node editor. + * \note Only calculated when drawing. + */ + float locx = 0; + float locy = 0; + + /* Runtime-only cache of the number of input links, for multi-input sockets. */ + short total_inputs = 0; + + /** Cached data from execution. */ + void *cache = nullptr; + /** Only valid when #topology_cache_is_dirty is false. */ Vector directly_linked_links; Vector directly_linked_sockets; diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index d8451cab0f5..e17c5e31a46 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -641,8 +641,6 @@ static void direct_link_node_socket(BlendDataReader *reader, bNodeSocket *sock) BLO_read_data_address(reader, &sock->storage); BLO_read_data_address(reader, &sock->default_value); BLO_read_data_address(reader, &sock->default_attribute_name); - sock->total_inputs = 0; /* Clear runtime data set before drawing. */ - sock->cache = nullptr; sock->runtime = MEM_new(__func__); } @@ -2262,7 +2260,7 @@ static void node_socket_copy(bNodeSocket *sock_dst, const bNodeSocket *sock_src, sock_dst->stack_index = 0; /* XXX some compositor nodes (e.g. image, render layers) still store * some persistent buffer data here, need to clear this to avoid dangling pointers. */ - sock_dst->cache = nullptr; + sock_dst->runtime->cache = nullptr; } namespace blender::bke { diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index 8fc4461cd9d..708efc0c7a6 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -1585,10 +1585,10 @@ static float2 socket_link_connection_location(const bNode &node, const bNodeSocket &socket, const bNodeLink &link) { - const float2 socket_location(socket.locx, socket.locy); + const float2 socket_location(socket.runtime->locx, socket.runtime->locy); if (socket.is_multi_input() && socket.is_input() && !(node.flag & NODE_HIDDEN)) { return node_link_calculate_multi_input_position( -socket_location, link.multi_input_socket_index, socket.total_inputs); +socket_location, link.multi_input_socket_index, socket.runtime->total_inputs); } return socket_location; } diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 3d553ff3b0b..71ff840bd1d 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -417,8 +417,8 @@ static void node_update_basis(const bContext &C, buty = min_ii(buty, dy - NODE_DY); /* Round the socket location to stop it from jiggling. */ -socket->locx = round(loc.x + NODE_WIDTH(node)); -socket->locy = round(dy - NODE_DYS); +socket->runtime->locx = round(loc.x + NODE_WIDTH(node)); +socket->runtime->locy = round(dy - NODE_DYS); dy = buty; if (socket->next) { @@ -511,8 +511,9 @@ static void node_update_basis(const bContext &C, * to account for the increased height of the taller sockets. */ float multi_input_socket_offset = 0.0f; if (socket->flag & SOCK_MULTI_INPUT) { - if (socket->total_inputs > 2) { -multi_input_socket_offset = (socket->total_inputs - 2) * NODE_MULTI_INPUT_LINK_GAP; + if (socket->runtime->total_inputs > 2) { +multi_input_socket_offset = (socket->runt
[Bf-blender-cvs] [5938e97a24c] master: Merge branch 'blender-v3.4-release'
Commit: 5938e97a24c9b0e8d84eb1ec0c17996f0c98bbc2 Author: Sergey Sharybin Date: Wed Nov 23 10:36:11 2022 +0100 Branches: master https://developer.blender.org/rB5938e97a24c9b0e8d84eb1ec0c17996f0c98bbc2 Merge branch 'blender-v3.4-release' === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0d73d5c1a24] blender-v3.4-release: Fix frozen image editor when Cycles compiles kernels
Commit: 0d73d5c1a2477bd7170fbb4306ec511ddcadefb1 Author: Sergey Sharybin Date: Tue Nov 22 18:59:32 2022 +0100 Branches: blender-v3.4-release https://developer.blender.org/rB0d73d5c1a2477bd7170fbb4306ec511ddcadefb1 Fix frozen image editor when Cycles compiles kernels It is possible that the image editor redraw happens prior to the "Loading render kernels" status is reported from status but after the display driver is created. This will make the image editor to wait on the scene mutex to update the display pass in the film. If it happens to be that the kernels are actually to be compiled then the Blender interface appears to be completely frozen, without any information line in the image editor. This change makes it so the amount of time the scene mutex is held during the kernel compilation is minimal. It is a bit unideal to unlock and re-lock the scene mutex in the middle of update, while nested reset mutex is held, but this is already what is needed for the OptiX denoiser optimization some lines below. We can probably reduce the lifetime of some locks, avoiding such potential out-of-order re-locking. Doing so is outside of the scope of this patch. The scene update only happens from the single place in the session, which makes it easy to ensure the kernels are loaded prior the rest of the scene update. Not only this change makes it so that the "Loading render kernels" status appears in the image editor, but also allows to pan and zoom in the image editor, potentially allowing artists to re-adjust their point of interest. Differential Revision: https://developer.blender.org/D16581 === M intern/cycles/scene/scene.cpp M intern/cycles/scene/scene.h M intern/cycles/session/session.cpp === diff --git a/intern/cycles/scene/scene.cpp b/intern/cycles/scene/scene.cpp index 3a05bede7a3..1a611b2a3db 100644 --- a/intern/cycles/scene/scene.cpp +++ b/intern/cycles/scene/scene.cpp @@ -488,6 +488,8 @@ void Scene::update_kernel_features() return; } + thread_scoped_lock scene_lock(mutex); + /* These features are not being tweaked as often as shaders, * so could be done selective magic for the viewport as well. */ uint kernel_features = shader_manager->get_kernel_features(this); @@ -574,9 +576,6 @@ bool Scene::update(Progress &progress) return false; } - /* Load render kernels, before device update where we upload data to the GPU. */ - load_kernels(progress, false); - /* Upload scene data to the GPU. */ progress.set_status("Updating Scene"); MEM_GUARDED_CALL(&progress, device_update, device, progress); @@ -616,13 +615,8 @@ static void log_kernel_features(const uint features) << "\n"; } -bool Scene::load_kernels(Progress &progress, bool lock_scene) +bool Scene::load_kernels(Progress &progress) { - thread_scoped_lock scene_lock; - if (lock_scene) { -scene_lock = thread_scoped_lock(mutex); - } - update_kernel_features(); const uint kernel_features = dscene.data.kernel_features; diff --git a/intern/cycles/scene/scene.h b/intern/cycles/scene/scene.h index d87cc37aafe..f2bc8f7b9f2 100644 --- a/intern/cycles/scene/scene.h +++ b/intern/cycles/scene/scene.h @@ -270,6 +270,7 @@ class Scene : public NodeOwner { void enable_update_stats(); + bool load_kernels(Progress &progress); bool update(Progress &progress); bool has_shadow_catcher(); @@ -333,7 +334,6 @@ class Scene : public NodeOwner { uint loaded_kernel_features; void update_kernel_features(); - bool load_kernels(Progress &progress, bool lock_scene = true); bool has_shadow_catcher_ = false; bool shadow_catcher_modified_ = true; diff --git a/intern/cycles/session/session.cpp b/intern/cycles/session/session.cpp index acaa55f4990..e5ece8dc0cb 100644 --- a/intern/cycles/session/session.cpp +++ b/intern/cycles/session/session.cpp @@ -378,6 +378,18 @@ RenderWork Session::run_update_for_next_iteration() const int width = max(1, buffer_params_.full_width / resolution); const int height = max(1, buffer_params_.full_height / resolution); +{ + /* Load render kernels, before device update where we upload data to the GPU. + * Do it outside of the scene mutex since the heavy part of the loading (i.e. kernel + * compilation) does not depend on the scene and some other functionality (like display + * driver) might be waiting on the scene mutex to synchronize display pass. + * + * The scene will lock itself for the short period if it needs to update kernel features. */ + scene_lock.unlock(); + scene->load_kernels(progress); + scene_lock.lock(); +} + if (update_scene(width, height)) { profiler.reset(scene->shaders.size(), scene->objects.size()); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.o
[Bf-blender-cvs] [01e479b7904] master: Cleanup: simplify removing asset code
Commit: 01e479b79041369e28a38cc8e2c844af0240e385 Author: Jacques Lucke Date: Wed Nov 23 10:04:24 2022 +0100 Branches: master https://developer.blender.org/rB01e479b79041369e28a38cc8e2c844af0240e385 Cleanup: simplify removing asset code Differential Revision: https://developer.blender.org/D16570 === M source/blender/asset_system/intern/asset_storage.cc === diff --git a/source/blender/asset_system/intern/asset_storage.cc b/source/blender/asset_system/intern/asset_storage.cc index d4dcc0ce73c..d21468a9c8e 100644 --- a/source/blender/asset_system/intern/asset_storage.cc +++ b/source/blender/asset_system/intern/asset_storage.cc @@ -29,29 +29,10 @@ AssetRepresentation &AssetStorage::add_external_asset(StringRef name, bool AssetStorage::remove_asset(AssetRepresentation &asset) { - auto remove_if_contained_fn = [&asset](StorageT &storage) { -/* Create a "fake" unique_ptr to figure out the hash for the pointed to asset representation. - * The standard requires that this is the same for all unique_ptr's wrapping the same address. - */ -std::unique_ptr fake_asset_ptr{&asset}; - -const std::unique_ptr *real_asset_ptr = storage.lookup_key_ptr_as( -fake_asset_ptr); -/* Make sure the contained storage is not destructed. */ -fake_asset_ptr.release(); - -if (!real_asset_ptr) { - return false; -} - -storage.remove_contained(*real_asset_ptr); -return true; - }; - - if (remove_if_contained_fn(local_id_assets_)) { + if (local_id_assets_.remove_as(&asset)) { return true; } - return remove_if_contained_fn(external_assets_); + return external_assets_.remove_as(&asset); } void AssetStorage::remap_ids_and_remove_invalid(const IDRemapper &mappings) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs