[Bf-blender-cvs] [bb8488c62c9] master: Cleanup: refactoring uvislands to prepare for python api

2022-08-07 Thread Chris Blackbourn
Commit: bb8488c62c9ae5a62e46c50d9e3a69d413c28ded
Author: Chris Blackbourn
Date:   Mon Aug 8 11:47:30 2022 +1200
Branches: master
https://developer.blender.org/rBbb8488c62c9ae5a62e46c50d9e3a69d413c28ded

Cleanup: refactoring uvislands to prepare for python api

Rename vert -> vertex.
Add `BM_uv_element_get_head`.

See also: D15598

===

M   source/blender/blenkernel/BKE_mesh_mapping.h
M   source/blender/editors/include/ED_mesh.h
M   source/blender/editors/mesh/editmesh_utils.c
M   source/blender/editors/sculpt_paint/sculpt_uv.c
M   source/blender/editors/uvedit/uvedit_smart_stitch.c

===

diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h 
b/source/blender/blenkernel/BKE_mesh_mapping.h
index 0c1839f9ac8..44588a06119 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -61,14 +61,16 @@ typedef struct UvElement {
  * the number of uvs per island.
  */
 typedef struct UvElementMap {
-  /* address UvElements by their vertex */
-  struct UvElement **vert;
   /** UvElement Storage. */
   struct UvElement *storage;
   /** Total number of UVs. */
   int total_uvs;
   /** Total number of unique UVs. */
   int total_unique_uvs;
+
+  /* If Non-NULL, address UvElements by `BM_elem_index_get(BMVert*)`. */
+  struct UvElement **vertex;
+
   /* Number of Islands in the mesh */
   int totalIslands;
   /* Stores the starting index in buf where each island begins */
diff --git a/source/blender/editors/include/ED_mesh.h 
b/source/blender/editors/include/ED_mesh.h
index 1981b069011..9d3fd5af47f 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -144,6 +144,7 @@ void BM_uv_element_map_free(struct UvElementMap 
*element_map);
 struct UvElement *BM_uv_element_get(struct UvElementMap *map,
 struct BMFace *efa,
 struct BMLoop *l);
+struct UvElement *BM_uv_element_get_head(struct UvElementMap *map, struct 
UvElement *child);
 
 /**
  * Can we edit UV's for this mesh?
diff --git a/source/blender/editors/mesh/editmesh_utils.c 
b/source/blender/editors/mesh/editmesh_utils.c
index 134532f0b21..78390db5349 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -732,25 +732,18 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm,
 
   BMVert *ev;
   BMFace *efa;
-  BMLoop *l;
   BMIter iter, liter;
-  /* vars from original func */
-  UvElementMap *element_map;
-  bool *winding = NULL;
   BLI_buffer_declare_static(vec2f, tf_uv_buf, BLI_BUFFER_NOP, 
BM_DEFAULT_NGON_STACK_SIZE);
-
   MLoopUV *luv;
-  int totverts, totfaces, i, totuv, j;
-
   const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
+  if (cd_loop_uv_offset < 0) {
+return NULL;
+  }
 
   BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE);
 
-  totfaces = bm->totface;
-  totverts = bm->totvert;
-  totuv = 0;
-
-  /* generate UvElement array */
+  /* Count total uvs. */
+  int totuv = 0;
   BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
 if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
   continue;
@@ -764,6 +757,7 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm,
   totuv += efa->len;
 }
 else {
+  BMLoop *l;
   BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
 if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) {
   totuv++;
@@ -776,18 +770,17 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm,
 return NULL;
   }
 
-  element_map = (UvElementMap *)MEM_callocN(sizeof(*element_map), 
"UvElementMap");
+  UvElementMap *element_map = (UvElementMap 
*)MEM_callocN(sizeof(*element_map), "UvElementMap");
   element_map->total_uvs = totuv;
-  element_map->vert = (UvElement **)MEM_callocN(sizeof(*element_map->vert) * 
totverts,
-"UvElementVerts");
+  element_map->vertex = (UvElement **)MEM_callocN(sizeof(*element_map->vertex) 
* bm->totvert,
+  "UvElementVerts");
   element_map->storage = (UvElement 
*)MEM_callocN(sizeof(*element_map->storage) * totuv,
   "UvElement");
 
-  if (use_winding) {
-winding = MEM_callocN(sizeof(*winding) * totfaces, "winding");
-  }
+  bool *winding = use_winding ? MEM_callocN(sizeof(*winding) * bm->totface, 
"winding") : NULL;
 
   UvElement *buf = element_map->storage;
+  int j;
   BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, j) {
 
 if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
@@ -804,18 +797,20 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm,
   tf_uv = (float(*)[2])BLI_buffer_reinit_data(&tf_uv_buf, vec2f, efa->len);
 }
 
+int i;
+BMLoop *l;
 BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
   

[Bf-blender-cvs] [9b924b2a23b] master: Fix: Typo in geometry node tooltip

2022-08-07 Thread Hans Goudey
Commit: 9b924b2a23b5e50cd3f02c2acfb575c70235d9ce
Author: Hans Goudey
Date:   Sun Aug 7 22:30:23 2022 -0500
Branches: master
https://developer.blender.org/rB9b924b2a23b5e50cd3f02c2acfb575c70235d9ce

Fix: Typo in geometry node tooltip

===

M   source/blender/nodes/NOD_static_types.h

===

diff --git a/source/blender/nodes/NOD_static_types.h 
b/source/blender/nodes/NOD_static_types.h
index 586d3e36177..786ce88152e 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -404,7 +404,7 @@ DefNode(GeometryNode, GEO_NODE_TRANSLATE_INSTANCES, 0, 
"TRANSLATE_INSTANCES",Tra
 DefNode(GeometryNode, GEO_NODE_TRIANGULATE, def_geo_triangulate, 
"TRIANGULATE", Triangulate, "Triangulate", "Convert all faces in a mesh to 
triangular faces")
 DefNode(GeometryNode, GEO_NODE_TRIM_CURVE, def_geo_curve_trim, "TRIM_CURVE", 
TrimCurve, "Trim Curve", "Shorten curves by removing portions at the start or 
end")
 DefNode(GeometryNode, GEO_NODE_UV_PACK_ISLANDS, 0, "UV_PACK_ISLANDS", 
UVPackIslands, "Pack UV Islands", "Scale islands of a UV map and move them so 
they fill the UV space as much as possible")
-DefNode(GeometryNode, GEO_NODE_UV_UNWRAP, def_geo_uv_unwrap, "UV_UNWRAP", 
UVUnwrap, "UV Unwrap", "Generate a UV map islands based on seam edges")
+DefNode(GeometryNode, GEO_NODE_UV_UNWRAP, def_geo_uv_unwrap, "UV_UNWRAP", 
UVUnwrap, "UV Unwrap", "Generate a UV map based on seam edges")
 DefNode(GeometryNode, GEO_NODE_VIEWER, def_geo_viewer, "VIEWER", Viewer, 
"Viewer", "Display the input data in the Spreadsheet Editor")
 DefNode(GeometryNode, GEO_NODE_VOLUME_CUBE, 0, "VOLUME_CUBE", VolumeCube, 
"Volume Cube", "Generate a dense volume with a field that controls the density 
at each grid voxel based on its position")
 DefNode(GeometryNode, GEO_NODE_VOLUME_TO_MESH, def_geo_volume_to_mesh, 
"VOLUME_TO_MESH", VolumeToMesh, "Volume to Mesh", "Generate a mesh on the 
\"surface\" of a volume")

___
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] [64984126a2b] master: Cleanup: refactoring uvislands to prepare for python api

2022-08-07 Thread Chris Blackbourn
Commit: 64984126a2b688a4bdd64bea4bcac1091756adab
Author: Chris Blackbourn
Date:   Mon Aug 8 10:15:13 2022 +1200
Branches: master
https://developer.blender.org/rB64984126a2b688a4bdd64bea4bcac1091756adab

Cleanup: refactoring uvislands to prepare for python api

Rename buf -> storage.

See also: D15598

===

M   source/blender/blenkernel/BKE_mesh_mapping.h
M   source/blender/editors/mesh/editmesh_utils.c
M   source/blender/editors/sculpt_paint/sculpt_uv.c
M   source/blender/editors/uvedit/uvedit_ops.c
M   source/blender/editors/uvedit/uvedit_smart_stitch.c

===

diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h 
b/source/blender/blenkernel/BKE_mesh_mapping.h
index f9dda7f5737..0c1839f9ac8 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -17,11 +17,10 @@ struct MLoopUV;
 struct MPoly;
 struct MVert;
 
-/* map from uv vertex to face (for select linked, stitch, uv suburf) */
-
 /* UvVertMap */
 #define STD_UV_CONNECT_LIMIT 0.0001f
 
+/* Map from uv vertex to face. Used by select linked, uv subsurf and obj 
exporter. */
 typedef struct UvVertMap {
   struct UvMapVert **vert;
   struct UvMapVert *buf;
@@ -64,8 +63,8 @@ typedef struct UvElement {
 typedef struct UvElementMap {
   /* address UvElements by their vertex */
   struct UvElement **vert;
-  /* UvElement Store */
-  struct UvElement *buf;
+  /** UvElement Storage. */
+  struct UvElement *storage;
   /** Total number of UVs. */
   int total_uvs;
   /** Total number of unique UVs. */
diff --git a/source/blender/editors/mesh/editmesh_utils.c 
b/source/blender/editors/mesh/editmesh_utils.c
index fb7120b19ae..134532f0b21 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -603,7 +603,7 @@ static void bm_uv_assign_island(UvElementMap *element_map,
 int islandbufsize)
 {
   element->island = nisland;
-  map[element - element_map->buf] = islandbufsize;
+  map[element - element_map->storage] = islandbufsize;
 
   /* Copy *element to islandbuf[islandbufsize]. */
   islandbuf[islandbufsize].l = element->l;
@@ -625,11 +625,11 @@ static int bm_uv_edge_select_build_islands(UvElementMap 
*element_map,
   /* For each UvElement, locate the "separate" UvElement that precedes it in 
the linked list. */
   UvElement **head_table = MEM_mallocN(sizeof(*head_table) * total_uvs, 
"uv_island_head_table");
   for (int i = 0; i < total_uvs; i++) {
-UvElement *head = element_map->buf + i;
+UvElement *head = element_map->storage + i;
 if (head->separate) {
   UvElement *element = head;
   while (element) {
-head_table[element - element_map->buf] = head;
+head_table[element - element_map->storage] = head;
 element = element->next;
 if (element && element->separate) {
   break;
@@ -646,7 +646,7 @@ static int bm_uv_edge_select_build_islands(UvElementMap 
*element_map,
  "uv_island_element_stack");
   int stacksize_uv = 0;
   for (int i = 0; i < total_uvs; i++) {
-UvElement *element = element_map->buf + i;
+UvElement *element = element_map->storage + i;
 if (element->island != INVALID_ISLAND) {
   /* Unique UV (element and all it's children) are already part of an 
island. */
   continue;
@@ -676,7 +676,7 @@ static int bm_uv_edge_select_build_islands(UvElementMap 
*element_map,
 if (!uv_selected || uvedit_edge_select_test(scene, element->l, 
cd_loop_uv_offset)) {
   UvElement *next = BM_uv_element_get(element_map, 
element->l->next->f, element->l->next);
   if (next->island == INVALID_ISLAND) {
-UvElement *tail = head_table[next - element_map->buf];
+UvElement *tail = head_table[next - element_map->storage];
 stack_uv[stacksize_uv++] = tail;
 while (tail) {
   bm_uv_assign_island(element_map, tail, nislands, map, islandbuf, 
islandbufsize++);
@@ -692,7 +692,7 @@ static int bm_uv_edge_select_build_islands(UvElementMap 
*element_map,
 if (!uv_selected || uvedit_edge_select_test(scene, element->l->prev, 
cd_loop_uv_offset)) {
   UvElement *prev = BM_uv_element_get(element_map, 
element->l->prev->f, element->l->prev);
   if (prev->island == INVALID_ISLAND) {
-UvElement *tail = head_table[prev - element_map->buf];
+UvElement *tail = head_table[prev - element_map->storage];
 stack_uv[stacksize_uv++] = tail;
 while (tail) {
   bm_uv_assign_island(element_map, tail, nislands, map, islandbuf, 
islandbufsize++);
@@ -736,7 +736,6 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm,
   BMIter iter, liter;
   /* vars from original func */
   UvElementMap *element_map;
-  UvElement *buf;
   bool *winding = NULL;
   BL

[Bf-blender-cvs] [387e7e9e8d0] master: Merge branch 'blender-v3.3-release'

2022-08-07 Thread Xavier Hallade
Commit: 387e7e9e8d0163750e2b4d97369f76c14cc021fd
Author: Xavier Hallade
Date:   Sun Aug 7 23:08:34 2022 +0200
Branches: master
https://developer.blender.org/rB387e7e9e8d0163750e2b4d97369f76c14cc021fd

Merge branch 'blender-v3.3-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] [e4938b163ea] blender-v3.3-release: Cycles: re-enable zebin format for Intel GPUs on Linux

2022-08-07 Thread Xavier Hallade
Commit: e4938b163ea60d0738a84b5bd623e5239816ee2f
Author: Xavier Hallade
Date:   Sun Aug 7 22:54:15 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBe4938b163ea60d0738a84b5bd623e5239816ee2f

Cycles: re-enable zebin format for Intel GPUs on Linux

zebin format is critical for the compatibility of AoT graphics binaries
across driver versions. It was previously disabled on Linux due to
runtime issues that are now fixed in
https://github.com/intel/compute-runtime/releases/tag/22.31.23852.
The minimum supported driver version isn't bumped to this one yet as
current codebase with current IGC compiler does actually run fine on
earlier drivers and is not running into these issues anymore.

===

M   intern/cycles/kernel/CMakeLists.txt

===

diff --git a/intern/cycles/kernel/CMakeLists.txt 
b/intern/cycles/kernel/CMakeLists.txt
index 8ecdac6ee27..96b5842b77d 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -751,10 +751,8 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
   if (NOT DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen)
 SET (CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen 
"${CYCLES_ONEAPI_SYCL_OPTIONS_spir64}" CACHE STRING "Extra build options for 
spir64_gen target")
   endif()
-  # enabling zebin (graphics binary format with improved compatibility) on 
Windows only while support on Linux isn't available yet
-  if(WIN32)
-string(PREPEND CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "--format zebin ")
-  endif()
+  # Enable zebin, a graphics binary format with improved compatibility.
+  string(PREPEND CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "--format zebin ")
   string(PREPEND CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "-device 
${CYCLES_ONEAPI_SPIR64_GEN_DEVICES} ")
 
   if (WITH_CYCLES_ONEAPI_BINARIES)

___
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] [344c53561aa] blender-v3.3-release: Fix: Incorrect field node deduplication for shortest path nodes

2022-08-07 Thread Hans Goudey
Commit: 344c53561aa8bc76091f5587e2d467f58d09ff23
Author: Hans Goudey
Date:   Sun Aug 7 14:38:17 2022 -0500
Branches: blender-v3.3-release
https://developer.blender.org/rB344c53561aa8bc76091f5587e2d467f58d09ff23

Fix: Incorrect field node deduplication for shortest path nodes

Mistake in c8ae1fce6024556b72c.

===

M   source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc
M   
source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc

===

diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc 
b/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc
index efdf0911ec9..53cbd691fdb 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc
@@ -110,7 +110,12 @@ class PathToEdgeSelectionFieldInput final : public 
GeometryFieldInput {
 
   bool is_equal_to(const fn::FieldNode &other) const override
   {
-return dynamic_cast(&other) != 
nullptr;
+if (const PathToEdgeSelectionFieldInput *other_field =
+dynamic_cast(&other)) {
+  return other_field->start_vertices_ == start_vertices_ &&
+ other_field->next_vertex_ == next_vertex_;
+}
+return false;
   }
 };
 
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc 
b/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc
index 89abaca3c66..ca6406d2810 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc
@@ -148,7 +148,11 @@ class ShortestEdgePathsNextVertFieldInput final : public 
GeometryFieldInput {
 
   bool is_equal_to(const fn::FieldNode &other) const override
   {
-return dynamic_cast(&other) 
!= nullptr;
+if (const ShortestEdgePathsNextVertFieldInput *other_field =
+dynamic_cast(&other)) 
{
+  return other_field->end_selection_ == end_selection_ && 
other_field->cost_ == cost_;
+}
+return false;
   }
 };
 
@@ -215,7 +219,11 @@ class ShortestEdgePathsCostFieldInput final : public 
GeometryFieldInput {
 
   bool is_equal_to(const fn::FieldNode &other) const override
   {
-return dynamic_cast(&other) != 
nullptr;
+if (const ShortestEdgePathsCostFieldInput *other_field =
+dynamic_cast(&other)) {
+  return other_field->end_selection_ == end_selection_ && 
other_field->cost_ == cost_;
+}
+return false;
   }
 };

___
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] [341e9f7a7c4] master: Revert "Parallelize remesh reprojects"

2022-08-07 Thread Erik Abrahamsson
Commit: 341e9f7a7c422f13211d514d529e3df764337385
Author: Erik Abrahamsson
Date:   Sun Aug 7 20:09:20 2022 +0200
Branches: master
https://developer.blender.org/rB341e9f7a7c422f13211d514d529e3df764337385

Revert "Parallelize remesh reprojects"

This reverts commit 34009dfb2390f6084fc6d782309e0d7a4210f262.
This was committed by accident an does not belong in master.

===

M   source/blender/blenkernel/intern/mesh_remesh_voxel.cc

===

diff --git a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc 
b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
index 2fa11834818..85aed01ce52 100644
--- a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
+++ b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
@@ -19,7 +19,6 @@
 #include "BLI_math_vec_types.hh"
 #include "BLI_math_vector.h"
 #include "BLI_span.hh"
-#include "BLI_task.hh"
 
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
@@ -300,20 +299,17 @@ void BKE_mesh_remesh_reproject_paint_mask(Mesh *target, 
Mesh *source)
 &source->vdata, CD_PAINT_MASK, CD_CALLOC, nullptr, source->totvert);
   }
 
-  blender::threading::parallel_for(IndexRange(target->totvert), 4096, 
[&](const IndexRange range) {
-for (const int i : range) {
-  float from_co[3];
-  BVHTreeNearest nearest;
-  nearest.index = -1;
-  nearest.dist_sq = FLT_MAX;
-  copy_v3_v3(from_co, target_verts[i].co);
-  BLI_bvhtree_find_nearest(
-  bvhtree.tree, from_co, &nearest, bvhtree.nearest_callback, &bvhtree);
-  if (nearest.index != -1) {
-target_mask[i] = source_mask[nearest.index];
-  }
+  for (int i = 0; i < target->totvert; i++) {
+float from_co[3];
+BVHTreeNearest nearest;
+nearest.index = -1;
+nearest.dist_sq = FLT_MAX;
+copy_v3_v3(from_co, target_verts[i].co);
+BLI_bvhtree_find_nearest(bvhtree.tree, from_co, &nearest, 
bvhtree.nearest_callback, &bvhtree);
+if (nearest.index != -1) {
+  target_mask[i] = source_mask[nearest.index];
 }
-  });
+  }
   free_bvhtree_from_mesh(&bvhtree);
 }
 
@@ -346,24 +342,21 @@ void BKE_remesh_reproject_sculpt_face_sets(Mesh *target, 
Mesh *source)
   const MLoopTri *looptri = BKE_mesh_runtime_looptri_ensure(source);
   BKE_bvhtree_from_mesh_get(&bvhtree, source, BVHTREE_FROM_LOOPTRI, 2);
 
-  blender::threading::parallel_for(IndexRange(target->totpoly), 2048, 
[&](const IndexRange range) {
-for (const int i : range) {
-  float from_co[3];
-  BVHTreeNearest nearest;
-  nearest.index = -1;
-  nearest.dist_sq = FLT_MAX;
-  const MPoly *mpoly = &target_polys[i];
-  BKE_mesh_calc_poly_center(mpoly, &target_loops[mpoly->loopstart], 
target_verts, from_co);
-  BLI_bvhtree_find_nearest(
-  bvhtree.tree, from_co, &nearest, bvhtree.nearest_callback, &bvhtree);
-  if (nearest.index != -1) {
-target_face_sets[i] = source_face_sets[looptri[nearest.index].poly];
-  }
-  else {
-target_face_sets[i] = 1;
-  }
+  for (int i = 0; i < target->totpoly; i++) {
+float from_co[3];
+BVHTreeNearest nearest;
+nearest.index = -1;
+nearest.dist_sq = FLT_MAX;
+const MPoly *mpoly = &target_polys[i];
+BKE_mesh_calc_poly_center(mpoly, &target_loops[mpoly->loopstart], 
target_verts, from_co);
+BLI_bvhtree_find_nearest(bvhtree.tree, from_co, &nearest, 
bvhtree.nearest_callback, &bvhtree);
+if (nearest.index != -1) {
+  target_face_sets[i] = source_face_sets[looptri[nearest.index].poly];
 }
-  });
+else {
+  target_face_sets[i] = 1;
+}
+  }
   free_bvhtree_from_mesh(&bvhtree);
 }
 
@@ -403,22 +396,19 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, 
const Mesh *source)
 MVert *target_verts = (MVert *)CustomData_get_layer(&target->vdata, 
CD_MVERT);
 
 if (domain == ATTR_DOMAIN_POINT) {
-  blender::threading::parallel_for(
-  IndexRange(target->totvert), 4096, [&](const IndexRange range) {
-for (const int i : range) {
-  BVHTreeNearest nearest;
-  nearest.index = -1;
-  nearest.dist_sq = FLT_MAX;
-  BLI_bvhtree_find_nearest(
-  bvhtree.tree, target_verts[i].co, &nearest, 
bvhtree.nearest_callback, &bvhtree);
-
-  if (nearest.index != -1) {
-memcpy(POINTER_OFFSET(target_data, (size_t)i * data_size),
-   POINTER_OFFSET(source_data, (size_t)nearest.index * 
data_size),
-   data_size);
-  }
-}
-  });
+  for (int i = 0; i < target->totvert; i++) {
+BVHTreeNearest nearest;
+nearest.index = -1;
+nearest.dist_sq = FLT_MAX;
+BLI_bvhtree_find_nearest(
+bvhtree.tree, target_verts[i].co, &nearest, 
bvhtree.nearest_callback, &bvhtree);
+
+if (nearest.index != -1) {
+  memcpy(POINTER_

[Bf-blender-cvs] [e2079303503] master: Revert "Update grain size"

2022-08-07 Thread Erik Abrahamsson
Commit: e2079303503cecb2a2404117214ffba3e5906323
Author: Erik Abrahamsson
Date:   Sun Aug 7 20:08:53 2022 +0200
Branches: master
https://developer.blender.org/rBe2079303503cecb2a2404117214ffba3e5906323

Revert "Update grain size"

This reverts commit 31674b9d141ccd5bc310b638828d4e1cce6546a5.
This was committed by accident an does not belong in master.

===

M   source/blender/blenkernel/intern/mesh_remesh_voxel.cc

===

diff --git a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc 
b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
index 470cc80dc48..2fa11834818 100644
--- a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
+++ b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
@@ -446,7 +446,7 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, const 
Mesh *source)
   }
 
   blender::threading::parallel_for(
-  IndexRange(target->totvert), 4096, [&](const IndexRange range) {
+  IndexRange(target->totvert), 2048, [&](const IndexRange range) {
 for (const int i : range) {
   BVHTreeNearest nearest;
   nearest.index = -1;

___
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] [6e8709caa37] master: Cleanup: Fix typo Propatation -> Propagation

2022-08-07 Thread Erik Abrahamsson
Commit: 6e8709caa374335447b7ac4ad201396cc81423b0
Author: Erik Abrahamsson
Date:   Sun Aug 7 19:48:28 2022 +0200
Branches: master
https://developer.blender.org/rB6e8709caa374335447b7ac4ad201396cc81423b0

Cleanup: Fix typo Propatation -> Propagation

Fixes the typo in the struct `DefaultPropatationMixerStruct`.

===

M   source/blender/blenkernel/BKE_attribute_math.hh
M   source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc

===

diff --git a/source/blender/blenkernel/BKE_attribute_math.hh 
b/source/blender/blenkernel/BKE_attribute_math.hh
index 0a8e013abf2..770937688d7 100644
--- a/source/blender/blenkernel/BKE_attribute_math.hh
+++ b/source/blender/blenkernel/BKE_attribute_math.hh
@@ -464,12 +464,12 @@ template<> struct DefaultMixerStruct {
   using type = SimpleMixerWithAccumulationType;
 };
 
-template struct DefaultPropatationMixerStruct {
+template struct DefaultPropagationMixerStruct {
   /* Use void by default. This can be checked for in `if constexpr` 
statements. */
   using type = typename DefaultMixerStruct::type;
 };
 
-template<> struct DefaultPropatationMixerStruct {
+template<> struct DefaultPropagationMixerStruct {
   using type = BooleanPropagationMixer;
 };
 
@@ -479,7 +479,7 @@ template<> struct DefaultPropatationMixerStruct {
  * (the default mixing for booleans).
  */
 template
-using DefaultPropatationMixer = typename 
DefaultPropatationMixerStruct::type;
+using DefaultPropagationMixer = typename 
DefaultPropagationMixerStruct::type;
 
 /* Utility to get a good default mixer for a given type. This is `void` when 
there is no default
  * mixer for the given type. */
diff --git a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc 
b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
index acf85e74353..024dbd1c852 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
@@ -225,7 +225,7 @@ template
 void copy_with_mixing(MutableSpan dst, Span src, GetMixIndicesFn 
get_mix_indices_fn)
 {
   threading::parallel_for(dst.index_range(), 512, [&](const IndexRange range) {
-attribute_math::DefaultPropatationMixer mixer{dst.slice(range)};
+attribute_math::DefaultPropagationMixer mixer{dst.slice(range)};
 for (const int i_dst : IndexRange(range.size())) {
   for (const int i_src : get_mix_indices_fn(range[i_dst])) {
 mixer.mix_in(i_dst, src[i_src]);
@@ -437,7 +437,7 @@ static void extrude_mesh_edges(MeshComponent &component,
   Array vert_offsets;
   if (!edge_offsets.is_single()) {
 vert_offsets.reinitialize(orig_vert_size);
-attribute_math::DefaultPropatationMixer mixer(vert_offsets);
+attribute_math::DefaultPropagationMixer mixer(vert_offsets);
 for (const int i_edge : edge_selection) {
   const MEdge &edge = orig_edges[i_edge];
   const float3 offset = edge_offsets[i_edge];
@@ -583,7 +583,7 @@ static void extrude_mesh_edges(MeshComponent &component,
   /* Both corners on each vertical edge of the side polygon get 
the same value,
* so there are only two unique values to mix. */
   Array side_poly_corner_data(2);
-  attribute_math::DefaultPropatationMixer 
mixer{side_poly_corner_data};
+  attribute_math::DefaultPropagationMixer 
mixer{side_poly_corner_data};
 
   const MEdge &duplicate_edge = duplicate_edges[i_edge_selection];
   const int new_vert_1 = duplicate_edge.v1;
@@ -705,7 +705,7 @@ static void extrude_mesh_face_regions(MeshComponent 
&component,
   Array vert_offsets;
   if (!poly_offsets.is_single()) {
 vert_offsets.reinitialize(orig_vert_size);
-attribute_math::DefaultPropatationMixer mixer(vert_offsets);
+attribute_math::DefaultPropagationMixer mixer(vert_offsets);
 for (const int i_poly : poly_selection) {
   const MPoly &poly = orig_polys[i_poly];
   const float3 offset = poly_offsets[i_poly];

___
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] [34009dfb239] master: Parallelize remesh reprojects

2022-08-07 Thread Erik Abrahamsson
Commit: 34009dfb2390f6084fc6d782309e0d7a4210f262
Author: Erik Abrahamsson
Date:   Sat Aug 6 09:30:33 2022 +0200
Branches: master
https://developer.blender.org/rB34009dfb2390f6084fc6d782309e0d7a4210f262

Parallelize remesh reprojects

Differential Revision: https://developer.blender.org/D15638

===

M   source/blender/blenkernel/intern/mesh_remesh_voxel.cc

===

diff --git a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc 
b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
index 85aed01ce52..2fa11834818 100644
--- a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
+++ b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
@@ -19,6 +19,7 @@
 #include "BLI_math_vec_types.hh"
 #include "BLI_math_vector.h"
 #include "BLI_span.hh"
+#include "BLI_task.hh"
 
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
@@ -299,17 +300,20 @@ void BKE_mesh_remesh_reproject_paint_mask(Mesh *target, 
Mesh *source)
 &source->vdata, CD_PAINT_MASK, CD_CALLOC, nullptr, source->totvert);
   }
 
-  for (int i = 0; i < target->totvert; i++) {
-float from_co[3];
-BVHTreeNearest nearest;
-nearest.index = -1;
-nearest.dist_sq = FLT_MAX;
-copy_v3_v3(from_co, target_verts[i].co);
-BLI_bvhtree_find_nearest(bvhtree.tree, from_co, &nearest, 
bvhtree.nearest_callback, &bvhtree);
-if (nearest.index != -1) {
-  target_mask[i] = source_mask[nearest.index];
+  blender::threading::parallel_for(IndexRange(target->totvert), 4096, 
[&](const IndexRange range) {
+for (const int i : range) {
+  float from_co[3];
+  BVHTreeNearest nearest;
+  nearest.index = -1;
+  nearest.dist_sq = FLT_MAX;
+  copy_v3_v3(from_co, target_verts[i].co);
+  BLI_bvhtree_find_nearest(
+  bvhtree.tree, from_co, &nearest, bvhtree.nearest_callback, &bvhtree);
+  if (nearest.index != -1) {
+target_mask[i] = source_mask[nearest.index];
+  }
 }
-  }
+  });
   free_bvhtree_from_mesh(&bvhtree);
 }
 
@@ -342,21 +346,24 @@ void BKE_remesh_reproject_sculpt_face_sets(Mesh *target, 
Mesh *source)
   const MLoopTri *looptri = BKE_mesh_runtime_looptri_ensure(source);
   BKE_bvhtree_from_mesh_get(&bvhtree, source, BVHTREE_FROM_LOOPTRI, 2);
 
-  for (int i = 0; i < target->totpoly; i++) {
-float from_co[3];
-BVHTreeNearest nearest;
-nearest.index = -1;
-nearest.dist_sq = FLT_MAX;
-const MPoly *mpoly = &target_polys[i];
-BKE_mesh_calc_poly_center(mpoly, &target_loops[mpoly->loopstart], 
target_verts, from_co);
-BLI_bvhtree_find_nearest(bvhtree.tree, from_co, &nearest, 
bvhtree.nearest_callback, &bvhtree);
-if (nearest.index != -1) {
-  target_face_sets[i] = source_face_sets[looptri[nearest.index].poly];
-}
-else {
-  target_face_sets[i] = 1;
+  blender::threading::parallel_for(IndexRange(target->totpoly), 2048, 
[&](const IndexRange range) {
+for (const int i : range) {
+  float from_co[3];
+  BVHTreeNearest nearest;
+  nearest.index = -1;
+  nearest.dist_sq = FLT_MAX;
+  const MPoly *mpoly = &target_polys[i];
+  BKE_mesh_calc_poly_center(mpoly, &target_loops[mpoly->loopstart], 
target_verts, from_co);
+  BLI_bvhtree_find_nearest(
+  bvhtree.tree, from_co, &nearest, bvhtree.nearest_callback, &bvhtree);
+  if (nearest.index != -1) {
+target_face_sets[i] = source_face_sets[looptri[nearest.index].poly];
+  }
+  else {
+target_face_sets[i] = 1;
+  }
 }
-  }
+  });
   free_bvhtree_from_mesh(&bvhtree);
 }
 
@@ -396,19 +403,22 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, 
const Mesh *source)
 MVert *target_verts = (MVert *)CustomData_get_layer(&target->vdata, 
CD_MVERT);
 
 if (domain == ATTR_DOMAIN_POINT) {
-  for (int i = 0; i < target->totvert; i++) {
-BVHTreeNearest nearest;
-nearest.index = -1;
-nearest.dist_sq = FLT_MAX;
-BLI_bvhtree_find_nearest(
-bvhtree.tree, target_verts[i].co, &nearest, 
bvhtree.nearest_callback, &bvhtree);
-
-if (nearest.index != -1) {
-  memcpy(POINTER_OFFSET(target_data, (size_t)i * data_size),
- POINTER_OFFSET(source_data, (size_t)nearest.index * 
data_size),
- data_size);
-}
-  }
+  blender::threading::parallel_for(
+  IndexRange(target->totvert), 4096, [&](const IndexRange range) {
+for (const int i : range) {
+  BVHTreeNearest nearest;
+  nearest.index = -1;
+  nearest.dist_sq = FLT_MAX;
+  BLI_bvhtree_find_nearest(
+  bvhtree.tree, target_verts[i].co, &nearest, 
bvhtree.nearest_callback, &bvhtree);
+
+  if (nearest.index != -1) {
+memcpy(POINTER_OFFSET(target_data, (size_t)i * data_size),
+   POINTER_OFFSET(source_data, (size_t)nearest

[Bf-blender-cvs] [31674b9d141] master: Update grain size

2022-08-07 Thread Erik Abrahamsson
Commit: 31674b9d141ccd5bc310b638828d4e1cce6546a5
Author: Erik Abrahamsson
Date:   Sat Aug 6 09:34:22 2022 +0200
Branches: master
https://developer.blender.org/rB31674b9d141ccd5bc310b638828d4e1cce6546a5

Update grain size

===

M   source/blender/blenkernel/intern/mesh_remesh_voxel.cc

===

diff --git a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc 
b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
index 2fa11834818..470cc80dc48 100644
--- a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
+++ b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
@@ -446,7 +446,7 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, const 
Mesh *source)
   }
 
   blender::threading::parallel_for(
-  IndexRange(target->totvert), 2048, [&](const IndexRange range) {
+  IndexRange(target->totvert), 4096, [&](const IndexRange range) {
 for (const int i : range) {
   BVHTreeNearest nearest;
   nearest.index = -1;

___
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] [605c311b1bb] temp-eevee-next-cryptomatte: Eevee next: Cryptomatte Initial Commit.

2022-08-07 Thread Jeroen Bakker
Commit: 605c311b1bb55bb6d5ff3ac2f5d7b9ebb38fd3c0
Author: Jeroen Bakker
Date:   Sun Aug 7 16:34:17 2022 +0200
Branches: temp-eevee-next-cryptomatte
https://developer.blender.org/rB605c311b1bb55bb6d5ff3ac2f5d7b9ebb38fd3c0

Eevee next: Cryptomatte Initial Commit.

Mostly setting op data structures and data transformations.

===

M   source/blender/blenkernel/intern/cryptomatte.cc
M   source/blender/draw/CMakeLists.txt
A   source/blender/draw/engines/eevee_next/eevee_cryptomatte.cc
A   source/blender/draw/engines/eevee_next/eevee_cryptomatte.hh
M   source/blender/draw/engines/eevee_next/eevee_film.cc
M   source/blender/draw/engines/eevee_next/eevee_film.hh
M   source/blender/draw/engines/eevee_next/eevee_instance.cc
M   source/blender/draw/engines/eevee_next/eevee_pipeline.cc
M   source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc
M   source/blender/draw/engines/eevee_next/eevee_renderbuffers.hh
M   source/blender/draw/engines/eevee_next/eevee_shader_shared.hh
M   source/blender/draw/engines/eevee_next/shaders/infos/eevee_film_info.hh
M   source/blender/makesdna/DNA_layer_types.h
M   source/blender/makesdna/DNA_scene_types.h

===

diff --git a/source/blender/blenkernel/intern/cryptomatte.cc 
b/source/blender/blenkernel/intern/cryptomatte.cc
index 102bda0f2b6..bb1e3bce92c 100644
--- a/source/blender/blenkernel/intern/cryptomatte.cc
+++ b/source/blender/blenkernel/intern/cryptomatte.cc
@@ -54,13 +54,15 @@ struct CryptomatteSession {
 CryptomatteSession::CryptomatteSession(const Main *bmain)
 {
   if (!BLI_listbase_is_empty(&bmain->objects)) {
-blender::bke::cryptomatte::CryptomatteLayer &objects = 
add_layer("CryptoObject");
+blender::bke::cryptomatte::CryptomatteLayer &objects = add_layer(
+RE_PASSNAME_CRYPTOMATTE_OBJECT);
 LISTBASE_FOREACH (ID *, id, &bmain->objects) {
   objects.add_ID(*id);
 }
   }
   if (!BLI_listbase_is_empty(&bmain->materials)) {
-blender::bke::cryptomatte::CryptomatteLayer &materials = 
add_layer("CryptoMaterial");
+blender::bke::cryptomatte::CryptomatteLayer &materials = add_layer(
+RE_PASSNAME_CRYPTOMATTE_MATERIAL);
 LISTBASE_FOREACH (ID *, id, &bmain->materials) {
   materials.add_ID(*id);
 }
@@ -93,13 +95,13 @@ CryptomatteSession::CryptomatteSession(const Scene *scene)
 }
 
 if (cryptoflags & VIEW_LAYER_CRYPTOMATTE_OBJECT) {
-  add_layer(blender::StringRefNull(view_layer->name) + ".CryptoObject");
+  add_layer(blender::StringRefNull(view_layer->name) + "." + 
RE_PASSNAME_CRYPTOMATTE_OBJECT);
 }
 if (cryptoflags & VIEW_LAYER_CRYPTOMATTE_ASSET) {
-  add_layer(blender::StringRefNull(view_layer->name) + ".CryptoAsset");
+  add_layer(blender::StringRefNull(view_layer->name) + "." + 
RE_PASSNAME_CRYPTOMATTE_ASSET);
 }
 if (cryptoflags & VIEW_LAYER_CRYPTOMATTE_MATERIAL) {
-  add_layer(blender::StringRefNull(view_layer->name) + ".CryptoMaterial");
+  add_layer(blender::StringRefNull(view_layer->name) + "." + 
RE_PASSNAME_CRYPTOMATTE_MATERIAL);
 }
   }
 }
diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index c34a6daa126..7d10563147e 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -134,6 +134,7 @@ set(SRC
   engines/eevee/eevee_temporal_sampling.c
   engines/eevee/eevee_volumes.c
   engines/eevee_next/eevee_camera.cc
+  engines/eevee_next/eevee_cryptomatte.cc
   engines/eevee_next/eevee_depth_of_field.cc
   engines/eevee_next/eevee_engine.cc
   engines/eevee_next/eevee_film.cc
diff --git a/source/blender/draw/engines/eevee_next/eevee_cryptomatte.cc 
b/source/blender/draw/engines/eevee_next/eevee_cryptomatte.cc
new file mode 100644
index 000..e69de29bb2d
diff --git a/source/blender/draw/engines/eevee_next/eevee_cryptomatte.hh 
b/source/blender/draw/engines/eevee_next/eevee_cryptomatte.hh
new file mode 100644
index 000..8566c76a0e9
--- /dev/null
+++ b/source/blender/draw/engines/eevee_next/eevee_cryptomatte.hh
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright 2021 Blender Foundation.
+ */
+
+/** \file
+ * \ingroup eevee
+ *
+ * Cryptomatte.
+ *
+ * Cryptomatte stores the output during rendering in a single texture.
+ * Inside the film the output is extracted per enabled cryptomatte layer.
+ * Each cryptomatte layer can hold N samples. These are stored in multiple
+ * sequentially bound textures. The samples are sorted and merged.
+ */
+
+#pragma once
+
+#include "eevee_shader_shared.hh"
+
+namespace blender::eevee {
+
+class Instance;
+
+/*  */
+/** \name Cryptomatte
+ * \{ */
+
+class Cryptomatte {
+ private:
+  class Instance &inst_;
+
+ public:
+  DepthOfField(Instance &inst) : inst_(inst){};
+  ~DepthOfFie