[Bf-blender-cvs] [575884b8278] master: Update RNA Manual References

2022-06-18 Thread Aaron Carlisle
Commit: 575884b827864141a25e55b3989b4b1f5bcc72a3
Author: Aaron Carlisle
Date:   Sat Jun 18 18:14:54 2022 -0400
Branches: master
https://developer.blender.org/rB575884b827864141a25e55b3989b4b1f5bcc72a3

Update RNA Manual References

===

M   release/scripts/modules/rna_manual_reference.py

===

diff --git a/release/scripts/modules/rna_manual_reference.py 
b/release/scripts/modules/rna_manual_reference.py
index 9896bd3e281..cfce84f84e3 100644
--- a/release/scripts/modules/rna_manual_reference.py
+++ b/release/scripts/modules/rna_manual_reference.py
@@ -189,6 +189,7 @@ url_manual_mapping = (
 ("bpy.types.rendersettings_simplify_gpencil_view_fill*", 
"render/cycles/render_settings/simplify.html#bpy-types-rendersettings-simplify-gpencil-view-fill"),
 ("bpy.types.sequencertoolsettings.snap_to_hold_offset*", 
"video_editing/edit/montage/editing.html#bpy-types-sequencertoolsettings-snap-to-hold-offset"),
 ("bpy.types.toolsettings.use_mesh_automerge_and_split*", 
"modeling/meshes/tools/tool_settings.html#bpy-types-toolsettings-use-mesh-automerge-and-split"),
+("bpy.ops.scene.view_layer_remove_unused_lightgroups*", 
"render/layers/passes.html#bpy-ops-scene-view-layer-remove-unused-lightgroups"),
 ("bpy.types.animvizmotionpaths.show_keyframe_numbers*", 
"animation/motion_paths.html#bpy-types-animvizmotionpaths-show-keyframe-numbers"),
 ("bpy.types.brush.cloth_constraint_softbody_strength*", 
"sculpt_paint/sculpting/tools/cloth.html#bpy-types-brush-cloth-constraint-softbody-strength"),
 ("bpy.types.brush.elastic_deform_volume_preservation*", 
"sculpt_paint/sculpting/tools/elastic_deform.html#bpy-types-brush-elastic-deform-volume-preservation"),
@@ -302,11 +303,13 @@ url_manual_mapping = (
 ("bpy.types.rigidbodyconstraint.breaking_threshold*", 
"physics/rigid_body/constraints/introduction.html#bpy-types-rigidbodyconstraint-breaking-threshold"),
 ("bpy.types.spaceclipeditor.use_manual_calibration*", 
"editors/clip/display/clip_display.html#bpy-types-spaceclipeditor-use-manual-calibration"),
 ("bpy.types.spacedopesheeteditor.show_pose_markers*", 
"animation/markers.html#bpy-types-spacedopesheeteditor-show-pose-markers"),
+("bpy.types.spaceimageoverlay.show_grid_background*", 
"editors/uv/overlays.html#bpy-types-spaceimageoverlay-show-grid-background"),
+("bpy.types.spacenodeoverlay.show_named_attributes*", 
"modeling/geometry_nodes/inspection.html#bpy-types-spacenodeoverlay-show-named-attributes"),
 ("bpy.types.spaceoutliner.use_filter_object_camera*", 
"editors/outliner/interface.html#bpy-types-spaceoutliner-use-filter-object-camera"),
 ("bpy.types.spaceoutliner.use_filter_object_others*", 
"editors/outliner/interface.html#bpy-types-spaceoutliner-use-filter-object-others"),
 ("bpy.types.spacesequenceeditor.overlay_frame_type*", 
"editors/video_sequencer/preview/sidebar.html#bpy-types-spacesequenceeditor-overlay-frame-type"),
 ("bpy.types.spacesequenceeditor.show_strip_overlay*", 
"editors/video_sequencer/sequencer/display.html#bpy-types-spacesequenceeditor-show-strip-overlay"),
-("bpy.types.spaceuveditor.custom_grid_subdivisions*", 
"editors/uv/sidebar.html#bpy-types-spaceuveditor-custom-grid-subdivisions"),
+("bpy.types.spaceuveditor.custom_grid_subdivisions*", 
"editors/uv/overlays.html#bpy-types-spaceuveditor-custom-grid-subdivisions"),
 ("bpy.types.toolsettings.proportional_edit_falloff*", 
"editors/3dview/controls/proportional_editing.html#bpy-types-toolsettings-proportional-edit-falloff"),
 ("bpy.types.toolsettings.use_edge_path_live_unwrap*", 
"modeling/meshes/tools/tool_settings.html#bpy-types-toolsettings-use-edge-path-live-unwrap"),
 ("bpy.types.toolsettings.use_gpencil_draw_additive*", 
"grease_pencil/modes/draw/introduction.html#bpy-types-toolsettings-use-gpencil-draw-additive"),
@@ -388,6 +391,7 @@ url_manual_mapping = (
 ("bpy.types.geometrynodecurvehandletypeselection*", 
"modeling/geometry_nodes/curve/handle_type_selection.html#bpy-types-geometrynodecurvehandletypeselection"),
 ("bpy.types.geometrynodeinputmeshvertexneighbors*", 
"modeling/geometry_nodes/mesh/vertex_neighbors.html#bpy-types-geometrynodeinputmeshvertexneighbors"),
 ("bpy.types.greasepencil.curve_edit_corner_angle*", 
"grease_pencil/modes/edit/curve_editing.html#bpy-types-greasepencil-curve-edit-corner-angle"),
+("bpy.types.imageformatsettings.color_management*", 
"render/output/properties/output.html#bpy-types-imageformatsettings-color-management"),
 ("bpy.types.lineartgpencilmodifier.source_camera*", 
"grease_pencil/modifiers/generate/line_art.html#bpy-types-lineartgpencilmodifier-source-camera"),
 ("bpy.types.lineartgpencilmodifier.use_face_mark*", 
"grease_pencil/modifiers/generate/line_art.html#bpy-types-lineartgpencilmodifier-use-face-mark"),
 

[Bf-blender-cvs] [7bf306622e5] master: Constraints: handle the custom target at the constraint level.

2022-06-18 Thread Alexander Gavrilov
Commit: 7bf306622e50dff7a502da385955d841340db965
Author: Alexander Gavrilov
Date:   Fri Jun 3 16:28:09 2022 +0300
Branches: master
https://developer.blender.org/rB7bf306622e50dff7a502da385955d841340db965

Constraints: handle the custom target at the constraint level.

Since the custom target is a feature implemented at constraint
level, it is more appropriate to handle it in the common wrapper
functions, instead of modifying all the type specific callbacks
like get_constraint_targets and flush_constraint_targets.

Also, tag the special target with a flag so other code can
handle it appropriately where necessary.

This was split from D9732, and effectively reverts and refactors
part of D7437. This patch should cause no functional changes.

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

===

M   source/blender/blenkernel/intern/constraint.c
M   source/blender/makesdna/DNA_constraint_types.h

===

diff --git a/source/blender/blenkernel/intern/constraint.c 
b/source/blender/blenkernel/intern/constraint.c
index 6ffb3299869..aa09541c043 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -949,30 +949,9 @@ static void default_get_tarmat_full_bbone(struct Depsgraph 
*UNUSED(depsgraph),
   } \
   (void)0
 
-static void custom_space_id_looper(bConstraint *con, ConstraintIDFunc func, 
void *userdata)
+static bool is_custom_space_needed(bConstraint *con)
 {
-  func(con, (ID **)>space_object, false, userdata);
-}
-
-static int get_space_tar(bConstraint *con, ListBase *list)
-{
-  if (!con || !list ||
-  (con->ownspace != CONSTRAINT_SPACE_CUSTOM && con->tarspace != 
CONSTRAINT_SPACE_CUSTOM)) {
-return 0;
-  }
-  bConstraintTarget *ct;
-  SINGLETARGET_GET_TARS(con, con->space_object, con->space_subtarget, ct, 
list);
-  return 1;
-}
-
-static void flush_space_tar(bConstraint *con, ListBase *list, bool no_copy)
-{
-  if (!con || !list ||
-  (con->ownspace != CONSTRAINT_SPACE_CUSTOM && con->tarspace != 
CONSTRAINT_SPACE_CUSTOM)) {
-return;
-  }
-  bConstraintTarget *ct = (bConstraintTarget *)list->last;
-  SINGLETARGET_FLUSH_TARS(con, con->space_object, con->space_subtarget, ct, 
list, no_copy);
+  return con->ownspace == CONSTRAINT_SPACE_CUSTOM || con->tarspace == 
CONSTRAINT_SPACE_CUSTOM;
 }
 
 /* - ChildOf Constraint  */
@@ -1161,8 +1140,6 @@ static void trackto_id_looper(bConstraint *con, 
ConstraintIDFunc func, void *use
 
   /* target only */
   func(con, (ID **)>tar, false, userdata);
-
-  custom_space_id_looper(con, func, userdata);
 }
 
 static int trackto_get_tars(bConstraint *con, ListBase *list)
@@ -1174,7 +1151,7 @@ static int trackto_get_tars(bConstraint *con, ListBase 
*list)
 /* standard target-getting macro for single-target constraints */
 SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list);
 
-return 1 + get_space_tar(con, list);
+return 1;
   }
 
   return 0;
@@ -1188,7 +1165,6 @@ static void trackto_flush_tars(bConstraint *con, ListBase 
*list, bool no_copy)
 
 /* the following macro is used for all standard single-target constraints 
*/
 SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, 
no_copy);
-flush_space_tar(con, list, no_copy);
   }
 }
 
@@ -1661,11 +1637,11 @@ static bConstraintTypeInfo CTI_LOCLIMIT = {
 "Limit Location",/* name */
 "bLocLimitConstraint",   /* struct name */
 NULL,/* free data */
-custom_space_id_looper,  /* id looper */
+NULL,/* id looper */
 NULL,/* copy data */
 NULL,/* new data */
-get_space_tar,   /* get constraint targets */
-flush_space_tar, /* flush constraint targets */
+NULL,/* get constraint targets */
+NULL,/* flush constraint targets */
 NULL,/* get target matrix */
 loclimit_evaluate,   /* evaluate */
 };
@@ -1742,11 +1718,11 @@ static bConstraintTypeInfo CTI_ROTLIMIT = {
 "Limit Rotation",/* name */
 "bRotLimitConstraint",   /* struct name */
 NULL,/* free data */
-custom_space_id_looper,  /* id looper */
+NULL,/* id looper */
 NULL,/* copy data */
 NULL,/* new data */
-get_space_tar,   /* get constraint targets */
-flush_space_tar, /* flush constraint targets */
+NULL,/* get constraint targets */
+NULL,/* flush constraint targets */
 NULL,/* get target matrix */
 rotlimit_evaluate,   /* evaluate */
 };
@@ -1809,11 +1785,11 @@ 

[Bf-blender-cvs] [b8bd304bd45] master: Geometry Nodes: speedup Separate XYZ node

2022-06-18 Thread Jacques Lucke
Commit: b8bd304bd45397b8c5a5ce850c4ceb2fdefe4961
Author: Jacques Lucke
Date:   Sat Jun 18 13:32:46 2022 +0200
Branches: master
https://developer.blender.org/rBb8bd304bd45397b8c5a5ce850c4ceb2fdefe4961

Geometry Nodes: speedup Separate XYZ node

This speeds up the node ~20% in common cases, e.g. when only the
X axis is used. The main optimization comes from not writing to memory
that's not used afterwards anymore anyway.

The "optimal code" for just extracting the x axis in a separate loop was
not faster for me. That indicates that the node is bottlenecked by
memory bandwidth, which seems reasonable.

===

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

===

diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc 
b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc
index 94a6febe92e..d4413036555 100644
--- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc
@@ -48,16 +48,36 @@ class MF_SeparateXYZ : public fn::MultiFunction {
   void call(IndexMask mask, fn::MFParams params, fn::MFContext 
UNUSED(context)) const override
   {
 const VArray  = params.readonly_single_input(0, 
"XYZ");
-MutableSpan xs = params.uninitialized_single_output(1, "X");
-MutableSpan ys = params.uninitialized_single_output(2, "Y");
-MutableSpan zs = params.uninitialized_single_output(3, "Z");
-
-for (int64_t i : mask) {
-  float3 xyz = vectors[i];
-  xs[i] = xyz.x;
-  ys[i] = xyz.y;
-  zs[i] = xyz.z;
+MutableSpan xs = 
params.uninitialized_single_output_if_required(1, "X");
+MutableSpan ys = 
params.uninitialized_single_output_if_required(2, "Y");
+MutableSpan zs = 
params.uninitialized_single_output_if_required(3, "Z");
+
+std::array, 3> outputs = {xs, ys, zs};
+Vector used_outputs;
+if (!xs.is_empty()) {
+  used_outputs.append(0);
 }
+if (!ys.is_empty()) {
+  used_outputs.append(1);
+}
+if (!zs.is_empty()) {
+  used_outputs.append(2);
+}
+
+devirtualize_varray(vectors, [&](auto vectors) {
+  mask.to_best_mask_type([&](auto mask) {
+const int used_outputs_num = used_outputs.size();
+const int *used_outputs_data = used_outputs.data();
+
+for (const int64_t i : mask) {
+  const float3  = vectors[i];
+  for (const int out_i : IndexRange(used_outputs_num)) {
+const int coordinate = used_outputs_data[out_i];
+outputs[coordinate][i] = vector[coordinate];
+  }
+}
+  });
+});
   }
 };

___
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] [cf3238c1c79] master: Fix initial window size being scaled down for Hi-DPI displays in Wayland

2022-06-18 Thread Campbell Barton
Commit: cf3238c1c79a8acb3e311938eda58558ece49cf6
Author: Campbell Barton
Date:   Sat Jun 18 20:51:49 2022 +1000
Branches: master
https://developer.blender.org/rBcf3238c1c79a8acb3e311938eda58558ece49cf6

Fix initial window size being scaled down for Hi-DPI displays in Wayland

getMainDisplayDimensions return values were scaled by the UI-scale,
instead of returning pixel values.

Also correct an error accessing the rotated monitor size,
which happened to be harmless as the value isn't used at the moment.

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index aebee003145..f2caa1e3ce3 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -2013,7 +2013,7 @@ static void output_handle_done(void *data, struct 
wl_output * /*wl_output*/)
   int32_t size_native[2];
   if (output->transform & WL_OUTPUT_TRANSFORM_90) {
 size_native[0] = output->size_native[1];
-size_native[1] = output->size_native[1];
+size_native[1] = output->size_native[0];
   }
   else {
 size_native[0] = output->size_native[0];
@@ -2362,11 +2362,12 @@ GHOST_TSuccess 
GHOST_SystemWayland::setCursorPosition(int32_t /*x*/, int32_t /*y
 
 void GHOST_SystemWayland::getMainDisplayDimensions(uint32_t , uint32_t 
) const
 {
-  if (getNumDisplays() > 0) {
-/* We assume first output as main. */
-width = uint32_t(d->outputs[0]->size_native[0]) / d->outputs[0]->scale;
-height = uint32_t(d->outputs[0]->size_native[1]) / d->outputs[0]->scale;
+  if (getNumDisplays() == 0) {
+return;
   }
+  /* We assume first output as main. */
+  width = uint32_t(d->outputs[0]->size_native[0]);
+  height = uint32_t(d->outputs[0]->size_native[1]);
 }
 
 void GHOST_SystemWayland::getAllDisplayDimensions(uint32_t , uint32_t 
) const

___
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] [7d030213b25] master: GHOST/Wayland: implement getAllDisplayDimensions

2022-06-18 Thread Campbell Barton
Commit: 7d030213b259420d176228f6a57af3ccc99d08f8
Author: Campbell Barton
Date:   Sat Jun 18 20:58:00 2022 +1000
Branches: master
https://developer.blender.org/rB7d030213b259420d176228f6a57af3ccc99d08f8

GHOST/Wayland: implement getAllDisplayDimensions

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp
M   intern/ghost/intern/GHOST_SystemWayland.h

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index f2caa1e3ce3..db8bfceda9b 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -2372,7 +2372,23 @@ void 
GHOST_SystemWayland::getMainDisplayDimensions(uint32_t , uint32_t 
 
 void GHOST_SystemWayland::getAllDisplayDimensions(uint32_t , uint32_t 
) const
 {
-  getMainDisplayDimensions(width, height);
+  int32_t xy_min[2] = {INT32_MAX, INT32_MAX};
+  int32_t xy_max[2] = {INT32_MIN, INT32_MIN};
+
+  for (const output_t *output : d->outputs) {
+int32_t xy[2] = {0, 0};
+if (output->has_position_logical) {
+  xy[0] = output->position_logical[0];
+  xy[1] = output->position_logical[1];
+}
+xy_min[0] = std::min(xy_min[0], xy[0]);
+xy_min[1] = std::min(xy_min[1], xy[1]);
+xy_max[0] = std::max(xy_max[0], xy[0] + output->size_native[0]);
+xy_max[1] = std::max(xy_max[1], xy[1] + output->size_native[1]);
+  }
+
+  width = xy_max[0] - xy_min[0];
+  height = xy_max[1] - xy_min[1];
 }
 
 GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings 
/*glSettings*/)
diff --git a/intern/ghost/intern/GHOST_SystemWayland.h 
b/intern/ghost/intern/GHOST_SystemWayland.h
index 04aa4063947..1599e644c68 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.h
+++ b/intern/ghost/intern/GHOST_SystemWayland.h
@@ -32,6 +32,7 @@ struct output_t {
   int32_t size_logical[2] = {0, 0};
   bool has_size_logical = false;
 
+  /** Monitor position in pixels. */
   int32_t position_logical[2] = {0, 0};
   bool has_position_logical = 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] [ac4836af6ad] master: Cleanup: Remove unused argument, unnecessary struct keyword

2022-06-18 Thread Hans Goudey
Commit: ac4836af6ad915aa6fa2c0e268459d384e0b466e
Author: Hans Goudey
Date:   Sat Jun 18 13:08:15 2022 +0200
Branches: master
https://developer.blender.org/rBac4836af6ad915aa6fa2c0e268459d384e0b466e

Cleanup: Remove unused argument, unnecessary struct keyword

===

M   source/blender/draw/intern/draw_cache_extract_mesh.cc
M   source/blender/draw/intern/draw_cache_impl_subdivision.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_fdots.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_tris.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_data.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_area.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_edituv_data.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_nor.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_lnor.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_orco.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_sculpt_data.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_select_idx.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_skin_roots.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_uv.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
M   source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_weights.cc

===

diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc 
b/source/blender/draw/intern/draw_cache_extract_mesh.cc
index 5fd7b4c..380736ef656 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh.cc
+++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc
@@ -155,7 +155,7 @@ struct ExtractTaskData {
   bool use_threading = false;
 
   ExtractTaskData(const MeshRenderData *mr,
-  struct MeshBatchCache *cache,
+  MeshBatchCache *cache,
   ExtractorRunDatas *extractors,
   MeshBufferList *mbuflist,
   const bool use_threading)
@@ -193,7 +193,7 @@ static void extract_task_data_free(void *data)
  * \{ */
 
 BLI_INLINE void extract_init(const MeshRenderData *mr,
- struct MeshBatchCache *cache,
+ MeshBatchCache *cache,
  ExtractorRunDatas ,
  MeshBufferList *mbuflist,
  void *data_stack)
@@ -209,7 +209,7 @@ BLI_INLINE void extract_init(const MeshRenderData *mr,
 }
 
 BLI_INLINE void extract_finish(const MeshRenderData *mr,
-   struct MeshBatchCache *cache,
+   MeshBatchCache *cache,
const ExtractorRunDatas ,
void *data_stack)
 {
diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc 
b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
index b37a420b555..9992216bdec 100644
--- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc
+++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
@@ -2004,7 +2004,7 @@ static void 
draw_subdiv_cache_ensure_mat_offsets(DRWSubdivCache *cache,
 
 static bool draw_subdiv_create_requested_buffers(Object *ob,
  Mesh *mesh,
- struct MeshBatchCache 
*batch_cache,
+ MeshBatchCache *batch_cache,
  MeshBufferCache *mbc,

[Bf-blender-cvs] [30f244d96f1] master: Fix: curves have incorrect resolution attribute after realizing instances

2022-06-18 Thread Jacques Lucke
Commit: 30f244d96f16142d449cc1d050dc88218201fa4a
Author: Jacques Lucke
Date:   Sat Jun 18 13:01:41 2022 +0200
Branches: master
https://developer.blender.org/rB30f244d96f16142d449cc1d050dc88218201fa4a

Fix: curves have incorrect resolution attribute after realizing instances

If the resolution attribute existed on some curves, but not on others, it
was initialized to zero by default. However, zero is not a valid resolution.

===

M   source/blender/geometry/intern/realize_instances.cc

===

diff --git a/source/blender/geometry/intern/realize_instances.cc 
b/source/blender/geometry/intern/realize_instances.cc
index 4db4256ec8f..bd4099d37f9 100644
--- a/source/blender/geometry/intern/realize_instances.cc
+++ b/source/blender/geometry/intern/realize_instances.cc
@@ -134,6 +134,12 @@ struct RealizeCurveInfo {
* doesn't exist on some (but not all) of the input curves data-blocks.
*/
   Span radius;
+
+  /**
+   * The resolution attribute must be filled with the default value if it does 
not exist on some
+   * curves.
+   */
+  VArray resolution;
 };
 
 /** Start indices in the final output curves data-block. */
@@ -185,6 +191,7 @@ struct AllCurvesInfo {
   bool create_id_attribute = false;
   bool create_handle_postion_attributes = false;
   bool create_radius_attribute = false;
+  bool create_resolution_attribute = false;
 };
 
 /** Collects all tasks that need to be executed to realize all instances. */
@@ -1037,6 +1044,7 @@ static OrderedAttributes 
gather_generic_curve_attributes_to_propagate(
   src_component_types, GEO_COMPONENT_TYPE_CURVE, true, 
attributes_to_propagate);
   attributes_to_propagate.remove("position");
   attributes_to_propagate.remove("radius");
+  attributes_to_propagate.remove("resolution");
   attributes_to_propagate.remove("handle_right");
   attributes_to_propagate.remove("handle_left");
   r_create_id = attributes_to_propagate.pop_try("id").has_value();
@@ -1075,12 +1083,13 @@ static AllCurvesInfo preprocess_curves(const 
GeometrySet _set,
   info.realize_info.reinitialize(info.order.size());
   for (const int curve_index : info.realize_info.index_range()) {
 RealizeCurveInfo _info = info.realize_info[curve_index];
-const Curves *curves = info.order[curve_index];
-curve_info.curves = curves;
+const Curves *curves_id = info.order[curve_index];
+const bke::CurvesGeometry  = 
bke::CurvesGeometry::wrap(curves_id->geometry);
+curve_info.curves = curves_id;
 
 /* Access attributes. */
 CurveComponent component;
-component.replace(const_cast(curves), 
GeometryOwnershipType::ReadOnly);
+component.replace(const_cast(curves_id), 
GeometryOwnershipType::ReadOnly);
 curve_info.attributes.reinitialize(info.attributes.size());
 for (const int attribute_index : info.attributes.index_range()) {
   const eAttrDomain domain = info.attributes.kinds[attribute_index].domain;
@@ -1106,6 +1115,12 @@ static AllCurvesInfo preprocess_curves(const GeometrySet 
_set,
   info.create_radius_attribute = true;
 }
 
+/* Retrieve the resolution attribute, if it exists. */
+curve_info.resolution = curves.resolution();
+if (component.attribute_exists("resolution")) {
+  info.create_resolution_attribute = true;
+}
+
 /* Retrieve handle position attributes, if they exist. */
 if (component.attribute_exists("handle_right")) {
   curve_info.handle_left = component
@@ -1131,7 +1146,8 @@ static void execute_realize_curve_task(const 
RealizeInstancesOptions ,
MutableSpan all_dst_ids,
MutableSpan all_handle_left,
MutableSpan all_handle_right,
-   MutableSpan all_radii)
+   MutableSpan all_radii,
+   MutableSpan all_resolutions)
 {
   const RealizeCurveInfo _info = *task.curve_info;
   const Curves _id = *curves_info.curves;
@@ -1171,6 +1187,10 @@ static void execute_realize_curve_task(const 
RealizeInstancesOptions ,
 }
   }
 
+  if (all_curves_info.create_resolution_attribute) {
+curves_info.resolution.materialize(all_resolutions.slice(dst_curve_range));
+  }
+
   /* Copy curve offsets. */
   const Span src_offsets = curves.offsets();
   const MutableSpan dst_offsets = 
dst_curves.offsets_for_write().slice(dst_curve_range);
@@ -1268,6 +1288,15 @@ static void execute_realize_curve_tasks(const 
RealizeInstancesOptions ,
 radius_span = radius.as_span();
   }
 
+  /* Prepare resolution attribute if necessary. */
+  OutputAttribute_Typed resolution;
+  MutableSpan resolution_span;
+  if (all_curves_info.create_resolution_attribute) {
+resolution = 
dst_component.attribute_try_get_for_output_only("resolution",
+

[Bf-blender-cvs] [3c2a2a6c965] master: Cleanup: Always store attribute name in attribute request

2022-06-18 Thread Hans Goudey
Commit: 3c2a2a6c9659dd66f1a1d3a5e4153d1d2f8243eb
Author: Hans Goudey
Date:   Sat Jun 18 11:48:51 2022 +0200
Branches: master
https://developer.blender.org/rB3c2a2a6c9659dd66f1a1d3a5e4153d1d2f8243eb

Cleanup: Always store attribute name in attribute request

Previously the attribute name was only stored in the request for curves.
Instead, pass it as part of the "add request" function, so that it is
always used. Since the whole attribute pipeline is name-based,
this can simplify code in a few places.

===

M   source/blender/draw/intern/draw_attributes.cc
M   source/blender/draw/intern/draw_attributes.h
M   source/blender/draw/intern/draw_cache_impl_curves.cc
M   source/blender/draw/intern/draw_cache_impl_mesh.cc
M   
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc

===

diff --git a/source/blender/draw/intern/draw_attributes.cc 
b/source/blender/draw/intern/draw_attributes.cc
index 8fb4210901f..3f187aef8e6 100644
--- a/source/blender/draw/intern/draw_attributes.cc
+++ b/source/blender/draw/intern/draw_attributes.cc
@@ -65,9 +65,10 @@ bool drw_attributes_overlap(const DRW_Attributes *a, const 
DRW_Attributes *b)
 }
 
 DRW_AttributeRequest *drw_attributes_add_request(DRW_Attributes *attrs,
- eCustomDataType type,
- int layer,
- eAttrDomain domain)
+ const char *name,
+ const eCustomDataType type,
+ const int layer_index,
+ const eAttrDomain domain)
 {
   if (attrs->num_requests >= GPU_MAX_ATTR) {
 return nullptr;
@@ -75,7 +76,8 @@ DRW_AttributeRequest 
*drw_attributes_add_request(DRW_Attributes *attrs,
 
   DRW_AttributeRequest *req = >requests[attrs->num_requests];
   req->cd_type = type;
-  req->layer_index = layer;
+  BLI_strncpy(req->attribute_name, name, sizeof(req->attribute_name));
+  req->layer_index = layer_index;
   req->domain = domain;
   attrs->num_requests += 1;
   return req;
diff --git a/source/blender/draw/intern/draw_attributes.h 
b/source/blender/draw/intern/draw_attributes.h
index 4f82f3b94e9..b577c6c4162 100644
--- a/source/blender/draw/intern/draw_attributes.h
+++ b/source/blender/draw/intern/draw_attributes.h
@@ -46,8 +46,9 @@ void drw_attributes_merge(DRW_Attributes *dst,
 bool drw_attributes_overlap(const DRW_Attributes *a, const DRW_Attributes *b);
 
 DRW_AttributeRequest *drw_attributes_add_request(DRW_Attributes *attrs,
- eCustomDataType type,
- int layer,
+ const char *name,
+ eCustomDataType data_type,
+ int layer_index,
  eAttrDomain domain);
 
 bool drw_custom_data_match_attribute(const CustomData *custom_data,
diff --git a/source/blender/draw/intern/draw_cache_impl_curves.cc 
b/source/blender/draw/intern/draw_cache_impl_curves.cc
index 6e2b7bc758c..ee81f74ca26 100644
--- a/source/blender/draw/intern/draw_cache_impl_curves.cc
+++ b/source/blender/draw/intern/draw_cache_impl_curves.cc
@@ -529,11 +529,7 @@ static bool curves_ensure_attributes(const Curves ,
   continue;
 }
 
-DRW_AttributeRequest *request = drw_attributes_add_request(
-_needed, type, layer_index, domain);
-if (request) {
-  BLI_strncpy(request->attribute_name, name, 
sizeof(request->attribute_name));
-}
+drw_attributes_add_request(_needed, name, type, layer_index, domain);
   }
 
   CurvesEvalFinalCache _cache = cache.curves_cache.final[subdiv];
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.cc 
b/source/blender/draw/intern/draw_cache_impl_mesh.cc
index 7c02ee2c033..e93b1a66b66 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.cc
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.cc
@@ -574,7 +574,7 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const 
Object *object,
 }
 
 if (layer != -1 && domain.has_value()) {
-  drw_attributes_add_request(attributes, type, layer, *domain);
+  drw_attributes_add_request(attributes, name, type, layer, 
*domain);
 }
 break;
   }
@@ -585,7 +585,7 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const 
Object *object,
   case CD_PROP_FLOAT:
   case CD_PROP_FLOAT2: {
 if (layer != -1 && domain.has_value()) {
-  drw_attributes_add_request(attributes, type, layer, *domain);
+  

[Bf-blender-cvs] [8a3ff496a73] master: Cleanup: Remove unnecessary switch statement

2022-06-18 Thread Hans Goudey
Commit: 8a3ff496a737daa9ce5a33c2699ac0b20e52e8f0
Author: Hans Goudey
Date:   Sat Jun 18 11:40:46 2022 +0200
Branches: master
https://developer.blender.org/rB8a3ff496a737daa9ce5a33c2699ac0b20e52e8f0

Cleanup: Remove unnecessary switch statement

The types are retrieved by the attribute matching above anyway,
there is no reason to have another switch based on the type.

===

M   source/blender/draw/intern/draw_cache_impl_curves.cc

===

diff --git a/source/blender/draw/intern/draw_cache_impl_curves.cc 
b/source/blender/draw/intern/draw_cache_impl_curves.cc
index 68ca1153c96..6e2b7bc758c 100644
--- a/source/blender/draw/intern/draw_cache_impl_curves.cc
+++ b/source/blender/draw/intern/draw_cache_impl_curves.cc
@@ -529,24 +529,10 @@ static bool curves_ensure_attributes(const Curves ,
   continue;
 }
 
-switch (type) {
-  case CD_PROP_BOOL:
-  case CD_PROP_INT8:
-  case CD_PROP_INT32:
-  case CD_PROP_FLOAT:
-  case CD_PROP_FLOAT2:
-  case CD_PROP_FLOAT3:
-  case CD_PROP_COLOR: {
-DRW_AttributeRequest *request = drw_attributes_add_request(
-_needed, type, layer_index, domain);
-if (request) {
-  BLI_strncpy(request->attribute_name, name, 
sizeof(request->attribute_name));
-}
-
-break;
-  }
-  default:
-break;
+DRW_AttributeRequest *request = drw_attributes_add_request(
+_needed, type, layer_index, domain);
+if (request) {
+  BLI_strncpy(request->attribute_name, name, 
sizeof(request->attribute_name));
 }
   }

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

2022-06-18 Thread Jeffrey Liu
Commit: 282c5a6f9805d2b6efb153e895168a34388f9176
Author: Jeffrey Liu
Date:   Sat Jun 18 04:40:11 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB282c5a6f9805d2b6efb153e895168a34388f9176

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] [59fffd32626] soc-2022-many-lights-sampling: Fix: Cycles light tree construction/traversal bugs

2022-06-18 Thread Jeffrey Liu
Commit: 59fffd326262122d291829188a3ec75f04c53980
Author: Jeffrey Liu
Date:   Sat Jun 18 04:01:50 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB59fffd326262122d291829188a3ec75f04c53980

Fix: Cycles light tree construction/traversal bugs

===

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

===

diff --git a/intern/cycles/kernel/light/light_tree.h 
b/intern/cycles/kernel/light/light_tree.h
index 7cff13b7c97..87c49ebc30c 100644
--- a/intern/cycles/kernel/light/light_tree.h
+++ b/intern/cycles/kernel/light/light_tree.h
@@ -21,7 +21,7 @@ ccl_device float light_tree_bounding_box_angle(const float3 
bbox_min,
   corners[6] = make_float3(bbox_max.x, bbox_max.y, bbox_min.z);
   corners[7] = bbox_max;
   for (int i = 0; i < 8; ++i) {
-float3 point_to_corner = normalize(P - corners[i]);
+float3 point_to_corner = normalize(corners[i] - P);
 const float cos_theta_u = dot(point_to_centroid, point_to_corner);
 theta_u = fmaxf(fast_acosf(cos_theta_u), theta_u);
   }
@@ -41,9 +41,12 @@ ccl_device float light_tree_node_importance(const float3 P,
 const float energy)
 {
   const float3 centroid = 0.5f * bbox_min + 0.5f * bbox_max;
-  const float3 point_to_centroid = normalize(P - centroid);
+  const float3 point_to_centroid = normalize(centroid - P);
 
-  const float distance_squared = len_squared(P - centroid);
+  /* Since we're not using the splitting heuristic, we clamp
+   * the distance to half the radius of the cluster. */
+  const float distance_squared = fminf(len_squared(centroid - P),
+   0.25f * len_squared(bbox_max - 
centroid));
 
   const float theta = fast_acosf(dot(bcone_axis, -point_to_centroid));
   const float theta_i = fast_acosf(dot(point_to_centroid, N));
@@ -51,17 +54,15 @@ ccl_device float light_tree_node_importance(const float3 P,
 
   /* to-do: compare this with directly using fmaxf and cosf. */
   /* Avoid using cosine until needed. */
-  const float theta_prime = fmaxf(theta_i - theta_u, 0);
-  /* to-do: this is also a rough heuristic to see if any contribution is 
possible.
-   * In the paper, this is only theta_e, but this seems to be off for point 
lights. */
-  if (theta_prime >= theta_o + theta_e) {
+  const float theta_prime = fmaxf(theta - theta_o - theta_u, 0);
+  if (theta_prime >= theta_e) {
 return 0;
   }
-  const float cos_theta_prime = cosf(theta_prime);
+  const float cos_theta_prime = fast_cosf(theta_prime);
 
   float cos_theta_i_prime = 1;
-  if (theta - theta_o - theta_u > 0) {
-cos_theta_i_prime = fabsf(cosf(theta - theta_o - theta_u));
+  if (theta_i - theta_u > 0) {
+cos_theta_i_prime = fabsf(fast_cosf(theta_i - theta_u));
   }
 
   /* to-do: find a good approximation for this value. */
@@ -160,11 +161,16 @@ ccl_device bool light_tree_sample(KernelGlobals kg,
 const float left_probability = left_importance / (left_importance + 
right_importance);
 
 if (tree_u < left_probability) {
+  index = index + 1;
   knode = left;
+  tree_u = tree_u * (left_importance + right_importance) / left_importance;
   *pdf_factor *= left_probability;
 }
 else {
+  index = knode->child_index;
   knode = right;
+  tree_u = (tree_u * (left_importance + right_importance) - 
left_importance) /
+   right_importance;
   *pdf_factor *= (1 - left_probability);
 }
   }
diff --git a/intern/cycles/scene/light.cpp b/intern/cycles/scene/light.cpp
index 86a235815c7..aa04bf4986c 100644
--- a/intern/cycles/scene/light.cpp
+++ b/intern/cycles/scene/light.cpp
@@ -352,6 +352,7 @@ void LightManager::device_update_distribution(Device *,
 for (int index = 0; index < linearized_bvh.size(); index++) {
   const PackedLightTreeNode  = linearized_bvh[index];
 
+  light_tree_nodes[index].energy = node.energy;
   for (int i = 0; i < 3; i++) {
 light_tree_nodes[index].bounding_box_min[i] = node.bbox.min[i];
 light_tree_nodes[index].bounding_box_max[i] = node.bbox.max[i];
@@ -536,6 +537,7 @@ void LightManager::device_update_distribution(Device *,
  * the light has been sampled through the light distribution.
  * Therefore, we override it for now and adjust the pdf manually in the 
light tree.*/
 if (scene->integrator->get_use_light_tree()) {
+  kintegrator->pdf_triangles = 1.0f;
   kintegrator->pdf_lights = 1.0f;
 }
 else {
diff --git a/intern/cycles/scene/light_tree.cpp 
b/intern/cycles/scene/light_tree.cpp
index 35c3d11104e..d50f257e6c7 100644
--- a/intern/cycles/scene/light_tree.cpp
+++ b/intern/cycles/scene/light_tree.cpp
@@ -37,9 +37,9 @@ OrientationBounds merge(const OrientationBounds& cone_a,
   }
   else {
  

[Bf-blender-cvs] [498f079d2c3] master: GHOST/Wayland: support displaying custom software cursors

2022-06-18 Thread Campbell Barton
Commit: 498f079d2c3644b47ff5c004bc1cf93a9ba6604b
Author: Campbell Barton
Date:   Sat Jun 18 15:10:03 2022 +1000
Branches: master
https://developer.blender.org/rB498f079d2c3644b47ff5c004bc1cf93a9ba6604b

GHOST/Wayland: support displaying custom software cursors

Add a method to access the custom cursor from GHOST which is used
for drawing a software cursor. This means the knife tools cursor now
work as expected.

Although non-custom cursors are still not supported.

===

M   intern/ghost/GHOST_C-api.h
M   intern/ghost/GHOST_IWindow.h
M   intern/ghost/GHOST_Types.h
M   intern/ghost/intern/GHOST_C-api.cpp
M   intern/ghost/intern/GHOST_SystemWayland.cpp
M   intern/ghost/intern/GHOST_SystemWayland.h
M   intern/ghost/intern/GHOST_Window.cpp
M   intern/ghost/intern/GHOST_Window.h
M   intern/ghost/intern/GHOST_WindowWayland.cpp
M   intern/ghost/intern/GHOST_WindowWayland.h
M   source/blender/windowmanager/intern/wm_draw.c

===

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 08ca9603985..5ace0fcc9d2 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -364,6 +364,9 @@ extern GHOST_TSuccess 
GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle
  int hotY,
  bool canInvertColor);
 
+extern GHOST_TSuccess GHOST_GetCursorBitmap(GHOST_WindowHandle windowhandle,
+GHOST_CursorBitmapRef *bitmap);
+
 /**
  * Returns the visibility state of the cursor.
  * \param windowhandle: The handle to the window.
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index f9552246e89..f712d9bd9f0 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -285,6 +285,8 @@ class GHOST_IWindow {
   int hotY,
   bool canInvertColor) = 0;
 
+  virtual GHOST_TSuccess getCursorBitmap(GHOST_CursorBitmapRef *bitmap) = 0;
+
   /**
* Returns the visibility state of the cursor.
* \return The visibility state of the cursor.
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 78f2b24ea78..35bde3d4413 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -44,6 +44,16 @@ GHOST_DECLARE_HANDLE(GHOST_XrContextHandle);
 
 typedef void (*GHOST_TBacktraceFn)(void *file_handle);
 
+/**
+ * A reference to cursor bitmap data.
+ */
+typedef struct {
+  /** `RGBA` bytes. */
+  const uint8_t *data;
+  int data_size[2];
+  int hot_spot[2];
+} GHOST_CursorBitmapRef;
+
 typedef struct {
   int flags;
 } GHOST_GLSettings;
diff --git a/intern/ghost/intern/GHOST_C-api.cpp 
b/intern/ghost/intern/GHOST_C-api.cpp
index 032ecd6aab5..2b5414cd47b 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -326,6 +326,14 @@ GHOST_TSuccess 
GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
   return window->setCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, 
canInvertColor);
 }
 
+GHOST_TSuccess GHOST_GetCursorBitmap(GHOST_WindowHandle windowhandle,
+ GHOST_CursorBitmapRef *bitmap)
+{
+  GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
+
+  return window->getCursorBitmap(bitmap);
+}
+
 bool GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
 {
   GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index bff96b3c0a4..aebee003145 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -96,6 +96,7 @@ struct buffer_t {
 
 struct cursor_t {
   bool visible = false;
+  bool is_custom = false;
   struct wl_surface *wl_surface = nullptr;
   struct wl_buffer *wl_buffer = nullptr;
   struct wl_cursor_image wl_image = {0};
@@ -2587,6 +2588,7 @@ GHOST_TSuccess 
GHOST_SystemWayland::setCursorShape(GHOST_TStandardCursor shape)
 return GHOST_kFailure;
   }
 
+  c->is_custom = false;
   c->wl_buffer = buffer;
   c->wl_image = *image;
 
@@ -2650,6 +2652,7 @@ GHOST_TSuccess 
GHOST_SystemWayland::setCustomCursorShape(uint8_t *bitmap,
   nullptr, cursor->file_buffer->size, PROT_READ | PROT_WRITE, MAP_SHARED, 
fd, 0);
 
   if (cursor->file_buffer->data == MAP_FAILED) {
+cursor->file_buffer->data = nullptr;
 close(fd);
 return GHOST_kFailure;
   }
@@ -2694,6 +2697,7 @@ GHOST_TSuccess 
GHOST_SystemWayland::setCustomCursorShape(uint8_t *bitmap,
 }
   }
 
+  cursor->is_custom = true;
   cursor->wl_buffer = buffer;
   cursor->wl_image.width = uint32_t(sizex);
   cursor->wl_image.height = uint32_t(sizey);
@@ -2705,6 +2709,27 @@ GHOST_TSuccess 

[Bf-blender-cvs] [881d1c9bc23] master: Fix crash in wayland when closing a window

2022-06-18 Thread Campbell Barton
Commit: 881d1c9bc234e203cff033ea02998ce99f3070cd
Author: Campbell Barton
Date:   Sat Jun 18 16:48:58 2022 +1000
Branches: master
https://developer.blender.org/rB881d1c9bc234e203cff033ea02998ce99f3070cd

Fix crash in wayland when closing a window

The focus_pointer only pointer was only cleared when the window existed,
which caused a dangling focus_pointer when closing a window.

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 2d1337df1de..bff96b3c0a4 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1161,12 +1161,13 @@ static void pointer_handle_leave(void *data,
  uint32_t /*serial*/,
  struct wl_surface *surface)
 {
+  /* First clear the `focus_pointer`, since the window won't exist when 
closing the window. */
+  static_cast(data)->focus_pointer = nullptr;
+
   GHOST_IWindow *win = window_from_surface(surface);
   if (!win) {
 return;
   }
-
-  static_cast(data)->focus_pointer = nullptr;
   static_cast(win)->deactivate();
 }

___
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