[Bf-blender-cvs] [850aa3d26a2] geometry-nodes-simulation: Allow multiple caches in the same node group

2022-12-02 Thread Hans Goudey
Commit: 850aa3d26a2b38efa04ff233f1df675bcd76673a
Author: Hans Goudey
Date:   Fri Dec 2 16:13:18 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB850aa3d26a2b38efa04ff233f1df675bcd76673a

Allow multiple caches in the same node group

The caches now hash the identifier of the output node as well.

===

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 33b7f7f3b59..8af09d96618 100644
--- a/source/blender/blenkernel/BKE_compute_cache.hh
+++ b/source/blender/blenkernel/BKE_compute_cache.hh
@@ -131,10 +131,6 @@ 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 3e9be29050c..a9555d27693 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include "BKE_compute_cache.hh"
+#include "BKE_compute_contexts.hh"
 #include "BKE_scene.h"
 
 #include "DEG_depsgraph_query.h"
@@ -66,14 +67,18 @@ static void node_init(bNodeTree *tree, bNode *node)
 
 static void node_geo_exec(GeoNodeExecParams params)
 {
-  // const NodeGeometrySimulationInput &storage = node_storage(params.node());
+  const NodeGeometrySimulationInput &storage = node_storage(params.node());
+  const int32_t sim_output_node_id = storage.output_node_id;
+
   const Scene *scene = DEG_get_input_scene(params.depsgraph());
   const float scene_ctime = BKE_scene_ctime_get(scene);
   const int scene_frame = int(scene_ctime);
 
   const GeoNodesLFUserData &lf_data = *params.user_data();
   bke::ComputeCaches &all_caches = *lf_data.modifier_data->cache_per_frame;
-  const bke::SimulationCache *cache = 
all_caches.lookup_context(lf_data.compute_context->hash());
+
+  const bke::NodeGroupComputeContext cache_context(lf_data.compute_context, 
sim_output_node_id);
+  const bke::SimulationCache *cache = 
all_caches.lookup_context(cache_context.hash());
   if (!cache) {
 params.set_output("Geometry", 
params.extract_input("Geometry"));
 return;
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 1b40c295ed1..b6cc9d11a5e 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_output.cc
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
 #include "BKE_compute_cache.hh"
+#include "BKE_compute_contexts.hh"
 #include "BKE_scene.h"
 
 #include "DEG_depsgraph_query.h"
@@ -42,14 +43,17 @@ static void node_geo_exec(GeoNodeExecParams params)
 return;
   }
 
-  const NodeGeometrySimulationOutput &storage = node_storage(params.node());
+  const bNode &node = params.node();
+  const NodeGeometrySimulationOutput &storage = node_storage(node);
   const Scene *scene = DEG_get_input_scene(params.depsgraph());
   const float scene_ctime = BKE_scene_ctime_get(scene);
   const int scene_frame = int(scene_ctime);
 
   const GeoNodesLFUserData &lf_data = *params.user_data();
   bke::ComputeCaches &all_caches = *lf_data.modifier_data->cache_per_frame;
-  bke::SimulationCache &cache = 
all_caches.ensure_for_context(lf_data.compute_context->hash());
+
+  const bke::NodeGroupComputeContext cache_context(lf_data.compute_context, 
node.identifier);
+  bke::SimulationCache &cache = 
all_caches.ensure_for_context(cache_context.hash());
 
   if (cache.geometry_per_frame.is_empty()) {
 if (params.lazy_output_is_required("Started")) {

___
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] [92a1234830b] geometry-nodes-simulation: Add hint to add simulation output node first

2022-12-02 Thread Hans Goudey
Commit: 92a1234830b69a1ad442514dce31f1474a41ea12
Author: Hans Goudey
Date:   Fri Dec 2 15:49:11 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB92a1234830b69a1ad442514dce31f1474a41ea12

Add hint to add simulation output node first

Until we can add both nodes at the same time, or we find
an improve simulation to link the two nodes

===

M   release/scripts/startup/bl_ui/node_add_menu_geometry.py

===

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 bf014e52634..d6503e6cf3a 100644
--- a/release/scripts/startup/bl_ui/node_add_menu_geometry.py
+++ b/release/scripts/startup/bl_ui/node_add_menu_geometry.py
@@ -298,7 +298,7 @@ class NODE_MT_category_simulation(Menu):
 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.add_node_type(layout, "GeometryNodeSimulationOutput", 
label="Simulation Output (Add this first)")
 node_add_menu.draw_assets_for_catalog(layout, self.bl_label)

___
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] [1ba264d5f0b] geometry-nodes-simulation: Be more forgiving when simulation nodes lost their storage

2022-12-02 Thread Hans Goudey
Commit: 1ba264d5f0b7b22ca458eb8b3d7ac6d6f4595cc9
Author: Hans Goudey
Date:   Fri Dec 2 16:06:03 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rB1ba264d5f0b7b22ca458eb8b3d7ac6d6f4595cc9

Be more forgiving when simulation nodes lost their storage

===

M   source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc

===

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 0a199ddf91d..3e9be29050c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_simulation_input.cc
@@ -41,7 +41,8 @@ static void node_init(bNodeTree *tree, bNode *node)
   VectorSet sim_output_ids;
   Set sim_input_output_ids;
   for (bNode *other_node : tree->all_nodes()) {
-if (other_node->type == GEO_NODE_SIMULATION_INPUT && other_node != node) {
+if (other_node->type == GEO_NODE_SIMULATION_INPUT && other_node != node &&
+other_node->storage) {
   const NodeGeometrySimulationInput &storage = node_storage(*other_node);
   sim_input_output_ids.add_new(storage.output_node_id);
 }

___
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] [afe5d0b9f20] geometry-nodes-simulation: Merge branch 'master' into geometry-nodes-simulation

2022-12-02 Thread Hans Goudey
Commit: afe5d0b9f20b3be9b425ccd94edea70bcdaeea9a
Author: Hans Goudey
Date:   Fri Dec 2 14:48:03 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rBafe5d0b9f20b3be9b425ccd94edea70bcdaeea9a

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] [9719fd69648] master: Cleanup: format

2022-12-02 Thread Chris Blackbourn
Commit: 9719fd6964883210b8c13a48fe0571330a5c63e8
Author: Chris Blackbourn
Date:   Sat Dec 3 10:53:44 2022 +1300
Branches: master
https://developer.blender.org/rB9719fd6964883210b8c13a48fe0571330a5c63e8

Cleanup: format

===

M   source/blender/gpu/vulkan/vk_pixel_buffer.cc

===

diff --git a/source/blender/gpu/vulkan/vk_pixel_buffer.cc 
b/source/blender/gpu/vulkan/vk_pixel_buffer.cc
index 65780778d59..177f19d8acd 100644
--- a/source/blender/gpu/vulkan/vk_pixel_buffer.cc
+++ b/source/blender/gpu/vulkan/vk_pixel_buffer.cc
@@ -9,7 +9,7 @@
 
 namespace blender::gpu {
 
-VKPixelBuffer::VKPixelBuffer(int64_t size): PixelBuffer(size)
+VKPixelBuffer::VKPixelBuffer(int64_t size) : PixelBuffer(size)
 {
 }

___
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] [18e386613c3] master: Attributes: Remove asserts for DefaultMixer negative weight

2022-12-02 Thread Iliya Katueshenock
Commit: 18e386613c31fdec3cbc238e4481ed7b548b47ec
Author: Iliya Katueshenock
Date:   Fri Dec 2 14:44:54 2022 -0600
Branches: master
https://developer.blender.org/rB18e386613c31fdec3cbc238e4481ed7b548b47ec

Attributes: Remove asserts for DefaultMixer negative weight

The attribute smoothing node asks for the ability to have a factor
outside the range of 0 and 1. The problem with this is that there is a
negative weight assertion for some of the mixers. If mixing between 0
and 1, then at a factor of 2, one of the elements will be negative.

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

===

M   source/blender/blenkernel/BKE_attribute_math.hh
M   source/blender/blenkernel/intern/attribute_math.cc

===

diff --git a/source/blender/blenkernel/BKE_attribute_math.hh 
b/source/blender/blenkernel/BKE_attribute_math.hh
index 5c0e5f428a4..9056356da4a 100644
--- a/source/blender/blenkernel/BKE_attribute_math.hh
+++ b/source/blender/blenkernel/BKE_attribute_math.hh
@@ -285,7 +285,6 @@ template class SimpleMixer {
*/
   void set(const int64_t index, const T &value, const float weight = 1.0f)
   {
-BLI_assert(weight >= 0.0f);
 buffer_[index] = value * weight;
 total_weights_[index] = weight;
   }
@@ -295,7 +294,6 @@ template class SimpleMixer {
*/
   void mix_in(const int64_t index, const T &value, const float weight = 1.0f)
   {
-BLI_assert(weight >= 0.0f);
 buffer_[index] += value * weight;
 total_weights_[index] += weight;
   }
diff --git a/source/blender/blenkernel/intern/attribute_math.cc 
b/source/blender/blenkernel/intern/attribute_math.cc
index d8102b4eeb8..68f05df3ce0 100644
--- a/source/blender/blenkernel/intern/attribute_math.cc
+++ b/source/blender/blenkernel/intern/attribute_math.cc
@@ -23,7 +23,6 @@ void ColorGeometry4fMixer::set(const int64_t index,
const ColorGeometry4f &color,
const float weight)
 {
-  BLI_assert(weight >= 0.0f);
   buffer_[index].r = color.r * weight;
   buffer_[index].g = color.g * weight;
   buffer_[index].b = color.b * weight;
@@ -35,7 +34,6 @@ void ColorGeometry4fMixer::mix_in(const int64_t index,
   const ColorGeometry4f &color,
   const float weight)
 {
-  BLI_assert(weight >= 0.0f);
   ColorGeometry4f &output_color = buffer_[index];
   output_color.r += color.r * weight;
   output_color.g += color.g * weight;
@@ -89,7 +87,6 @@ void ColorGeometry4bMixer::ColorGeometry4bMixer::set(int64_t 
index,
  const ColorGeometry4b 
&color,
  const float weight)
 {
-  BLI_assert(weight >= 0.0f);
   accumulation_buffer_[index][0] = color.r * weight;
   accumulation_buffer_[index][1] = color.g * weight;
   accumulation_buffer_[index][2] = color.b * weight;
@@ -99,7 +96,6 @@ void ColorGeometry4bMixer::ColorGeometry4bMixer::set(int64_t 
index,
 
 void ColorGeometry4bMixer::mix_in(int64_t index, const ColorGeometry4b &color, 
float weight)
 {
-  BLI_assert(weight >= 0.0f);
   float4 &accum_value = accumulation_buffer_[index];
   accum_value[0] += color.r * weight;
   accum_value[1] += color.g * weight;

___
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] [cff291d1f3c] geometry-nodes-simulation: Merge branch 'master' into geometry-nodes-simulation

2022-12-02 Thread Hans Goudey
Commit: cff291d1f3cebb18c35ee9788eb22640df37402b
Author: Hans Goudey
Date:   Fri Dec 2 14:32:09 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rBcff291d1f3cebb18c35ee9788eb22640df37402b

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] [bbcdca13786] geometry-nodes-simulation: Merge branch 'master' into geometry-nodes-simulation

2022-12-02 Thread Hans Goudey
Commit: bbcdca13786ed3df912e3069620c3ca2aca556d6
Author: Hans Goudey
Date:   Fri Dec 2 11:24:32 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rBbbcdca13786ed3df912e3069620c3ca2aca556d6

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] [ce16fa0f4c4] master: Fix: Node Editor: Hide compoitor-specific menu items

2022-12-02 Thread Hans Goudey
Commit: ce16fa0f4c4661fa1329f53896f4d908699627c6
Author: Hans Goudey
Date:   Fri Dec 2 14:30:54 2022 -0600
Branches: master
https://developer.blender.org/rBce16fa0f4c4661fa1329f53896f4d908699627c6

Fix: Node Editor: Hide compoitor-specific menu items

Previews and the "Read Viewlayers" operator are specific to the
compositor and shouldn't show in other node editor types.

===

M   release/scripts/startup/bl_ui/space_node.py
M   source/blender/editors/space_node/node_edit.cc

===

diff --git a/release/scripts/startup/bl_ui/space_node.py 
b/release/scripts/startup/bl_ui/space_node.py
index da94350b428..194f40e9434 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -307,8 +307,10 @@ class NODE_MT_select(Menu):
 class NODE_MT_node(Menu):
 bl_label = "Node"
 
-def draw(self, _context):
+def draw(self, context):
 layout = self.layout
+snode = context.space_data
+is_compositor = snode.tree_type == 'CompositorNodeTree'
 
 layout.operator("transform.translate")
 layout.operator("transform.rotate")
@@ -346,14 +348,17 @@ class NODE_MT_node(Menu):
 
 layout.operator("node.hide_toggle")
 layout.operator("node.mute_toggle")
-layout.operator("node.preview_toggle")
+if is_compositor:
+layout.operator("node.preview_toggle")
 layout.operator("node.hide_socket_toggle")
 layout.operator("node.options_toggle")
 layout.operator("node.collapse_hide_unused_toggle")
 
-layout.separator()
 
-layout.operator("node.read_viewlayers")
+if is_compositor:
+layout.separator()
+
+layout.operator("node.read_viewlayers")
 
 
 class NODE_MT_view_pie(Menu):
diff --git a/source/blender/editors/space_node/node_edit.cc 
b/source/blender/editors/space_node/node_edit.cc
index 38af2669bdc..95f64999f6e 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -1709,7 +1709,7 @@ void NODE_OT_preview_toggle(wmOperatorType *ot)
 
   /* callbacks */
   ot->exec = node_preview_toggle_exec;
-  ot->poll = ED_operator_node_active;
+  ot->poll = composite_node_active;
 
   /* flags */
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

___
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] [2155bdd500f] master: Cleanup: Remove "done" variable from node runtime

2022-12-02 Thread Hans Goudey
Commit: 2155bdd500fd087f372b2240d992085cb9dd7090
Author: Hans Goudey
Date:   Fri Dec 2 14:14:14 2022 -0600
Branches: master
https://developer.blender.org/rB2155bdd500fd087f372b2240d992085cb9dd7090

Cleanup: Remove "done" variable from node runtime

The runtime storage is meant for more persistent things. These local
states for an algorithm are much better handled by an array now.

===

M   source/blender/blenkernel/BKE_node_runtime.hh
M   source/blender/editors/space_node/node_relationships.cc
M   source/blender/functions/intern/field.cc

===

diff --git a/source/blender/blenkernel/BKE_node_runtime.hh 
b/source/blender/blenkernel/BKE_node_runtime.hh
index a2241557315..09722b46fc1 100644
--- a/source/blender/blenkernel/BKE_node_runtime.hh
+++ b/source/blender/blenkernel/BKE_node_runtime.hh
@@ -212,9 +212,6 @@ class bNodeRuntime : NonCopyable, NonMovable {
   /** #eNodeTreeChangedFlag. */
   uint32_t changed_flag = 0;
 
-  /** For dependency and sorting. */
-  short done = 0;
-
   /** Used as a boolean for execution. */
   uint8_t need_exec = 0;
 
diff --git a/source/blender/editors/space_node/node_relationships.cc 
b/source/blender/editors/space_node/node_relationships.cc
index 50be528bbe6..93761388f43 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -1630,40 +1630,42 @@ void NODE_OT_parent_set(wmOperatorType *ot)
 /** \name Join Nodes Operator
  * \{ */
 
-/* tags for depth-first search */
-#define NODE_JOIN_DONE 1
-#define NODE_JOIN_IS_DESCENDANT 2
+struct NodeJoinState {
+  bool done;
+  bool descendent;
+};
 
 static void node_join_attach_recursive(bNodeTree &ntree,
+   MutableSpan join_states,
bNode *node,
bNode *frame,
const VectorSet 
&selected_nodes)
 {
-  node->runtime->done |= NODE_JOIN_DONE;
+  join_states[node->runtime->index_in_tree].done = true;
 
   if (node == frame) {
-node->runtime->done |= NODE_JOIN_IS_DESCENDANT;
+join_states[node->runtime->index_in_tree].descendent = true;
   }
   else if (node->parent) {
 /* call recursively */
-if (!(node->parent->runtime->done & NODE_JOIN_DONE)) {
-  node_join_attach_recursive(ntree, node->parent, frame, selected_nodes);
+if (!join_states[node->parent->runtime->index_in_tree].done) {
+  node_join_attach_recursive(ntree, join_states, node->parent, frame, 
selected_nodes);
 }
 
 /* in any case: if the parent is a descendant, so is the child */
-if (node->parent->runtime->done & NODE_JOIN_IS_DESCENDANT) {
-  node->runtime->done |= NODE_JOIN_IS_DESCENDANT;
+if (join_states[node->parent->runtime->index_in_tree].descendent) {
+  join_states[node->runtime->index_in_tree].descendent = true;
 }
 else if (selected_nodes.contains(node)) {
   /* if parent is not an descendant of the frame, reattach the node */
   nodeDetachNode(&ntree, node);
   nodeAttachNode(&ntree, node, frame);
-  node->runtime->done |= NODE_JOIN_IS_DESCENDANT;
+  join_states[node->runtime->index_in_tree].descendent = true;
 }
   }
   else if (selected_nodes.contains(node)) {
 nodeAttachNode(&ntree, node, frame);
-node->runtime->done |= NODE_JOIN_IS_DESCENDANT;
+join_states[node->runtime->index_in_tree].descendent = true;
   }
 }
 
@@ -1678,14 +1680,11 @@ static int node_join_exec(bContext *C, wmOperator * 
/*op*/)
   bNode *frame_node = nodeAddStaticNode(C, &ntree, NODE_FRAME);
   nodeSetActive(&ntree, frame_node);
 
-  /* reset tags */
-  for (bNode *node : ntree.all_nodes()) {
-node->runtime->done = 0;
-  }
+  Array join_states(ntree.all_nodes().size(), 
NodeJoinState{false, false});
 
   for (bNode *node : ntree.all_nodes()) {
-if (!(node->runtime->done & NODE_JOIN_DONE)) {
-  node_join_attach_recursive(ntree, node, frame_node, selected_nodes);
+if (!join_states[node->runtime->index_in_tree].done) {
+  node_join_attach_recursive(ntree, join_states, node, frame_node, 
selected_nodes);
 }
   }
 
@@ -1808,32 +1807,35 @@ void NODE_OT_attach(wmOperatorType *ot)
 /** \name Detach Operator
  * \{ */
 
-/* tags for depth-first search */
-#define NODE_DETACH_DONE 1
-#define NODE_DETACH_IS_DESCENDANT 2
+struct NodeDetachstate {
+  bool done;
+  bool descendent;
+};
 
-static void node_detach_recursive(bNodeTree &ntree, bNode *node)
+static void node_detach_recursive(bNodeTree &ntree,
+  MutableSpan detach_states,
+  bNode *node)
 {
-  node->runtime->done |= NODE_DETACH_DONE;
+  detach_states[node->runtime->index_in_tree].done = true;
 
   if (node->parent) {
 /* call recursively */
-if (!(node->parent->runtime->done & NODE_DETACH_DONE)

[Bf-blender-cvs] [ecc25bc62ec] temp-asset-library-all: Use "All" library for node add menu building

2022-12-02 Thread Julian Eisel
Commit: ecc25bc62ec517420ce0aef47d9a6af761643f22
Author: Julian Eisel
Date:   Fri Dec 2 20:23:54 2022 +0100
Branches: temp-asset-library-all
https://developer.blender.org/rBecc25bc62ec517420ce0aef47d9a6af761643f22

Use "All" library for node add menu building

Code was manually building the add menu from all asset libraries, this
should be simpler now.

===

M   source/blender/editors/asset/ED_asset_list.hh
M   source/blender/editors/asset/intern/asset_list.cc
M   source/blender/editors/space_node/add_menu_assets.cc

===

diff --git a/source/blender/editors/asset/ED_asset_list.hh 
b/source/blender/editors/asset/ED_asset_list.hh
index 541fa315f77..f60c6752d5f 100644
--- a/source/blender/editors/asset/ED_asset_list.hh
+++ b/source/blender/editors/asset/ED_asset_list.hh
@@ -15,6 +15,18 @@ struct AssetLibraryReference;
 struct FileDirEntry;
 struct bContext;
 
+namespace blender::asset_system {
+class AssetLibrary;
+}
+
+/**
+ * Get the asset library being read into an asset-list and identified using \a 
library_reference.
+ * \note The asset library may be loaded asynchronously, so this may return 
null until it becomes
+ *   available.
+ */
+blender::asset_system::AssetLibrary *ED_assetlist_library_get(
+const AssetLibraryReference &library_reference);
+
 /* Can return false to stop iterating. */
 using AssetListIterFn = blender::FunctionRef;
 void ED_assetlist_iterate(const AssetLibraryReference &library_reference, 
AssetListIterFn fn);
diff --git a/source/blender/editors/asset/intern/asset_list.cc 
b/source/blender/editors/asset/intern/asset_list.cc
index 64636693a58..e086e5702d1 100644
--- a/source/blender/editors/asset/intern/asset_list.cc
+++ b/source/blender/editors/asset/intern/asset_list.cc
@@ -114,6 +114,7 @@ class AssetList : NonCopyable {
   void clear(bContext *C);
 
   bool needsRefetch() const;
+  asset_system::AssetLibrary *asset_library() const;
   void iterate(AssetListIterFn fn) const;
   bool listen(const wmNotifier ¬ifier) const;
   int size() const;
@@ -180,6 +181,11 @@ bool AssetList::needsRefetch() const
   return filelist_needs_force_reset(filelist_) || 
filelist_needs_reading(filelist_);
 }
 
+asset_system::AssetLibrary *AssetList::asset_library() const
+{
+  return reinterpret_cast(filelist_asset_library(filelist_));
+}
+
 void AssetList::iterate(AssetListIterFn fn) const
 {
   FileList *files = filelist_;
@@ -399,6 +405,7 @@ AssetListStorage::AssetListMap 
&AssetListStorage::global_storage()
 /** \name C-API
  * \{ */
 
+using namespace blender;
 using namespace blender::ed::asset;
 
 void ED_assetlist_storage_fetch(const AssetLibraryReference 
*library_reference, const bContext *C)
@@ -449,6 +456,16 @@ void ED_assetlist_iterate(const AssetLibraryReference 
&library_reference, AssetL
   }
 }
 
+asset_system::AssetLibrary *ED_assetlist_library_get(
+const AssetLibraryReference &library_reference)
+{
+  const AssetList *list = AssetListStorage::lookup_list(library_reference);
+  if (!list) {
+return nullptr;
+  }
+  return list->asset_library();
+}
+
 ImBuf *ED_assetlist_asset_image_get(const AssetHandle *asset_handle)
 {
   ImBuf *imbuf = filelist_file_getimage(asset_handle->file_data);
diff --git a/source/blender/editors/space_node/add_menu_assets.cc 
b/source/blender/editors/space_node/add_menu_assets.cc
index bb5f33f8cf0..2296922e040 100644
--- a/source/blender/editors/space_node/add_menu_assets.cc
+++ b/source/blender/editors/space_node/add_menu_assets.cc
@@ -49,13 +49,6 @@ struct LibraryAsset {
   AssetHandle handle;
 };
 
-struct LibraryCatalog {
-  asset_system::AssetLibrary *library;
-  /* Catalog pointers are not save to store. Use the catalog ID instead and 
lookup the catalog when
-   * needed. */
-  const asset_system::CatalogID catalog_id;
-};
-
 struct AssetItemTree {
   asset_system::AssetCatalogTree catalogs;
   MultiValueMap assets_per_path;
@@ -63,14 +56,18 @@ struct AssetItemTree {
   full_catalog_per_tree_item;
 };
 
+static AssetLibraryReference all_library_reference()
+{
+  AssetLibraryReference all_library_ref{};
+  all_library_ref.custom_library_index = -1;
+  all_library_ref.type = ASSET_LIBRARY_ALL;
+  return all_library_ref;
+}
+
 static bool all_loading_finished()
 {
-  for (const AssetLibraryReference &library : 
asset_system::all_valid_asset_library_refs()) {
-if (!ED_assetlist_is_loaded(&library)) {
-  return false;
-}
-  }
-  return true;
+  AssetLibraryReference all_library_ref = all_library_reference();
+  return ED_assetlist_is_loaded(&all_library_ref);
 }
 
 static AssetItemTree build_catalog_tree(const bContext &C, const bNodeTree 
*node_tree)
@@ -78,68 +75,52 @@ static AssetItemTree build_catalog_tree(const bContext &C, 
const bNodeTree *node
   if (!node_tree) {
 return {};
   }
-  const Main &bmain = *CTX_data_main(&C);
-  const Vector all_libraries = 
asset_system::all_

[Bf-blender-cvs] [11abc1be394] temp-asset-library-all: Use "All" library for node search menu building

2022-12-02 Thread Julian Eisel
Commit: 11abc1be394ccb148c5cda3ecde6dbe0d5eb4f27
Author: Julian Eisel
Date:   Fri Dec 2 20:28:33 2022 +0100
Branches: temp-asset-library-all
https://developer.blender.org/rB11abc1be394ccb148c5cda3ecde6dbe0d5eb4f27

Use "All" library for node search menu building

Code was manually building the search menu items from all asset
libraries, this is simpler now.

===

M   source/blender/editors/space_node/add_node_search.cc

===

diff --git a/source/blender/editors/space_node/add_node_search.cc 
b/source/blender/editors/space_node/add_node_search.cc
index ba060ab3925..85c79d5e57d 100644
--- a/source/blender/editors/space_node/add_node_search.cc
+++ b/source/blender/editors/space_node/add_node_search.cc
@@ -93,12 +93,15 @@ static void search_items_for_asset_metadata(const bNodeTree 
&node_tree,
   search_items.append(std::move(item));
 }
 
-static void gather_search_items_for_asset_library(const bContext &C,
-  const bNodeTree &node_tree,
-  const AssetLibraryReference 
&library_ref,
-  Set 
&r_added_assets,
-  Vector 
&search_items)
+static void gather_search_items_for_all_assets(const bContext &C,
+   const bNodeTree &node_tree,
+   Set 
&r_added_assets,
+   Vector 
&search_items)
 {
+  AssetLibraryReference library_ref{};
+  library_ref.custom_library_index = -1;
+  library_ref.type = ASSET_LIBRARY_ALL;
+
   AssetFilterSettings filter_settings{};
   filter_settings.id_types = FILTER_ID_NT;
 
@@ -117,26 +120,6 @@ static void gather_search_items_for_asset_library(const 
bContext &C,
   });
 }
 
-static void gather_search_items_for_all_assets(const bContext &C,
-   const bNodeTree &node_tree,
-   Set 
&r_added_assets,
-   Vector 
&search_items)
-{
-  int i;
-  LISTBASE_FOREACH_INDEX (const bUserAssetLibrary *, asset_library, 
&U.asset_libraries, i) {
-AssetLibraryReference library_ref{};
-library_ref.custom_library_index = i;
-library_ref.type = ASSET_LIBRARY_CUSTOM;
-/* Skip local assets to avoid duplicates when the asset is part of the 
local file library. */
-gather_search_items_for_asset_library(C, node_tree, library_ref, 
r_added_assets, search_items);
-  }
-
-  AssetLibraryReference library_ref{};
-  library_ref.custom_library_index = -1;
-  library_ref.type = ASSET_LIBRARY_LOCAL;
-  gather_search_items_for_asset_library(C, node_tree, library_ref, 
r_added_assets, search_items);
-}
-
 static void gather_search_items_for_node_groups(const bContext &C,
 const bNodeTree &node_tree,
 const Set 
&local_assets,

___
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] [a07a2e2369d] temp-asset-library-all: Avoid redundant loading of catalogs and "All" library processing

2022-12-02 Thread Julian Eisel
Commit: a07a2e2369d0290d08e124aa53d56cfd4600e341
Author: Julian Eisel
Date:   Fri Dec 2 19:32:46 2022 +0100
Branches: temp-asset-library-all
https://developer.blender.org/rBa07a2e2369d0290d08e124aa53d56cfd4600e341

Avoid redundant loading of catalogs and "All" library processing

===

M   source/blender/asset_system/AS_asset_library.hh
M   source/blender/asset_system/intern/asset_library_service.cc
M   source/blender/editors/space_file/filelist.cc

===

diff --git a/source/blender/asset_system/AS_asset_library.hh 
b/source/blender/asset_system/AS_asset_library.hh
index 3f2562aa987..6526e3e8382 100644
--- a/source/blender/asset_system/AS_asset_library.hh
+++ b/source/blender/asset_system/AS_asset_library.hh
@@ -84,8 +84,7 @@ class AssetLibrary {
*  library. This is just a combination of the other 
ones, so usually
*  iterating over it is redundant.
*/
-  static void foreach_loaded(FunctionRef fn,
- bool include_all_library = true);
+  static void foreach_loaded(FunctionRef fn, bool 
include_all_library);
 
   void load_catalogs();
 
diff --git a/source/blender/asset_system/intern/asset_library_service.cc 
b/source/blender/asset_system/intern/asset_library_service.cc
index 430de903db7..fbcda02025c 100644
--- a/source/blender/asset_system/intern/asset_library_service.cc
+++ b/source/blender/asset_system/intern/asset_library_service.cc
@@ -155,20 +155,25 @@ AssetLibrary 
*AssetLibraryService::get_asset_library_all(const Main *bmain)
   all_library_ = std::make_unique();
 
   AssetLibrary &all_library = *all_library_;
-  auto build_catalogs_fn = [&all_library]() {
+  auto build_catalogs_fn = [&all_library](const bool is_first_load) {
 /* Start with empty catalog storage. */
 all_library.catalog_service = std::make_unique();
 
 /* (Re-)load catalogs on refresh. */
-AssetLibrary::foreach_loaded([&all_library](AssetLibrary &nested) {
-  nested.catalog_service->reload_catalogs();
-  all_library.catalog_service->add_from_existing(*nested.catalog_service);
-});
+AssetLibrary::foreach_loaded(
+[&](AssetLibrary &nested) {
+  /* On first load the catalogs were read just above, no need to 
reload. */
+  if (!is_first_load) {
+nested.catalog_service->reload_catalogs();
+  }
+  
all_library.catalog_service->add_from_existing(*nested.catalog_service);
+},
+false);
 all_library.catalog_service->rebuild_tree();
   };
 
-  build_catalogs_fn();
-  all_library.on_refresh_ = build_catalogs_fn;
+  build_catalogs_fn(true);
+  all_library.on_refresh_ = [build_catalogs_fn]() { build_catalogs_fn(false); 
};
 
   return &all_library;
 }
diff --git a/source/blender/editors/space_file/filelist.cc 
b/source/blender/editors/space_file/filelist.cc
index 60c34ceda5f..2bf91efc610 100644
--- a/source/blender/editors/space_file/filelist.cc
+++ b/source/blender/editors/space_file/filelist.cc
@@ -3907,18 +3907,20 @@ static void 
filelist_readjob_all_asset_library(FileListReadJob *job_params,
 
   /* The "All" asset library was loaded, which means all other asset libraries 
are also loaded.
* Load their assets from disk into the "All" library. */
-  asset_system::AssetLibrary::foreach_loaded([&](asset_system::AssetLibrary 
&nested_library) {
-StringRefNull root_path = nested_library.root_path();
-if (root_path.is_empty()) {
-  return;
-}
+  asset_system::AssetLibrary::foreach_loaded(
+  [&](asset_system::AssetLibrary &nested_library) {
+StringRefNull root_path = nested_library.root_path();
+if (root_path.is_empty()) {
+  return;
+}
 
-/* Override library info to read this library. */
-job_params->load_asset_library = &nested_library;
-BLI_strncpy(filelist->filelist.root, root_path.c_str(), 
sizeof(filelist->filelist.root));
+/* Override library info to read this library. */
+job_params->load_asset_library = &nested_library;
+BLI_strncpy(filelist->filelist.root, root_path.c_str(), 
sizeof(filelist->filelist.root));
 
-filelist_readjob_recursive_dir_add_items(true, job_params, stop, 
do_update, progress);
-  });
+filelist_readjob_recursive_dir_add_items(true, job_params, stop, 
do_update, progress);
+  },
+  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] [ab4926bcffe] master: Fix: Various mishandling of node identifiers and vector

2022-12-02 Thread Hans Goudey
Commit: ab4926bcffeef20cfb9225d23f68429c1f1d0c87
Author: Hans Goudey
Date:   Fri Dec 2 13:20:40 2022 -0600
Branches: master
https://developer.blender.org/rBab4926bcffeef20cfb9225d23f68429c1f1d0c87

Fix: Various mishandling of node identifiers and vector

In a few places, nodes were added without updating the Identifiers and
vector. In other places nodes we removed without removing from and
rebuilding the vector. This is solved in a few ways. First I exposed
a function to rebuild the vector from scratch, and added unique ID
finding to a few places.

The changes to node group building and separating are more involved,
mostly because it was hard to see the correct behavior without some
refactoring. Now `VectorSet` is used to store nodes involved in the
operation. Some things are handled more simply with the topology
cache and by passing a span of nodes.

===

M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenloader/intern/versioning_250.c
M   source/blender/editors/space_node/node_edit.cc
M   source/blender/editors/space_node/node_group.cc
M   source/blender/editors/space_node/node_intern.hh
M   source/blender/editors/space_node/node_relationships.cc
M   source/blender/editors/space_node/node_select.cc
M   source/blender/nodes/shader/node_shader_tree.cc

===

diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 74d6f8becd1..3680d8ac8cd 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -670,6 +670,13 @@ void nodeUnlinkNode(struct bNodeTree *ntree, struct bNode 
*node);
 void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
 void nodeUniqueID(struct bNodeTree *ntree, struct bNode *node);
 
+/**
+ * Rebuild the `node_by_id` runtime vector set. Call after removing a node if 
not handled
+ * separately. This is important instead of just using `nodes_by_id.remove()` 
since it maintains
+ * the node order.
+ */
+void nodeRebuildIDVector(struct bNodeTree *node_tree);
+
 /**
  * Delete node, associated animation data and ID user count.
  */
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index c502381fc62..8bff3a8f997 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -2933,12 +2933,12 @@ static void node_unlink_attached(bNodeTree *ntree, 
bNode *parent)
   }
 }
 
-static void rebuild_nodes_vector(bNodeTree &node_tree)
+void nodeRebuildIDVector(bNodeTree *node_tree)
 {
   /* Rebuild nodes #VectorSet which must have the same order as the list. */
-  node_tree.runtime->nodes_by_id.clear();
-  LISTBASE_FOREACH (bNode *, node, &node_tree.nodes) {
-node_tree.runtime->nodes_by_id.add_new(node);
+  node_tree->runtime->nodes_by_id.clear();
+  LISTBASE_FOREACH (bNode *, node, &node_tree->nodes) {
+node_tree->runtime->nodes_by_id.add_new(node);
   }
 }
 
@@ -2955,7 +2955,7 @@ static void node_free_node(bNodeTree *ntree, bNode *node)
   if (ntree) {
 BLI_remlink(&ntree->nodes, node);
 /* Rebuild nodes #VectorSet which must have the same order as the list. */
-rebuild_nodes_vector(*ntree);
+nodeRebuildIDVector(ntree);
 
 /* texture node has bad habit of keeping exec data around */
 if (ntree->type == NTREE_TEXTURE && ntree->runtime->execdata) {
@@ -3013,7 +3013,7 @@ void ntreeFreeLocalNode(bNodeTree *ntree, bNode *node)
   node_unlink_attached(ntree, node);
 
   node_free_node(ntree, node);
-  rebuild_nodes_vector(*ntree);
+  nodeRebuildIDVector(ntree);
 }
 
 void nodeRemoveNode(Main *bmain, bNodeTree *ntree, bNode *node, bool 
do_id_user)
@@ -3073,7 +3073,7 @@ void nodeRemoveNode(Main *bmain, bNodeTree *ntree, bNode 
*node, bool do_id_user)
 
   /* Free node itself. */
   node_free_node(ntree, node);
-  rebuild_nodes_vector(*ntree);
+  nodeRebuildIDVector(ntree);
 }
 
 static void node_socket_interface_free(bNodeTree * /*ntree*/,
diff --git a/source/blender/blenloader/intern/versioning_250.c 
b/source/blender/blenloader/intern/versioning_250.c
index f87034548df..5dd64051881 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -2001,6 +2001,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main 
*bmain)
  */
 link = MEM_callocN(sizeof(bNodeLink), "link");
 BLI_addtail(&ntree->links, link);
+nodeUniqueID(ntree, node);
 link->fromnode = NULL;
 link->fromsock = gsock;
 link->tonode = node;
@@ -2024,6 +2025,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main 
*bmain)
  */
 link = MEM_callocN(sizeof(bNodeLink), "link");
 BLI_addtail(&ntree->links, link);
+nodeUniqueID(

[Bf-blender-cvs] [1c26341464b] master: Cleanup: Gammar in BMesh mesh conversion comment

2022-12-02 Thread Hans Goudey
Commit: 1c26341464bdbf62b5acd72ea35956a617207262
Author: Hans Goudey
Date:   Fri Dec 2 13:26:49 2022 -0600
Branches: master
https://developer.blender.org/rB1c26341464bdbf62b5acd72ea35956a617207262

Cleanup: Gammar in BMesh mesh conversion comment

===

M   source/blender/bmesh/intern/bmesh_mesh_convert.cc

===

diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc 
b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
index 59aa20ca8d8..0ee1d546ddc 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@ -581,9 +581,9 @@ static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int 
ototvert)
  * Also not correct but it's better then having it zeroed for e.g.
  *
  * - Missing key-index layer.
- *   In this case the basis key wont apply it's deltas to other keys and in 
the case
- *   a shape-key layer is missing, its coordinates will be initialized from 
the edit-mesh
- *   vertex locations instead of attempting to remap the shape-keys 
coordinates.
+ *   In this case the basis key won't apply its deltas to other keys and if a 
shape-key layer is
+ *   missing, its coordinates will be initialized from the edit-mesh vertex 
locations instead of
+ *   attempting to remap the shape-keys coordinates.
  *
  * \note These cases are considered abnormal and shouldn't occur in typical 
usage.
  * A warning is logged in this case to help troubleshooting bugs with 
shape-keys.

___
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] [a3c45bc3136] soc-2022-many-lights-sampling: Cycles: disable light tree on HIP due to internal compiler errors

2022-12-02 Thread Brecht Van Lommel
Commit: a3c45bc31364fed8f1a16da01c92c04bc19ee097
Author: Brecht Van Lommel
Date:   Fri Dec 2 16:17:54 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rBa3c45bc31364fed8f1a16da01c92c04bc19ee097

Cycles: disable light tree on HIP due to internal compiler errors

To avoid this blocking the merge to master, but still plan to fix this for
the 3.5 release.

===

M   intern/cycles/device/device.cpp
M   intern/cycles/device/device.h
M   intern/cycles/device/hip/device.cpp
M   intern/cycles/kernel/light/sample.h
M   intern/cycles/kernel/types.h
M   intern/cycles/scene/light.cpp

===

diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 6aef5458246..ff7e46d48ab 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -351,6 +351,7 @@ DeviceInfo Device::get_multi_device(const 
vector &subdevices,
   info.num = 0;
 
   info.has_nanovdb = true;
+  info.has_light_tree = true;
   info.has_osl = true;
   info.has_guiding = true;
   info.has_profiling = true;
@@ -399,6 +400,7 @@ DeviceInfo Device::get_multi_device(const 
vector &subdevices,
 
 /* Accumulate device info. */
 info.has_nanovdb &= device.has_nanovdb;
+info.has_light_tree &= device.has_light_tree;
 info.has_osl &= device.has_osl;
 info.has_guiding &= device.has_guiding;
 info.has_profiling &= device.has_profiling;
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index 11d693cb25b..b9308dc8949 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -65,6 +65,7 @@ class DeviceInfo {
   int num;
   bool display_device;/* GPU is used as a display device. */
   bool has_nanovdb;   /* Support NanoVDB volumes. */
+  bool has_light_tree;/* Support light tree. */
   bool has_osl;   /* Support Open Shading Language. */
   bool has_guiding;   /* Support path guiding. */
   bool has_profiling; /* Supports runtime collection of profiling 
info. */
@@ -84,6 +85,7 @@ class DeviceInfo {
 cpu_threads = 0;
 display_device = false;
 has_nanovdb = false;
+has_light_tree = true;
 has_osl = false;
 has_guiding = false;
 has_profiling = false;
diff --git a/intern/cycles/device/hip/device.cpp 
b/intern/cycles/device/hip/device.cpp
index 3c9c73e7db0..518239f9877 100644
--- a/intern/cycles/device/hip/device.cpp
+++ b/intern/cycles/device/hip/device.cpp
@@ -137,6 +137,7 @@ void device_hip_info(vector &devices)
 info.num = num;
 
 info.has_nanovdb = true;
+info.has_light_tree = false;
 info.denoisers = 0;
 
 info.has_gpu_queue = true;
diff --git a/intern/cycles/kernel/light/sample.h 
b/intern/cycles/kernel/light/sample.h
index 9297746ce35..39bf3a59949 100644
--- a/intern/cycles/kernel/light/sample.h
+++ b/intern/cycles/kernel/light/sample.h
@@ -337,6 +337,7 @@ ccl_device_inline bool 
light_sample_from_volume_segment(KernelGlobals kg,
   int emitter_shader_flag = 0;
   float emitter_pdf_selection = 0.0f;
 
+#ifdef __LIGHT_TREE__
   if (kernel_data.integrator.use_light_tree) {
 if (!light_tree_sample(kg,
  randu,
@@ -355,7 +356,9 @@ ccl_device_inline bool 
light_sample_from_volume_segment(KernelGlobals kg,
   return false;
 }
   }
-  else {
+  else
+#endif
+  {
 if (!light_distribution_sample(kg,
randu,
randv,
@@ -425,6 +428,7 @@ ccl_device bool light_sample_from_position(KernelGlobals kg,
   int emitter_shader_flag = 0;
   float emitter_pdf_selection = 0.0f;
 
+#ifdef __LIGHT_TREE__
   if (kernel_data.integrator.use_light_tree) {
 if (!light_tree_sample(kg,
   randu,
@@ -443,7 +447,9 @@ ccl_device bool light_sample_from_position(KernelGlobals kg,
   return false;
 }
   }
-  else {
+  else
+#endif
+  {
 if (!light_distribution_sample(kg,
randu,
randv,
@@ -509,10 +515,13 @@ ccl_device_inline bool 
light_sample_new_position(KernelGlobals kg,
   return false;
 }
 
+#ifdef __LIGHT_TREE__
 if (kernel_data.integrator.use_light_tree) {
   ls->pdf *= ls->pdf_selection;
 }
-else {
+else
+#endif
+{
   /* Handled in triangle_light_sample for effeciency. */
 }
 return true;
@@ -558,6 +567,7 @@ ccl_device_inline float 
light_sample_mis_weight_forward_surface(KernelGlobals kg
   float pdf = triangle_light_pdf(kg, sd, t);
 
   /* Light selection pdf. */
+#ifdef __LIGHT_TREE__
   if (kernel_data.integrator.use_light_tree) {
 float3 ray_P = INTEGRATOR_STATE(state, ray, P);
 const float3 N = INTEGRATOR_STATE(state, path, mis_origin_n);
@@ -565,7 +575,9 @@ ccl_device_inline float 
light_sample_mis_weight_forw

[Bf-blender-cvs] [d55e3733e8a] soc-2022-many-lights-sampling: Cleanup: remove unused shadow pass code

2022-12-02 Thread Brecht Van Lommel
Commit: d55e3733e8a64529edf9c9e2648d71e00571d1dd
Author: Brecht Van Lommel
Date:   Fri Dec 2 15:29:21 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rBd55e3733e8a64529edf9c9e2648d71e00571d1dd

Cleanup: remove unused shadow pass code

===

M   intern/cycles/kernel/data_template.h
M   intern/cycles/scene/light.cpp

===

diff --git a/intern/cycles/kernel/data_template.h 
b/intern/cycles/kernel/data_template.h
index 5f420b3579d..06df7fe1e62 100644
--- a/intern/cycles/kernel/data_template.h
+++ b/intern/cycles/kernel/data_template.h
@@ -97,7 +97,6 @@ KERNEL_STRUCT_MEMBER(film, int, pass_emission)
 KERNEL_STRUCT_MEMBER(film, int, pass_background)
 KERNEL_STRUCT_MEMBER(film, int, pass_ao)
 KERNEL_STRUCT_MEMBER(film, float, pass_alpha_threshold)
-KERNEL_STRUCT_MEMBER(film, float, pass_shadow_scale)
 KERNEL_STRUCT_MEMBER(film, int, pass_shadow_catcher)
 KERNEL_STRUCT_MEMBER(film, int, pass_shadow_catcher_sample_count)
 KERNEL_STRUCT_MEMBER(film, int, pass_shadow_catcher_matte)
@@ -131,10 +130,6 @@ KERNEL_STRUCT_MEMBER(film, int, 
use_approximate_shadow_catcher)
 KERNEL_STRUCT_MEMBER(film, int, pass_guiding_color)
 KERNEL_STRUCT_MEMBER(film, int, pass_guiding_probability)
 KERNEL_STRUCT_MEMBER(film, int, pass_guiding_avg_roughness)
-/* Padding. */
-KERNEL_STRUCT_MEMBER(film, int, pad1)
-KERNEL_STRUCT_MEMBER(film, int, pad2)
-KERNEL_STRUCT_MEMBER(film, int, pad3)
 KERNEL_STRUCT_END(KernelFilm)
 
 /* Integrator. */
diff --git a/intern/cycles/scene/light.cpp b/intern/cycles/scene/light.cpp
index b78863e3f6e..b18cd63a0ee 100644
--- a/intern/cycles/scene/light.cpp
+++ b/intern/cycles/scene/light.cpp
@@ -266,13 +266,12 @@ bool LightManager::object_usable_as_light(Object *object)
   return false;
 }
 
-void LightManager::device_update_distribution(Device *device,
+void LightManager::device_update_distribution(Device *,
   DeviceScene *dscene,
   Scene *scene,
   Progress &progress)
 {
   KernelIntegrator *kintegrator = &dscene->data.integrator;
-  KernelFilm *kfilm = &dscene->data.film;
 
   /* Update CDF over lights. */
   progress.set_status("Updating Lights", "Computing distribution");
@@ -305,7 +304,6 @@ void LightManager::device_update_distribution(Device 
*device,
   }
 
   const size_t num_lights = kintegrator->num_lights;
-  const size_t num_background_lights = kintegrator->num_background_lights;
   const size_t num_distribution = num_triangles + num_lights;
 
   /* Distribution size. */
@@ -454,18 +452,6 @@ void LightManager::device_update_distribution(Device 
*device,
 }
   }
 
-  /* bit of an ugly hack to compensate for emitting triangles influencing
-   * amount of samples we get for this pass */
-  kfilm->pass_shadow_scale = 1.0f;
-
-  if (kintegrator->distribution_pdf_triangles != 0.0f) {
-kfilm->pass_shadow_scale /= 0.5f;
-  }
-
-  if (num_background_lights < num_lights) {
-kfilm->pass_shadow_scale /= (float)(num_lights - num_background_lights) / 
(float)num_lights;
-  }
-
   /* Copy distribution to device. */
   dscene->light_distribution.copy_to_device();
 }
@@ -476,7 +462,6 @@ void LightManager::device_update_tree(Device *device,
   Progress &progress)
 {
   KernelIntegrator *kintegrator = &dscene->data.integrator;
-  KernelFilm *kfilm = &dscene->data.film;
 
   if (!kintegrator->use_light_tree) {
 dscene->light_tree_nodes.free();
@@ -556,9 +541,6 @@ void LightManager::device_update_tree(Device *device,
   /* Update integrator state. */
   kintegrator->use_direct_light = !light_prims.empty();
 
-  /* TODO: this shadow scale mechanism does not work for light tree. */
-  kfilm->pass_shadow_scale = 1.0f;
-
   /* TODO: For now, we'll start with a smaller number of max lights in a node.
* More benchmarking is needed to determine what number works best. */
   LightTree light_tree(light_prims, kintegrator->num_distant_lights, 8);

___
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] [60ecf2ee0ec] soc-2022-many-lights-sampling: Merge branch 'master' into soc-2022-many-lights-sampling

2022-12-02 Thread Brecht Van Lommel
Commit: 60ecf2ee0ecab1057ffe687508baa83531252fa3
Author: Brecht Van Lommel
Date:   Fri Dec 2 18:27:47 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB60ecf2ee0ecab1057ffe687508baa83531252fa3

Merge branch 'master' into soc-2022-many-lights-sampling

===



===

diff --cc intern/cycles/kernel/light/area.h
index 2108073c199,db8faf6ec10..16d2e2c7d3a
--- a/intern/cycles/kernel/light/area.h
+++ b/intern/cycles/kernel/light/area.h
@@@ -321,44 -342,4 +342,44 @@@ ccl_device_inline bool area_light_sampl
  
return true;
  }
 +
 +template
 +ccl_device_forceinline bool area_light_tree_parameters(const ccl_global 
KernelLight *klight,
 +   const float3 centroid,
 +   const float3 P,
 +   const float3 N,
 +   const float3 
bcone_axis,
 +   ccl_private float 
&cos_theta_u,
 +   ccl_private float2 
&distance,
 +   ccl_private float3 
&point_to_centroid)
 +{
 +  if (!in_volume_segment) {
 +/* TODO: a cheap substitute for minimal distance between point and 
primitive. Does it
 + * worth the overhead to compute the accurate minimal distance? */
 +float min_distance;
 +point_to_centroid = safe_normalize_len(centroid - P, &min_distance);
 +distance = make_float2(min_distance, min_distance);
 +  }
 +
-   const float3 extentu = klight->area.extentu;
-   const float3 extentv = klight->area.extentv;
++  const float3 extentu = klight->area.axis_u * klight->area.len_u;
++  const float3 extentv = klight->area.axis_v * klight->area.len_v;
 +  for (int i = 0; i < 4; i++) {
 +const float3 corner = ((i & 1) - 0.5f) * extentu + 0.5f * ((i & 2) - 1) * 
extentv + centroid;
 +float distance_point_to_corner;
 +const float3 point_to_corner = safe_normalize_len(corner - P, 
&distance_point_to_corner);
 +cos_theta_u = fminf(cos_theta_u, dot(point_to_centroid, point_to_corner));
 +if (!in_volume_segment) {
 +  distance.x = fmaxf(distance.x, distance_point_to_corner);
 +}
 +  }
 +
 +  const bool front_facing = dot(bcone_axis, point_to_centroid) < 0;
 +  const bool shape_above_surface = dot(N, centroid - P) + fabsf(dot(N, 
extentu)) +
 +   fabsf(dot(N, extentv)) >
 +   0;
 +  const bool in_volume = is_zero(N);
 +
 +  return (front_facing && shape_above_surface) || in_volume;
 +}
 +
  CCL_NAMESPACE_END

___
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] [59052c3759f] soc-2022-many-lights-sampling: Merge branch 'master' into soc-2022-many-lights-sampling

2022-12-02 Thread Brecht Van Lommel
Commit: 59052c3759ff79b208a2ca890eb036a152e2466c
Author: Brecht Van Lommel
Date:   Fri Dec 2 18:59:45 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB59052c3759ff79b208a2ca890eb036a152e2466c

Merge branch 'master' into soc-2022-many-lights-sampling

===



===



___
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] [af5d2256538] temp-asset-library-all: Load catalogs for "All" asset library

2022-12-02 Thread Julian Eisel
Commit: af5d225653889bde783f165726ce95786928839a
Author: Julian Eisel
Date:   Fri Dec 2 19:19:08 2022 +0100
Branches: temp-asset-library-all
https://developer.blender.org/rBaf5d225653889bde783f165726ce95786928839a

Load catalogs for "All" asset library

Merges the catalog definitions from all asset libraries in to the
storage of the "All" one, builds the catalog tree and refreshes data as
needed. This doesn't allow writing changes back to the catalog
definition files, so the UI probably shouldn't allow edits.

===

M   source/blender/asset_system/AS_asset_catalog.hh
M   source/blender/asset_system/AS_asset_library.hh
M   source/blender/asset_system/intern/asset_catalog.cc
M   source/blender/asset_system/intern/asset_library.cc
M   source/blender/asset_system/intern/asset_library_service.cc

===

diff --git a/source/blender/asset_system/AS_asset_catalog.hh 
b/source/blender/asset_system/AS_asset_catalog.hh
index 87b9425c8c6..a7829778fdf 100644
--- a/source/blender/asset_system/AS_asset_catalog.hh
+++ b/source/blender/asset_system/AS_asset_catalog.hh
@@ -67,6 +67,12 @@ class AssetCatalogService {
   /** Load asset catalog definitions from the given file or directory. */
   void load_from_disk(const CatalogFilePath &file_or_directory_path);
 
+  /**
+   * Duplicate the catalogs from \a other_service into this one. Does not 
rebuild the tree, this
+   * needs to be done by the caller (call #rebuild_tree()!).
+   */
+  void add_from_existing(const AssetCatalogService &other_service);
+
   /**
* Write the catalog definitions to disk.
*
@@ -105,6 +111,15 @@ class AssetCatalogService {
*/
   void reload_catalogs();
 
+  /**
+   * Make sure the tree is updated to the latest collection of catalogs stored 
in this service.
+   * Does not depend on a CDF file being available so this can be called on a 
service that stores
+   * catalogs that are not stored in a CDF.
+   * Most API functions that modify catalog data will trigger this, unless 
otherwise specified (for
+   * batch operations).
+   */
+  void rebuild_tree();
+
   /** Return catalog with the given ID. Return nullptr if not found. */
   AssetCatalog *find_catalog(CatalogID catalog_id) const;
 
@@ -222,7 +237,6 @@ class AssetCatalogService {
   const CatalogFilePath &blend_file_path);
 
   std::unique_ptr read_into_tree();
-  void rebuild_tree();
 
   /**
* For every catalog, ensure that its parent path also has a known catalog.
@@ -270,6 +284,11 @@ class AssetCatalogCollection {
   AssetCatalogCollection(AssetCatalogCollection &&other) noexcept = default;
 
   std::unique_ptr deep_copy() const;
+  /**
+   * Copy the catalogs from \a other and append them to this collection. 
Copies no other data
+   * otherwise (but marks as having unsaved changes).
+   */
+  void add_catalogs_from_existing(const AssetCatalogCollection &other);
 
  protected:
   static OwningAssetCatalogMap copy_catalog_map(const OwningAssetCatalogMap 
&orig);
diff --git a/source/blender/asset_system/AS_asset_library.hh 
b/source/blender/asset_system/AS_asset_library.hh
index d377f2334b8..3f2562aa987 100644
--- a/source/blender/asset_system/AS_asset_library.hh
+++ b/source/blender/asset_system/AS_asset_library.hh
@@ -56,6 +56,8 @@ class AssetLibrary {
*/
   std::unique_ptr asset_storage_;
 
+  std::function on_refresh_;
+
   bCallbackFuncStore on_save_callback_store_{};
 
  public:
diff --git a/source/blender/asset_system/intern/asset_catalog.cc 
b/source/blender/asset_system/intern/asset_catalog.cc
index 9b47aca1209..7924ceb862c 100644
--- a/source/blender/asset_system/intern/asset_catalog.cc
+++ b/source/blender/asset_system/intern/asset_catalog.cc
@@ -323,6 +323,11 @@ void AssetCatalogService::load_from_disk(const 
CatalogFilePath &file_or_director
   rebuild_tree();
 }
 
+void AssetCatalogService::add_from_existing(const AssetCatalogService 
&other_service)
+{
+  
catalog_collection_->add_catalogs_from_existing(*other_service.catalog_collection_);
+}
+
 void AssetCatalogService::load_directory_recursive(const CatalogFilePath 
&directory_path)
 {
   /* TODO(@sybren): implement proper multi-file support. For now, just load
@@ -658,15 +663,25 @@ std::unique_ptr 
AssetCatalogCollection::deep_copy() cons
   return copy;
 }
 
-OwningAssetCatalogMap AssetCatalogCollection::copy_catalog_map(const 
OwningAssetCatalogMap &orig)
+static void copy_catalog_map_into_existing(const OwningAssetCatalogMap &source,
+   OwningAssetCatalogMap &dest)
 {
-  OwningAssetCatalogMap copy;
-
-  for (const auto &orig_catalog_uptr : orig.values()) {
+  for (const auto &orig_catalog_uptr : source.values()) {
 auto copy_catalog_uptr = 
std::make_unique(*orig_catalog_uptr);
-copy.add_new(copy_catalog_uptr->catalog_id, std::move(copy_catalog_uptr));
+dest.add_new(copy_catalog_uptr->catalog_id, std::

[Bf-blender-cvs] [fb2303fb739] temp-asset-library-all: Avoid ugly nested library storage

2022-12-02 Thread Julian Eisel
Commit: fb2303fb739e72e263289d9aeee10031b10a3ec6
Author: Julian Eisel
Date:   Fri Dec 2 16:58:47 2022 +0100
Branches: temp-asset-library-all
https://developer.blender.org/rBfb2303fb739e72e263289d9aeee10031b10a3ec6

Avoid ugly nested library storage

We actually don't have to do this, since we can just iterate over all
loaded libraries after calling the loading for the "All" asset library.

===

M   source/blender/asset_system/AS_asset_library.hh
M   source/blender/asset_system/intern/asset_library.cc
M   source/blender/asset_system/intern/asset_library_service.cc
M   source/blender/asset_system/intern/asset_library_service.hh
M   source/blender/editors/space_file/filelist.cc

===

diff --git a/source/blender/asset_system/AS_asset_library.hh 
b/source/blender/asset_system/AS_asset_library.hh
index a9ed5ff0594..d377f2334b8 100644
--- a/source/blender/asset_system/AS_asset_library.hh
+++ b/source/blender/asset_system/AS_asset_library.hh
@@ -56,10 +56,6 @@ class AssetLibrary {
*/
   std::unique_ptr asset_storage_;
 
-  /** In some cases an asset library is a combination of multiple other ones, 
these are then
-   * referenced here. "All" asset library only currently. */
-  Vector nested_libs_; /* Non-owning pointers. */
-
   bCallbackFuncStore on_save_callback_store_{};
 
  public:
@@ -78,6 +74,17 @@ class AssetLibrary {
   AssetLibrary(StringRef root_path = "");
   ~AssetLibrary();
 
+  /**
+   * Execute \a fn for every asset library that is loaded. The asset library 
is passed to the
+   * \a fn call.
+   *
+   * \param skip_all_library: When true, the \a fn will also be executed for 
the "All" asset
+   *  library. This is just a combination of the other 
ones, so usually
+   *  iterating over it is redundant.
+   */
+  static void foreach_loaded(FunctionRef fn,
+ bool include_all_library = true);
+
   void load_catalogs();
 
   /** Load catalogs that have changed on disk. */
@@ -101,8 +108,6 @@ class AssetLibrary {
   /** Remove an asset from the library that was added using 
#add_external_asset() or
* #add_local_id_asset(). Can usually be expected to be constant time 
complexity (worst case may
* differ).
-   * Can also be called when this asset library is just a merged library 
containing multiple nested
-   * ones ("All" library). Will then check if it exists in a nested library 
and remove it.
*
* \note This is save to call if \a asset is freed (dangling reference), 
will not perform any
*   change then.
@@ -110,11 +115,6 @@ class AssetLibrary {
* case when the reference is dangling). */
   bool remove_asset(AssetRepresentation &asset);
 
-  /** In some cases an asset library is a combination of multiple other ones 
("All" asset library
-   * only currently). Iterate over the contained asset libraries, executing \a 
fn for each of them.
-   */
-  void foreach_nested(FunctionRef fn);
-
   /**
* Remap ID pointers for local ID assets, see #BKE_lib_remap.h. When an ID 
pointer would be
* mapped to null (typically when an ID gets removed), the asset is removed, 
because we don't
@@ -142,9 +142,6 @@ class AssetLibrary {
   AssetIdentifier asset_identifier_from_library(StringRef relative_asset_path);
 
   StringRefNull root_path() const;
-
- private:
-  std::optional find_asset_index(const AssetRepresentation &asset);
 };
 
 Vector all_valid_asset_library_refs();
@@ -152,6 +149,13 @@ Vector 
all_valid_asset_library_refs();
 }  // namespace blender::asset_system
 
 /**
+ * Load the data for an asset library, but not the asset representations 
themselves (loading these
+ * is currently not done in the asset system).
+ *
+ * For the "All" asset library (#ASSET_LIBRARY_ALL), every other known asset 
library will be
+ * loaded as well. So a call to #AssetLibrary::foreach_loaded() can be 
expected to iterate over all
+ * libraries.
+ *
  * \warning Catalogs are reloaded, invalidating catalog pointers. Do not store 
catalog pointers,
  *  store CatalogIDs instead and lookup the catalog where needed.
  */
diff --git a/source/blender/asset_system/intern/asset_library.cc 
b/source/blender/asset_system/intern/asset_library.cc
index 1fe477707a1..b763822c1ac 100644
--- a/source/blender/asset_system/intern/asset_library.cc
+++ b/source/blender/asset_system/intern/asset_library.cc
@@ -121,9 +121,11 @@ void AS_asset_library_refresh_catalog_simplename(struct 
::AssetLibrary *asset_li
 void AS_asset_library_remap_ids(const IDRemapper *mappings)
 {
   AssetLibraryService *service = AssetLibraryService::get();
-  service->foreach_loaded_asset_library([mappings](asset_system::AssetLibrary 
&library) {
-library.remap_ids_and_remove_invalid(*mappings);
-  });
+  service->foreach_loaded_asset_library(
+  [mappings](asset_system::AssetLibrary &library

[Bf-blender-cvs] [1dc8305213a] temp-asset-library-all: Merge branch 'master' into temp-asset-library-all

2022-12-02 Thread Julian Eisel
Commit: 1dc8305213a838b2e87e3a480576570b95cdc0d1
Author: Julian Eisel
Date:   Fri Dec 2 19:18:18 2022 +0100
Branches: temp-asset-library-all
https://developer.blender.org/rB1dc8305213a838b2e87e3a480576570b95cdc0d1

Merge branch 'master' into temp-asset-library-all

===



===



___
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] [948f13a8e70] master: Cleanup: compiler warning

2022-12-02 Thread Brecht Van Lommel
Commit: 948f13a8e70d7f26b8178dd0b153963c8cc6485d
Author: Brecht Van Lommel
Date:   Fri Dec 2 19:08:56 2022 +0100
Branches: master
https://developer.blender.org/rB948f13a8e70d7f26b8178dd0b153963c8cc6485d

Cleanup: compiler warning

===

M   intern/cycles/scene/light.cpp

===

diff --git a/intern/cycles/scene/light.cpp b/intern/cycles/scene/light.cpp
index 4907810c117..804f6bb7bd1 100644
--- a/intern/cycles/scene/light.cpp
+++ b/intern/cycles/scene/light.cpp
@@ -265,7 +265,7 @@ bool LightManager::object_usable_as_light(Object *object)
   return false;
 }
 
-void LightManager::device_update_distribution(Device *device,
+void LightManager::device_update_distribution(Device *,
   DeviceScene *dscene,
   Scene *scene,
   Progress &progress)

___
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] [71071a25a04] master: Fix crash on File > Link or Append

2022-12-02 Thread Julian Eisel
Commit: 71071a25a046c90f17ae3a6c4bde2a21470a0e4e
Author: Julian Eisel
Date:   Fri Dec 2 19:07:42 2022 +0100
Branches: master
https://developer.blender.org/rB71071a25a046c90f17ae3a6c4bde2a21470a0e4e

Fix crash on File > Link or Append

Would attempt to destruct memory of a null pointer. Use `MEM_delete()`
instead of manual destruction, which allows this case (NOP then).

===

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

===

diff --git a/source/blender/blenkernel/intern/asset.cc 
b/source/blender/blenkernel/intern/asset.cc
index 74605af815d..8fa5fc5842b 100644
--- a/source/blender/blenkernel/intern/asset.cc
+++ b/source/blender/blenkernel/intern/asset.cc
@@ -33,8 +33,8 @@ AssetMetaData *BKE_asset_metadata_create()
 
 void BKE_asset_metadata_free(AssetMetaData **asset_data)
 {
-  (*asset_data)->~AssetMetaData();
-  MEM_SAFE_FREE(*asset_data);
+  MEM_delete(*asset_data);
+  *asset_data = nullptr;
 }
 
 AssetMetaData::~AssetMetaData()

___
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] [2a33875065a] master: Fix link error after recent changes to use span for iterating over nodes

2022-12-02 Thread Brecht Van Lommel
Commit: 2a33875065ab360ca015b42a75558ebcbac1ae2a
Author: Brecht Van Lommel
Date:   Fri Dec 2 18:50:38 2022 +0100
Branches: master
https://developer.blender.org/rB2a33875065ab360ca015b42a75558ebcbac1ae2a

Fix link error after recent changes to use span for iterating over nodes

===

M   source/blender/nodes/shader/node_shader_util.cc

===

diff --git a/source/blender/nodes/shader/node_shader_util.cc 
b/source/blender/nodes/shader/node_shader_util.cc
index fcf0e80a2e5..b1617a779ea 100644
--- a/source/blender/nodes/shader/node_shader_util.cc
+++ b/source/blender/nodes/shader/node_shader_util.cc
@@ -7,6 +7,8 @@
 
 #include "DNA_node_types.h"
 
+#include "BKE_node_runtime.hh"
+
 #include "node_shader_util.hh"
 
 #include "NOD_socket_search_link.hh"

___
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] [6fd43f10d7a] tmp-workbench-rewrite2: wbench next: shadows (w.i.p.)

2022-12-02 Thread Miguel Pozo
Commit: 6fd43f10d7a3713ea8cafd38818656fbcc31a6cf
Author: Miguel Pozo
Date:   Fri Dec 2 18:39:21 2022 +0100
Branches: tmp-workbench-rewrite2
https://developer.blender.org/rB6fd43f10d7a3713ea8cafd38818656fbcc31a6cf

wbench next: shadows (w.i.p.)

===

M   source/blender/draw/CMakeLists.txt
M   
source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh
M   
source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh
M   
source/blender/draw/engines/workbench/shaders/workbench_composite_comp.glsl
M   
source/blender/draw/engines/workbench/shaders/workbench_transparent_accum_frag.glsl
M   source/blender/draw/engines/workbench/workbench_engine.cc
M   source/blender/draw/engines/workbench/workbench_mesh_passes.cc
M   source/blender/draw/engines/workbench/workbench_private.hh
A   source/blender/draw/engines/workbench/workbench_shadow.cc
M   source/blender/draw/engines/workbench/workbench_state.cc

===

diff --git a/source/blender/draw/CMakeLists.txt 
b/source/blender/draw/CMakeLists.txt
index 92d7d133f2f..c747e191e3e 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -176,6 +176,7 @@ set(SRC
   engines/workbench/workbench_shader.cc
   engines/workbench/workbench_shader_cache.cc
   engines/workbench/workbench_shadow.c
+  engines/workbench/workbench_shadow.cc
   engines/workbench/workbench_state.cc
   engines/workbench/workbench_transparent.c
   engines/workbench/workbench_volume.c
diff --git 
a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh
 
b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh
index ffa1adea180..c33218cff1b 100644
--- 
a/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh
+++ 
b/source/blender/draw/engines/workbench/shaders/infos/workbench_composite_info.hh
@@ -51,6 +51,7 @@ GPU_SHADER_CREATE_INFO(workbench_next_composite)
 .sampler(3, ImageType::FLOAT_2D, "normal_tx")
 .sampler(4, ImageType::FLOAT_2D, "material_tx")
 .sampler(5, ImageType::DEPTH_2D, "depth_tx")
+.sampler(6, ImageType::UINT_2D, "stencil_tx")
 .uniform_buf(WB_WORLD_SLOT, "WorldData", "world_data")
 .push_constant(Type::BOOL, "forceShadowing")
 .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, 
"out_color_img")
@@ -72,11 +73,11 @@ 
GPU_SHADER_CREATE_INFO(workbench_next_resolve_opaque_flat).define("WORKBENCH_LIG
 
 GPU_SHADER_CREATE_INFO(workbench_next_resolve_curvature)
 .define("WORKBENCH_CURVATURE")
-.sampler(6, ImageType::UINT_2D, "object_id_tx");
+.sampler(7, ImageType::UINT_2D, "object_id_tx");
 
 GPU_SHADER_CREATE_INFO(workbench_next_resolve_cavity)
 .define("WORKBENCH_CAVITY")
-.sampler(7, ImageType::FLOAT_2D, "jitter_tx") /* TODO(Miguel Pozo): 
GPU_SAMPLER_REPEAT is set
+.sampler(8, ImageType::FLOAT_2D, "jitter_tx") /* TODO(Miguel Pozo): 
GPU_SAMPLER_REPEAT is set
  in CavityEffect, it 
doesn't work here ? */
 .uniform_buf(5, "float4", "cavity_samples[512]");
 
diff --git 
a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh 
b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh
index c66e4d61233..a77af467ec8 100644
--- 
a/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh
+++ 
b/source/blender/draw/engines/workbench/shaders/infos/workbench_shadow_info.hh
@@ -19,6 +19,16 @@ GPU_SHADER_CREATE_INFO(workbench_shadow_common)
 .vertex_source("workbench_shadow_vert.glsl")
 .additional_info("draw_mesh");
 
+GPU_SHADER_CREATE_INFO(workbench_next_shadow_common)
+.vertex_in(0, Type::VEC3, "pos")
+.vertex_out(workbench_shadow_iface)
+.push_constant(Type::FLOAT, "lightDistance")
+.push_constant(Type::VEC3, "lightDirection")
+.vertex_source("workbench_shadow_vert.glsl")
+.additional_info("draw_view")
+.additional_info("draw_modelmat_new")
+.additional_info("draw_resource_handle_new");
+
 /** \} */
 
 /*  */
@@ -58,42 +68,64 @@ GPU_SHADER_CREATE_INFO(workbench_shadow_debug)
 .fragment_out(2, Type::UINT, "objectId")
 .fragment_source("workbench_shadow_debug_frag.glsl");
 
+GPU_SHADER_CREATE_INFO(workbench_next_shadow_no_debug)
+.additional_info("workbench_shadow_no_debug");
+
+GPU_SHADER_CREATE_INFO(workbench_next_shadow_debug).additional_info("workbench_shadow_debug");
+
 /** \} */
 
 /*  */
 /** \name Variations Declaration
  * \{ */
 
-#define WORKBENCH_SHADOW_VARIATIONS(suffix, ...) \
-  GPU_SHADER_CREATE_INFO(workbench_shadow_pass_manifold_no_caps##suffix) \
+#define WORKBENCH_SHADOW_VARIATIONS(common, prefix, suffix, ...) \

[Bf-blender-cvs] [0302ab4e029] master: Fix link error on Linux + Clang due to missing atomic symbols

2022-12-02 Thread Brecht Van Lommel
Commit: 0302ab4e02973b15c8815e1b1d5fe3c987bd6e7b
Author: Brecht Van Lommel
Date:   Fri Dec 2 18:00:32 2022 +0100
Branches: master
https://developer.blender.org/rB0302ab4e02973b15c8815e1b1d5fe3c987bd6e7b

Fix link error on Linux + Clang due to missing atomic symbols

The new atomic disjoint set uses additional atomics which are not supported
as intrinsics on all architectures and require linking to libatomic.

Now always link to libatomic on Linux when it is available, instead of only
checking if atomic add for int64_t requires linking to this library.

Thanks to Sergey for the help fixing this.

===

M   build_files/cmake/platform/platform_unix.cmake

===

diff --git a/build_files/cmake/platform/platform_unix.cmake 
b/build_files/cmake/platform/platform_unix.cmake
index 3a75fda35a4..6f23b55d78d 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -970,16 +970,9 @@ if(WITH_COMPILER_CCACHE)
   endif()
 endif()
 
-# On some platforms certain atomic operations are not possible with assembly 
and/or intrinsics and
-# they are emulated in software with locks. For example, on armel there is no 
intrinsics to grant
-# 64 bit atomic operations and STL library uses libatomic to offload software 
emulation of atomics
-# to.
-# This function will check whether libatomic is required and if so will 
configure linker flags.
-# If atomic operations are possible without libatomic then linker flags are 
left as-is.
-function(CONFIGURE_ATOMIC_LIB_IF_NEEDED)
-  # Source which is used to enforce situation when software emulation of 
atomics is required.
-  # Assume that using 64bit integer gives a definitive answer (as in, if 64bit 
atomic operations
-  # are possible using assembly/intrinsics 8, 16, and 32 bit operations will 
also be possible.
+# Always link with libatomic if available, as it is required for data types
+# which don't have intrinsics.
+function(configure_atomic_lib_if_needed)
   set(_source
   "#include 
   #include 
@@ -990,25 +983,12 @@ function(CONFIGURE_ATOMIC_LIB_IF_NEEDED)
   )
 
   include(CheckCXXSourceCompiles)
-  check_cxx_source_compiles("${_source}" ATOMIC_OPS_WITHOUT_LIBATOMIC)
+  set(CMAKE_REQUIRED_LIBRARIES atomic)
+  check_cxx_source_compiles("${_source}" ATOMIC_OPS_WITH_LIBATOMIC)
+  unset(CMAKE_REQUIRED_LIBRARIES)
 
-  if(NOT ATOMIC_OPS_WITHOUT_LIBATOMIC)
-# Compilation of the test program has failed.
-# Try it again with -latomic to see if this is what is needed, or whether 
something else is
-# going on.
-
-set(CMAKE_REQUIRED_LIBRARIES atomic)
-check_cxx_source_compiles("${_source}" ATOMIC_OPS_WITH_LIBATOMIC)
-unset(CMAKE_REQUIRED_LIBRARIES)
-
-if(ATOMIC_OPS_WITH_LIBATOMIC)
-  set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -latomic" PARENT_SCOPE)
-else()
-  # Atomic operations are required part of Blender and it is not possible 
to process forward.
-  # We expect that either standard library or libatomic will make atomics 
to work. If both
-  # cases has failed something fishy o na bigger scope is going on.
-  message(FATAL_ERROR "Failed to detect required configuration for atomic 
operations")
-endif()
+  if(ATOMIC_OPS_WITH_LIBATOMIC)
+set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -latomic" PARENT_SCOPE)
   endif()
 endfunction()

___
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] [6b7119f9eda] master: Merge branch 'blender-v3.4-release'

2022-12-02 Thread Hans Goudey
Commit: 6b7119f9eda4bda0f2ad61958e6bbfff773de4dd
Author: Hans Goudey
Date:   Fri Dec 2 11:24:18 2022 -0600
Branches: master
https://developer.blender.org/rB6b7119f9eda4bda0f2ad61958e6bbfff773de4dd

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] [99dc90accc2] blender-v3.4-release: Fix: Reversed attribute is_internal RNA property

2022-12-02 Thread Hans Goudey
Commit: 99dc90accc2e279688932f2b94a96d0e546e6437
Author: Hans Goudey
Date:   Fri Dec 2 11:21:54 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rB99dc90accc2e279688932f2b94a96d0e546e6437

Fix: Reversed attribute is_internal RNA property

`is_internal` is supposed to mean that the attribute shouldn't be
visible in lists or the spreadsheet by default, and that it can't be
accessed in geometry nodes. But the value was reversed, which
just happened to work because the list filtering was swapped.

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

===

M   release/scripts/startup/bl_ui/properties_data_curves.py
M   release/scripts/startup/bl_ui/properties_data_mesh.py
M   release/scripts/startup/bl_ui/properties_data_pointcloud.py
M   source/blender/makesrna/intern/rna_attribute.c

===

diff --git a/release/scripts/startup/bl_ui/properties_data_curves.py 
b/release/scripts/startup/bl_ui/properties_data_curves.py
index df80bdb4552..f71296e98f9 100644
--- a/release/scripts/startup/bl_ui/properties_data_curves.py
+++ b/release/scripts/startup/bl_ui/properties_data_curves.py
@@ -89,7 +89,7 @@ class CURVES_UL_attributes(UIList):
 indices = [i for i in range(len(attributes))]
 
 for item in attributes:
-flags.append(self.bitflag_filter_item if item.is_internal else 0)
+flags.append(0 if item.is_internal else self.bitflag_filter_item)
 
 return flags, indices
 
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py 
b/release/scripts/startup/bl_ui/properties_data_mesh.py
index b9143fac912..ee10203908f 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -536,7 +536,7 @@ class MESH_UL_attributes(UIList):
 indices = [i for i in range(len(attributes))]
 
 for item in attributes:
-flags.append(self.bitflag_filter_item if item.is_internal else 0)
+flags.append(0 if item.is_internal else self.bitflag_filter_item)
 
 return flags, indices
 
@@ -632,9 +632,9 @@ class ColorAttributesListBase():
 skip = (
 (item.domain not in {"POINT", "CORNER"}) or
 (item.data_type not in {"FLOAT_COLOR", "BYTE_COLOR"}) or
-(not item.is_internal)
+item.is_internal
 )
-ret.append(self.bitflag_filter_item if not skip else 0)
+ret.append(0 if skip else self.bitflag_filter_item)
 idxs.append(idx)
 
 return ret, idxs
diff --git a/release/scripts/startup/bl_ui/properties_data_pointcloud.py 
b/release/scripts/startup/bl_ui/properties_data_pointcloud.py
index d93adcdcc60..6e12a3e8fb2 100644
--- a/release/scripts/startup/bl_ui/properties_data_pointcloud.py
+++ b/release/scripts/startup/bl_ui/properties_data_pointcloud.py
@@ -71,7 +71,7 @@ class POINTCLOUD_UL_attributes(UIList):
 indices = [i for i in range(len(attributes))]
 
 for item in attributes:
-flags.append(self.bitflag_filter_item if item.is_internal else 0)
+flags.append(0 if item.is_internal else self.bitflag_filter_item)
 
 return flags, indices
 
diff --git a/source/blender/makesrna/intern/rna_attribute.c 
b/source/blender/makesrna/intern/rna_attribute.c
index e1b6fb429a7..116eb1059b7 100644
--- a/source/blender/makesrna/intern/rna_attribute.c
+++ b/source/blender/makesrna/intern/rna_attribute.c
@@ -251,7 +251,7 @@ static int rna_Attribute_domain_get(PointerRNA *ptr)
 static bool rna_Attribute_is_internal_get(PointerRNA *ptr)
 {
   const CustomDataLayer *layer = (const CustomDataLayer *)ptr->data;
-  return BKE_attribute_allow_procedural_access(layer->name);
+  return !BKE_attribute_allow_procedural_access(layer->name);
 }
 
 static void rna_Attribute_data_begin(CollectionPropertyIterator *iter, 
PointerRNA *ptr)

___
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] [5b8e2ebd97b] master: Cleanup: Use Span to iterate over nodes instead of ListBase

2022-12-02 Thread Hans Goudey
Commit: 5b8e2ebd97bd795c6aea1b5270c8e49b70b3069e
Author: Hans Goudey
Date:   Fri Dec 2 11:12:51 2022 -0600
Branches: master
https://developer.blender.org/rB5b8e2ebd97bd795c6aea1b5270c8e49b70b3069e

Cleanup: Use Span to iterate over nodes instead of ListBase

Since 90ea1b76434fe175e, there is always a span of nodes
available at runtime. This is easier to read and write.

===

M   source/blender/blenkernel/intern/image.cc
M   source/blender/blenkernel/intern/material.cc
M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenkernel/intern/node_tree_update.cc
M   source/blender/blenkernel/intern/scene.cc
M   source/blender/blenkernel/intern/texture.cc
M   source/blender/blenloader/intern/versioning_common.cc
M   source/blender/blenloader/intern/versioning_defaults.cc
M   source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M   source/blender/editors/space_buttons/buttons_texture.cc
M   source/blender/editors/space_node/link_drag_search.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_group.cc
M   source/blender/editors/space_node/node_relationships.cc
M   source/blender/editors/space_node/node_select.cc
M   source/blender/editors/space_node/space_node.cc
M   source/blender/editors/transform/transform_convert_node.cc
M   source/blender/editors/util/ed_viewer_path.cc
M   source/blender/io/usd/intern/usd_writer_material.cc
M   source/blender/nodes/composite/node_composite_tree.cc
M   source/blender/nodes/shader/node_shader_util.cc
M   source/blender/nodes/shader/nodes/node_shader_common.cc
M   source/blender/render/intern/pipeline.cc

===

diff --git a/source/blender/blenkernel/intern/image.cc 
b/source/blender/blenkernel/intern/image.cc
index ae05096826b..5e8a2cad99e 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -71,6 +71,7 @@
 #include "BKE_lib_id.h"
 #include "BKE_main.h"
 #include "BKE_node.h"
+#include "BKE_node_runtime.hh"
 #include "BKE_node_tree_update.h"
 #include "BKE_packedFile.h"
 #include "BKE_report.h"
@@ -2743,7 +2744,7 @@ static void image_walk_ntree_all_users(
 {
   switch (ntree->type) {
 case NTREE_SHADER:
-  LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+  for (bNode *node : ntree->all_nodes()) {
 if (node->id) {
   if (node->type == SH_NODE_TEX_IMAGE) {
 NodeTexImage *tex = static_cast(node->storage);
@@ -2759,7 +2760,7 @@ static void image_walk_ntree_all_users(
   }
   break;
 case NTREE_TEXTURE:
-  LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+  for (bNode *node : ntree->all_nodes()) {
 if (node->id && node->type == TEX_NODE_IMAGE) {
   Image *ima = (Image *)node->id;
   ImageUser *iuser = static_cast(node->storage);
@@ -2768,7 +2769,7 @@ static void image_walk_ntree_all_users(
   }
   break;
 case NTREE_COMPOSIT:
-  LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
+  for (bNode *node : ntree->all_nodes()) {
 if (node->id && node->type == CMP_NODE_IMAGE) {
   Image *ima = (Image *)node->id;
   ImageUser *iuser = static_cast(node->storage);
diff --git a/source/blender/blenkernel/intern/material.cc 
b/source/blender/blenkernel/intern/material.cc
index 597375f4f81..bcce1e61eb5 100644
--- a/source/blender/blenkernel/intern/material.cc
+++ b/source/blender/blenkernel/intern/material.cc
@@ -58,6 +58,7 @@
 #include "BKE_material.h"
 #include "BKE_mesh.h"
 #include "BKE_node.h"
+#include "BKE_node_runtime.hh"
 #include "BKE_object.h"
 #include "BKE_scene.h"
 #include "BKE_vfont.h"
@@ -1387,7 +1388,7 @@ static bool ntree_foreach_texnode_recursive(bNodeTree 
*nodetree,
 {
   const bool do_image_nodes = (slot_filter & PAINT_SLOT_IMAGE) != 0;
   const bool do_color_attributes = (slot_filter & PAINT_SLOT_COLOR_ATTRIBUTE) 
!= 0;
-  LISTBASE_FOREACH (bNode *, node, &nodetree->nodes) {
+  for (bNode *node : nodetree->all_nodes()) {
 if (do_image_nodes && node->typeinfo->nclass == NODE_CLASS_TEXTURE &&
 node->typeinfo->type == SH_NODE_TEX_IMAGE && node->id) {
   if (!callback(node, userdata)) {
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index c712d7ff668..c502381fc62 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -166,9 +166,9 @@ static void ntree_copy_data(Main * /*bmain*/, ID *id_dst, 
const ID *id_src, cons
   }
 
   /* update node->parent pointers */
-  LISTBASE_FOREACH (bNode *, new_node, &ntree_dst->nodes) {
-if (new_node->parent) {
-  new_node->parent = 
dst_runti

[Bf-blender-cvs] [c5e71cebaa9] master: Cycles: Remove OpenGL header

2022-12-02 Thread Sergey Sharybin
Commit: c5e71cebaa9b32ce78b9c14f38e93cb0d304b347
Author: Sergey Sharybin
Date:   Fri Dec 2 16:47:14 2022 +0100
Branches: master
https://developer.blender.org/rBc5e71cebaa9b32ce78b9c14f38e93cb0d304b347

Cycles: Remove OpenGL header

It is not really used from any of the sources, including the
standalone app. Since we are moving to a more backend-independent
drawing it makes sense to remove header which was specific to
how Blender integrates Cycles into viewport.

There is probably some cleanup in CMake files is possible, but
there is some inter-dependency with USD.

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

===

M   intern/cycles/blender/display_driver.cpp
M   intern/cycles/blender/python.cpp
M   intern/cycles/blender/sync.cpp
M   intern/cycles/util/CMakeLists.txt
D   intern/cycles/util/opengl.h

===

diff --git a/intern/cycles/blender/display_driver.cpp 
b/intern/cycles/blender/display_driver.cpp
index f07d8b41838..7149592ad83 100644
--- a/intern/cycles/blender/display_driver.cpp
+++ b/intern/cycles/blender/display_driver.cpp
@@ -6,7 +6,6 @@
 #include "device/device.h"
 #include "util/log.h"
 #include "util/math.h"
-#include "util/opengl.h"
 
 #include "GPU_context.h"
 #include "GPU_immediate.h"
diff --git a/intern/cycles/blender/python.cpp b/intern/cycles/blender/python.cpp
index d27bd26f3dc..cfc7a78143c 100644
--- a/intern/cycles/blender/python.cpp
+++ b/intern/cycles/blender/python.cpp
@@ -18,7 +18,6 @@
 #include "util/guiding.h"
 #include "util/log.h"
 #include "util/md5.h"
-#include "util/opengl.h"
 #include "util/openimagedenoise.h"
 #include "util/path.h"
 #include "util/string.h"
diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp
index 5251f0fee9c..d3598fd19b9 100644
--- a/intern/cycles/blender/sync.cpp
+++ b/intern/cycles/blender/sync.cpp
@@ -26,7 +26,6 @@
 #include "util/foreach.h"
 #include "util/hash.h"
 #include "util/log.h"
-#include "util/opengl.h"
 #include "util/openimagedenoise.h"
 
 CCL_NAMESPACE_BEGIN
diff --git a/intern/cycles/util/CMakeLists.txt 
b/intern/cycles/util/CMakeLists.txt
index 7f8f4a5ce76..ea5a5de654d 100644
--- a/intern/cycles/util/CMakeLists.txt
+++ b/intern/cycles/util/CMakeLists.txt
@@ -74,7 +74,6 @@ set(SRC_HEADERS
   md5.h
   murmurhash.h
   openimagedenoise.h
-  opengl.h
   openvdb.h
   optimization.h
   param.h
diff --git a/intern/cycles/util/opengl.h b/intern/cycles/util/opengl.h
deleted file mode 100644
index fefee4ec022..000
--- a/intern/cycles/util/opengl.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: Apache-2.0
- * Copyright 2011-2022 Blender Foundation */
-
-#ifndef __UTIL_OPENGL_H__
-#define __UTIL_OPENGL_H__
-
-/* OpenGL header includes, used everywhere we use OpenGL, to deal with
- * platform differences in one central place. */
-
-#include 
-
-#endif /* __UTIL_OPENGL_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] [ab8946f957e] master: Merge branch 'blender-v3.4-release'

2022-12-02 Thread Bastien Montagne
Commit: ab8946f957e2f2a32479281c01b31ebec852ad10
Author: Bastien Montagne
Date:   Fri Dec 2 16:48:09 2022 +0100
Branches: master
https://developer.blender.org/rBab8946f957e2f2a32479281c01b31ebec852ad10

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] [3d9f4012dc6] master: Cycles: Fixes for viewport render on Metal drawing backend

2022-12-02 Thread Sergey Sharybin
Commit: 3d9f4012dc6da72f616cff3ed6afb91f88c84405
Author: Sergey Sharybin
Date:   Fri Dec 2 15:56:12 2022 +0100
Branches: master
https://developer.blender.org/rB3d9f4012dc6da72f616cff3ed6afb91f88c84405

Cycles: Fixes for viewport render on Metal drawing backend

This change fixes issues with viewport rendering when Metal
GPU backend is used for drawing. This is not a default build
configuration and requires the following tweaks:

- Enable WITH_METAL_BACKEND CMake option (set it to on)
- Use `--gpu-backend metal` command line arguments

It also helps using the `--factory-startup` command line
argument to ensure Eevee is not used (it is not ported and
will crash).

The root of the problem was in the use of glViewport().
It is replaced with the GPU_viewport_size_get_i() which
is supposed to be portable equivalent form the GPU module.
Without this change the viewport size is detected to be 0
which backfired in few places.

The rest of the changes were to make the code more robust
in the extreme conditions instead of asserting or crashing.

Simplified and streamlined GPU resources creation in the
display driver. It was a bit convoluted mix of creation of
the GPU resources and resizing them to the proper size. It
even seemed to be done in the reverse order. Now it is as
simple as "just ensure GPU resources are there for the
given texture or buffer size".

Also avoid division by zero in the tile manager.

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

===

M   intern/cycles/blender/display_driver.cpp
M   intern/cycles/blender/python.cpp
M   intern/cycles/session/tile.cpp

===

diff --git a/intern/cycles/blender/display_driver.cpp 
b/intern/cycles/blender/display_driver.cpp
index 883310e13ae..f07d8b41838 100644
--- a/intern/cycles/blender/display_driver.cpp
+++ b/intern/cycles/blender/display_driver.cpp
@@ -238,12 +238,19 @@ class DisplayGPUTexture {
 return *this;
   }
 
-  bool gpu_resources_ensure()
+  bool gpu_resources_ensure(const uint texture_width, const uint 
texture_height)
   {
+if (width != texture_width || height != texture_height) {
+  gpu_resources_destroy();
+}
+
 if (gpu_texture) {
   return true;
 }
 
+width = texture_width;
+height = texture_height;
+
 /* Texture must have a minimum size of 1x1. */
 gpu_texture = GPU_texture_create_2d(
 "CyclesBlitTexture", max(width, 1), max(height, 1), 1, GPU_RGBA16F, 
nullptr);
@@ -274,16 +281,6 @@ class DisplayGPUTexture {
 --num_used;
   }
 
-  void ensure_size(uint texture_width, uint texture_height)
-  {
-if (width != texture_width || height != texture_height) {
-  gpu_resources_destroy();
-  width = texture_width;
-  height = texture_height;
-  gpu_resources_ensure();
-}
-  }
-
   /* Texture resource allocated by the GPU module.
*
* NOTE: Allocated on the render engine's context. */
@@ -339,15 +336,15 @@ class DisplayGPUPixelBuffer {
 return *this;
   }
 
-  void ensure_size(uint new_width, uint new_height)
+  bool gpu_resources_ensure(const uint new_width, const uint new_height)
   {
-size_t required_size = sizeof(half4) * new_width * new_height * 4;
+const size_t required_size = sizeof(half4) * new_width * new_height * 4;
 
+/* Try to re-use the existing PBO if it has usable size. */
 if (gpu_pixel_buffer) {
   if (new_width != width || new_height != height ||
   GPU_pixel_buffer_size(gpu_pixel_buffer) < required_size) {
-GPU_pixel_buffer_free(gpu_pixel_buffer);
-gpu_pixel_buffer = nullptr;
+gpu_resources_destroy();
   }
 }
 
@@ -359,12 +356,6 @@ class DisplayGPUPixelBuffer {
 if (!gpu_pixel_buffer) {
   gpu_pixel_buffer = GPU_pixel_buffer_create(required_size);
 }
-  }
-
-  bool gpu_resources_ensure()
-  {
-/* Create pixel buffer using current size. */
-ensure_size(width, height);
 
 if (gpu_pixel_buffer == nullptr) {
   LOG(ERROR) << "Error creating texture pixel buffer object.";
@@ -420,16 +411,6 @@ class DrawTile {
 
   DrawTile &operator=(DrawTile &&other) = default;
 
-  bool gpu_resources_ensure()
-  {
-if (!texture.gpu_resources_ensure()) {
-  gpu_resources_destroy();
-  return false;
-}
-
-return true;
-  }
-
   void gpu_resources_destroy()
   {
 texture.gpu_resources_destroy();
@@ -449,16 +430,6 @@ class DrawTile {
 
 class DrawTileAndPBO {
  public:
-  bool gpu_resources_ensure()
-  {
-if (!tile.gpu_resources_ensure() || !buffer_object.gpu_resources_ensure()) 
{
-  gpu_resources_destroy();
-  return false;
-}
-
-return true;
-  }
-
   void gpu_resources_destroy()
   {
 tile.gpu_resources_destroy();
@@ -560,15 +531,6 @@ bool BlenderDisplayDriver::update_begin(const Params 
¶ms,
 need_clear_ = false;
   }
 
-  if (!tiles_->current_tile.gpu_resources_ensure()) {
-   

[Bf-blender-cvs] [e2f6fb5d358] blender-v3.4-release: i18n: Enable Finish language processing.

2022-12-02 Thread Bastien Montagne
Commit: e2f6fb5d358f642db4435b1b79df148ce72a49fd
Author: Bastien Montagne
Date:   Fri Dec 2 16:28:35 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBe2f6fb5d358f642db4435b1b79df148ce72a49fd

i18n: Enable Finish language processing.

===

M   release/scripts/modules/bl_i18n_utils/settings.py

===

diff --git a/release/scripts/modules/bl_i18n_utils/settings.py 
b/release/scripts/modules/bl_i18n_utils/settings.py
index fd596036157..2f3efc47180 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -98,7 +98,7 @@ IMPORT_MIN_LEVEL = 0.0
 
 # Languages in /branches we do not want to import in /trunk currently...
 IMPORT_LANGUAGES_SKIP = {
-'am_ET', 'bg_BG', 'fi_FI', 'el_GR', 'et_EE', 'ne_NP', 'ro_RO', 'uz_UZ', 
'uz_UZ@cyrillic', 'kk_KZ', 'es_ES',
+'am_ET', 'bg_BG', 'el_GR', 'et_EE', 'ne_NP', 'ro_RO', 'uz_UZ', 
'uz_UZ@cyrillic', 'kk_KZ', 'es_ES',
 }
 
 # Languages that need RTL pre-processing.

___
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] [a0caa039424] geometry-nodes-simulation: Merge branch 'master' into geometry-nodes-simulation

2022-12-02 Thread Hans Goudey
Commit: a0caa039424b3fbadd3ddc9393794275dd6e25e0
Author: Hans Goudey
Date:   Fri Dec 2 09:17:54 2022 -0600
Branches: geometry-nodes-simulation
https://developer.blender.org/rBa0caa039424b3fbadd3ddc9393794275dd6e25e0

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] [5186c9c9c65] temp-asset-library-all: Merge remote-tracking branch 'origin/master' into temp-asset-library-all

2022-12-02 Thread Julian Eisel
Commit: 5186c9c9c65c8b78b6c395442d3d53c9539b66b4
Author: Julian Eisel
Date:   Fri Dec 2 16:20:28 2022 +0100
Branches: temp-asset-library-all
https://developer.blender.org/rB5186c9c9c65c8b78b6c395442d3d53c9539b66b4

Merge remote-tracking branch 'origin/master' into temp-asset-library-all

===



===

diff --cc source/blender/editors/space_file/filelist.cc
index 9d1191ad80e,bf0f9c865a8..ca83ff6d51b
--- a/source/blender/editors/space_file/filelist.cc
+++ b/source/blender/editors/space_file/filelist.cc
@@@ -3125,13 -3104,17 +3125,17 @@@ static void filelist_readjob_list_lib_a
  if (datablock_info->asset_data) {
entry->typeflag |= FILE_TYPE_ASSET;
  
-   if (job_params->load_asset_library) {
- /** XXX Moving out the asset metadata like this isn't great. */
- std::unique_ptr metadata = BKE_asset_metadata_move_to_unique_ptr(
- datablock_info->asset_data);
- BKE_asset_metadata_free(&datablock_info->asset_data);
 -  if (filelist->asset_library) {
++  if (job_params->asset_library) {
+ /* Take ownership over the asset data (shallow copies into unique_ptr 
managed memory) to
+  * pass it on to the asset system. */
+ std::unique_ptr metadata = 
std::make_unique(*datablock_info->asset_data);
+ MEM_freeN(datablock_info->asset_data);
+ /* Give back a non-owning pointer, because the data-block info is 
still needed (e.g. to
+  * update the asset index). */
+ datablock_info->asset_data = metadata.get();
+ datablock_info->free_asset_data = false;
  
 -entry->asset = &filelist->asset_library->add_external_asset(
 +entry->asset = &job_params->load_asset_library->add_external_asset(
  entry->relpath, datablock_info->name, std::move(metadata));
}
  }

___
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] [2bce3c0ac49] master: Fix: don't allow node identifiers to be zero

2022-12-02 Thread Jacques Lucke
Commit: 2bce3c0ac49d3a3acf8028862db1c70f39d052a9
Author: Jacques Lucke
Date:   Fri Dec 2 15:41:58 2022 +0100
Branches: master
https://developer.blender.org/rB2bce3c0ac49d3a3acf8028862db1c70f39d052a9

Fix: don't allow node identifiers to be zero

Was missing in rB88c6d824e78ebe40b891.

===

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

===

diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 0f2b2e1c345..c712d7ff668 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -679,7 +679,7 @@ void ntreeBlendReadData(BlendDataReader *reader, ID 
*owner_id, bNodeTree *ntree)
 
 /* Create the `nodes_by_id` cache eagerly so it can be expected to be 
valid. Because
  * we create it here we also have to check for zero identifiers from 
previous versions. */
-if (ntree->runtime->nodes_by_id.contains_as(node->identifier)) {
+if (node->identifier == 0 || 
ntree->runtime->nodes_by_id.contains_as(node->identifier)) {
   nodeUniqueID(ntree, node);
 }
 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] [e028662f78b] master: Cycles: store axis and length of an area light instead of their product

2022-12-02 Thread Weizhen Huang
Commit: e028662f78bbbd642fb636a8d466c182a8e2841c
Author: Weizhen Huang
Date:   Fri Dec 2 15:21:57 2022 +0100
Branches: master
https://developer.blender.org/rBe028662f78bbbd642fb636a8d466c182a8e2841c

Cycles: store axis and length of an area light instead of their product

===

M   intern/cycles/kernel/light/area.h
M   intern/cycles/kernel/light/background.h
M   intern/cycles/kernel/types.h
M   intern/cycles/scene/light.cpp
M   intern/cycles/util/math_intersect.h

===

diff --git a/intern/cycles/kernel/light/area.h 
b/intern/cycles/kernel/light/area.h
index 212631d363d..db8faf6ec10 100644
--- a/intern/cycles/kernel/light/area.h
+++ b/intern/cycles/kernel/light/area.h
@@ -15,18 +15,19 @@ CCL_NAMESPACE_BEGIN
  * NOTE: light_p is modified when sample_coord is true. */
 ccl_device_inline float area_light_rect_sample(float3 P,
ccl_private float3 *light_p,
-   float3 extentu,
-   float3 extentv,
+   const float3 axis_u,
+   const float len_u,
+   const float3 axis_v,
+   const float len_v,
float randu,
float randv,
bool sample_coord)
 {
   /* In our name system we're using P for the center, which is o in the paper. 
*/
-  float3 corner = *light_p - extentu * 0.5f - extentv * 0.5f;
-  float extentu_len, extentv_len;
+  float3 corner = *light_p - axis_u * len_u * 0.5f - axis_v * len_v * 0.5f;
   /* Compute local reference system R. */
-  float3 x = normalize_len(extentu, &extentu_len);
-  float3 y = normalize_len(extentv, &extentv_len);
+  float3 x = axis_u;
+  float3 y = axis_v;
   float3 z = cross(x, y);
   /* Compute rectangle coords in local reference system. */
   float3 dir = corner - P;
@@ -38,8 +39,8 @@ ccl_device_inline float area_light_rect_sample(float3 P,
   }
   float x0 = dot(dir, x);
   float y0 = dot(dir, y);
-  float x1 = x0 + extentu_len;
-  float y1 = y0 + extentv_len;
+  float x1 = x0 + len_u;
+  float y1 = y0 + len_v;
   /* Compute internal angles (gamma_i). */
   float4 diff = make_float4(x0, y1, x1, y0) - make_float4(x1, y0, x0, y1);
   float4 nz = make_float4(y0, x1, y1, x0) * diff;
@@ -106,8 +107,10 @@ ccl_device float area_light_spread_attenuation(const 
float3 D,
 ccl_device bool area_light_spread_clamp_area_light(const float3 P,
const float3 lightNg,
ccl_private float3 *lightP,
-   ccl_private float3 *extentu,
-   ccl_private float3 *extentv,
+   const float3 axis_u,
+   ccl_private float *len_u,
+   const float3 axis_v,
+   ccl_private float *len_v,
const float tan_spread)
 {
   /* Closest point in area light plane and distance to that plane. */
@@ -117,22 +120,16 @@ ccl_device bool area_light_spread_clamp_area_light(const 
float3 P,
   /* Radius of circle on area light that actually affects the shading point. */
   const float radius = t / tan_spread;
 
-  /* TODO: would be faster to store as normalized vector + length, also in 
area_light_rect_sample.
-   */
-  float len_u, len_v;
-  const float3 u = normalize_len(*extentu, &len_u);
-  const float3 v = normalize_len(*extentv, &len_v);
-
   /* Local uv coordinates of closest point. */
-  const float closest_u = dot(u, closest_P - *lightP);
-  const float closest_v = dot(v, closest_P - *lightP);
+  const float closest_u = dot(axis_u, closest_P - *lightP);
+  const float closest_v = dot(axis_v, closest_P - *lightP);
 
   /* Compute rectangle encompassing the circle that affects the shading point,
* clamped to the bounds of the area light. */
-  const float min_u = max(closest_u - radius, -len_u * 0.5f);
-  const float max_u = min(closest_u + radius, len_u * 0.5f);
-  const float min_v = max(closest_v - radius, -len_v * 0.5f);
-  const float max_v = min(closest_v + radius, len_v * 0.5f);
+  const float min_u = max(closest_u - radius, -*len_u * 0.5f);
+  const float max_u = min(closest_u + radius, *len_u * 0.5f);
+  const float min_v = max(closest_v - radius, -*len_v * 0.5f);
+  const float max_v = min(closest_v + radius, *len_v * 0.5f);
 
   /* Skip if rectangle is empty. */
   if (min_u >= max_u || min_v >

[Bf-blender-cvs] [6a7917162c5] master: Fix asset index only generating empty entries since 1efc94bb2f7b

2022-12-02 Thread Julian Eisel
Commit: 6a7917162c560eef9c5db188bc0a4d608aff21ad
Author: Julian Eisel
Date:   Thu Dec 1 15:48:54 2022 +0100
Branches: master
https://developer.blender.org/rB6a7917162c560eef9c5db188bc0a4d608aff21ad

Fix asset index only generating empty entries since 1efc94bb2f7b

Steps to reproduce were:
- Open a .blend file that is located inside of an asset library and
  contains assets.
- Save and close the file.
- Open a new file (Ctrl+N -> General).
- Open asset browser and load the asset library from above.
- If the assets from the file above still show up, press refresh button.
- -> Assets from the file above don't appear.

Likely fixes the underlying issue for T102610. A followup will be needed
to correct the empty asset index files written because of this bug.

We're in the process of moving responsibilities from the file/asset
browser backend to the asset system. 1efc94bb2f7b introduces a new
representation for asset, which would own the asset metadata now instead
of the file data.

Since the file-list code still does the loading of asset libraries,
ownership of the asset metadata has to be transferred to the asset
system. However, the asset indexing still requires it to be available,
so it can update the index with latest data. So transfer the ownership,
but still keep a non-owning pointer set.

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

Reviewed by: Bastien Montagne

===

M   source/blender/blenkernel/BKE_asset.h
M   source/blender/blenkernel/intern/asset.cc
M   source/blender/blenloader/BLO_readfile.h
M   source/blender/blenloader/intern/readblenentry.cc
M   source/blender/editors/asset/intern/asset_indexer.cc
M   source/blender/editors/space_file/file_indexer.cc
M   source/blender/editors/space_file/filelist.cc
M   source/blender/makesdna/DNA_asset_types.h

===

diff --git a/source/blender/blenkernel/BKE_asset.h 
b/source/blender/blenkernel/BKE_asset.h
index 81a132a8f91..81b520a1db0 100644
--- a/source/blender/blenkernel/BKE_asset.h
+++ b/source/blender/blenkernel/BKE_asset.h
@@ -71,12 +71,3 @@ void BKE_asset_metadata_read(struct BlendDataReader *reader, 
struct AssetMetaDat
 #ifdef __cplusplus
 }
 #endif
-
-#ifdef __cplusplus
-
-#  include 
-
-[[nodiscard]] std::unique_ptr 
BKE_asset_metadata_move_to_unique_ptr(
-AssetMetaData *asset_data);
-
-#endif
diff --git a/source/blender/blenkernel/intern/asset.cc 
b/source/blender/blenkernel/intern/asset.cc
index 7103e017847..74605af815d 100644
--- a/source/blender/blenkernel/intern/asset.cc
+++ b/source/blender/blenkernel/intern/asset.cc
@@ -47,13 +47,6 @@ AssetMetaData::~AssetMetaData()
   BLI_freelistN(&tags);
 }
 
-std::unique_ptr 
BKE_asset_metadata_move_to_unique_ptr(AssetMetaData *asset_data)
-{
-  std::unique_ptr unique_asset_data = 
std::make_unique(*asset_data);
-  *asset_data = *DNA_struct_default_get(AssetMetaData);
-  return unique_asset_data;
-}
-
 static AssetTag *asset_metadata_tag_add(AssetMetaData *asset_data, const char 
*const name)
 {
   AssetTag *tag = (AssetTag *)MEM_callocN(sizeof(*tag), __func__);
diff --git a/source/blender/blenloader/BLO_readfile.h 
b/source/blender/blenloader/BLO_readfile.h
index 75a1956ce12..4c34b628a6d 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -182,6 +182,7 @@ void BLO_blendfiledata_free(BlendFileData *bfd);
 typedef struct BLODataBlockInfo {
   char name[64]; /* MAX_NAME */
   struct AssetMetaData *asset_data;
+  bool free_asset_data;
   /* Optimization: Tag data-blocks for which we know there is no preview.
* Knowing this can be used to skip the (potentially expensive) preview 
loading process. If this
* is set to true it means we looked for a preview and couldn't find one. 
False may mean that
@@ -189,6 +190,15 @@ typedef struct BLODataBlockInfo {
   bool no_preview_found;
 } BLODataBlockInfo;
 
+/**
+ * Frees contained data, not \a datablock_info itself.
+ */
+void BLO_datablock_info_free(BLODataBlockInfo *datablock_info);
+/**
+ * Can be used to free the list returned by 
#BLO_blendhandle_get_datablock_info().
+ */
+void BLO_datablock_info_linklist_free(struct LinkNode * /*BLODataBlockInfo*/ 
datablock_infos);
+
 /**
  * Open a blendhandle from a file path.
  *
@@ -231,8 +241,11 @@ struct LinkNode 
*BLO_blendhandle_get_datablock_names(BlendHandle *bh,
  * \param ofblocktype: The type of names to get.
  * \param use_assets_only: Limit the result to assets only.
  * \param r_tot_info_items: The length of the returned list.
+ *
  * \return A BLI_linklist of `BLODataBlockInfo *`.
- * The links and #BLODataBlockInfo.asset_data should be freed with MEM_freeN.
+ *
+ * \note The links should be freed using #BLO_datablock_info_free() or the 
entire list using
+ *   #BLO_datablock_info_linklist_free().
  */
 struct LinkNode * /*BLODataBlockInfo*/ 
BLO_blendhandle_get_databl

[Bf-blender-cvs] [f23b870def7] temp-vulkan-shader: Removed debug code.

2022-12-02 Thread Jeroen Bakker
Commit: f23b870def76e616815dda0a2198bb8714810bda
Author: Jeroen Bakker
Date:   Fri Dec 2 12:46:53 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rBf23b870def76e616815dda0a2198bb8714810bda

Removed debug code.

===

M   source/blender/gpu/vulkan/vk_shader.cc

===

diff --git a/source/blender/gpu/vulkan/vk_shader.cc 
b/source/blender/gpu/vulkan/vk_shader.cc
index e8580b66c22..7cdeca228bb 100644
--- a/source/blender/gpu/vulkan/vk_shader.cc
+++ b/source/blender/gpu/vulkan/vk_shader.cc
@@ -505,7 +505,6 @@ static char *glsl_patch_get()
   STR_CONCAT(patch, slen, "#define gpu_BaseInstance (0)\n");
   STR_CONCAT(patch, slen, "#define gpu_InstanceIndex (gl_InstanceIndex)\n");
 
-  // TODO: we should remove usage of gl_InstanceID/gl_VertexID.
   STR_CONCAT(patch, slen, "#define gl_InstanceID gpu_InstanceIndex\n");
 
   STR_CONCAT(patch, slen, "#define DFDX_SIGN 1.0\n");
@@ -547,7 +546,6 @@ Vector VKShader::compile_glsl_to_spirv(Span sources,
   }
 
   if (module.GetCompilationStatus() != shaderc_compilation_status_success) {
-// printf("%s %s\n", __func__, combined_sources.c_str());
 compilation_failed_ = true;
 return Vector();
   }

___
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] [f5f1ac9f035] temp-vulkan-shader: Revert whitespace change.

2022-12-02 Thread Jeroen Bakker
Commit: f5f1ac9f035b288efe8a563fa4292fb3f7f039c1
Author: Jeroen Bakker
Date:   Fri Dec 2 13:44:35 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rBf5f1ac9f035b288efe8a563fa4292fb3f7f039c1

Revert whitespace change.

===

M   source/blender/gpu/intern/gpu_init_exit.c

===

diff --git a/source/blender/gpu/intern/gpu_init_exit.c 
b/source/blender/gpu/intern/gpu_init_exit.c
index 2ed524f8666..2dbb4b215bb 100644
--- a/source/blender/gpu/intern/gpu_init_exit.c
+++ b/source/blender/gpu/intern/gpu_init_exit.c
@@ -34,6 +34,7 @@ void GPU_init(void)
   gpu_shader_create_info_init();
 
   gpu_codegen_init();
+
   gpu_batch_init();
 }

___
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] [50334537352] temp-vulkan-shader: Merge branch 'master' into temp-vulkan-shader

2022-12-02 Thread Jeroen Bakker
Commit: 50334537352efa0be4fdaf2c709bd88426ba751b
Author: Jeroen Bakker
Date:   Fri Dec 2 13:44:10 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB50334537352efa0be4fdaf2c709bd88426ba751b

Merge branch 'master' into temp-vulkan-shader

===



===



___
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] [da4b09ac6f0] temp-vulkan-shader: Remove code that hides missing feature in master as it is now fixed in master.

2022-12-02 Thread Jeroen Bakker
Commit: da4b09ac6f06eee1d476b21e0486557453a8794d
Author: Jeroen Bakker
Date:   Fri Dec 2 13:35:32 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rBda4b09ac6f06eee1d476b21e0486557453a8794d

Remove code that hides missing feature in master as it is now fixed in master.

===

M   source/blender/gpu/intern/gpu_init_exit.c

===

diff --git a/source/blender/gpu/intern/gpu_init_exit.c 
b/source/blender/gpu/intern/gpu_init_exit.c
index af906ad685f..2ed524f8666 100644
--- a/source/blender/gpu/intern/gpu_init_exit.c
+++ b/source/blender/gpu/intern/gpu_init_exit.c
@@ -34,13 +34,12 @@ void GPU_init(void)
   gpu_shader_create_info_init();
 
   gpu_codegen_init();
-  // TODO(jbakker): this should never land in master.
-  // gpu_batch_init();
+  gpu_batch_init();
 }
 
 void GPU_exit(void)
 {
-  // gpu_batch_exit();
+  gpu_batch_exit();
 
   gpu_codegen_exit();

___
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] [df3c4188662] temp-vulkan-shader: Merge branch 'master' into temp-vulkan-shader

2022-12-02 Thread Jeroen Bakker
Commit: df3c418866283707a9e14b620c2a3e92bba83758
Author: Jeroen Bakker
Date:   Fri Dec 2 12:52:51 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rBdf3c418866283707a9e14b620c2a3e92bba83758

Merge branch 'master' into temp-vulkan-shader

===



===



___
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] [79498d44637] master: Cleanup: Silenced unused parameter in pbvh.c

2022-12-02 Thread Jeroen Bakker
Commit: 79498d44637ed52a85b076477374a2dd8305a2a0
Author: Jeroen Bakker
Date:   Fri Dec 2 13:43:22 2022 +0100
Branches: master
https://developer.blender.org/rB79498d44637ed52a85b076477374a2dd8305a2a0

Cleanup: Silenced unused parameter in pbvh.c

===

M   source/blender/blenkernel/intern/pbvh.c

===

diff --git a/source/blender/blenkernel/intern/pbvh.c 
b/source/blender/blenkernel/intern/pbvh.c
index 0322b7135cb..98e21c685a2 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -176,8 +176,7 @@ static int partition_indices_faces(int *prim_indices,
int axis,
float mid,
BBC *prim_bbc,
-   const MLoopTri *looptri,
-   const MPoly *mpoly)
+   const MLoopTri *looptri)
 {
   for (int i = lo; i < hi; i++) {
 prim_scratch[i - lo] = prim_indices[i];
@@ -586,8 +585,7 @@ static void build_sub(PBVH *pbvh,
 axis,
 (cb->bmax[axis] + cb->bmin[axis]) * 0.5f,
 prim_bbc,
-pbvh->looptri,
-pbvh->mpoly);
+pbvh->looptri);
 }
 else {
   end = partition_indices_grids(pbvh->prim_indices,

___
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] [ea86ec200ac] master: GPU: Added VkVertexBuffer alloc/release data.

2022-12-02 Thread Jeroen Bakker
Commit: ea86ec200acca3071f23a65ec43d3c77fe02d8b3
Author: Jeroen Bakker
Date:   Fri Dec 2 13:38:45 2022 +0100
Branches: master
https://developer.blender.org/rBea86ec200acca3071f23a65ec43d3c77fe02d8b3

GPU: Added VkVertexBuffer alloc/release data.

This makes sure that the GPU_batch_init will not crash on an assert
where the data of vertex buffer needs to be allocated.

===

M   source/blender/gpu/vulkan/vk_vertex_buffer.cc
M   source/blender/gpu/vulkan/vk_vertex_buffer.hh

===

diff --git a/source/blender/gpu/vulkan/vk_vertex_buffer.cc 
b/source/blender/gpu/vulkan/vk_vertex_buffer.cc
index 5791e20fb30..01353acfa46 100644
--- a/source/blender/gpu/vulkan/vk_vertex_buffer.cc
+++ b/source/blender/gpu/vulkan/vk_vertex_buffer.cc
@@ -5,10 +5,17 @@
  * \ingroup gpu
  */
 
+#include "MEM_guardedalloc.h"
+
 #include "vk_vertex_buffer.hh"
 
 namespace blender::gpu {
 
+VKVertexBuffer::~VKVertexBuffer()
+{
+  release_data();
+}
+
 void VKVertexBuffer::bind_as_ssbo(uint /*binding*/)
 {
 }
@@ -37,6 +44,13 @@ void *VKVertexBuffer::unmap(const void * /*mapped_data*/) 
const
 
 void VKVertexBuffer::acquire_data()
 {
+  if (usage_ == GPU_USAGE_DEVICE_ONLY) {
+return;
+  }
+
+  /* Discard previous data if any. */
+  MEM_SAFE_FREE(data);
+  data = (uchar *)MEM_mallocN(sizeof(uchar) * this->size_alloc_get(), 
__func__);
 }
 
 void VKVertexBuffer::resize_data()
@@ -45,6 +59,7 @@ void VKVertexBuffer::resize_data()
 
 void VKVertexBuffer::release_data()
 {
+  MEM_SAFE_FREE(data);
 }
 
 void VKVertexBuffer::upload_data()
diff --git a/source/blender/gpu/vulkan/vk_vertex_buffer.hh 
b/source/blender/gpu/vulkan/vk_vertex_buffer.hh
index 84ccc65bcdf..04eb48f9bd0 100644
--- a/source/blender/gpu/vulkan/vk_vertex_buffer.hh
+++ b/source/blender/gpu/vulkan/vk_vertex_buffer.hh
@@ -13,6 +13,8 @@ namespace blender::gpu {
 
 class VKVertexBuffer : public VertBuf {
  public:
+  ~VKVertexBuffer();
+
   void bind_as_ssbo(uint binding) override;
   void bind_as_texture(uint binding) override;
   void wrap_handle(uint64_t handle) override;

___
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] [b8c7e93a650] master: Add experimental option to force all linked data as directly linked.

2022-12-02 Thread Bastien Montagne
Commit: b8c7e93a6504833ee1e617523dfe2921c4fd0816
Author: Bastien Montagne
Date:   Fri Dec 2 13:37:11 2022 +0100
Branches: master
https://developer.blender.org/rBb8c7e93a6504833ee1e617523dfe2921c4fd0816

Add experimental option to force all linked data as directly linked.

This is a workaround required to get BAT reliably working again after
recent rB133dde41bb5b, which fixed many indirectly linked IDs being
tagged as directly linked, and therefore having their reference written
in .blend file.

It seems that BAT is still missing proper handling of some ID pointers.

Required for the end of the Heist production here at Blender Studio.

===

M   source/blender/blenloader/intern/writefile.cc
M   source/blender/makesdna/DNA_userdef_types.h
M   source/blender/makesrna/intern/rna_userdef.c

===

diff --git a/source/blender/blenloader/intern/writefile.cc 
b/source/blender/blenloader/intern/writefile.cc
index 38d0970b4ed..bc1a90fb022 100644
--- a/source/blender/blenloader/intern/writefile.cc
+++ b/source/blender/blenloader/intern/writefile.cc
@@ -1131,9 +1131,17 @@ static bool write_file_handle(Main *mainvar,
   if (!wd->use_memfile) {
 ID *id_iter;
 FOREACH_MAIN_ID_BEGIN (mainvar, id_iter) {
-  if (ID_IS_LINKED(id_iter)) {
-id_iter->tag |= LIB_TAG_INDIRECT;
-id_iter->tag &= ~LIB_TAG_EXTERN;
+  if (ID_IS_LINKED(id_iter) && 
BKE_idtype_idcode_is_linkable(GS(id_iter->name))) {
+if (USER_EXPERIMENTAL_TEST(&U, use_all_linked_data_direct)) {
+  /* Forces all linked data to be considered as directly linked.
+   * FIXME: Workaround some BAT tool limitations for Heist production, 
should be removed
+   * asap afterward. */
+  id_lib_extern(id_iter);
+}
+else {
+  id_iter->tag |= LIB_TAG_INDIRECT;
+  id_iter->tag &= ~LIB_TAG_EXTERN;
+}
   }
 }
 FOREACH_MAIN_ID_END;
diff --git a/source/blender/makesdna/DNA_userdef_types.h 
b/source/blender/makesdna/DNA_userdef_types.h
index 911f139e54f..8a644803fd7 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -640,6 +640,7 @@ typedef struct UserDef_Experimental {
   char show_asset_debug_info;
   char no_asset_indexing;
   char use_viewport_debug;
+  char use_all_linked_data_direct;
   char SANITIZE_AFTER_HERE;
   /* The following options are automatically sanitized (set to 0)
* when the release cycle is not alpha. */
@@ -652,6 +653,7 @@ typedef struct UserDef_Experimental {
   char enable_eevee_next;
   char use_sculpt_texture_paint;
   char use_realtime_compositor;
+  char _pad0[7];
   /** `makesdna` does not allow empty structs. */
 } UserDef_Experimental;
 
diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index d240636f31b..b93983d0a87 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -6391,6 +6391,13 @@ static void rna_def_userdef_experimental(BlenderRNA 
*brna)
"Enable viewport debugging options for developers 
in the overlays "
"pop-over");
   RNA_def_property_update(prop, 0, "rna_userdef_ui_update");
+
+  prop = RNA_def_property(srna, "use_all_linked_data_direct", PROP_BOOLEAN, 
PROP_NONE);
+  RNA_def_property_ui_text(
+  prop,
+  "All Linked Data Direct",
+  "Forces all linked data to be considered as directly linked. Workaround 
for current "
+  "issues/limitations in BAT (Blender studio pipeline tool)");
 }
 
 static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA 
*cprop)

___
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] [d57f68616a6] master: Fix: bump minimum version

2022-12-02 Thread Jacques Lucke
Commit: d57f68616a668ef974953be42311a78a539a3fe0
Author: Jacques Lucke
Date:   Fri Dec 2 13:18:54 2022 +0100
Branches: master
https://developer.blender.org/rBd57f68616a668ef974953be42311a78a539a3fe0

Fix: bump minimum version

rB9fa4ceb340951 caused a forward compatibility issue.
Going forward, when changing socket names, only the name should be
changed and not the identifier if possible.

===

M   source/blender/blenkernel/BKE_blender_version.h

===

diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 6555eb07d78..abf9d67370b 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -30,7 +30,7 @@ extern "C" {
 /* Minimum Blender version that supports reading file written with the current
  * version. Older Blender versions will test this and show a warning if the 
file
  * was written with too new a version. */
-#define BLENDER_FILE_MIN_VERSION 304
+#define BLENDER_FILE_MIN_VERSION 305
 #define BLENDER_FILE_MIN_SUBVERSION 3
 
 /** User readable version string. */

___
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] [6d22aa2f847] master: Cleanup: simplify access to cached mesh normals

2022-12-02 Thread Jacques Lucke
Commit: 6d22aa2f8476fbddee8682668437f28a75954dd9
Author: Jacques Lucke
Date:   Fri Dec 2 13:11:53 2022 +0100
Branches: master
https://developer.blender.org/rB6d22aa2f8476fbddee8682668437f28a75954dd9

Cleanup: simplify access to cached mesh normals

===

M   source/blender/blenkernel/BKE_mesh.h
M   source/blender/blenkernel/intern/geometry_component_mesh.cc
M   source/blender/makesdna/DNA_mesh_types.h
M   
source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc

===

diff --git a/source/blender/blenkernel/BKE_mesh.h 
b/source/blender/blenkernel/BKE_mesh.h
index a3f74f0fb7c..66974dbedb5 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -1122,6 +1122,18 @@ inline blender::MutableSpan 
Mesh::deform_verts_for_write()
   return {BKE_mesh_deform_verts_for_write(this), this->totvert};
 }
 
+inline blender::Span Mesh::poly_normals() const
+{
+  return {reinterpret_cast(BKE_mesh_poly_normals_ensure(this)),
+  this->totpoly};
+}
+
+inline blender::Span Mesh::vertex_normals() const
+{
+  return {reinterpret_cast(BKE_mesh_vertex_normals_ensure(this)),
+  this->totvert};
+}
+
 #endif
 
 /** \} */
diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc 
b/source/blender/blenkernel/intern/geometry_component_mesh.cc
index 3f1cc84a107..c30426a8d98 100644
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@ -124,19 +124,17 @@ VArray mesh_normals_varray(const Mesh &mesh,
 {
   switch (domain) {
 case ATTR_DOMAIN_FACE: {
-  return VArray::ForSpan(
-  {(float3 *)BKE_mesh_poly_normals_ensure(&mesh), mesh.totpoly});
+  return VArray::ForSpan(mesh.poly_normals());
 }
 case ATTR_DOMAIN_POINT: {
-  return VArray::ForSpan(
-  {(float3 *)BKE_mesh_vertex_normals_ensure(&mesh), mesh.totvert});
+  return VArray::ForSpan(mesh.vertex_normals());
 }
 case ATTR_DOMAIN_EDGE: {
   /* In this case, start with vertex normals and convert to the edge 
domain, since the
* conversion from edges to vertices is very simple. Use "manual" domain 
interpolation
* instead of the GeometryComponent API to avoid calculating unnecessary 
values and to
* allow normalizing the result more simply. */
-  Span vert_normals{(float3 
*)BKE_mesh_vertex_normals_ensure(&mesh), mesh.totvert};
+  Span vert_normals = mesh.vertex_normals();
   const Span edges = mesh.edges();
   Array edge_normals(mask.min_array_size());
   for (const int i : mask) {
@@ -153,9 +151,7 @@ VArray mesh_normals_varray(const Mesh &mesh,
* component's generic domain interpolation is fine, the data will still 
be normalized,
* since the face normal is just copied to every corner. */
   return mesh.attributes().adapt_domain(
-  VArray::ForSpan({(float3 
*)BKE_mesh_poly_normals_ensure(&mesh), mesh.totpoly}),
-  ATTR_DOMAIN_FACE,
-  ATTR_DOMAIN_CORNER);
+  VArray::ForSpan(mesh.poly_normals()), ATTR_DOMAIN_FACE, 
ATTR_DOMAIN_CORNER);
 }
 default:
   return {};
diff --git a/source/blender/makesdna/DNA_mesh_types.h 
b/source/blender/makesdna/DNA_mesh_types.h
index 870435a..7a28485c768 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -15,6 +15,9 @@
 
 /** Workaround to forward-declare C++ type in C header. */
 #ifdef __cplusplus
+
+#  include "BLI_math_vec_types.hh"
+
 namespace blender {
 template class Span;
 template class MutableSpan;
@@ -267,6 +270,17 @@ typedef struct Mesh {
* cache dirty. If the mesh was changed first, the relevant dirty tags 
should be called first.
*/
   void loose_edges_tag_none() const;
+
+  /**
+   * Normal direction of every polygon, which is defined by the winding 
direction of its corners.
+   */
+  blender::Span poly_normals() const;
+  /**
+   * Normal direction for each vertex, which is defined as the weighted 
average of the normals
+   * from a vertices surrounding faces, or the normalized position of vertices 
connected to no
+   * faces.
+   */
+  blender::Span vertex_normals() const;
 #endif
 } Mesh;
 
diff --git 
a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc 
b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc
index 7b084995fc3..be98f53d161 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc
@@ -40,8 +40,7 @@ class PlanarFieldInput final : public bke::MeshFieldInput {
 const Span verts = mesh.verts();
 const Span polys = mesh.polys();
 const Span loops = mesh.loops();
-const Span poly_normals{
-reinterpret_cast(BKE_mesh_poly_normal

[Bf-blender-cvs] [caac5686c5d] master: GPU: Add vulkan to GPU_backend_get_type().

2022-12-02 Thread Jeroen Bakker
Commit: caac5686c5d4756be2e9d7a0200b63cea7f2fab7
Author: Jeroen Bakker
Date:   Fri Dec 2 12:51:11 2022 +0100
Branches: master
https://developer.blender.org/rBcaac5686c5d4756be2e9d7a0200b63cea7f2fab7

GPU: Add vulkan to GPU_backend_get_type().

Vulkan backend detection wasn't added to GPU_backend_get_type.
This change will add support for vulkan to the function.

===

M   source/blender/gpu/intern/gpu_context.cc

===

diff --git a/source/blender/gpu/intern/gpu_context.cc 
b/source/blender/gpu/intern/gpu_context.cc
index 7e94538892a..0443417a32a 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -321,6 +321,12 @@ eGPUBackendType GPU_backend_get_type()
   }
 #endif
 
+#ifdef WITH_VULKAN_BACKEND
+  if (g_backend && dynamic_cast(g_backend) != nullptr) {
+return GPU_BACKEND_VULKAN;
+  }
+#endif
+
   return GPU_BACKEND_NONE;
 }

___
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] [3d5a4fbcc2e] master: Cleanup: move some files that use normals to C++

2022-12-02 Thread Jacques Lucke
Commit: 3d5a4fbcc2e4d85344f993a58ae767ed2b252d5b
Author: Jacques Lucke
Date:   Fri Dec 2 12:34:26 2022 +0100
Branches: master
https://developer.blender.org/rB3d5a4fbcc2e4d85344f993a58ae767ed2b252d5b

Cleanup: move some files that use normals to C++

Doing this to help with T102858.

===

M   source/blender/blenkernel/CMakeLists.txt
R093source/blender/blenkernel/intern/data_transfer.c
source/blender/blenkernel/intern/data_transfer.cc
R086source/blender/blenkernel/intern/key.c  
source/blender/blenkernel/intern/key.cc
R087source/blender/blenkernel/intern/mesh_mirror.c  
source/blender/blenkernel/intern/mesh_mirror.cc
M   source/blender/blenlib/BLI_linklist.h
M   source/blender/bmesh/CMakeLists.txt
R089source/blender/bmesh/intern/bmesh_mesh_normals.c
source/blender/bmesh/intern/bmesh_mesh_normals.cc
M   source/blender/modifiers/CMakeLists.txt
R088source/blender/modifiers/intern/MOD_displace.c  
source/blender/modifiers/intern/MOD_displace.cc
R070source/blender/modifiers/intern/MOD_triangulate.c   
source/blender/modifiers/intern/MOD_triangulate.cc
M   source/blender/render/CMakeLists.txt
R094source/blender/render/intern/bake.c 
source/blender/render/intern/bake.cc
R095source/blender/render/intern/multires_bake.c
source/blender/render/intern/multires_bake.cc

===

diff --git a/source/blender/blenkernel/CMakeLists.txt 
b/source/blender/blenkernel/CMakeLists.txt
index 9ea57c7deb9..f56acc43582 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -118,7 +118,7 @@ set(SRC
   intern/curves_utils.cc
   intern/customdata.cc
   intern/customdata_file.c
-  intern/data_transfer.c
+  intern/data_transfer.cc
   intern/deform.c
   intern/displist.cc
   intern/dynamicpaint.c
@@ -164,7 +164,7 @@ set(SRC
   intern/instances.cc
   intern/ipo.c
   intern/kelvinlet.c
-  intern/key.c
+  intern/key.cc
   intern/keyconfig.c
   intern/lattice.c
   intern/lattice_deform.c
@@ -203,7 +203,7 @@ set(SRC
   intern/mesh_mapping.cc
   intern/mesh_merge.c
   intern/mesh_merge_customdata.cc
-  intern/mesh_mirror.c
+  intern/mesh_mirror.cc
   intern/mesh_normals.cc
   intern/mesh_remap.cc
   intern/mesh_remesh_voxel.cc
diff --git a/source/blender/blenkernel/intern/data_transfer.c 
b/source/blender/blenkernel/intern/data_transfer.cc
similarity index 93%
rename from source/blender/blenkernel/intern/data_transfer.c
rename to source/blender/blenkernel/intern/data_transfer.cc
index 7b81f74206d..0e2fa029a77 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.cc
@@ -271,18 +271,19 @@ static void data_transfer_dtdata_type_preprocess(Mesh 
*me_src,
 const float split_angle_dst = me_dst->smoothresh;
 
 /* This should be ensured by cddata_masks we pass to code 
generating/giving us me_src now. */
-BLI_assert(CustomData_get_layer(&me_src->ldata, CD_NORMAL) != NULL);
+BLI_assert(CustomData_get_layer(&me_src->ldata, CD_NORMAL) != nullptr);
 (void)me_src;
 
 float(*loop_nors_dst)[3];
-short(*custom_nors_dst)[2] = CustomData_get_layer(ldata_dst, 
CD_CUSTOMLOOPNORMAL);
+short(*custom_nors_dst)[2] = static_cast(
+CustomData_get_layer(ldata_dst, CD_CUSTOMLOOPNORMAL));
 
 /* Cache loop nors into a temp CDLayer. */
-loop_nors_dst = CustomData_get_layer(ldata_dst, CD_NORMAL);
-const bool do_loop_nors_dst = (loop_nors_dst == NULL);
+loop_nors_dst = static_cast(CustomData_get_layer(ldata_dst, 
CD_NORMAL));
+const bool do_loop_nors_dst = (loop_nors_dst == nullptr);
 if (do_loop_nors_dst) {
-  loop_nors_dst = CustomData_add_layer(
-  ldata_dst, CD_NORMAL, CD_SET_DEFAULT, NULL, num_loops_dst);
+  loop_nors_dst = static_cast(
+  CustomData_add_layer(ldata_dst, CD_NORMAL, CD_SET_DEFAULT, nullptr, 
num_loops_dst));
   CustomData_set_layer_flag(ldata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
 }
 if (dirty_nors_dst || do_loop_nors_dst) {
@@ -299,8 +300,8 @@ static void data_transfer_dtdata_type_preprocess(Mesh 
*me_src,
   num_polys_dst,
   use_split_nors_dst,
   split_angle_dst,
-  NULL,
-  NULL,
+  nullptr,
+  nullptr,
   custom_nors_dst);
 }
   }
@@ -330,12 +331,14 @@ static void data_transfer_dtdata_type_postprocess(Object 
*UNUSED(ob_src),
 CustomData *ldata_dst = &me_dst->ldata;
 
 const float(*poly_nors_dst)[3] = BKE_mesh_poly_normals_ensure(me_dst);
-float(*loop_nors_dst)[3] = CustomData_get_layer(ldata_dst, CD_NORMAL);
-short(*custom_nors_dst)[2] = CustomData_get_layer(ldata_dst, 
CD_CUST

[Bf-blender-cvs] [78abdcf31e9] temp-vulkan-shader: Tweaked gpu_InstanceIndex.

2022-12-02 Thread Jeroen Bakker
Commit: 78abdcf31e95f34797edbb804abe82d700eb4daa
Author: Jeroen Bakker
Date:   Fri Dec 2 12:24:03 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB78abdcf31e95f34797edbb804abe82d700eb4daa

Tweaked gpu_InstanceIndex.

===

M   source/blender/gpu/vulkan/vk_shader.cc

===

diff --git a/source/blender/gpu/vulkan/vk_shader.cc 
b/source/blender/gpu/vulkan/vk_shader.cc
index 58b13ea8747..e8580b66c22 100644
--- a/source/blender/gpu/vulkan/vk_shader.cc
+++ b/source/blender/gpu/vulkan/vk_shader.cc
@@ -502,10 +502,8 @@ static char *glsl_patch_get()
   /* Version need to go first. */
   STR_CONCAT(patch, slen, "#version 450\n");
   STR_CONCAT(patch, slen, "#define gl_VertexID gl_VertexIndex\n");
-  // TODO(jbakker): How does base instance work in vulkan. There seems to be a 
difference between
-  // OpenGL and Vulkan here. But I am not able to map the change to our 
code-base yet.
-  STR_CONCAT(patch, slen, "#define gpu_BaseInstance 0\n");
-  STR_CONCAT(patch, slen, "#define gpu_InstanceIndex (gl_InstanceIndex + 
gpu_BaseInstance)\n");
+  STR_CONCAT(patch, slen, "#define gpu_BaseInstance (0)\n");
+  STR_CONCAT(patch, slen, "#define gpu_InstanceIndex (gl_InstanceIndex)\n");
 
   // TODO: we should remove usage of gl_InstanceID/gl_VertexID.
   STR_CONCAT(patch, slen, "#define gl_InstanceID gpu_InstanceIndex\n");

___
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] [94e1e694bcb] temp-vulkan-shader: Merge branch 'temp-vulkan-shader' of git.blender.org:blender into temp-vulkan-shader

2022-12-02 Thread Jeroen Bakker
Commit: 94e1e694bcbc9d7cae0eea5c340d7e99d5d208e8
Author: Jeroen Bakker
Date:   Fri Dec 2 12:28:28 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB94e1e694bcbc9d7cae0eea5c340d7e99d5d208e8

Merge branch 'temp-vulkan-shader' of git.blender.org:blender into 
temp-vulkan-shader

===



===



___
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] [99e4bfd5e48] temp-vulkan-shader: Tweaked gpu_InstanceIndex.

2022-12-02 Thread Jeroen Bakker
Commit: 99e4bfd5e48787a9ac8796a061ad7ebd143a5868
Author: Jeroen Bakker
Date:   Fri Dec 2 12:24:03 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB99e4bfd5e48787a9ac8796a061ad7ebd143a5868

Tweaked gpu_InstanceIndex.

===

M   source/blender/gpu/vulkan/vk_shader.cc

===

diff --git a/source/blender/gpu/vulkan/vk_shader.cc 
b/source/blender/gpu/vulkan/vk_shader.cc
index 58b13ea8747..e8580b66c22 100644
--- a/source/blender/gpu/vulkan/vk_shader.cc
+++ b/source/blender/gpu/vulkan/vk_shader.cc
@@ -502,10 +502,8 @@ static char *glsl_patch_get()
   /* Version need to go first. */
   STR_CONCAT(patch, slen, "#version 450\n");
   STR_CONCAT(patch, slen, "#define gl_VertexID gl_VertexIndex\n");
-  // TODO(jbakker): How does base instance work in vulkan. There seems to be a 
difference between
-  // OpenGL and Vulkan here. But I am not able to map the change to our 
code-base yet.
-  STR_CONCAT(patch, slen, "#define gpu_BaseInstance 0\n");
-  STR_CONCAT(patch, slen, "#define gpu_InstanceIndex (gl_InstanceIndex + 
gpu_BaseInstance)\n");
+  STR_CONCAT(patch, slen, "#define gpu_BaseInstance (0)\n");
+  STR_CONCAT(patch, slen, "#define gpu_InstanceIndex (gl_InstanceIndex)\n");
 
   // TODO: we should remove usage of gl_InstanceID/gl_VertexID.
   STR_CONCAT(patch, slen, "#define gl_InstanceID gpu_InstanceIndex\n");

___
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] [794ce2a08f4] temp-vulkan-shader: Removed debug code.

2022-12-02 Thread Jeroen Bakker
Commit: 794ce2a08f46bb2fb14c69e74a5fc9e77f28cfe6
Author: Jeroen Bakker
Date:   Fri Dec 2 12:12:21 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB794ce2a08f46bb2fb14c69e74a5fc9e77f28cfe6

Removed debug code.

===

M   source/blender/gpu/intern/gpu_shader_create_info.cc

===

diff --git a/source/blender/gpu/intern/gpu_shader_create_info.cc 
b/source/blender/gpu/intern/gpu_shader_create_info.cc
index 6f4c728bbb0..ffbeedad285 100644
--- a/source/blender/gpu/intern/gpu_shader_create_info.cc
+++ b/source/blender/gpu/intern/gpu_shader_create_info.cc
@@ -387,7 +387,6 @@ bool gpu_shader_create_info_compile_all()
   reinterpret_cast(info));
   if (shader == nullptr) {
 printf("Compilation %s Failed\n", info->name_.c_str());
-// return false;
   }
   else {
 success++;

___
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] [67b37967230] temp-vulkan-shader: Revert change to device restriction.

2022-12-02 Thread Jeroen Bakker
Commit: 67b379672309155dd663e3442a0a7aade0ecac45
Author: Jeroen Bakker
Date:   Fri Dec 2 12:09:20 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB67b379672309155dd663e3442a0a7aade0ecac45

Revert change to device restriction.

===

M   intern/ghost/intern/GHOST_ContextVK.cpp

===

diff --git a/intern/ghost/intern/GHOST_ContextVK.cpp 
b/intern/ghost/intern/GHOST_ContextVK.cpp
index ff41741f162..e446d9057a7 100644
--- a/intern/ghost/intern/GHOST_ContextVK.cpp
+++ b/intern/ghost/intern/GHOST_ContextVK.cpp
@@ -26,7 +26,7 @@
 
 /* Set to 0 to allow devices that do not have the required features.
  * This allows development on OSX until we really needs these features. */
-#define STRICT_REQUIREMENTS 0
+#define STRICT_REQUIREMENTS 1
 
 using namespace std;

___
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] [26e08cbeb88] blender-v2.93-release: Depsgraph: fix spurious cycles with identically named idprops on bones.

2022-12-02 Thread Alexander Gavrilov
Commit: 26e08cbeb885a51c8222b7df32b6e04567c88d48
Author: Alexander Gavrilov
Date:   Tue Jan 4 14:28:37 2022 +0300
Branches: blender-v2.93-release
https://developer.blender.org/rB26e08cbeb885a51c8222b7df32b6e04567c88d48

Depsgraph: fix spurious cycles with identically named idprops on bones.

If multiple bones have a custom property with the same name,
depsgraph didn't distinguish between them, potentially leading
to spurious cycles.

This patch moves ID_PROPERTY operation nodes for bone custom
properties from the parameters component to individual bone
components, thus decoupling them.

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

===

M   source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M   source/blender/depsgraph/intern/builder/deg_builder_nodes.h
M   source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M   source/blender/depsgraph/intern/builder/deg_builder_rna.cc

===

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 930db0403ff..a33e6257d7b 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -251,6 +251,21 @@ OperationNode *DepsgraphNodeBuilder::add_operation_node(ID 
*id,
   return add_operation_node(id, comp_type, "", opcode, op, name, name_tag);
 }
 
+OperationNode *DepsgraphNodeBuilder::ensure_operation_node(ID *id,
+   NodeType comp_type,
+   const char 
*comp_name,
+   OperationCode 
opcode,
+   const 
DepsEvalOperationCb &op,
+   const char *name,
+   int name_tag)
+{
+  OperationNode *operation = find_operation_node(id, comp_type, comp_name, 
opcode, name, name_tag);
+  if (operation != nullptr) {
+return operation;
+  }
+  return add_operation_node(id, comp_type, comp_name, opcode, op, name, 
name_tag);
+}
+
 OperationNode *DepsgraphNodeBuilder::ensure_operation_node(ID *id,
NodeType comp_type,
OperationCode 
opcode,
@@ -1081,8 +1096,16 @@ void DepsgraphNodeBuilder::build_driver_id_property(ID 
*id, const char *rna_path
 return;
   }
   const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop);
-  ensure_operation_node(
-  id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, nullptr, 
prop_identifier);
+  /* Custom properties of bones are placed in their components to improve 
granularity. */
+  if (RNA_struct_is_a(ptr.type, &RNA_PoseBone)) {
+const bPoseChannel *pchan = static_cast(ptr.data);
+ensure_operation_node(
+id, NodeType::BONE, pchan->name, OperationCode::ID_PROPERTY, nullptr, 
prop_identifier);
+  }
+  else {
+ensure_operation_node(
+id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, nullptr, 
prop_identifier);
+  }
 }
 
 void DepsgraphNodeBuilder::build_parameters(ID *id)
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h 
b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index 7bbe130e8ff..3483a1856fa 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -126,6 +126,13 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder {
 const char *name = "",
 int name_tag = -1);
 
+  OperationNode *ensure_operation_node(ID *id,
+   NodeType comp_type,
+   const char *comp_name,
+   OperationCode opcode,
+   const DepsEvalOperationCb &op = nullptr,
+   const char *name = "",
+   int name_tag = -1);
   OperationNode *ensure_operation_node(ID *id,
NodeType comp_type,
OperationCode opcode,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc 
b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 48143aef09b..1f296a03f8f 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1715,8 +1715,17 @@ void 
DepsgraphRelationBuilder::build_driver_id_property(ID *id, const char *rna_
 return;
   }
   const c

[Bf-blender-cvs] [642bba24a91] temp-vulkan-shader: Added support for compute and shader storage.

2022-12-02 Thread Jeroen Bakker
Commit: 642bba24a91c3b09cfc28ea3405251120f1980e3
Author: Jeroen Bakker
Date:   Fri Dec 2 11:10:16 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB642bba24a91c3b09cfc28ea3405251120f1980e3

Added support for compute and shader storage.

===

M   source/blender/gpu/vulkan/vk_backend.cc
M   source/blender/gpu/vulkan/vk_shader.cc

===

diff --git a/source/blender/gpu/vulkan/vk_backend.cc 
b/source/blender/gpu/vulkan/vk_backend.cc
index c7e0b35ef27..9c62fe14694 100644
--- a/source/blender/gpu/vulkan/vk_backend.cc
+++ b/source/blender/gpu/vulkan/vk_backend.cc
@@ -155,6 +155,7 @@ void VKBackend::capabilities_init(VKContext &context)
   /* Reset all capabilities from previous context. */
   GCaps = {};
   GCaps.compute_shader_support = true;
+  GCaps.shader_storage_buffer_objects_support = true;
 }
 
 }  // namespace blender::gpu
\ No newline at end of file
diff --git a/source/blender/gpu/vulkan/vk_shader.cc 
b/source/blender/gpu/vulkan/vk_shader.cc
index 51dfbb97dee..58b13ea8747 100644
--- a/source/blender/gpu/vulkan/vk_shader.cc
+++ b/source/blender/gpu/vulkan/vk_shader.cc
@@ -510,6 +510,9 @@ static char *glsl_patch_get()
   // TODO: we should remove usage of gl_InstanceID/gl_VertexID.
   STR_CONCAT(patch, slen, "#define gl_InstanceID gpu_InstanceIndex\n");
 
+  STR_CONCAT(patch, slen, "#define DFDX_SIGN 1.0\n");
+  STR_CONCAT(patch, slen, "#define DFDY_SIGN 1.0\n");
+
   /* GLSL Backend Lib. */
   STR_CONCAT(patch, slen, datatoc_glsl_shader_defines_glsl);

___
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] [db6db0b754a] temp-vulkan-shader: Remove warning (pragma once not implemented).

2022-12-02 Thread Jeroen Bakker
Commit: db6db0b754adcbeef95bcb5431aafed6f8e694a5
Author: Jeroen Bakker
Date:   Fri Dec 2 11:12:16 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rBdb6db0b754adcbeef95bcb5431aafed6f8e694a5

Remove warning (pragma once not implemented).

===

M   intern/ghost/intern/GHOST_ContextVK.cpp
M   source/blender/draw/engines/eevee_next/eevee_defines.hh
M   source/blender/gpu/intern/gpu_shader_create_info.cc

===

diff --git a/intern/ghost/intern/GHOST_ContextVK.cpp 
b/intern/ghost/intern/GHOST_ContextVK.cpp
index e446d9057a7..ff41741f162 100644
--- a/intern/ghost/intern/GHOST_ContextVK.cpp
+++ b/intern/ghost/intern/GHOST_ContextVK.cpp
@@ -26,7 +26,7 @@
 
 /* Set to 0 to allow devices that do not have the required features.
  * This allows development on OSX until we really needs these features. */
-#define STRICT_REQUIREMENTS 1
+#define STRICT_REQUIREMENTS 0
 
 using namespace std;
 
diff --git a/source/blender/draw/engines/eevee_next/eevee_defines.hh 
b/source/blender/draw/engines/eevee_next/eevee_defines.hh
index fca8737f661..2c08aabbcfe 100644
--- a/source/blender/draw/engines/eevee_next/eevee_defines.hh
+++ b/source/blender/draw/engines/eevee_next/eevee_defines.hh
@@ -9,7 +9,9 @@
  * dragging larger headers into the createInfo pipeline which would cause 
problems.
  */
 
-#pragma once
+#ifndef GPU_VULKAN
+#  pragma once
+#endif
 
 /* Hierarchical Z down-sampling. */
 #define HIZ_MIP_COUNT 8
diff --git a/source/blender/gpu/intern/gpu_shader_create_info.cc 
b/source/blender/gpu/intern/gpu_shader_create_info.cc
index ffbeedad285..6f4c728bbb0 100644
--- a/source/blender/gpu/intern/gpu_shader_create_info.cc
+++ b/source/blender/gpu/intern/gpu_shader_create_info.cc
@@ -387,6 +387,7 @@ bool gpu_shader_create_info_compile_all()
   reinterpret_cast(info));
   if (shader == nullptr) {
 printf("Compilation %s Failed\n", info->name_.c_str());
+// return false;
   }
   else {
 success++;

___
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] [b1ba82ba978] temp-vulkan-shader: Fix sampler is a keyword, do not use a parameter name.

2022-12-02 Thread Jeroen Bakker
Commit: b1ba82ba978a39b75d74aa9f883d9eb9b92c
Author: Jeroen Bakker
Date:   Fri Dec 2 11:26:21 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rBb1ba82ba978a39b75d74aa9f883d9eb9b92c

Fix sampler is a keyword, do not use a parameter name.

===

M   
source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_texture_utilities.glsl
M   source/blender/gpu/vulkan/vk_backend.cc

===

diff --git 
a/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_texture_utilities.glsl
 
b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_texture_utilities.glsl
index 128fc6aeaf5..cd99e16add6 100644
--- 
a/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_texture_utilities.glsl
+++ 
b/source/blender/compositor/realtime_compositor/shaders/library/gpu_shader_compositor_texture_utilities.glsl
@@ -1,35 +1,35 @@
 /* A shorthand for 1D textureSize with a zero LOD. */
-int texture_size(sampler1D sampler)
+int texture_size(sampler1D sampler_1d)
 {
-  return textureSize(sampler, 0);
+  return textureSize(sampler_1d, 0);
 }
 
 /* A shorthand for 1D texelFetch with zero LOD and bounded access clamped to 
border. */
-vec4 texture_load(sampler1D sampler, int x)
+vec4 texture_load(sampler1D sampler_1d, int x)
 {
-  const int texture_bound = texture_size(sampler) - 1;
-  return texelFetch(sampler, clamp(x, 0, texture_bound), 0);
+  const int texture_bound = texture_size(sampler_1d) - 1;
+  return texelFetch(sampler_1d, clamp(x, 0, texture_bound), 0);
 }
 
 /* A shorthand for 2D textureSize with a zero LOD. */
-ivec2 texture_size(sampler2D sampler)
+ivec2 texture_size(sampler2D sampler_2d)
 {
-  return textureSize(sampler, 0);
+  return textureSize(sampler_2d, 0);
 }
 
 /* A shorthand for 2D texelFetch with zero LOD and bounded access clamped to 
border. */
-vec4 texture_load(sampler2D sampler, ivec2 texel)
+vec4 texture_load(sampler2D sampler_2d, ivec2 texel)
 {
-  const ivec2 texture_bounds = texture_size(sampler) - ivec2(1);
-  return texelFetch(sampler, clamp(texel, ivec2(0), texture_bounds), 0);
+  const ivec2 texture_bounds = texture_size(sampler_2d) - ivec2(1);
+  return texelFetch(sampler_2d, clamp(texel, ivec2(0), texture_bounds), 0);
 }
 
 /* A shorthand for 2D texelFetch with zero LOD and a fallback value for 
out-of-bound access. */
-vec4 texture_load(sampler2D sampler, ivec2 texel, vec4 fallback)
+vec4 texture_load(sampler2D sampler_2d, ivec2 texel, vec4 fallback)
 {
-  const ivec2 texture_bounds = texture_size(sampler) - ivec2(1);
+  const ivec2 texture_bounds = texture_size(sampler_2d) - ivec2(1);
   if (any(lessThan(texel, ivec2(0))) || any(greaterThan(texel, 
texture_bounds))) {
 return fallback;
   }
-  return texelFetch(sampler, texel, 0);
+  return texelFetch(sampler_2d, texel, 0);
 }
diff --git a/source/blender/gpu/vulkan/vk_backend.cc 
b/source/blender/gpu/vulkan/vk_backend.cc
index 9c62fe14694..b402ef2f503 100644
--- a/source/blender/gpu/vulkan/vk_backend.cc
+++ b/source/blender/gpu/vulkan/vk_backend.cc
@@ -156,6 +156,7 @@ void VKBackend::capabilities_init(VKContext &context)
   GCaps = {};
   GCaps.compute_shader_support = true;
   GCaps.shader_storage_buffer_objects_support = true;
+  GCaps.shader_image_load_store_support = true;
 }
 
 }  // namespace blender::gpu
\ No newline at end of file

___
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] [bbbe5a38940] temp-vulkan-shader: Fix Eevee-next depth of field compilation.

2022-12-02 Thread Jeroen Bakker
Commit: bbbe5a38940f0deb8625afbd1a3c24d8df42dd3c
Author: Jeroen Bakker
Date:   Fri Dec 2 12:04:18 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rBbbbe5a38940f0deb8625afbd1a3c24d8df42dd3c

Fix Eevee-next depth of field compilation.

===

M   
source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_tiles_flatten_comp.glsl

===

diff --git 
a/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_tiles_flatten_comp.glsl
 
b/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_tiles_flatten_comp.glsl
index 88737ade386..dcfd2a7ea24 100644
--- 
a/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_tiles_flatten_comp.glsl
+++ 
b/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_tiles_flatten_comp.glsl
@@ -26,7 +26,11 @@ shared uint bg_min_coc;
 shared uint bg_max_coc;
 shared uint bg_min_intersectable_coc;
 
+#ifdef GPU_VULKAN
+uint dof_tile_large_coc_uint = floatBitsToUint(dof_tile_large_coc);
+#else
 const uint dof_tile_large_coc_uint = floatBitsToUint(dof_tile_large_coc);
+#endif
 
 void main()
 {

___
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] [244f61e9e9a] temp-vulkan-shader: Fix motion patch shaders.

2022-12-02 Thread Jeroen Bakker
Commit: 244f61e9e9af12d218d7c3c3a4d442c7efcd5204
Author: Jeroen Bakker
Date:   Fri Dec 2 10:59:41 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB244f61e9e9af12d218d7c3c3a4d442c7efcd5204

Fix motion patch shaders.

===

M   
source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_vert.glsl

===

diff --git 
a/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_vert.glsl
 
b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_vert.glsl
index a56ca6d41b8..331dcdf6519 100644
--- 
a/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_vert.glsl
+++ 
b/source/blender/draw/engines/overlay/shaders/overlay_motion_path_line_vert.glsl
@@ -13,13 +13,12 @@ vec2 proj(vec4 pos)
   return (0.5 * (pos.xy / pos.w) + 0.5) * sizeViewport.xy;
 }
 
-#ifdef GPU_VULKAN
-// TODO(jbakker): Fix this macros.
-#define SET_INTENSITY(A, B, C, min, max) 0.0
-#else
-#define SET_INTENSITY(A, B, C, min, max) \
-  (((1.0 - (float(C - B) / float(C - A))) * (max - min)) + min)
-#endif
+float calc_intensity(int segment_start, int segment_current, int segment_end, 
float min, float max)
+{
+  return ((1.0 - (float(segment_end - segment_current) / float(segment_end - 
segment_start))) *
+  (max - min)) +
+ min;
+}
 
 void main()
 {
@@ -44,10 +43,10 @@ void main()
 else {
   /* black - before frameCurrent */
   if (selected) {
-intensity = SET_INTENSITY(frameStart, frame, frameCurrent, 0.25, 0.75);
+intensity = calc_intensity(frameStart, frame, frameCurrent, 0.25, 
0.75);
   }
   else {
-intensity = SET_INTENSITY(frameStart, frame, frameCurrent, 0.68, 0.92);
+intensity = calc_intensity(frameStart, frame, frameCurrent, 0.68, 
0.92);
   }
   interp.color.rgb = mix(colorWire.rgb, blend_base, intensity);
 }
@@ -60,10 +59,10 @@ void main()
 else {
   /* blue - after frameCurrent */
   if (selected) {
-intensity = SET_INTENSITY(frameCurrent, frame, frameEnd, 0.25, 0.75);
+intensity = calc_intensity(frameCurrent, frame, frameEnd, 0.25, 0.75);
   }
   else {
-intensity = SET_INTENSITY(frameCurrent, frame, frameEnd, 0.68, 0.92);
+intensity = calc_intensity(frameCurrent, frame, frameEnd, 0.68, 0.92);
   }
 
   interp.color.rgb = mix(colorBonePose.rgb, blend_base, intensity);

___
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] [f1d9fe95e8b] temp-vulkan-shader: Fixed lens distortion compilation.

2022-12-02 Thread Jeroen Bakker
Commit: f1d9fe95e8b1f874386f9db170905c06160b0388
Author: Jeroen Bakker
Date:   Fri Dec 2 12:04:44 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rBf1d9fe95e8b1f874386f9db170905c06160b0388

Fixed lens distortion compilation.

===

M   
source/blender/compositor/realtime_compositor/shaders/compositor_screen_lens_distortion.glsl

===

diff --git 
a/source/blender/compositor/realtime_compositor/shaders/compositor_screen_lens_distortion.glsl
 
b/source/blender/compositor/realtime_compositor/shaders/compositor_screen_lens_distortion.glsl
index dc572ea5aaf..58c1d97e81d 100644
--- 
a/source/blender/compositor/realtime_compositor/shaders/compositor_screen_lens_distortion.glsl
+++ 
b/source/blender/compositor/realtime_compositor/shaders/compositor_screen_lens_distortion.glsl
@@ -20,9 +20,9 @@ vec3 compute_chromatic_distortion_scale(float 
distance_squared)
 /* Compute the image coordinates after distortion by the given distortion 
scale computed by the
  * compute_distortion_scale function. Note that the function expects centered 
normalized UV
  * coordinates but outputs non-centered image coordinates. */
-vec2 compute_distorted_uv(vec2 uv, float scale)
+vec2 compute_distorted_uv(vec2 uv, float uv_scale)
 {
-  return (uv * scale + 0.5) * texture_size(input_tx) - 0.5;
+  return (uv * uv_scale + 0.5) * texture_size(input_tx) - 0.5;
 }
 
 /* Compute the number of integration steps that should be used to approximate 
the distorted pixel

___
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] [88c6d824e78] master: Nodes: ensure that node identifiers are larger than zero

2022-12-02 Thread Jacques Lucke
Commit: 88c6d824e78ebe40b8910b109154b7491cc76afe
Author: Jacques Lucke
Date:   Fri Dec 2 11:59:20 2022 +0100
Branches: master
https://developer.blender.org/rB88c6d824e78ebe40b8910b109154b7491cc76afe

Nodes: ensure that node identifiers are larger than zero

Zero should not be a valid identifier to make it easier to detect when
the identifier has not been set after a node has been allocated.

===

M   source/blender/blenkernel/intern/node.cc
M   source/blender/blenkernel/intern/node_tree_update.cc

===

diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index d349f3e87eb..0f2b2e1c345 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -2192,7 +2192,7 @@ void nodeUniqueID(bNodeTree *ntree, bNode *node)
 
   /* In the unlikely case that the random ID doesn't match, choose a new one 
until it does. */
   int32_t new_id = id_rng.get_int32();
-  while (ntree->runtime->nodes_by_id.contains_as(new_id)) {
+  while (ntree->runtime->nodes_by_id.contains_as(new_id) || new_id <= 0) {
 new_id = id_rng.get_int32();
   }
 
diff --git a/source/blender/blenkernel/intern/node_tree_update.cc 
b/source/blender/blenkernel/intern/node_tree_update.cc
index 72ea4da7855..57d85c10677 100644
--- a/source/blender/blenkernel/intern/node_tree_update.cc
+++ b/source/blender/blenkernel/intern/node_tree_update.cc
@@ -1013,7 +1013,7 @@ class NodeTreeMainUpdater {
 /* Check the uniqueness of node identifiers. */
 Set node_identifiers;
 LISTBASE_FOREACH (bNode *, node, &ntree.nodes) {
-  BLI_assert(node->identifier >= 0);
+  BLI_assert(node->identifier > 0);
   node_identifiers.add_new(node->identifier);
 }
 #endif

___
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] [3fe03c01ac5] refactor-mesh-corner-normals-lazy: Merge branch 'master' into refactor-mesh-corner-normals-lazy

2022-12-02 Thread Jacques Lucke
Commit: 3fe03c01ac58ded65095936f0553a46fb05f90cc
Author: Jacques Lucke
Date:   Fri Dec 2 10:41:54 2022 +0100
Branches: refactor-mesh-corner-normals-lazy
https://developer.blender.org/rB3fe03c01ac58ded65095936f0553a46fb05f90cc

Merge branch 'master' into refactor-mesh-corner-normals-lazy

===



===



___
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] [39615cd3b77] master: BLI: add atomic disjoint set data structure

2022-12-02 Thread Jacques Lucke
Commit: 39615cd3b7792a2fec82510c988a9f619a98f75f
Author: Jacques Lucke
Date:   Fri Dec 2 10:39:11 2022 +0100
Branches: master
https://developer.blender.org/rB39615cd3b7792a2fec82510c988a9f619a98f75f

BLI: add atomic disjoint set data structure

The existing `DisjointSet` data structure only supports single
threaded access, which limits performance severely in some cases.

This patch implements `AtomicDisjointSet` based on
"Wait-free Parallel Algorithms for the Union-Find Problem"
by Richard J. Anderson and Heather Woll.

The Mesh Island node also got updated to make use of the new data
structure. In my tests it got 2-5 times faster. More details are in 16653.

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

===

A   source/blender/blenlib/BLI_atomic_disjoint_set.hh
M   source/blender/blenlib/CMakeLists.txt
A   source/blender/blenlib/intern/atomic_disjoint_set.cc
M   source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc

===

diff --git a/source/blender/blenlib/BLI_atomic_disjoint_set.hh 
b/source/blender/blenlib/BLI_atomic_disjoint_set.hh
new file mode 100644
index 000..d0826ca1e0b
--- /dev/null
+++ b/source/blender/blenlib/BLI_atomic_disjoint_set.hh
@@ -0,0 +1,146 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#pragma once
+
+#include 
+
+#include "BLI_array.hh"
+
+namespace blender {
+
+/**
+ * Same as `DisjointSet` but is thread safe (at slightly higher cost for the 
single threaded case).
+ *
+ * The implementation is based on the following paper:
+ * "Wait-free Parallel Algorithms for the Union-Find Problem"
+ * by Richard J. Anderson and Heather Woll.
+ *
+ * It's also inspired by this implementation: https://github.com/wjakob/dset.
+ */
+class AtomicDisjointSet {
+ private:
+  /* Can generally used relaxed memory order with this algorithm. */
+  static constexpr auto relaxed = std::memory_order_relaxed;
+
+  struct Item {
+int parent;
+int rank;
+  };
+
+  /**
+   * An #Item per element. It's important that the entire item is in a single 
atomic, so that it
+   * can be updated atomically. */
+  mutable Array> items_;
+
+ public:
+  /**
+   * Create a new disjoing set with the given set. Initially, every element is 
in a separate set.
+   */
+  AtomicDisjointSet(const int size);
+
+  /**
+   * Join the sets containing elements x and y. Nothing happens when they were 
in the same set
+   * before.
+   */
+  void join(int x, int y)
+  {
+while (true) {
+  x = this->find_root(x);
+  y = this->find_root(y);
+
+  if (x == y) {
+/* They are in the same set already. */
+return;
+  }
+
+  Item x_item = items_[x].load(relaxed);
+  Item y_item = items_[y].load(relaxed);
+
+  if (
+  /* Implement union by rank heuristic. */
+  x_item.rank > y_item.rank
+  /* If the rank is the same, make a consistent decision. */
+  || (x_item.rank == y_item.rank && x < y)) {
+std::swap(x_item, y_item);
+std::swap(x, y);
+  }
+
+  /* Update parent of item x. */
+  const Item x_item_new{y, x_item.rank};
+  if (!items_[x].compare_exchange_strong(x_item, x_item_new, relaxed)) {
+/* Another thread has updated item x, start again. */
+continue;
+  }
+
+  if (x_item.rank == y_item.rank) {
+/* Increase rank of item y. This may fail when another thread has 
updated item y in the
+ * meantime. That may lead to worse behavior with the union by rank 
heurist, but seems to
+ * be ok in practice. */
+const Item y_item_new{y, y_item.rank + 1};
+items_[y].compare_exchange_weak(y_item, y_item_new, relaxed);
+  }
+}
+  }
+
+  /**
+   * Return true when x and y are in the same set.
+   */
+  bool in_same_set(int x, int y) const
+  {
+while (true) {
+  x = this->find_root(x);
+  y = this->find_root(y);
+  if (x == y) {
+return true;
+  }
+  if (items_[x].load(relaxed).parent == x) {
+return false;
+  }
+}
+  }
+
+  /**
+   * Find the element that represents the set containing x currently.
+   */
+  int find_root(int x) const
+  {
+while (true) {
+  const Item item = items_[x].load(relaxed);
+  if (x == item.parent) {
+return x;
+  }
+  const int new_parent = items_[item.parent].load(relaxed).parent;
+  if (item.parent != new_parent) {
+/* This halves the path for faster future lookups. That fail but that 
does not change
+ * correctness. */
+Item expected = item;
+const Item desired{new_parent, item.rank};
+items_[x].compare_exchange_weak(expected, desired, relaxed);
+  }
+  x = new_parent;
+}
+  }
+
+  /**
+   * True when x represents a set.
+   */
+  bool is_root(const int x) const
+  {
+const Item item = items_[x].load(relaxed);
+retur

[Bf-blender-cvs] [49723cca426] temp-vulkan-shader: Enable OpenGL/Metal shader compilation. (was disabled for debugging).

2022-12-02 Thread Jeroen Bakker
Commit: 49723cca426213e091ea4057d4eb1f3f319828a4
Author: Jeroen Bakker
Date:   Fri Dec 2 10:29:18 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB49723cca426213e091ea4057d4eb1f3f319828a4

Enable OpenGL/Metal shader compilation. (was disabled for debugging).

===

M   source/blender/gpu/intern/gpu_shader_builder.cc

===

diff --git a/source/blender/gpu/intern/gpu_shader_builder.cc 
b/source/blender/gpu/intern/gpu_shader_builder.cc
index 2a573072249..61cf95c6d17 100644
--- a/source/blender/gpu/intern/gpu_shader_builder.cc
+++ b/source/blender/gpu/intern/gpu_shader_builder.cc
@@ -103,9 +103,9 @@ int main(int argc, const char *argv[])
   };
 
   blender::Vector backends_to_validate;
-  //backends_to_validate.append({"OpenGL", GPU_BACKEND_OPENGL});
+  backends_to_validate.append({"OpenGL", GPU_BACKEND_OPENGL});
 #ifdef WITH_METAL_BACKEND
-  //backends_to_validate.append({"Metal", GPU_BACKEND_METAL});
+  backends_to_validate.append({"Metal", GPU_BACKEND_METAL});
 #endif
 #ifdef WITH_VULKAN_BACKEND
   backends_to_validate.append({"Vulkan", GPU_BACKEND_VULKAN});
@@ -123,6 +123,9 @@ int main(int argc, const char *argv[])
   printf("Shader compilation failed for %s backend\n", 
backend.name.c_str());
   exit_code = 1;
 }
+else {
+  printf("%s backend shader compilation succeeded.\n", 
backend.name.c_str());
+}
 builder.exit();
   }

___
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] [2d6dfbf0389] temp-vulkan-shader: Fix vulkan compilation of common_smaa_lib.glsl

2022-12-02 Thread Jeroen Bakker
Commit: 2d6dfbf03892058e24491b0d82d0897134cc5f4a
Author: Jeroen Bakker
Date:   Fri Dec 2 09:31:04 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB2d6dfbf03892058e24491b0d82d0897134cc5f4a

Fix vulkan compilation of common_smaa_lib.glsl

===

M   source/blender/draw/intern/shaders/common_smaa_lib.glsl

===

diff --git a/source/blender/draw/intern/shaders/common_smaa_lib.glsl 
b/source/blender/draw/intern/shaders/common_smaa_lib.glsl
index 0c040c9acfe..1b8a8202166 100644
--- a/source/blender/draw/intern/shaders/common_smaa_lib.glsl
+++ b/source/blender/draw/intern/shaders/common_smaa_lib.glsl
@@ -569,7 +569,7 @@ SamplerState PointSampler
 #define SMAAGather(tex, coord) tex.Gather(LinearSampler, coord, 0)
 #  endif
 #endif
-#if defined(SMAA_GLSL_3) || defined(SMAA_GLSL_4) || defined(GPU_METAL)
+#if defined(SMAA_GLSL_3) || defined(SMAA_GLSL_4) || defined(GPU_METAL) || 
defined(GPU_VULKAN)
 #  define SMAATexture2D(tex) sampler2D tex
 #  define SMAATexturePass2D(tex) tex
 #  define SMAASampleLevelZero(tex, coord) textureLod(tex, coord, 0.0)
@@ -583,8 +583,28 @@ SamplerState PointSampler
 #  define lerp(a, b, t) mix(a, b, t)
 #  define saturate(a) clamp(a, 0.0, 1.0)
 #  if defined(SMAA_GLSL_4)
-#define mad(a, b, c) fma(a, b, c)
 #define SMAAGather(tex, coord) textureGather(tex, coord)
+#  endif
+#  if defined(SMAA_GLSL_4)
+#define mad(a, b, c) fma(a, b, c)
+#  elif defined(GPU_VULKAN)
+/* NOTE(Vulkan) mad macro doesn't work, define each override as work-around. */
+vec4 mad(vec4 a, vec4 b, vec4 c)
+{
+  return fma(a, b, c);
+}
+vec3 mad(vec3 a, vec3 b, vec3 c)
+{
+  return fma(a, b, c);
+}
+vec2 mad(vec2 a, vec2 b, vec2 c)
+{
+  return fma(a, b, c);
+}
+float mad(float a, float b, float c)
+{
+  return fma(a, b, c);
+}
 #  else
 #define mad(a, b, c) (a * b + c)
 #  endif

___
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] [8781886cf7f] temp-vulkan-shader: Fix compilation of line dashed shader.

2022-12-02 Thread Jeroen Bakker
Commit: 8781886cf7f465b1081a7f45af95a2fd642f67e4
Author: Jeroen Bakker
Date:   Fri Dec 2 10:17:20 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB8781886cf7f465b1081a7f45af95a2fd642f67e4

Fix compilation of line dashed shader.

===

M   
source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl

===

diff --git 
a/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl 
b/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
index 68835cb1d0f..4b15bb3851d 100644
--- 
a/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
+++ 
b/source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl
@@ -13,6 +13,8 @@ void main()
   gl_Position = ModelViewProjectionMatrix * pos_4d;
   stipple_start = stipple_pos = viewport_size * 0.5 * (gl_Position.xy / 
gl_Position.w);
 #ifdef USE_WORLD_CLIP_PLANES
-  world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
+  /* Spir-V GLSL pre-processors chokes when passed directly. */
+  vec3 wpos = (ModelMatrix * pos_4d).xyz;
+  world_clip_planes_calc_clip_distance(wpos);
 #endif
 }

___
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] [12b9ebc6901] temp-vulkan-shader: Moved debug code.

2022-12-02 Thread Jeroen Bakker
Commit: 12b9ebc6901ac665741c94a9009be9622a896d3e
Author: Jeroen Bakker
Date:   Fri Dec 2 10:29:38 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB12b9ebc6901ac665741c94a9009be9622a896d3e

Moved debug code.

===

M   source/blender/gpu/vulkan/vk_shader.cc

===

diff --git a/source/blender/gpu/vulkan/vk_shader.cc 
b/source/blender/gpu/vulkan/vk_shader.cc
index c24a03bf45c..51dfbb97dee 100644
--- a/source/blender/gpu/vulkan/vk_shader.cc
+++ b/source/blender/gpu/vulkan/vk_shader.cc
@@ -534,7 +534,6 @@ Vector VKShader::compile_glsl_to_spirv(Span sources,
   shaderc::SpvCompilationResult module = compiler.CompileGlslToSpv(
   combined_sources, stage, name, options);
   if (module.GetNumErrors() != 0 || module.GetNumWarnings() != 0) {
-// printf("%s %s\n", __func__, combined_sources.c_str());
 std::string log = module.GetErrorMessage();
 Vector logcstr(log.c_str(), log.c_str() + log.size() + 1);
 
@@ -547,6 +546,7 @@ Vector VKShader::compile_glsl_to_spirv(Span sources,
   }
 
   if (module.GetCompilationStatus() != shaderc_compilation_status_success) {
+// printf("%s %s\n", __func__, combined_sources.c_str());
 compilation_failed_ = true;
 return Vector();
   }

___
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] [37ee9595a0d] temp-vulkan-shader: Fix gpencil shaders.

2022-12-02 Thread Jeroen Bakker
Commit: 37ee9595a0d3793cd4c6b561be7ff1641c45a746
Author: Jeroen Bakker
Date:   Fri Dec 2 10:13:40 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB37ee9595a0d3793cd4c6b561be7ff1641c45a746

Fix gpencil shaders.

===

M   
source/blender/draw/engines/overlay/shaders/overlay_edit_gpencil_guide_vert.glsl
M   source/blender/draw/intern/shaders/common_gpencil_lib.glsl

===

diff --git 
a/source/blender/draw/engines/overlay/shaders/overlay_edit_gpencil_guide_vert.glsl
 
b/source/blender/draw/engines/overlay/shaders/overlay_edit_gpencil_guide_vert.glsl
index a5091345539..a7dbc3c9f7c 100644
--- 
a/source/blender/draw/engines/overlay/shaders/overlay_edit_gpencil_guide_vert.glsl
+++ 
b/source/blender/draw/engines/overlay/shaders/overlay_edit_gpencil_guide_vert.glsl
@@ -6,9 +6,11 @@ void main()
 {
   GPU_INTEL_VERTEX_SHADER_WORKAROUND
 
-  gl_Position = point_world_to_ndc(pPosition);
+  /* Spir-V GLSL pre-processors chokes when passed directly. */
+  vec3 pos = pPosition;
+  gl_Position = point_world_to_ndc(pos);
   finalColor = pColor;
   gl_PointSize = pSize;
 
-  view_clipping_distances(pPosition);
+  view_clipping_distances(pos);
 }
diff --git a/source/blender/draw/intern/shaders/common_gpencil_lib.glsl 
b/source/blender/draw/intern/shaders/common_gpencil_lib.glsl
index def841b07aa..25d8394ad9f 100644
--- a/source/blender/draw/intern/shaders/common_gpencil_lib.glsl
+++ b/source/blender/draw/intern/shaders/common_gpencil_lib.glsl
@@ -253,7 +253,9 @@ vec4 gpencil_vertex(vec4 viewport_size,
 x_axis = vec2(1.0, 0.0);
   }
   else { /* GP_STROKE_ALIGNMENT_OBJECT */
-vec4 ndc_x = point_world_to_ndc(wpos1 + ModelMatrix[0].xyz);
+/* Spir-V GLSL pre-processors chokes when passed directly. */
+vec3 wpos = wpos1 + ModelMatrix[0].xyz;
+vec4 ndc_x = point_world_to_ndc(wpos);
 vec2 ss_x = gpencil_project_to_screenspace(ndc_x, viewport_size);
 x_axis = safe_normalize(ss_x - ss1);
   }

___
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] [be1dce8dfb1] temp-vulkan-shader: Fix compilation issues in workbench shadow.

2022-12-02 Thread Jeroen Bakker
Commit: be1dce8dfb13f8ed5b464b0d91b58aebbf14f26f
Author: Jeroen Bakker
Date:   Fri Dec 2 09:58:31 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rBbe1dce8dfb13f8ed5b464b0d91b58aebbf14f26f

Fix compilation issues in workbench shadow.

===

M   source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl

===

diff --git 
a/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl 
b/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl
index a220434ec45..fa4d5ef4d96 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_vert.glsl
@@ -5,5 +5,6 @@ void main()
 {
   vData.pos = pos;
   vData.frontPosition = point_object_to_ndc(pos);
-  vData.backPosition = point_object_to_ndc(pos + lightDirection * 
lightDistance);
+  vec3 back_pos = pos + lightDirection * lightDistance;
+  vData.backPosition = point_object_to_ndc(back_pos);
 }

___
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] [7214298cd18] temp-vulkan-shader: Merge branch 'master' into temp-vulkan-shader

2022-12-02 Thread Jeroen Bakker
Commit: 7214298cd18574ed9e36804b11eaaad97af331e7
Author: Jeroen Bakker
Date:   Fri Dec 2 08:37:58 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB7214298cd18574ed9e36804b11eaaad97af331e7

Merge branch 'master' into temp-vulkan-shader

===



===

diff --cc source/blender/gpu/CMakeLists.txt
index 6b6c88acf98,cf485bf476a..5c6db59b739
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@@ -192,11 -191,12 +192,13 @@@ set(VULKAN_SR
vulkan/vk_batch.cc
vulkan/vk_context.cc
vulkan/vk_drawlist.cc
+   vulkan/vk_fence.cc
vulkan/vk_framebuffer.cc
vulkan/vk_index_buffer.cc
+   vulkan/vk_pixel_buffer.cc
vulkan/vk_query.cc
vulkan/vk_shader.cc
 +  vulkan/vk_shader_log.cc
vulkan/vk_storage_buffer.cc
vulkan/vk_texture.cc
vulkan/vk_uniform_buffer.cc
@@@ -206,11 -206,12 +208,13 @@@
vulkan/vk_batch.hh
vulkan/vk_context.hh
vulkan/vk_drawlist.hh
+   vulkan/vk_fence.hh
vulkan/vk_framebuffer.hh
vulkan/vk_index_buffer.hh
+   vulkan/vk_pixel_buffer.hh
vulkan/vk_query.hh
vulkan/vk_shader.hh
 +  vulkan/vk_shader_log.hh
vulkan/vk_storage_buffer.hh
vulkan/vk_texture.hh
vulkan/vk_uniform_buffer.hh

___
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] [63084dc7dd6] temp-vulkan-shader: Merge branch 'master' into temp-vulkan-shader

2022-12-02 Thread Jeroen Bakker
Commit: 63084dc7dd68b82335f939b82364cfb3bff4412f
Author: Jeroen Bakker
Date:   Fri Dec 2 08:05:34 2022 +0100
Branches: temp-vulkan-shader
https://developer.blender.org/rB63084dc7dd68b82335f939b82364cfb3bff4412f

Merge branch 'master' into temp-vulkan-shader

===



===



___
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] [5f0120cd357] master: Merge branch 'blender-v3.4-release'

2022-12-02 Thread Thomas Dinges
Commit: 5f0120cd35785d956a0bf6eabce79b1a432687ac
Author: Thomas Dinges
Date:   Fri Dec 2 08:47:05 2022 +0100
Branches: master
https://developer.blender.org/rB5f0120cd35785d956a0bf6eabce79b1a432687ac

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] [46f991dbae9] master: Sculpt: Fix broken pivots when entering paint modes

2022-12-02 Thread Joseph Eagar
Commit: 46f991dbae96b95870bf3db4564082fc6e2e0ee5
Author: Joseph Eagar
Date:   Fri Dec 2 00:37:50 2022 -0800
Branches: master
https://developer.blender.org/rB46f991dbae96b95870bf3db4564082fc6e2e0ee5

Sculpt: Fix broken pivots when entering paint modes

When entering paint modes the paint pivot was cleared,
which broken rotate around pivot.  Fixed for all paint modes.
PBVH modes set the pivot to the PBVH bounding box
while texture paint uses the evaluated mesh bounding box.

===

M   release/scripts/addons

===

diff --git a/release/scripts/addons b/release/scripts/addons
index fdfd24de034..0b0052bd53a 16
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit fdfd24de034d4bba4fb67731d0aae81dc4940239
+Subproject commit 0b0052bd53ad8249ed07dfb87705c338af698bde

___
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] [0197b524e47] master: Update THIRD-PARTY-LICENSES.txt for Blender 3.4.

2022-12-02 Thread Thomas Dinges
Commit: 0197b524e47477f57100b35436a741212e916c52
Author: Thomas Dinges
Date:   Thu Dec 1 15:21:43 2022 +0100
Branches: master
https://developer.blender.org/rB0197b524e47477f57100b35436a741212e916c52

Update THIRD-PARTY-LICENSES.txt for Blender 3.4.

===

M   release/license/THIRD-PARTY-LICENSES.txt

===

diff --git a/release/license/THIRD-PARTY-LICENSES.txt 
b/release/license/THIRD-PARTY-LICENSES.txt
index e0ac2bdf226..e574f74e27b 100644
--- a/release/license/THIRD-PARTY-LICENSES.txt
+++ b/release/license/THIRD-PARTY-LICENSES.txt
@@ -23,14 +23,16 @@ PERFORMANCE OF THIS SOFTWARE.
 ** Cuda Wrangler; version cbf465b -- https://github.com/CudaWrangler/cuew
 ** Draco; version 1.3.6 -- https://google.github.io/draco/
 ** Embree; version 3.13.4 -- https://github.com/embree/embree
-** Intel® Open Path Guiding Library; version v0.3.1-beta --
+** Intel(R) oneAPI DPC++ compiler; version 20221019 --
+https://github.com/intel/llvm#oneapi-dpc-compiler
+** Intel® Open Path Guiding Library; version v0.4.1-beta --
 http://www.openpgl.org/
 ** Mantaflow; version 0.13 -- http://mantaflow.com/
 ** oneAPI Threading Building Block; version 2020_U3 --
 https://software.intel.com/en-us/oneapi/onetbb
 ** OpenCL Wrangler; version 27a6867 -- https://github.com/OpenCLWrangler/clew
 ** OpenImageDenoise; version 1.4.3 -- https://www.openimagedenoise.org/
-** OpenSSL; version 1.1.1 -- https://www.openssl.org/
+** OpenSSL; version 1.1.1q -- https://www.openssl.org/
 ** OpenXR SDK; version 1.0.17 -- https://khronos.org/openxr
 ** RangeTree; version 40ebed8aa209 -- https://github.com/ideasman42/rangetree-c
 ** SDL Extension Wrangler; version 15edf8e --
@@ -242,6 +244,8 @@ limitations under the License.
 Copyright 2018 The Draco Authors
 * For Embree see also this required NOTICE:
 Copyright 2009-2020 Intel Corporation
+* For Intel(R) oneAPI DPC++ compiler see also this required NOTICE:
+Copyright (C) 2021 Intel Corporation
 * For Intel® Open Path Guiding Library see also this required NOTICE:
 Copyright 2020 Intel Corporation.
 * For Mantaflow see also this required NOTICE:
@@ -273,7 +277,7 @@ limitations under the License.
 Copyright (c) 2016, Alliance for Open Media. All rights reserved.
 ** NASM; version 2.15.02 -- https://www.nasm.us/
 Contributions since 2008-12-15 are Copyright Intel Corporation.
-** OpenJPEG; version 2.4.0 -- https://github.com/uclouvain/openjpeg
+** OpenJPEG; version 2.5.0 -- https://github.com/uclouvain/openjpeg
 Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
 Copyright (c) 2002-2014, Professor Benoit Macq
 Copyright (c) 2003-2014, Antonin Descampe
@@ -330,7 +334,7 @@ Copyright Intel Corporation
 Copyright (c) 2005-2021, NumPy Developers.
 ** Ogg; version 1.3.5 -- https://www.xiph.org/ogg/
 COPYRIGHT (C) 1994-2019 by the Xiph.Org Foundation https://www.xiph.org/
-** Open Shading Language; version 1.11.17.0 --
+** Open Shading Language; version 1.12.6.2 --
 https://github.com/imageworks/OpenShadingLanguage
 Copyright Contributors to the Open Shading Language project.
 ** OpenColorIO; version 2.1.1 --
@@ -339,7 +343,7 @@ Copyright Contributors to the OpenColorIO Project.
 ** OpenEXR; version 3.1.5 --
 https://github.com/AcademySoftwareFoundation/openexr
 Copyright Contributors to the OpenEXR Project. All rights reserved.
-** OpenImageIO; version 2.3.13.0 -- http://www.openimageio.org
+** OpenImageIO; version 2.3.20.0 -- http://www.openimageio.org
 Copyright (c) 2008-present by Contributors to the OpenImageIO project. All
 Rights Reserved.
 ** Pystring; version 1.1.3 -- https://github.com/imageworks/pystring
@@ -1183,7 +1187,7 @@ Copyright (C) 2003-2021 x264 project
 ** miniLZO; version 2.08 -- http://www.oberhumer.com/opensource/lzo/
 LZO and miniLZO are Copyright (C) 1996-2014 Markus Franz Xaver Oberhumer
 All Rights Reserved.
-** The FreeType Project; version 2.11.1 --
+** The FreeType Project; version 2.12.1 --
 https://sourceforge.net/projects/freetype
 Copyright (C) 1996-2020 by David Turner, Robert Wilhelm, and Werner Lemberg.
 ** X Drag and Drop; version 2000-08-08 --
@@ -2186,8 +2190,10 @@ of this License. But first, please read http://ffmpeg.org/
+** FFmpeg; version 5.1.2 -- http://ffmpeg.org/
 -
+** Libsndfile; version 1.1.0 -- http://libsndfile.github.io/libsndfile/
+Copyright (C) 2011-2016 Erik de Castro Lopo 
 
 GNU LESSER GENERAL PUBLIC LICENSE
 
@@ -2675,171 +2681,6 @@ That's all there is to it!
 
 --
 
-** Libsndfile; version 1.0.28 -- http://www.mega-nerd.com/libsndfile/
-Copyright (C) 2011-2016 Erik de Castro Lopo 
-
-GNU LESSER GENERAL PUBLIC LICENSE
-
-Version 3, 29 June 2007
-
-Copyright (C) 2007 Free Software Foundation, Inc. 
-
-Everyone is permitted to copy and distribute verbatim copies of this license
-document, but changing it is not allowed.
-
-This version of the GNU Lesser General Public License incorporates the

[Bf-blender-cvs] [6b0e769d14a] master: Nodes: Restrict viewer key tree updates to compositor

2022-12-02 Thread Omar Emara
Commit: 6b0e769d14adf16b0b93b262e226c25b5b9cf95d
Author: Omar Emara
Date:   Fri Dec 2 10:32:50 2022 +0200
Branches: master
https://developer.blender.org/rB6b0e769d14adf16b0b93b262e226c25b5b9cf95d

Nodes: Restrict viewer key tree updates to compositor

The active viewer key is only used by the compositor, so only tag the
node tree for update of it is a compositor node tree.

===

M   source/blender/editors/space_node/space_node.cc

===

diff --git a/source/blender/editors/space_node/space_node.cc 
b/source/blender/editors/space_node/space_node.cc
index c993fa57d76..cb124342a83 100644
--- a/source/blender/editors/space_node/space_node.cc
+++ b/source/blender/editors/space_node/space_node.cc
@@ -196,7 +196,8 @@ void ED_node_set_active_viewer_key(SpaceNode *snode)
   if (snode->nodetree && path) {
 /* A change in active viewer may result in the change of the output node 
used by the
  * compositor, so we need to get notified about such changes. */
-if (snode->nodetree->active_viewer_key.value != path->parent_key.value) {
+if (snode->nodetree->active_viewer_key.value != path->parent_key.value &&
+snode->nodetree->type == NTREE_COMPOSIT) {
   DEG_id_tag_update(&snode->nodetree->id, ID_RECALC_NTREE_OUTPUT);
   WM_main_add_notifier(NC_NODE, 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