[Bf-blender-cvs] [2d4ec904974] master: Transform: support multi-threading for most modes

2021-06-29 Thread Campbell Barton
Commit: 2d4ec90497443dc28e342c539e65010c7f4a04bb
Author: Campbell Barton
Date:   Tue Jun 29 16:18:26 2021 +1000
Branches: master
https://developer.blender.org/rB2d4ec90497443dc28e342c539e65010c7f4a04bb

Transform: support multi-threading for most modes

Multi-threading support for transform modes: bevel-weight, crease,
push-pull, rotate, shear, shrink-fatten, skin-resize, to-sphere,
trackball & translate.

This is done using a parallel loop over transform data.

From testing a 1.5million polygon mesh on a 32 core system
the overall performance gains were between ~20-28%

To ensure the code is thread-safe arguments to shared data are const.

Reviewed By: mano-wii

===

M   source/blender/editors/transform/transform_data.h
M   source/blender/editors/transform/transform_mode_edge_bevelweight.c
M   source/blender/editors/transform/transform_mode_edge_crease.c
M   source/blender/editors/transform/transform_mode_push_pull.c
M   source/blender/editors/transform/transform_mode_resize.c
M   source/blender/editors/transform/transform_mode_rotate.c
M   source/blender/editors/transform/transform_mode_shear.c
M   source/blender/editors/transform/transform_mode_shrink_fatten.c
M   source/blender/editors/transform/transform_mode_skin_resize.c
M   source/blender/editors/transform/transform_mode_tosphere.c
M   source/blender/editors/transform/transform_mode_trackball.c
M   source/blender/editors/transform/transform_mode_translate.c

===

diff --git a/source/blender/editors/transform/transform_data.h 
b/source/blender/editors/transform/transform_data.h
index 59b76c2eec5..606453e356b 100644
--- a/source/blender/editors/transform/transform_data.h
+++ b/source/blender/editors/transform/transform_data.h
@@ -149,6 +149,8 @@ typedef struct TransData {
   short protectflag;
 } TransData;
 
+#define TRANSDATA_THREAD_LIMIT 1024
+
 /** #TransData.flag */
 enum {
   TD_SELECTED = 1 << 0,
diff --git a/source/blender/editors/transform/transform_mode_edge_bevelweight.c 
b/source/blender/editors/transform/transform_mode_edge_bevelweight.c
index 3ce52ed3296..425bfec241e 100644
--- a/source/blender/editors/transform/transform_mode_edge_bevelweight.c
+++ b/source/blender/editors/transform/transform_mode_edge_bevelweight.c
@@ -25,6 +25,7 @@
 
 #include "BLI_math.h"
 #include "BLI_string.h"
+#include "BLI_task.h"
 
 #include "BKE_context.h"
 #include "BKE_unit.h"
@@ -39,6 +40,50 @@
 #include "transform_mode.h"
 #include "transform_snap.h"
 
+/*  */
+/** \name Transform (Bevel Weight) Element
+ * \{ */
+
+/**
+ * \note Small arrays / data-structures should be stored copied for faster 
memory access.
+ */
+struct TransDataArgs_BevelWeight {
+  const TransInfo *t;
+  const TransDataContainer *tc;
+  float weight;
+};
+
+static void transdata_elem_bevel_weight(const TransInfo *UNUSED(t),
+const TransDataContainer *UNUSED(tc),
+TransData *td,
+const float weight)
+{
+  if (td->val == NULL) {
+return;
+  }
+  *td->val = td->ival + weight * td->factor;
+  if (*td->val < 0.0f) {
+*td->val = 0.0f;
+  }
+  if (*td->val > 1.0f) {
+*td->val = 1.0f;
+  }
+}
+
+static void transdata_elem_bevel_weight_fn(void *__restrict iter_data_v,
+   const int iter,
+   const TaskParallelTLS *__restrict 
UNUSED(tls))
+{
+  struct TransDataArgs_BevelWeight *data = iter_data_v;
+  TransData *td = &data->tc->data[iter];
+  if (td->flag & TD_SKIP) {
+return;
+  }
+  transdata_elem_bevel_weight(data->t, data->tc, td, data->weight);
+}
+
+/** \} */
+
 /*  */
 /** \name Transform (Bevel Weight)
  * \{ */
@@ -83,18 +128,25 @@ static void applyBevelWeight(TransInfo *t, const int 
UNUSED(mval[2]))
   }
 
   FOREACH_TRANS_DATA_CONTAINER (t, tc) {
-TransData *td = tc->data;
-for (i = 0; i < tc->data_len; i++, td++) {
-  if (td->val) {
-*td->val = td->ival + weight * td->factor;
-if (*td->val < 0.0f) {
-  *td->val = 0.0f;
-}
-if (*td->val > 1.0f) {
-  *td->val = 1.0f;
+if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
+  TransData *td = tc->data;
+  for (i = 0; i < tc->data_len; i++, td++) {
+if (td->flag & TD_SKIP) {
+  continue;
 }
+transdata_elem_bevel_weight(t, tc, td, weight);
   }
 }
+else {
+  struct TransDataArgs_BevelWeight data = {
+  .t = t,
+  .tc = tc,
+  .weight = weight,
+  };
+  TaskParallelSettings settings;
+  BLI_parallel_range_settings_defaults(&settings);
+  BLI_task_parallel_range(0, tc->data

[Bf-blender-cvs] [501d2443d03] master: Cleanup: use const arguments for accessor functions

2021-06-29 Thread Campbell Barton
Commit: 501d2443d03cce18985fab3ffad5d23238748f3e
Author: Campbell Barton
Date:   Wed Jun 30 16:37:14 2021 +1000
Branches: master
https://developer.blender.org/rB501d2443d03cce18985fab3ffad5d23238748f3e

Cleanup: use const arguments for accessor functions

===

M   source/blender/blenkernel/BKE_armature.h
M   source/blender/blenkernel/BKE_collection.h
M   source/blender/blenkernel/BKE_fcurve.h
M   source/blender/blenkernel/BKE_gpencil_geom.h
M   source/blender/blenkernel/BKE_key.h
M   source/blender/blenkernel/BKE_layer.h
M   source/blender/blenkernel/BKE_pbvh.h
M   source/blender/blenkernel/BKE_shader_fx.h
M   source/blender/blenkernel/BKE_text.h
M   source/blender/blenkernel/BKE_undo_system.h
M   source/blender/blenkernel/intern/armature.c
M   source/blender/blenkernel/intern/collection.c
M   source/blender/blenkernel/intern/fcurve.c
M   source/blender/blenkernel/intern/gpencil_geom.c
M   source/blender/blenkernel/intern/key.c
M   source/blender/blenkernel/intern/layer.c
M   source/blender/blenkernel/intern/layer_utils.c
M   source/blender/blenkernel/intern/pbvh.c
M   source/blender/blenkernel/intern/shader_fx.c
M   source/blender/blenkernel/intern/softbody.c
M   source/blender/blenkernel/intern/text.c
M   source/blender/blenkernel/intern/undo_system.c
M   source/blender/blenlib/BLI_dynstr.h
M   source/blender/blenlib/BLI_edgehash.h
M   source/blender/blenlib/BLI_ghash.h
M   source/blender/blenlib/BLI_mempool.h
M   source/blender/blenlib/intern/BLI_dynstr.c
M   source/blender/blenlib/intern/BLI_ghash.c
M   source/blender/blenlib/intern/BLI_mempool.c
M   source/blender/blenlib/intern/edgehash.c
M   source/blender/blenloader/intern/versioning_cycles.c
M   source/blender/editors/animation/anim_filter.c
M   source/blender/editors/animation/keyframing.c
M   source/blender/editors/curve/editcurve_select.c
M   source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c
M   source/blender/editors/gpencil/editaction_gpencil.c
M   source/blender/editors/gpencil/gpencil_data.c
M   source/blender/editors/gpencil/gpencil_sculpt_paint.c
M   source/blender/editors/gpencil/gpencil_utils.c
M   source/blender/editors/include/ED_curve.h
M   source/blender/editors/include/ED_gizmo_library.h
M   source/blender/editors/include/ED_gpencil.h
M   source/blender/editors/include/ED_keyframing.h
M   source/blender/editors/include/ED_mask.h
M   source/blender/editors/include/ED_node.h
M   source/blender/editors/include/ED_object.h
M   source/blender/editors/interface/interface_widgets.c
M   source/blender/editors/mask/mask_editaction.c
M   source/blender/editors/object/object_edit.c
M   source/blender/editors/object/object_modes.c
M   source/blender/editors/object/object_vgroup.c
M   source/blender/editors/render/render_shading.c
M   source/blender/editors/space_node/node_edit.cc
M   source/blender/editors/transform/transform_constraints.c
M   source/blender/editors/transform/transform_constraints.h
M   source/blender/makesrna/RNA_access.h
M   source/blender/makesrna/intern/rna_access.c
M   source/blender/modifiers/intern/MOD_ui_common.c
M   source/blender/render/RE_bake.h
M   source/blender/render/intern/engine.c
M   source/blender/render/intern/render_result.c
M   source/blender/render/intern/render_result.h
M   source/blender/sequencer/SEQ_iterator.h
M   source/blender/sequencer/SEQ_utils.h
M   source/blender/sequencer/intern/iterator.c
M   source/blender/sequencer/intern/prefetch.c
M   source/blender/sequencer/intern/sequence_lookup.c
M   source/blender/sequencer/intern/utils.c
M   source/blender/windowmanager/WM_api.h
M   source/blender/windowmanager/intern/wm_jobs.c

===

diff --git a/source/blender/blenkernel/BKE_armature.h 
b/source/blender/blenkernel/BKE_armature.h
index 07b7aa2ec50..86aa18e5739 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -151,7 +151,7 @@ typedef struct PoseTree {
 
 struct bArmature *BKE_armature_add(struct Main *bmain, const char *name);
 struct bArmature *BKE_armature_from_object(struct Object *ob);
-int BKE_armature_bonelist_count(struct ListBase *lb);
+int BKE_armature_bonelist_count(const struct ListBase *lb);
 void BKE_armature_bonelist_free(struct ListBase *lb, const bool do_id_user);
 void BKE_armature_editbonelist_free(struct ListBase *lb, const bool 
do_id_user);
 
diff --git a/source/blender/blenkernel/BKE_collection.h 
b/source/blender/blenkernel/BKE_collection.h
index 7963d54126e..f47cdf32ca0 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -164,7 +164,8 @@ bool BKE_collect

[Bf-blender-cvs] [df9597cfba7] master: Cleanup: use const for datatoc declarations

2021-06-29 Thread Campbell Barton
Commit: df9597cfba78deb40009553ab9dcf09c21edd434
Author: Campbell Barton
Date:   Wed Jun 30 16:32:33 2021 +1000
Branches: master
https://developer.blender.org/rBdf9597cfba78deb40009553ab9dcf09c21edd434

Cleanup: use const for datatoc declarations

===

M   intern/ghost/test/multitest/MultiTest.c
M   source/blender/blenkernel/BKE_font.h
M   source/blender/blenkernel/intern/font.c
M   source/blender/editors/include/ED_datafiles.h

===

diff --git a/intern/ghost/test/multitest/MultiTest.c 
b/intern/ghost/test/multitest/MultiTest.c
index 3b424f1ca89..ccbbbceb5b6 100644
--- a/intern/ghost/test/multitest/MultiTest.c
+++ b/intern/ghost/test/multitest/MultiTest.c
@@ -60,7 +60,7 @@
 #include "GPU_init_exit.h"
 
 extern int datatoc_bfont_ttf_size;
-extern char datatoc_bfont_ttf[];
+extern char const datatoc_bfont_ttf[];
 
 typedef struct _LoggerWindow LoggerWindow;
 typedef struct _MultiTestApp MultiTestApp;
diff --git a/source/blender/blenkernel/BKE_font.h 
b/source/blender/blenkernel/BKE_font.h
index b23ccbe25ff..522d3843bb2 100644
--- a/source/blender/blenkernel/BKE_font.h
+++ b/source/blender/blenkernel/BKE_font.h
@@ -66,8 +66,8 @@ typedef struct EditFont {
 
 } EditFont;
 
-bool BKE_vfont_is_builtin(struct VFont *vfont);
-void BKE_vfont_builtin_register(void *mem, int size);
+bool BKE_vfont_is_builtin(const struct VFont *vfont);
+void BKE_vfont_builtin_register(const void *mem, int size);
 
 void BKE_vfont_free_data(struct VFont *vfont);
 struct VFont *BKE_vfont_builtin_get(void);
diff --git a/source/blender/blenkernel/intern/font.c 
b/source/blender/blenkernel/intern/font.c
index 95de9a9d636..8bb2c401b03 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -216,15 +216,15 @@ void BKE_vfont_free_data(struct VFont *vfont)
   }
 }
 
-static void *builtin_font_data = NULL;
+static const void *builtin_font_data = NULL;
 static int builtin_font_size = 0;
 
-bool BKE_vfont_is_builtin(struct VFont *vfont)
+bool BKE_vfont_is_builtin(const struct VFont *vfont)
 {
   return STREQ(vfont->filepath, FO_BUILTIN_NAME);
 }
 
-void BKE_vfont_builtin_register(void *mem, int size)
+void BKE_vfont_builtin_register(const void *mem, int size)
 {
   builtin_font_data = mem;
   builtin_font_size = size;
diff --git a/source/blender/editors/include/ED_datafiles.h 
b/source/blender/editors/include/ED_datafiles.h
index 40b0a8d96b1..59e0e014933 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -30,275 +30,275 @@ extern "C" {
 /* Datafiles embedded in Blender */
 
 extern int datatoc_startup_blend_size;
-extern char datatoc_startup_blend[];
+extern const char datatoc_startup_blend[];
 
 extern int datatoc_preview_blend_size;
-extern char datatoc_preview_blend[];
+extern const char datatoc_preview_blend[];
 
 extern int datatoc_preview_grease_pencil_blend_size;
-extern char datatoc_preview_grease_pencil_blend[];
+extern const char datatoc_preview_grease_pencil_blend[];
 
 extern int datatoc_blender_icons16_png_size;
-extern char datatoc_blender_icons16_png[];
+extern const char datatoc_blender_icons16_png[];
 
 extern int datatoc_blender_icons32_png_size;
-extern char datatoc_blender_icons32_png[];
+extern const char datatoc_blender_icons32_png[];
 
 extern int datatoc_prvicons_png_size;
-extern char datatoc_prvicons_png[];
+extern const char datatoc_prvicons_png[];
 
 extern int datatoc_alert_icons_png_size;
-extern char datatoc_alert_icons_png[];
+extern const char datatoc_alert_icons_png[];
 
 extern int datatoc_blender_logo_png_size;
-extern char datatoc_blender_logo_png[];
+extern const char datatoc_blender_logo_png[];
 
 extern int datatoc_splash_png_size;
-extern char datatoc_splash_png[];
+extern const char datatoc_splash_png[];
 
 extern int datatoc_bfont_pfb_size;
-extern char datatoc_bfont_pfb[];
+extern const char datatoc_bfont_pfb[];
 
 /* Brush icon datafiles */
 /* TODO: this could be simplified by putting all
  * the brush icons in one file */
 extern int datatoc_add_png_size;
-extern char datatoc_add_png[];
+extern const char datatoc_add_png[];
 
 extern int datatoc_blob_png_size;
-extern char datatoc_blob_png[];
+extern const char datatoc_blob_png[];
 
 extern int datatoc_blur_png_size;
-extern char datatoc_blur_png[];
+extern const char datatoc_blur_png[];
 
 extern int datatoc_clay_png_size;
-extern char datatoc_clay_png[];
+extern const char datatoc_clay_png[];
 
 extern int datatoc_claystrips_png_size;
-extern char datatoc_claystrips_png[];
+extern const char datatoc_claystrips_png[];
 
 extern int datatoc_clone_png_size;
-extern char datatoc_clone_png[];
+extern const char datatoc_clone_png[];
 
 extern int datatoc_crease_png_size;
-extern char datatoc_crease_png[];
+extern const char datatoc_crease_png[];
 
 extern int datatoc_darken_png_size;
-extern char datatoc_d

[Bf-blender-cvs] [bcca36f4e8f] tmp_T72605: Account for other generators, and intermediate directories.

2021-06-29 Thread Ankit Meel
Commit: bcca36f4e8ff0b2435437293f9724c019c54cb77
Author: Ankit Meel
Date:   Wed Jun 30 11:35:37 2021 +0530
Branches: tmp_T72605
https://developer.blender.org/rBbcca36f4e8ff0b2435437293f9724c019c54cb77

Account for other generators, and intermediate directories.

===

M   source/creator/CMakeLists.txt

===

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index ae634dc50bf..361e7bfc65a 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -1020,18 +1020,20 @@ elseif(APPLE)
   endif()
   execute_process(COMMAND SetFile -d ${SETFILE_DATE} -m ${SETFILE_DATE}
   ${EXECUTABLE_OUTPUT_PATH}/Blender.app)
-  execute_process(COMMAND chmod a+rx,u+w ${EXECUTABLE_OUTPUT_PATH}/Blender.app)
-
-  set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
-OWNER_READGROUP_READWORLD_READ
-OWNER_WRITE
-OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
-  )
+  add_custom_command(TARGET blender
+# Ensure that the binary exists.
+POST_BUILD
+# Permissions for all intermediate directories and the Blender binary.
+COMMAND chmod -R a+rx,u+w
+# ${EXECUTABLE_OUTPUT_PATH}/Blender.app is wrong path for Xcode generator.
+"$"
+"$"
+"$/MacOS"
+"$")
 
   install(
 TARGETS blender
 DESTINATION "."
-PERMISSIONS ${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS}
   )
 
   # install release and app files

___
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] [39aa0062605] soc-2021-uv-editor-improvements: UV: Replace default grid with subdividing grid

2021-06-29 Thread Siddhartha Jejurkar
Commit: 39aa0062605635be64d5422e54fad2a4ec08d708
Author: Siddhartha Jejurkar
Date:   Wed Jun 30 11:55:18 2021 +0530
Branches: soc-2021-uv-editor-improvements
https://developer.blender.org/rB39aa0062605635be64d5422e54fad2a4ec08d708

UV: Replace default grid with subdividing grid

Replaces the default static grid with a dynamically subdividing grid.
This means that zooming in the UV editor will add more divisions to
the grid and vice versa when zooming out.

===

M   source/blender/draw/engines/overlay/overlay_grid.c
M   source/blender/draw/engines/overlay/overlay_private.h
M   source/blender/draw/engines/overlay/shaders/grid_frag.glsl

===

diff --git a/source/blender/draw/engines/overlay/overlay_grid.c 
b/source/blender/draw/engines/overlay/overlay_grid.c
index bd092062e9c..ab2dcb160b0 100644
--- a/source/blender/draw/engines/overlay/overlay_grid.c
+++ b/source/blender/draw/engines/overlay/overlay_grid.c
@@ -23,6 +23,7 @@
 #include "DRW_render.h"
 
 #include "DNA_camera_types.h"
+#include "DNA_screen_types.h"
 
 #include "DEG_depsgraph_query.h"
 
@@ -46,6 +47,7 @@ enum {
   GRID_BACK = (1 << 9),
   GRID_CAMERA = (1 << 10),
   PLANE_IMAGE = (1 << 11),
+  DYNAMIC_GRID = (1 << 12),
 };
 
 void OVERLAY_grid_init(OVERLAY_Data *vedata)
@@ -61,18 +63,38 @@ void OVERLAY_grid_init(OVERLAY_Data *vedata)
 
   if (pd->space_type == SPACE_IMAGE) {
 SpaceImage *sima = (SpaceImage *)draw_ctx->space_data;
+View2D v2d = draw_ctx->region->v2d;
+
 shd->grid_flag = ED_space_image_has_buffer(sima) ? 0 : PLANE_IMAGE | 
SHOW_GRID;
 shd->grid_distance = 1.0f;
 copy_v3_fl3(
 shd->grid_size, (float)sima->tile_grid_shape[0], 
(float)sima->tile_grid_shape[1], 1.0f);
-for (int step = 0; step < 8; step++) {
-  if (sima->flag & SI_DYNAMIC_GRID) {
+
+/* For a NxN grid */
+int N = 4;
+float xzoom = (v2d.cur.xmax - v2d.cur.xmin) / ((float)(v2d.mask.xmax - 
v2d.mask.xmin));
+float yzoom = (v2d.cur.ymax - v2d.cur.ymin) / ((float)(v2d.mask.ymax - 
v2d.mask.ymin));
+/* Calculating average of xzoom and yzoom for accuracy. Using only xzoom 
or yzoom would have
+ * been sufficient */
+shd->zoom_factor = (xzoom + yzoom) / 2.0f;
+/* grid begins to appear when the length of one grid unit is at least
+ * (N^2) pixels in the UV/Image editor */
+shd->zoom_factor *= (N * N);
+
+printf("xzoom = %f\n", xzoom);
+printf("zoom Factor = %f\n\n", shd->zoom_factor);
+
+if (sima->flag & SI_DYNAMIC_GRID) {
+  shd->grid_flag |= DYNAMIC_GRID;
+  for (int step = 0; step < 8; step++) {
 /* Temporary fix : dynamic_grid_size is not using the default value 
(=1) assignd in RNA */
 sima->dynamic_grid_size = (sima->dynamic_grid_size == 0) ? 1 : 
sima->dynamic_grid_size;
 shd->grid_steps[step] = powf(1, step) * (1.0f / 
((float)sima->dynamic_grid_size));
   }
-  else {
-shd->grid_steps[step] = powf(4, step) * (1.0f / 16.0f);
+}
+else {
+  for (int step = 0; step < 8; step++) {
+shd->grid_steps[step] = powf(N, step) * (1.0f / (powf(N, 8)));
   }
 }
 return;
@@ -245,6 +267,7 @@ void OVERLAY_grid_cache_init(OVERLAY_Data *vedata)
 
   grp = DRW_shgroup_create(sh, psl->grid_ps);
   DRW_shgroup_uniform_int(grp, "gridFlag", &shd->grid_flag, 1);
+  DRW_shgroup_uniform_float_copy(grp, "zoomFactor", shd->zoom_factor);
   DRW_shgroup_uniform_vec3(grp, "planeAxes", shd->grid_axes, 1);
   DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
   DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth);
diff --git a/source/blender/draw/engines/overlay/overlay_private.h 
b/source/blender/draw/engines/overlay/overlay_private.h
index a48b46a61fc..8c5c8613585 100644
--- a/source/blender/draw/engines/overlay/overlay_private.h
+++ b/source/blender/draw/engines/overlay/overlay_private.h
@@ -142,6 +142,7 @@ typedef struct OVERLAY_ShadingData {
   float grid_steps[8];
   float inv_viewport_size[2];
   float grid_line_size;
+  float zoom_factor; /* Length per pixel in the UV editor viewport */
   int grid_flag;
   int zpos_flag;
   int zneg_flag;
diff --git a/source/blender/draw/engines/overlay/shaders/grid_frag.glsl 
b/source/blender/draw/engines/overlay/shaders/grid_frag.glsl
index 3220adbff36..81e3f341a4f 100644
--- a/source/blender/draw/engines/overlay/shaders/grid_frag.glsl
+++ b/source/blender/draw/engines/overlay/shaders/grid_frag.glsl
@@ -15,6 +15,7 @@ uniform float lineKernel = 0.0;
 uniform sampler2D depthBuffer;
 
 uniform int gridFlag;
+uniform float zoomFactor;
 
 #define STEPS_LEN 8
 uniform float gridSteps[STEPS_LEN] = float[](0.001, 0.01, 0.1, 1.0, 10.0, 
100.0, 1000.0, 1.0);
@@ -28,6 +29,8 @@ uniform float gridSteps[STEPS_LEN] = float[](0.001, 0.01, 
0.1, 1.0, 10.0, 100.0,
 #define PLANE_YZ (1 << 6)
 #define GRID_BACK (1 << 9)/* grid is behind object

[Bf-blender-cvs] [8884d2d61b3] master: Geometry Nodes: Curve Primitive Bezier Segment

2021-06-29 Thread Johnny Matthews
Commit: 8884d2d61b3d60d44d4f8aecaba1d0fd121b0bf3
Author: Johnny Matthews
Date:   Wed Jun 30 00:03:55 2021 -0500
Branches: master
https://developer.blender.org/rB8884d2d61b3d60d44d4f8aecaba1d0fd121b0bf3

Geometry Nodes: Curve Primitive Bezier Segment

Creates a Curve with 1 Bezier Spline from four positions (start,
start handle, end handle, end) and a resolution. The handles are
aligned and mirrored automatically. An "Offset" mode is also included
to allow specifying the handles relative to the control points.

The default settings recreate the existing default Bezier Curve in the
3D viewport add menu.

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

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/makesdna/DNA_node_types.h
M   source/blender/makesrna/intern/rna_nodetree.c
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
A   
source/blender/nodes/geometry/nodes/node_geo_curve_primitive_bezier_segment.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 37dd4e635b5..4dff242bd9f 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -513,6 +513,7 @@ geometry_node_categories = [
 NodeItem("GeometryNodeCurveStar"),
 NodeItem("GeometryNodeCurveSpiral"),
 NodeItem("GeometryNodeCurveQuadraticBezier"),
+NodeItem("GeometryNodeCurvePrimitiveBezierSegment"),
 ]),
 GeometryNodeCategory("GEO_GEOMETRY", "Geometry", items=[
 NodeItem("GeometryNodeBoundBox"),
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index daffd523161..27f9edac731 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1442,6 +1442,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define GEO_NODE_CURVE_PRIMITIVE_STAR 1062
 #define GEO_NODE_CURVE_PRIMITIVE_SPIRAL 1063
 #define GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER 1064
+#define GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT 1065
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index f23d6004824..87b069d7c50 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -5054,6 +5054,7 @@ static void registerGeometryNodes()
   register_node_type_geo_collection_info();
   register_node_type_geo_convex_hull();
   register_node_type_geo_curve_length();
+  register_node_type_geo_curve_primitive_bezier_segment();
   register_node_type_geo_curve_primitive_quadratic_bezier();
   register_node_type_geo_curve_primitive_spiral();
   register_node_type_geo_curve_primitive_star();
diff --git a/source/blender/makesdna/DNA_node_types.h 
b/source/blender/makesdna/DNA_node_types.h
index 12625d3408d..480a8c03c41 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1357,6 +1357,11 @@ typedef struct NodeSwitch {
   uint8_t input_type;
 } NodeSwitch;
 
+typedef struct NodeGeometryCurvePrimitiveBezierSegment {
+  /* GeometryNodeCurvePrimitiveBezierSegmentMode. */
+  uint8_t mode;
+} NodeGeometryCurvePrimitiveBezierSegment;
+
 typedef struct NodeGeometryCurveResample {
   /* GeometryNodeCurveSampleMode. */
   uint8_t mode;
@@ -1889,6 +1894,11 @@ typedef enum GeometryNodeMeshLineCountMode {
   GEO_NODE_MESH_LINE_COUNT_RESOLUTION = 1,
 } GeometryNodeMeshLineCountMode;
 
+typedef enum GeometryNodeCurvePrimitiveBezierSegmentMode {
+  GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_POSITION = 0,
+  GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_OFFSET = 1,
+} GeometryNodeCurvePrimitiveBezierSegmentMode;
+
 typedef enum GeometryNodeCurveSampleMode {
   GEO_NODE_CURVE_SAMPLE_COUNT = 0,
   GEO_NODE_CURVE_SAMPLE_LENGTH = 1,
diff --git a/source/blender/makesrna/intern/rna_nodetree.c 
b/source/blender/makesrna/intern/rna_nodetree.c
index 13abadf809b..b3f46509955 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -8967,6 +8967,33 @@ static void def_geo_boolean(StructRNA *srna)
   RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
 }
 
+static void def_geo_curve_primitive_bezier_segment(StructRNA *srna)
+{
+  static const EnumPropertyItem mode_items[] = {
+
+  {GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_POSITION,
+   "POSITION",
+   ICON_NONE,
+   "Position",
+   "The start and end handles are fixed positions"},
+  {GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_OFFSET,
+   "OFFSET",
+   ICON_NONE,
+   "Offset",
+   "The start and end handles are offsets from the splin

[Bf-blender-cvs] [c36d2a9a7a2] master: Cleanup: rename 'count' to 'len'

2021-06-29 Thread Campbell Barton
Commit: c36d2a9a7a2a01fdaeea98270ef1eb2314dfada3
Author: Campbell Barton
Date:   Wed Jun 30 14:35:01 2021 +1000
Branches: master
https://developer.blender.org/rBc36d2a9a7a2a01fdaeea98270ef1eb2314dfada3

Cleanup: rename 'count' to 'len'

Reserve the term count for values that require calculation
(typically linked lists).

Without this convention it's difficult to know if using a length
accessor function in a loop will be O(N^2) without inspecting the
underlying implementation.

===

M   source/blender/editors/transform/transform_snap_sequencer.c
M   source/blender/sequencer/SEQ_iterator.h
M   source/blender/sequencer/intern/iterator.c

===

diff --git a/source/blender/editors/transform/transform_snap_sequencer.c 
b/source/blender/editors/transform/transform_snap_sequencer.c
index 952b580a0a3..a180db349ff 100644
--- a/source/blender/editors/transform/transform_snap_sequencer.c
+++ b/source/blender/editors/transform/transform_snap_sequencer.c
@@ -52,14 +52,14 @@ typedef struct TransSeqSnapData {
 /** \name Snap sources
  * \{ */
 
-static int seq_get_snap_source_points_count(SeqCollection *snap_sources)
+static int seq_get_snap_source_points_len(SeqCollection *snap_sources)
 {
-  return SEQ_collection_count(snap_sources) * 2;
+  return SEQ_collection_len(snap_sources) * 2;
 }
 
 static void seq_snap_source_points_alloc(TransSeqSnapData *snap_data, 
SeqCollection *snap_sources)
 {
-  const size_t point_count = seq_get_snap_source_points_count(snap_sources);
+  const size_t point_count = seq_get_snap_source_points_len(snap_sources);
   snap_data->source_snap_points = MEM_callocN(sizeof(int) * point_count, 
__func__);
   memset(snap_data->source_snap_points, 0, sizeof(int));
   snap_data->source_snap_point_count = point_count;
@@ -136,7 +136,7 @@ static int seq_get_snap_target_points_count(const TransInfo 
*t,
 count += 2;
   }
 
-  count *= SEQ_collection_count(snap_targets);
+  count *= SEQ_collection_len(snap_targets);
 
   if (snap_mode & SEQ_SNAP_TO_PLAYHEAD) {
 count++;
diff --git a/source/blender/sequencer/SEQ_iterator.h 
b/source/blender/sequencer/SEQ_iterator.h
index 39d8a7241fb..bdc5a093fbe 100644
--- a/source/blender/sequencer/SEQ_iterator.h
+++ b/source/blender/sequencer/SEQ_iterator.h
@@ -71,7 +71,7 @@ bool SEQ_iterator_ensure(SeqCollection *collection,
 struct Sequence *SEQ_iterator_yield(SeqIterator *iterator);
 
 SeqCollection *SEQ_collection_create(void);
-uint SEQ_collection_count(SeqCollection *collection);
+uint SEQ_collection_len(SeqCollection *collection);
 bool SEQ_collection_append_strip(struct Sequence *seq, SeqCollection *data);
 bool SEQ_collection_remove_strip(struct Sequence *seq, SeqCollection *data);
 void SEQ_collection_free(SeqCollection *collection);
diff --git a/source/blender/sequencer/intern/iterator.c 
b/source/blender/sequencer/intern/iterator.c
index 4df92ce7df4..dd343776200 100644
--- a/source/blender/sequencer/intern/iterator.c
+++ b/source/blender/sequencer/intern/iterator.c
@@ -117,7 +117,7 @@ SeqCollection *SEQ_collection_create(void)
 /**
  * Return number of items in collection.
  */
-uint SEQ_collection_count(SeqCollection *collection)
+uint SEQ_collection_len(SeqCollection *collection)
 {
   return BLI_gset_len(collection->set);
 }

___
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] [77ac1f39c4c] master: Cleanup: unused arg warnings

2021-06-29 Thread Campbell Barton
Commit: 77ac1f39c4c9ff2cdce2527ef0035beb749db610
Author: Campbell Barton
Date:   Wed Jun 30 14:32:44 2021 +1000
Branches: master
https://developer.blender.org/rB77ac1f39c4c9ff2cdce2527ef0035beb749db610

Cleanup: unused arg warnings

===

M   source/blender/editors/transform/transform_snap_sequencer.c

===

diff --git a/source/blender/editors/transform/transform_snap_sequencer.c 
b/source/blender/editors/transform/transform_snap_sequencer.c
index 3100a8f5c39..952b580a0a3 100644
--- a/source/blender/editors/transform/transform_snap_sequencer.c
+++ b/source/blender/editors/transform/transform_snap_sequencer.c
@@ -70,7 +70,7 @@ static int cmp_fn(const void *a, const void *b)
   return (*(int *)a - *(int *)b);
 }
 
-static void seq_snap_source_points_build(const TransInfo *t,
+static void seq_snap_source_points_build(const TransInfo *UNUSED(t),
  TransSeqSnapData *snap_data,
  SeqCollection *snap_sources)
 {
@@ -125,7 +125,7 @@ static SeqCollection *query_snap_targets(const TransInfo *t)
 }
 
 static int seq_get_snap_target_points_count(const TransInfo *t,
-TransSeqSnapData *snap_data,
+TransSeqSnapData 
*UNUSED(snap_data),
 SeqCollection *snap_targets)
 {
   const short snap_mode = t->tsnap.mode;

___
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] [e5d35a05f68] tmp_T72605: Fix directory permissions.

2021-06-29 Thread Ankit Meel
Commit: e5d35a05f687e66842feab6d2602b8649a93b4ea
Author: Ankit Meel
Date:   Wed Jun 30 09:15:01 2021 +0530
Branches: tmp_T72605
https://developer.blender.org/rBe5d35a05f687e66842feab6d2602b8649a93b4ea

Fix directory permissions.

===

M   source/creator/CMakeLists.txt

===

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 57030757540..ae634dc50bf 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -1020,14 +1020,18 @@ elseif(APPLE)
   endif()
   execute_process(COMMAND SetFile -d ${SETFILE_DATE} -m ${SETFILE_DATE}
   ${EXECUTABLE_OUTPUT_PATH}/Blender.app)
+  execute_process(COMMAND chmod a+rx,u+w ${EXECUTABLE_OUTPUT_PATH}/Blender.app)
+
+  set(CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
+OWNER_READGROUP_READWORLD_READ
+OWNER_WRITE
+OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
+  )
 
   install(
 TARGETS blender
 DESTINATION "."
-PERMISSIONS
-  OWNER_READGROUP_READWORLD_READ
-  OWNER_WRITE
-  OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
+PERMISSIONS ${CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS}
   )
 
   # install release and app files

___
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] [d3788207aae] master: Geometry Nodes: Curve Primitive Quadratic Bezier Segment

2021-06-29 Thread Johnny Matthews
Commit: d3788207aae6e7a3546850a5d6e71ed552030cc0
Author: Johnny Matthews
Date:   Tue Jun 29 22:39:08 2021 -0500
Branches: master
https://developer.blender.org/rBd3788207aae6e7a3546850a5d6e71ed552030cc0

Geometry Nodes: Curve Primitive Quadratic Bezier Segment

This patch is for a node that creates a poly spline from a
3 point quadratic Bezier. Resolution is also specified.

Curve primitives design task: T89220

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

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
A   
source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index c963509938a..37dd4e635b5 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -512,6 +512,7 @@ geometry_node_categories = [
 GeometryNodeCategory("GEO_PRIMITIVES_CURVE", "Curve Primitives", items=[
 NodeItem("GeometryNodeCurveStar"),
 NodeItem("GeometryNodeCurveSpiral"),
+NodeItem("GeometryNodeCurveQuadraticBezier"),
 ]),
 GeometryNodeCategory("GEO_GEOMETRY", "Geometry", items=[
 NodeItem("GeometryNodeBoundBox"),
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 919a907cec8..daffd523161 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1441,6 +1441,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define GEO_NODE_RAYCAST 1061
 #define GEO_NODE_CURVE_PRIMITIVE_STAR 1062
 #define GEO_NODE_CURVE_PRIMITIVE_SPIRAL 1063
+#define GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER 1064
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index b528a8a3e49..f23d6004824 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -5054,6 +5054,7 @@ static void registerGeometryNodes()
   register_node_type_geo_collection_info();
   register_node_type_geo_convex_hull();
   register_node_type_geo_curve_length();
+  register_node_type_geo_curve_primitive_quadratic_bezier();
   register_node_type_geo_curve_primitive_spiral();
   register_node_type_geo_curve_primitive_star();
   register_node_type_geo_curve_to_mesh();
diff --git a/source/blender/nodes/CMakeLists.txt 
b/source/blender/nodes/CMakeLists.txt
index eda8be582b6..2576756571c 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -164,6 +164,7 @@ set(SRC
   geometry/nodes/node_geo_common.cc
   geometry/nodes/node_geo_convex_hull.cc
   geometry/nodes/node_geo_curve_length.cc  
+  geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc
   geometry/nodes/node_geo_curve_primitive_spiral.cc
   geometry/nodes/node_geo_curve_primitive_star.cc
   geometry/nodes/node_geo_curve_to_mesh.cc
diff --git a/source/blender/nodes/NOD_geometry.h 
b/source/blender/nodes/NOD_geometry.h
index f0e1ca4ec84..b3797c1834c 100644
--- a/source/blender/nodes/NOD_geometry.h
+++ b/source/blender/nodes/NOD_geometry.h
@@ -52,6 +52,7 @@ void register_node_type_geo_bounding_box(void);
 void register_node_type_geo_collection_info(void);
 void register_node_type_geo_convex_hull(void);
 void register_node_type_geo_curve_length(void);
+void register_node_type_geo_curve_primitive_quadratic_bezier(void);
 void register_node_type_geo_curve_primitive_spiral(void);
 void register_node_type_geo_curve_primitive_star(void);
 void register_node_type_geo_curve_to_mesh(void);
diff --git a/source/blender/nodes/NOD_static_types.h 
b/source/blender/nodes/NOD_static_types.h
index 4c63c1627a1..5d2717b3bbd 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -291,6 +291,7 @@ DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, 
"BOUNDING_BOX", BoundBox, "Bound
 DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, 
"COLLECTION_INFO", CollectionInfo, "Collection Info", "")
 DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, "CONVEX_HULL", ConvexHull, 
"Convex Hull", "")
 DefNode(GeometryNode, GEO_NODE_CURVE_LENGTH, 0, "CURVE_LENGTH", CurveLength, 
"Curve Length", "")
+DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER, 0, 
"CURVE_PRIMITIVE_QUADRATIC_BEZIER", CurveQuadraticBezier, "Quadratic Bezier", 
"")
 DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_STAR, 0, 
"CURVE_PRIMITIVE_STAR", CurveStar, "Star", "")
 DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_SPIRAL, 0, 
"CURVE_PRIMITIVE_SPIRAL", CurveSpiral, "Curve Spiral", "")
 DefNode(Geo

[Bf-blender-cvs] [21ebee25802] master: Geometry Nodes: Curve Primitive Spiral

2021-06-29 Thread Johnny Matthews
Commit: 21ebee258027f8c8bae0d51bb8d655013c5ee0a3
Author: Johnny Matthews
Date:   Tue Jun 29 22:20:54 2021 -0500
Branches: master
https://developer.blender.org/rB21ebee258027f8c8bae0d51bb8d655013c5ee0a3

Geometry Nodes: Curve Primitive Spiral

This node creates a curve spline and gives control for the number of
rotations, the number of points per rotation, start and end radius,
height, and direction. The "Reverse" input produces a visual change,
it doesn't just change the order of the control points.

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

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
A   source/blender/nodes/geometry/nodes/node_geo_curve_primitive_spiral.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index 2a85246fe50..c963509938a 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -511,6 +511,7 @@ geometry_node_categories = [
 ]),
 GeometryNodeCategory("GEO_PRIMITIVES_CURVE", "Curve Primitives", items=[
 NodeItem("GeometryNodeCurveStar"),
+NodeItem("GeometryNodeCurveSpiral"),
 ]),
 GeometryNodeCategory("GEO_GEOMETRY", "Geometry", items=[
 NodeItem("GeometryNodeBoundBox"),
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 84b60d18ee0..919a907cec8 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1440,6 +1440,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define GEO_NODE_CURVE_SUBDIVIDE 1060
 #define GEO_NODE_RAYCAST 1061
 #define GEO_NODE_CURVE_PRIMITIVE_STAR 1062
+#define GEO_NODE_CURVE_PRIMITIVE_SPIRAL 1063
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index 7e8047c8e3f..b528a8a3e49 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -5054,6 +5054,7 @@ static void registerGeometryNodes()
   register_node_type_geo_collection_info();
   register_node_type_geo_convex_hull();
   register_node_type_geo_curve_length();
+  register_node_type_geo_curve_primitive_spiral();
   register_node_type_geo_curve_primitive_star();
   register_node_type_geo_curve_to_mesh();
   register_node_type_geo_curve_to_points();
diff --git a/source/blender/nodes/CMakeLists.txt 
b/source/blender/nodes/CMakeLists.txt
index 65490f98cbf..eda8be582b6 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -164,6 +164,7 @@ set(SRC
   geometry/nodes/node_geo_common.cc
   geometry/nodes/node_geo_convex_hull.cc
   geometry/nodes/node_geo_curve_length.cc  
+  geometry/nodes/node_geo_curve_primitive_spiral.cc
   geometry/nodes/node_geo_curve_primitive_star.cc
   geometry/nodes/node_geo_curve_to_mesh.cc
   geometry/nodes/node_geo_curve_to_points.cc
diff --git a/source/blender/nodes/NOD_geometry.h 
b/source/blender/nodes/NOD_geometry.h
index aee26d1444c..f0e1ca4ec84 100644
--- a/source/blender/nodes/NOD_geometry.h
+++ b/source/blender/nodes/NOD_geometry.h
@@ -52,6 +52,7 @@ void register_node_type_geo_bounding_box(void);
 void register_node_type_geo_collection_info(void);
 void register_node_type_geo_convex_hull(void);
 void register_node_type_geo_curve_length(void);
+void register_node_type_geo_curve_primitive_spiral(void);
 void register_node_type_geo_curve_primitive_star(void);
 void register_node_type_geo_curve_to_mesh(void);
 void register_node_type_geo_curve_to_points(void);
diff --git a/source/blender/nodes/NOD_static_types.h 
b/source/blender/nodes/NOD_static_types.h
index a7a69522421..4c63c1627a1 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -292,6 +292,7 @@ DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, 
def_geo_collection_info, "COLLEC
 DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, "CONVEX_HULL", ConvexHull, 
"Convex Hull", "")
 DefNode(GeometryNode, GEO_NODE_CURVE_LENGTH, 0, "CURVE_LENGTH", CurveLength, 
"Curve Length", "")
 DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_STAR, 0, 
"CURVE_PRIMITIVE_STAR", CurveStar, "Star", "")
+DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_SPIRAL, 0, 
"CURVE_PRIMITIVE_SPIRAL", CurveSpiral, "Curve Spiral", "")
 DefNode(GeometryNode, GEO_NODE_CURVE_RESAMPLE, def_geo_curve_resample, 
"CURVE_RESAMPLE", CurveResample, "Resample Curve", "")
 DefNode(GeometryNode, GEO_NODE_CURVE_SUBDIVIDE, def_geo_curve_subdivide, 
"CURVE_SUBDIVIDE", CurveSubdivide, "Curve Subdivide", "")
 DefNode(GeometryNode, GEO_NODE_CURVE_TO_MESH, 0, "CURVE_TO_MESH", Curv

[Bf-blender-cvs] [12e67e0054a] temp-lineart-contained: LineArt: Remove merge duplicated code.

2021-06-29 Thread YimingWu
Commit: 12e67e0054a76c78397d68972487230425a00fca
Author: YimingWu
Date:   Wed Jun 30 11:11:43 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB12e67e0054a76c78397d68972487230425a00fca

LineArt: Remove merge duplicated code.

===

M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

===

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 7771c1c66b0..1759f309759 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -2028,25 +2028,6 @@ static uchar lineart_intersection_mask_check(Collection 
*c, Object *ob)
   return 0;
 }
 
-static uchar lineart_intersection_mask_check(Collection *c, Object *ob)
-{
-  LISTBASE_FOREACH (CollectionChild *, cc, &c->children) {
-uchar result = lineart_intersection_mask_check(cc->collection, ob);
-if (result) {
-  return result;
-}
-  }
-
-  if (c->children.first == NULL) {
-if (BKE_collection_has_object(c, (Object *)(ob->id.orig_id))) {
-  if (c->lineart_flags & COLLECTION_LRT_USE_INTERSECTION_MASK) {
-return c->lineart_intersection_mask;
-  }
-}
-  }
-  return 0;
-}
-
 /**
  * See if this object in such collection is used for generating line art,
  * Disabling a collection for line art will doable all objects inside.

___
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] [86c6769e203] master: Geometry Nodes: Curve Primitive Spiral

2021-06-29 Thread Johnny Matthews
Commit: 86c6769e203366d5f039869cb26e9f4d85ca205b
Author: Johnny Matthews
Date:   Tue Jun 29 22:00:29 2021 -0500
Branches: master
https://developer.blender.org/rB86c6769e203366d5f039869cb26e9f4d85ca205b

Geometry Nodes: Curve Primitive Spiral

This patch adds a Curve Primitives menu in Geometry nodes with an
initial entry of a star primitive.

The node is a basic star pattern node that outputs a poly spline.
Options control the inner and outer radius, the number of points,
and the twist of the valleys.

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

===

M   release/scripts/startup/nodeitems_builtins.py
M   source/blender/blenkernel/BKE_node.h
M   source/blender/blenkernel/intern/node.cc
M   source/blender/nodes/CMakeLists.txt
M   source/blender/nodes/NOD_geometry.h
M   source/blender/nodes/NOD_static_types.h
A   source/blender/nodes/geometry/nodes/node_geo_curve_primitive_star.cc

===

diff --git a/release/scripts/startup/nodeitems_builtins.py 
b/release/scripts/startup/nodeitems_builtins.py
index e7d991622e8..2a85246fe50 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -509,6 +509,9 @@ geometry_node_categories = [
 NodeItem("GeometryNodeCurveLength"),
 NodeItem("GeometryNodeCurveReverse"),
 ]),
+GeometryNodeCategory("GEO_PRIMITIVES_CURVE", "Curve Primitives", items=[
+NodeItem("GeometryNodeCurveStar"),
+]),
 GeometryNodeCategory("GEO_GEOMETRY", "Geometry", items=[
 NodeItem("GeometryNodeBoundBox"),
 NodeItem("GeometryNodeConvexHull"),
@@ -540,7 +543,7 @@ geometry_node_categories = [
 NodeItem("GeometryNodeSubdivisionSurface"),
 NodeItem("GeometryNodeSubdivide"),
 ]),
-GeometryNodeCategory("GEO_PRIMITIVES", "Mesh Primitives", items=[
+GeometryNodeCategory("GEO_PRIMITIVES_MESH", "Mesh Primitives", items=[
 NodeItem("GeometryNodeMeshCircle"),
 NodeItem("GeometryNodeMeshCone"),
 NodeItem("GeometryNodeMeshCube"),
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index a0f6be6b3e9..84b60d18ee0 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1439,6 +1439,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define GEO_NODE_SEPARATE_COMPONENTS 1059
 #define GEO_NODE_CURVE_SUBDIVIDE 1060
 #define GEO_NODE_RAYCAST 1061
+#define GEO_NODE_CURVE_PRIMITIVE_STAR 1062
 
 /** \} */
 
diff --git a/source/blender/blenkernel/intern/node.cc 
b/source/blender/blenkernel/intern/node.cc
index cf0dd75ea9d..7e8047c8e3f 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -5054,6 +5054,7 @@ static void registerGeometryNodes()
   register_node_type_geo_collection_info();
   register_node_type_geo_convex_hull();
   register_node_type_geo_curve_length();
+  register_node_type_geo_curve_primitive_star();
   register_node_type_geo_curve_to_mesh();
   register_node_type_geo_curve_to_points();
   register_node_type_geo_curve_resample();
diff --git a/source/blender/nodes/CMakeLists.txt 
b/source/blender/nodes/CMakeLists.txt
index 39f26737620..65490f98cbf 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -164,6 +164,7 @@ set(SRC
   geometry/nodes/node_geo_common.cc
   geometry/nodes/node_geo_convex_hull.cc
   geometry/nodes/node_geo_curve_length.cc  
+  geometry/nodes/node_geo_curve_primitive_star.cc
   geometry/nodes/node_geo_curve_to_mesh.cc
   geometry/nodes/node_geo_curve_to_points.cc
   geometry/nodes/node_geo_curve_resample.cc
diff --git a/source/blender/nodes/NOD_geometry.h 
b/source/blender/nodes/NOD_geometry.h
index fddaaf6e640..aee26d1444c 100644
--- a/source/blender/nodes/NOD_geometry.h
+++ b/source/blender/nodes/NOD_geometry.h
@@ -52,6 +52,7 @@ void register_node_type_geo_bounding_box(void);
 void register_node_type_geo_collection_info(void);
 void register_node_type_geo_convex_hull(void);
 void register_node_type_geo_curve_length(void);
+void register_node_type_geo_curve_primitive_star(void);
 void register_node_type_geo_curve_to_mesh(void);
 void register_node_type_geo_curve_to_points(void);
 void register_node_type_geo_curve_resample(void);
diff --git a/source/blender/nodes/NOD_static_types.h 
b/source/blender/nodes/NOD_static_types.h
index d79fa7bffb3..a7a69522421 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -291,6 +291,7 @@ DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, 
"BOUNDING_BOX", BoundBox, "Bound
 DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, 
"COLLECTION_INFO", CollectionInfo, "Collection Info", "")
 DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, "CONVEX_HULL", ConvexHull, 
"Convex Hull", "")
 DefNode(GeometryNode, G

[Bf-blender-cvs] [ff29428e0d3] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained

2021-06-29 Thread YimingWu
Commit: ff29428e0d352c592d9b4548fb4daf031f015bd2
Author: YimingWu
Date:   Wed Jun 30 10:54:53 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBff29428e0d352c592d9b4548fb4daf031f015bd2

Merge remote-tracking branch 'origin/master' into temp-lineart-contained

===



===

diff --cc source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index c9eceb4893f,9593a1364e7..687efe31a44
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@@ -744,12 -653,8 +742,14 @@@ static void panelRegister(ARegionType *
   material_mask_panel_draw_header,
   material_mask_panel_draw,
   occlusion_panel);
 +  gpencil_modifier_subpanel_register(region_type,
 + "intersection",
 + "",
 + intersection_panel_draw_header,
 + intersection_panel_draw,
 + panel_type);
+   gpencil_modifier_subpanel_register(
+   region_type, "intersection", "Intersection", NULL, 
intersection_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "face_mark", "", face_mark_panel_draw_header, 
face_mark_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
diff --cc source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 1d1c91cf5c2,247b0b3f57b..5c84f7b11d7
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@@ -393,9 -378,9 +394,9 @@@ typedef struct LineartObjectInfo 
double model_view_proj[4][4];
double model_view[4][4];
double normal[4][4];
 -  LineartElementLinkNode *v_eln;
 +  LineartElementLinkNode *eln;
int usage;
-   unsigned char override_intersection_mask;
+   uint8_t override_intersection_mask;
int global_i_offset;
  
bool free_use_mesh;
diff --cc source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 52e45438f43,c05749061a9..7771c1c66b0
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@@ -2009,40 -1932,25 +2009,44 @@@ static void lineart_object_load_worker(
}
  }
  
- static bool _lineart_object_not_in_source_collection(Collection *source, 
Object *ob)
+ static uchar lineart_intersection_mask_check(Collection *c, Object *ob)
  {
-   CollectionChild *cc;
-   Collection *c = source->id.orig_id ? (Collection *)source->id.orig_id : 
source;
-   if (BKE_collection_has_object_recursive_instanced(c, (Object 
*)(ob->id.orig_id))) {
- return false;
+   LISTBASE_FOREACH (CollectionChild *, cc, &c->children) {
+ uchar result = lineart_intersection_mask_check(cc->collection, ob);
+ if (result) {
+   return result;
+ }
}
-   for (cc = source->children.first; cc; cc = cc->next) {
- if (!_lineart_object_not_in_source_collection(cc->collection, ob)) {
-   return false;
+ 
+   if (c->children.first == NULL) {
+ if (BKE_collection_has_object(c, (Object *)(ob->id.orig_id))) {
+   if (c->lineart_flags & COLLECTION_LRT_USE_INTERSECTION_MASK) {
+ return c->lineart_intersection_mask;
+   }
  }
}
-   return true;
+   return 0;
  }
  
 +static uchar lineart_intersection_mask_check(Collection *c, Object *ob)
 +{
 +  LISTBASE_FOREACH (CollectionChild *, cc, &c->children) {
 +uchar result = lineart_intersection_mask_check(cc->collection, ob);
 +if (result) {
 +  return result;
 +}
 +  }
 +
 +  if (c->children.first == NULL) {
 +if (BKE_collection_has_object(c, (Object *)(ob->id.orig_id))) {
 +  if (c->lineart_flags & COLLECTION_LRT_USE_INTERSECTION_MASK) {
 +return c->lineart_intersection_mask;
 +  }
 +}
 +  }
 +  return 0;
 +}
 +
  /**
   * See if this object in such collection is used for generating line art,
   * Disabling a collection for line art will doable all objects inside.
diff --cc source/blender/makesrna/intern/rna_gpencil_modifier.c
index bdaa844a9ba,3e6048e30c4..503feb37058
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@@ -3078,15 -3011,9 +3078,15 @@@ static void rna_def_modifier_gpencillin
prop = RNA_def_property(srna, "use_material_mask_bits", PROP_BOOLEAN, 
PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "material_mask_bits", 1);
RNA_def_property_array(prop, 8);
-   RNA_def_property_ui_text(prop, "Masks", "");
+   RNA_def_property_ui_text(prop, "Masks", "Mask bits to match from Material 
Line Art settings");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
  
 +

[Bf-blender-cvs] [f8ffde6a078] temp-lineart-contained: LineArt: Fix debug number accidental assignment.

2021-06-29 Thread YimingWu
Commit: f8ffde6a0783b6b6044db5914d4f29b977cdc4bd
Author: YimingWu
Date:   Wed Jun 30 10:50:31 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBf8ffde6a0783b6b6044db5914d4f29b977cdc4bd

LineArt: Fix debug number accidental assignment.

===

M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

===

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 611357d4815..52e45438f43 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -3171,7 +3171,7 @@ static LineartRenderBuffer 
*lineart_create_render_buffer(Scene *scene,
   rb->use_back_face_culling = (lmd->calculation_flags & 
LRT_USE_BACK_FACE_CULLING) != 0;
   if (rb->max_occlusion_level < 1) {
 rb->use_back_face_culling = true;
-if (G.debug_value = 4000) {
+if (G.debug_value == 4000) {
   printf("Backface culling enabled automatically.\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] [3c71ddfc8cb] wl_default: add extern 'wayland-protocols' 1.21

2021-06-29 Thread Christian Rauch
Commit: 3c71ddfc8cbcc0bdf31c8e712eb7115b60dccdd4
Author: Christian Rauch
Date:   Wed Jun 23 21:35:59 2021 +0100
Branches: wl_default
https://developer.blender.org/rB3c71ddfc8cbcc0bdf31c8e712eb7115b60dccdd4

add extern 'wayland-protocols' 1.21

source: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/tree/1.21

===

A   extern/wayland-protocols/COPYING
A   extern/wayland-protocols/stable/presentation-time/README
A   extern/wayland-protocols/stable/presentation-time/presentation-time.xml
A   extern/wayland-protocols/stable/viewporter/README
A   extern/wayland-protocols/stable/viewporter/viewporter.xml
A   extern/wayland-protocols/stable/xdg-shell/README
A   extern/wayland-protocols/stable/xdg-shell/xdg-shell.xml
A   extern/wayland-protocols/staging/xdg-activation/README
A   extern/wayland-protocols/staging/xdg-activation/x11-interoperation.rst
A   extern/wayland-protocols/staging/xdg-activation/xdg-activation-v1.xml
A   extern/wayland-protocols/unstable/fullscreen-shell/README
A   
extern/wayland-protocols/unstable/fullscreen-shell/fullscreen-shell-unstable-v1.xml
A   extern/wayland-protocols/unstable/idle-inhibit/README
A   
extern/wayland-protocols/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml
A   extern/wayland-protocols/unstable/input-method/README
A   
extern/wayland-protocols/unstable/input-method/input-method-unstable-v1.xml
A   extern/wayland-protocols/unstable/input-timestamps/README
A   
extern/wayland-protocols/unstable/input-timestamps/input-timestamps-unstable-v1.xml
A   extern/wayland-protocols/unstable/keyboard-shortcuts-inhibit/README
A   
extern/wayland-protocols/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml
A   extern/wayland-protocols/unstable/linux-dmabuf/README
A   
extern/wayland-protocols/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
A   extern/wayland-protocols/unstable/linux-explicit-synchronization/README
A   
extern/wayland-protocols/unstable/linux-explicit-synchronization/linux-explicit-synchronization-unstable-v1.xml
A   extern/wayland-protocols/unstable/pointer-constraints/README
A   
extern/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml
A   extern/wayland-protocols/unstable/pointer-gestures/README
A   
extern/wayland-protocols/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml
A   extern/wayland-protocols/unstable/primary-selection/README
A   
extern/wayland-protocols/unstable/primary-selection/primary-selection-unstable-v1.xml
A   extern/wayland-protocols/unstable/relative-pointer/README
A   
extern/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml
A   extern/wayland-protocols/unstable/tablet/README
A   extern/wayland-protocols/unstable/tablet/tablet-unstable-v1.xml
A   extern/wayland-protocols/unstable/tablet/tablet-unstable-v2.xml
A   extern/wayland-protocols/unstable/text-input/README
A   extern/wayland-protocols/unstable/text-input/text-input-unstable-v1.xml
A   extern/wayland-protocols/unstable/text-input/text-input-unstable-v3.xml
A   extern/wayland-protocols/unstable/xdg-decoration/README
A   
extern/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
A   extern/wayland-protocols/unstable/xdg-foreign/README
A   
extern/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v1.xml
A   
extern/wayland-protocols/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml
A   extern/wayland-protocols/unstable/xdg-output/README
A   extern/wayland-protocols/unstable/xdg-output/xdg-output-unstable-v1.xml
A   extern/wayland-protocols/unstable/xdg-shell/README
A   extern/wayland-protocols/unstable/xdg-shell/xdg-shell-unstable-v5.xml
A   extern/wayland-protocols/unstable/xdg-shell/xdg-shell-unstable-v6.xml
A   extern/wayland-protocols/unstable/xwayland-keyboard-grab/README
A   
extern/wayland-protocols/unstable/xwayland-keyboard-grab/xwayland-keyboard-grab-unstable-v1.xml

===

diff --git a/extern/wayland-protocols/COPYING b/extern/wayland-protocols/COPYING
new file mode 100644
index 000..8ab3291e385
--- /dev/null
+++ b/extern/wayland-protocols/COPYING
@@ -0,0 +1,33 @@
+Copyright © 2008-2013 Kristian Høgsberg
+Copyright © 2010-2013 Intel Corporation
+Copyright © 2013  Rafael Antognolli
+Copyright © 2013  Jasper St. Pierre
+Copyright © 2014  Jonas Ådahl
+Copyright © 2014  Jason Ekstrand
+Copyright © 2014-2015 Collabora, Ltd.
+Copyright © 2015  Red Hat Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to us

[Bf-blender-cvs] [7c646369ec7] wl_default: cmake: add 'wayland-protocols' to 'deps' make step

2021-06-29 Thread Christian Rauch
Commit: 7c646369ec7293ec933bf5f11a520280a38e34c1
Author: Christian Rauch
Date:   Tue Jun 29 23:36:23 2021 +0100
Branches: wl_default
https://developer.blender.org/rB7c646369ec7293ec933bf5f11a520280a38e34c1

cmake: add 'wayland-protocols' to 'deps' make step

===

M   build_files/build_environment/cmake/versions.cmake
A   build_files/build_environment/cmake/wayland_protocols.cmake

===

diff --git a/build_files/build_environment/cmake/versions.cmake 
b/build_files/build_environment/cmake/versions.cmake
index d93b8463b4b..c01ecf6a911 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -462,6 +462,12 @@ set(XR_OPENXR_SDK_HASH 0df6b2fd6045423451a77ff6bc3e1a75)
 set(XR_OPENXR_SDK_HASH_TYPE MD5)
 set(XR_OPENXR_SDK_FILE OpenXR-SDK-${XR_OPENXR_SDK_VERSION}.tar.gz)
 
+set(WL_PROTOCOLS_VERSION 1.21)
+set(WL_PROTOCOLS_URI 
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/${WL_PROTOCOLS}/wayland-protocols-${WL_PROTOCOLS}.tar.gz)
+set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
+set(WL_PROTOCOLS_HASH_TYPE MD5)
+set(WL_PROTOCOLS_FILE wayland-protocols-${WL_PROTOCOLS}.tar.gz)
+
 if(BLENDER_PLATFORM_ARM)
   # Unreleased version with macOS arm support.
   set(ISPC_URI 
https://github.com/ispc/ispc/archive/f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
diff --git a/build_files/build_environment/cmake/wayland_protocols.cmake 
b/build_files/build_environment/cmake/wayland_protocols.cmake
new file mode 100644
index 000..b055edc821a
--- /dev/null
+++ b/build_files/build_environment/cmake/wayland_protocols.cmake
@@ -0,0 +1,31 @@
+# * BEGIN GPL LICENSE BLOCK *
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# * END GPL LICENSE BLOCK *
+
+# Note the utility apps may use png/tiff/gif system libraries, but the
+# library itself does not depend on them, so should give no problems.
+
+ExternalProject_Add(external_wayland_protocols
+  URL file://${PACKAGE_DIR}/${WL_PROTOCOLS_FILE}
+  DOWNLOAD_DIR ${DOWNLOAD_DIR}
+  URL_HASH ${WL_PROTOCOLS_HASH_TYPE}=${WL_PROTOCOLS_HASH}
+  PREFIX ${BUILD_DIR}/wayland-protocols
+  CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/wayland-protocols 
${DEFAULT_CMAKE_FLAGS}
+  INSTALL_DIR ${LIBDIR}/wayland-protocols
+)
+
+list(APPEND CMAKE_PREFIX_PATH "${LIBDIR}/wayland-protocols")

___
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] [41f380f13fc] wl_default: cmake: use extern 'wayland-protocols' if system version is insufficient

2021-06-29 Thread Christian Rauch
Commit: 41f380f13fc81f057a49e5829e870b85cf8d9921
Author: Christian Rauch
Date:   Wed Jun 23 21:43:04 2021 +0100
Branches: wl_default
https://developer.blender.org/rB41f380f13fc81f057a49e5829e870b85cf8d9921

cmake: use extern 'wayland-protocols' if system version is insufficient

===

M   intern/ghost/CMakeLists.txt

===

diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 77ec307e604..bbc064ba1e6 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -294,7 +294,13 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
 )
 
 pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
-pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
+
+pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
+if (wayland-protocols_FOUND)
+  pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
+else()
+  set(WAYLAND_PROTOCOLS_DIR ${CMAKE_SOURCE_DIR}"/extern/wayland-protocols")
+endif()
 
 # Generate protocols bindings.
 macro(generate_protocol_bindings NAME PROT_DEF)

___
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] [93b3880863a] wl_default: GHOST/wayland: try Wayland only when 'BLENDER_WAYLAND' is set

2021-06-29 Thread Christian Rauch
Commit: 93b3880863afe17d9ef5f13d18d74a0a8bb2cd05
Author: Christian Rauch
Date:   Thu Jun 3 21:12:09 2021 +0100
Branches: wl_default
https://developer.blender.org/rB93b3880863afe17d9ef5f13d18d74a0a8bb2cd05

GHOST/wayland: try Wayland only when 'BLENDER_WAYLAND' is set

===

M   intern/ghost/intern/GHOST_ISystem.cpp

===

diff --git a/intern/ghost/intern/GHOST_ISystem.cpp 
b/intern/ghost/intern/GHOST_ISystem.cpp
index 7c12bfe0306..5ef942efb59 100644
--- a/intern/ghost/intern/GHOST_ISystem.cpp
+++ b/intern/ghost/intern/GHOST_ISystem.cpp
@@ -55,11 +55,13 @@ GHOST_TSuccess GHOST_ISystem::createSystem()
 m_system = new GHOST_SystemNULL();
 #elif defined(WITH_GHOST_X11) && defined(WITH_GHOST_WAYLAND)
 /* Special case, try Wayland, fall back to X11. */
-try {
-  m_system = new GHOST_SystemWayland();
-}
-catch (const std::runtime_error &) {
-  /* fallback to X11. */
+if (std::getenv("BLENDER_WAYLAND")) {
+  try {
+m_system = new GHOST_SystemWayland();
+  }
+  catch (const std::runtime_error &) {
+/* fallback to X11. */
+  }
 }
 if (!m_system) {
   m_system = new GHOST_SystemX11();

___
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] [3d6dc1ca403] wl_default: doc: add Wayland dependencies

2021-06-29 Thread Christian Rauch
Commit: 3d6dc1ca4036fa5632eef4fae943a66f784ee06b
Author: Christian Rauch
Date:   Sat Jun 5 00:35:24 2021 +0100
Branches: wl_default
https://developer.blender.org/rB3d6dc1ca4036fa5632eef4fae943a66f784ee06b

doc: add Wayland dependencies

The wayland support requires the following development packages:
libwayland-dev, wayland-protocols, libegl-dev, libxkbcommon-dev,
libdbus-1-dev, linux-libc-dev

===

M   build_files/build_environment/install_deps.sh

===

diff --git a/build_files/build_environment/install_deps.sh 
b/build_files/build_environment/install_deps.sh
index 808e154955d..bda70eebcf0 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -1128,6 +1128,7 @@ Those libraries should be available as packages in all 
recent distributions (opt
 * Basics of dev environment (cmake, gcc, svn , git, ...).
 * libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
 * libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as 
needed).
+* libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, 
libdbus-1-3, libegl1 (Wayland)
 * libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, 
libyaml-cpp.
 * libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], 
fontconfig, [libharu/libhpdf].\""
 
@@ -3839,6 +3840,7 @@ install_DEB() {
   _packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev 
libpng-dev libtiff-dev \
  git libfreetype6-dev libfontconfig-dev libx11-dev flex bison 
libxxf86vm-dev \
  libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev 
libxinerama-dev \
+ libwayland-dev wayland-protocols libegl-dev libxkbcommon-dev 
libdbus-1-dev linux-libc-dev \
  libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev 
\
  libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
  libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev 
libjemalloc-dev \
@@ -4508,6 +4510,7 @@ install_RPM() {
   _packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison 
fontconfig-devel \
  libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel 
SDL2-devel \
  libX11-devel libXi-devel libXcursor-devel libXrandr-devel 
libXinerama-devel \
+ wayland-devel wayland-protocols-devel mesa-libEGL-devel 
libxkbcommon-devel dbus-devel kernel-headers \
  wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel 
\
  glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
  libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \

___
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] [6954ea8305b] wl_default: cmake: enable Wayland by default

2021-06-29 Thread Christian Rauch
Commit: 6954ea8305b613c92508cf5c65fd9c4f9feec46f
Author: Christian Rauch
Date:   Sun May 23 16:41:29 2021 +0100
Branches: wl_default
https://developer.blender.org/rB6954ea8305b613c92508cf5c65fd9c4f9feec46f

cmake: enable Wayland by default

===

M   CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 297e32bd67e..8c1b92d083f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -217,7 +217,7 @@ if(UNIX AND NOT (APPLE OR HAIKU))
   option(WITH_GHOST_X11 "Enable building Blender against X11 for windowing" ON)
   mark_as_advanced(WITH_GHOST_X11)
 
-  option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for 
windowing (under development)" OFF)
+  option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for 
windowing" ON)
   mark_as_advanced(WITH_GHOST_WAYLAND)
 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] [6c7b44e9fd7] tmp_T72605: macOS: execute permission for all users

2021-06-29 Thread Ankit Meel
Commit: 6c7b44e9fd748a3b4d27639c8c408ca92b5a48b2
Author: Ankit Meel
Date:   Tue Jun 29 22:52:49 2021 +0530
Branches: tmp_T72605
https://developer.blender.org/rB6c7b44e9fd748a3b4d27639c8c408ca92b5a48b2

macOS: execute permission for all users

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

===

M   source/creator/CMakeLists.txt

===

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index a4b32fac9fc..4d9beb8e7d1 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -1024,6 +1024,7 @@ elseif(APPLE)
   install(
 TARGETS blender
 DESTINATION "."
+PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
   )
 
   # install release and app files

___
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] [d8ef33795cb] tmp_T72605: Set read write bits too

2021-06-29 Thread Ankit Meel
Commit: d8ef33795cbdf6875f7fa683573a37c4972d142a
Author: Ankit Meel
Date:   Wed Jun 30 02:44:16 2021 +0530
Branches: tmp_T72605
https://developer.blender.org/rBd8ef33795cbdf6875f7fa683573a37c4972d142a

Set read write bits too

===

M   source/creator/CMakeLists.txt

===

diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 4d9beb8e7d1..57030757540 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -1024,7 +1024,10 @@ elseif(APPLE)
   install(
 TARGETS blender
 DESTINATION "."
-PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
+PERMISSIONS
+  OWNER_READGROUP_READWORLD_READ
+  OWNER_WRITE
+  OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
   )
 
   # install release and app files

___
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] [2d35eed34d0] master: Cleanup: split uses of _snap_sequencer_apply according to transform mode

2021-06-29 Thread Germano Cavalcante
Commit: 2d35eed34d01e4e63d672e35da7b3d45e97ff9ee
Author: Germano Cavalcante
Date:   Tue Jun 29 18:08:41 2021 -0300
Branches: master
https://developer.blender.org/rB2d35eed34d01e4e63d672e35da7b3d45e97ff9ee

Cleanup: split uses of _snap_sequencer_apply according to transform mode

The `applySnap` callback of each mode was overwriting the value
calculated in `transform_snap_sequencer_apply`.

===

M   source/blender/editors/transform/transform_mode_edge_seq_slide.c
M   source/blender/editors/transform/transform_mode_translate.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/transform/transform_snap.h
M   source/blender/editors/transform/transform_snap_sequencer.c

===

diff --git a/source/blender/editors/transform/transform_mode_edge_seq_slide.c 
b/source/blender/editors/transform/transform_mode_edge_seq_slide.c
index 1b054696930..fe853440c96 100644
--- a/source/blender/editors/transform/transform_mode_edge_seq_slide.c
+++ b/source/blender/editors/transform/transform_mode_edge_seq_slide.c
@@ -149,6 +149,7 @@ void initSeqSlide(TransInfo *t)
 {
   t->transform = applySeqSlide;
   t->handleEvent = seq_slide_handleEvent;
+  t->tsnap.applySnap = transform_snap_sequencer_apply_translate;
 
   initMouseInputMode(t, &t->mouse, INPUT_VECTOR);
 
diff --git a/source/blender/editors/transform/transform_mode_translate.c 
b/source/blender/editors/transform/transform_mode_translate.c
index 394271f7724..49afd7f0421 100644
--- a/source/blender/editors/transform/transform_mode_translate.c
+++ b/source/blender/editors/transform/transform_mode_translate.c
@@ -222,6 +222,9 @@ static void ApplySnapTranslation(TransInfo *t, float vec[3])
   vec[1] = point[1] - t->tsnap.snapTarget[1];
 }
   }
+  else if (t->spacetype == SPACE_SEQ) {
+transform_snap_sequencer_apply_translate(t, vec);
+  }
   else {
 if (t->spacetype == SPACE_VIEW3D) {
   if (t->options & CTX_PAINT_CURVE) {
diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index 1749a63e1dc..9a33dc1218d 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -499,7 +499,7 @@ void applySnapping(TransInfo *t, float *vec)
 
 t->tsnap.last = current;
 
-if (t->tsnap.applySnap && validSnap(t)) {
+if (validSnap(t)) {
   t->tsnap.applySnap(t, vec);
 }
   }
@@ -980,10 +980,10 @@ static void snap_calc_node_fn(TransInfo *t, float 
*UNUSED(vec))
   }
 }
 
-static void snap_calc_sequencer_fn(TransInfo *t, float *vec)
+static void snap_calc_sequencer_fn(TransInfo *t, float *UNUSED(vec))
 {
   BLI_assert(t->spacetype == SPACE_SEQ);
-  if (transform_snap_sequencer_apply(t, vec, t->tsnap.snapPoint)) {
+  if (transform_snap_sequencer_calc(t)) {
 t->tsnap.status |= (POINT_INIT | TARGET_INIT);
   }
   else {
diff --git a/source/blender/editors/transform/transform_snap.h 
b/source/blender/editors/transform/transform_snap.h
index e0989418c1c..6dfaeab93e6 100644
--- a/source/blender/editors/transform/transform_snap.h
+++ b/source/blender/editors/transform/transform_snap.h
@@ -84,4 +84,5 @@ float transform_snap_distance_len_squared_fn(TransInfo *t, 
const float p1[3], co
 /* transform_snap_sequencer.c */
 struct TransSeqSnapData *transform_snap_sequencer_data_alloc(const TransInfo 
*t);
 void transform_snap_sequencer_data_free(struct TransSeqSnapData *data);
-bool transform_snap_sequencer_apply(struct TransInfo *t, float *vec, float 
*snap_point);
+bool transform_snap_sequencer_calc(struct TransInfo *t);
+void transform_snap_sequencer_apply_translate(TransInfo *t, float *vec);
diff --git a/source/blender/editors/transform/transform_snap_sequencer.c 
b/source/blender/editors/transform/transform_snap_sequencer.c
index 22d738e75ca..3100a8f5c39 100644
--- a/source/blender/editors/transform/transform_snap_sequencer.c
+++ b/source/blender/editors/transform/transform_snap_sequencer.c
@@ -234,11 +234,10 @@ void transform_snap_sequencer_data_free(TransSeqSnapData 
*data)
   MEM_freeN(data);
 }
 
-bool transform_snap_sequencer_apply(TransInfo *t, float *vec, float 
*snap_point)
+bool transform_snap_sequencer_calc(TransInfo *t)
 {
   const TransSeqSnapData *snap_data = t->tsnap.seq_context;
   int best_dist = MAXFRAME, best_target_frame = 0, best_source_frame = 0;
-  *snap_point = 0;
 
   for (int i = 0; i < snap_data->source_snap_point_count; i++) {
 int snap_source_frame = snap_data->source_snap_points[i] + 
round_fl_to_int(t->values[0]);
@@ -260,7 +259,12 @@ bool transform_snap_sequencer_apply(TransInfo *t, float 
*vec, float *snap_point)
 return false;
   }
 
-  *snap_point = best_target_frame;
-  *vec += best_target_frame - best_source_frame;
+  t->tsnap.snapPoint[0] = best_target_frame;
+  t->tsnap.snapTarget[0] = best_source_frame;
   return true;
 }
+

[Bf-blender-cvs] [dd14ea18190] master: Cleanup: split CalcSnapGeometry in smaller functions

2021-06-29 Thread Germano Cavalcante
Commit: dd14ea18190ff27082009f73a556569a43377a71
Author: Germano Cavalcante
Date:   Tue Jun 29 17:38:34 2021 -0300
Branches: master
https://developer.blender.org/rBdd14ea18190ff27082009f73a556569a43377a71

Cleanup: split CalcSnapGeometry in smaller functions

===

M   source/blender/editors/transform/transform_snap.c

===

diff --git a/source/blender/editors/transform/transform_snap.c 
b/source/blender/editors/transform/transform_snap.c
index 34a380f9199..1749a63e1dc 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -76,7 +76,10 @@ static bool doForceIncrementSnap(const TransInfo *t);
 static void setSnappingCallback(TransInfo *t);
 
 /* static void CalcSnapGrid(TransInfo *t, float *vec); */
-static void CalcSnapGeometry(TransInfo *t, float *vec);
+static void snap_calc_view3d_fn(TransInfo *t, float *vec);
+static void snap_calc_uv_fn(TransInfo *t, float *vec);
+static void snap_calc_node_fn(TransInfo *t, float *vec);
+static void snap_calc_sequencer_fn(TransInfo *t, float *vec);
 
 static void TargetSnapMedian(TransInfo *t);
 static void TargetSnapCenter(TransInfo *t);
@@ -752,9 +755,17 @@ void freeSnapping(TransInfo *t)
 
 static void setSnappingCallback(TransInfo *t)
 {
-  t->tsnap.calcSnap = CalcSnapGeometry;
-
-  if (t->spacetype == SPACE_SEQ) {
+  if (t->spacetype == SPACE_VIEW3D) {
+t->tsnap.calcSnap = snap_calc_view3d_fn;
+  }
+  else if (t->spacetype == SPACE_IMAGE && t->obedit_type == OB_MESH) {
+t->tsnap.calcSnap = snap_calc_uv_fn;
+  }
+  else if (t->spacetype == SPACE_NODE) {
+t->tsnap.calcSnap = snap_calc_node_fn;
+  }
+  else if (t->spacetype == SPACE_SEQ) {
+t->tsnap.calcSnap = snap_calc_sequencer_fn;
 /* The target is calculated along with the snap point. */
 return;
   }
@@ -878,97 +889,105 @@ void getSnapPoint(const TransInfo *t, float vec[3])
 /** \} */
 
 /*  */
-/** \name Calc Snap (Generic)
+/** \name Calc Snap
  * \{ */
 
-static void CalcSnapGeometry(TransInfo *t, float *vec)
+static void snap_calc_view3d_fn(TransInfo *t, float *UNUSED(vec))
 {
-  if (t->spacetype == SPACE_VIEW3D) {
-float loc[3];
-float no[3];
-float mval[2];
-bool found = false;
-short snap_elem = 0;
-float dist_px = SNAP_MIN_DISTANCE; /* Use a user defined value here. */
+  BLI_assert(t->spacetype == SPACE_VIEW3D);
+  float loc[3];
+  float no[3];
+  float mval[2];
+  bool found = false;
+  short snap_elem = 0;
+  float dist_px = SNAP_MIN_DISTANCE; /* Use a user defined value here. */
 
-mval[0] = t->mval[0];
-mval[1] = t->mval[1];
+  mval[0] = t->mval[0];
+  mval[1] = t->mval[1];
 
-if (t->tsnap.mode & (SCE_SNAP_MODE_VERTEX | SCE_SNAP_MODE_EDGE | 
SCE_SNAP_MODE_FACE |
- SCE_SNAP_MODE_EDGE_MIDPOINT | 
SCE_SNAP_MODE_EDGE_PERPENDICULAR)) {
-  zero_v3(no); /* objects won't set this */
-  snap_elem = snapObjectsTransform(t, mval, &dist_px, loc, no);
-  found = snap_elem != 0;
-}
-if ((found == false) && (t->tsnap.mode & SCE_SNAP_MODE_VOLUME)) {
-  found = peelObjectsTransform(
-  t, mval, (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT) != 0, loc, 
no, NULL);
+  if (t->tsnap.mode & (SCE_SNAP_MODE_VERTEX | SCE_SNAP_MODE_EDGE | 
SCE_SNAP_MODE_FACE |
+   SCE_SNAP_MODE_EDGE_MIDPOINT | 
SCE_SNAP_MODE_EDGE_PERPENDICULAR)) {
+zero_v3(no); /* objects won't set this */
+snap_elem = snapObjectsTransform(t, mval, &dist_px, loc, no);
+found = snap_elem != 0;
+  }
+  if ((found == false) && (t->tsnap.mode & SCE_SNAP_MODE_VOLUME)) {
+found = peelObjectsTransform(
+t, mval, (t->settings->snap_flag & SCE_SNAP_PEEL_OBJECT) != 0, loc, 
no, NULL);
 
-  if (found) {
-snap_elem = SCE_SNAP_MODE_VOLUME;
-  }
+if (found) {
+  snap_elem = SCE_SNAP_MODE_VOLUME;
 }
+  }
+
+  if (found == true) {
+copy_v3_v3(t->tsnap.snapPoint, loc);
+copy_v3_v3(t->tsnap.snapNormal, no);
+
+t->tsnap.status |= POINT_INIT;
+  }
+  else {
+t->tsnap.status &= ~POINT_INIT;
+  }
+
+  t->tsnap.snapElem = (char)snap_elem;
+}
+
+static void snap_calc_uv_fn(TransInfo *t, float *UNUSED(vec))
+{
+  BLI_assert(t->spacetype == SPACE_IMAGE && t->obedit_type == OB_MESH);
+  if (t->tsnap.mode & SCE_SNAP_MODE_VERTEX) {
+float co[2];
+
+UI_view2d_region_to_view(&t->region->v2d, t->mval[0], t->mval[1], &co[0], 
&co[1]);
+
+uint objects_len = 0;
+Object **objects = 
BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(
+t->view_layer, NULL, &objects_len);
 
-if (found == true) {
-  copy_v3_v3(t->tsnap.snapPoint, loc);
-  copy_v3_v3(t->tsnap.snapNormal, no);
+float dist_sq = FLT_MAX;
+if (ED_uvedit_nearest_uv_multi(
+t->scene, objects, objects_le

[Bf-blender-cvs] [929d9ec0c79] master: Cleanup: Deduplicate code

2021-06-29 Thread Germano Cavalcante
Commit: 929d9ec0c79486bfc5d85b9e574c80491c9fef9d
Author: Germano Cavalcante
Date:   Tue Jun 29 17:42:48 2021 -0300
Branches: master
https://developer.blender.org/rB929d9ec0c79486bfc5d85b9e574c80491c9fef9d

Cleanup: Deduplicate code

===

M   source/blender/editors/transform/transform.c

===

diff --git a/source/blender/editors/transform/transform.c 
b/source/blender/editors/transform/transform.c
index 02a5dcbc622..88f91d477b5 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1697,40 +1697,16 @@ bool initTransform(bContext *C, TransInfo *t, 
wmOperator *op, const wmEvent *eve
 t->draw_handle_cursor = WM_paint_cursor_activate(
 SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, 
transform_draw_cursor_draw, t);
   }
-  else if (t->spacetype == SPACE_IMAGE) {
-t->draw_handle_view = ED_region_draw_cb_activate(
-t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
-t->draw_handle_cursor = WM_paint_cursor_activate(
-SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, 
transform_draw_cursor_draw, t);
-  }
-  else if (t->spacetype == SPACE_CLIP) {
-t->draw_handle_view = ED_region_draw_cb_activate(
-t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
-t->draw_handle_cursor = WM_paint_cursor_activate(
-SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, 
transform_draw_cursor_draw, t);
-  }
-  else if (t->spacetype == SPACE_NODE) {
-t->draw_handle_view = ED_region_draw_cb_activate(
-t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
-t->draw_handle_cursor = WM_paint_cursor_activate(
-SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, 
transform_draw_cursor_draw, t);
-  }
-  else if (t->spacetype == SPACE_GRAPH) {
+  else if (t->spacetype == SPACE_SEQ) {
 t->draw_handle_view = ED_region_draw_cb_activate(
 t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
-t->draw_handle_cursor = WM_paint_cursor_activate(
-SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, 
transform_draw_cursor_draw, t);
   }
-  else if (t->spacetype == SPACE_ACTION) {
+  else if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP, SPACE_NODE, 
SPACE_GRAPH, SPACE_ACTION)) {
 t->draw_handle_view = ED_region_draw_cb_activate(
 t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
 t->draw_handle_cursor = WM_paint_cursor_activate(
 SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, 
transform_draw_cursor_draw, t);
   }
-  else if (t->spacetype == SPACE_SEQ) {
-t->draw_handle_view = ED_region_draw_cb_activate(
-t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
-  }
 
   createTransData(C, t); /* Make #TransData structs from selection. */

___
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] [fba9cd019f2] master: VSE: Improved Snapping

2021-06-29 Thread Richard Antalik
Commit: fba9cd019f21f29bad1a6f3713370c5172dbc97f
Author: Richard Antalik
Date:   Tue Jun 29 20:12:19 2021 +0200
Branches: master
https://developer.blender.org/rBfba9cd019f21f29bad1a6f3713370c5172dbc97f

VSE: Improved Snapping

Change snapping behavior to snap strip edges when they are close to snap point.
Default behavior is, that each transformed strip is snapped to any other strip.

Implement snapping controls in sequencer tool settings. These controls include:

 - Snapping on/off
 - Ability to snap to playhead and strip hold offset points
 - Filter snap points by excluding sound or muted strips
 - Control snapping distance

Snapping controls are placed in timeline header similar to 3D viewport

Reviewed By: mano-wii

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

===

M   release/scripts/startup/bl_ui/space_sequencer.py
M   source/blender/blenkernel/BKE_blender_version.h
M   source/blender/blenkernel/intern/scene.c
M   source/blender/blenloader/intern/versioning_300.c
M   source/blender/editors/transform/CMakeLists.txt
M   source/blender/editors/transform/transform.c
M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_convert.h
M   source/blender/editors/transform/transform_convert_sequencer.c
M   source/blender/editors/transform/transform_mode_edge_seq_slide.c
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/transform/transform_snap.h
A   source/blender/editors/transform/transform_snap_sequencer.c
M   source/blender/makesdna/DNA_scene_types.h
M   source/blender/makesrna/intern/rna_scene.c
M   source/blender/sequencer/SEQ_iterator.h
M   source/blender/sequencer/SEQ_sequencer.h
M   source/blender/sequencer/intern/iterator.c
M   source/blender/sequencer/intern/sequencer.c

===

diff --git a/release/scripts/startup/bl_ui/space_sequencer.py 
b/release/scripts/startup/bl_ui/space_sequencer.py
index 13a8e46e2b8..ab05461f185 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -162,6 +162,14 @@ class SEQUENCER_HT_header(Header):
 if tool_settings.use_proportional_edit:
 row.prop(tool_settings, "proportional_edit_falloff", 
icon_only=True)
 
+if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
+tool_settings = context.tool_settings
+row = layout.row(align=True)
+row.prop(tool_settings, "use_snap_sequencer", text="")
+sub = row.row(align=True)
+sub.popover(panel="SEQUENCER_PT_snapping")
+layout.separator_spacer()
+
 row = layout.row(align=True)
 row.prop(st, "show_strip_overlay", text="", icon='OVERLAY')
 sub = row.row(align=True)
@@ -2264,6 +2272,30 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, 
PropertyPanel, Panel):
 bl_category = "Strip"
 
 
+class SEQUENCER_PT_snapping(Panel):
+bl_space_type = 'SEQUENCE_EDITOR'
+bl_region_type = 'HEADER'
+bl_label = ""
+
+def draw(self, context):
+tool_settings = context.tool_settings
+sequencer_tool_settings = tool_settings.sequencer_tool_settings
+
+layout = self.layout
+layout.use_property_split = True
+layout.use_property_decorate = False
+
+col = layout.column(heading="Snap to", align=True)
+col.prop(sequencer_tool_settings, "snap_seq_element", expand=True)
+
+col = layout.column(heading="Ignore", align=True)
+col.prop(sequencer_tool_settings, "snap_ignore_muted", text="Muted 
Strips")
+col.prop(sequencer_tool_settings, "snap_ignore_sound",text="Sound 
Strips")
+
+col = layout.column()
+col.prop(sequencer_tool_settings, "snap_distance", slider=True, 
text="Distance")
+
+
 classes = (
 SEQUENCER_MT_change,
 SEQUENCER_HT_tool_header,
@@ -2333,6 +2365,8 @@ classes = (
 
 SEQUENCER_PT_annotation,
 SEQUENCER_PT_annotation_onion,
+
+SEQUENCER_PT_snapping,
 )
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/source/blender/blenkernel/BKE_blender_version.h 
b/source/blender/blenkernel/BKE_blender_version.h
index 110b9fc4252..d5baeb08ccc 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -39,7 +39,7 @@ extern "C" {
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 6
+#define BLENDER_FILE_SUBVERSION 7
 
 /* 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
diff --git a/source/blender/blenkernel/intern/scene.c 
b/source/blender/blenkernel/intern/scene.c
index 791116682c8..84741038164 10

[Bf-blender-cvs] [ea43ae4194e] master: Fix crash on link/append for asset data-blocks in Thumbnails mode

2021-06-29 Thread Julian Eisel
Commit: ea43ae4194e29357f1d0d47430b462b4fd7f
Author: Julian Eisel
Date:   Tue Jun 29 20:02:01 2021 +0200
Branches: master
https://developer.blender.org/rBea43ae4194e29357f1d0d47430b462b4fd7f

Fix crash on link/append for asset data-blocks in Thumbnails mode

Same fix as 03a83b4eb5bc, but for the Thumbnails display mode.

===

M   source/blender/editors/space_file/file_draw.c

===

diff --git a/source/blender/editors/space_file/file_draw.c 
b/source/blender/editors/space_file/file_draw.c
index 6e409d2f5a4..46d37d21756 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -489,7 +489,8 @@ static void file_draw_preview(const SpaceFile *sfile,
   UI_but_drag_set_id(but, id);
 }
 /* path is no more static, cannot give it directly to but... */
-else if (file->typeflag & FILE_TYPE_ASSET) {
+else if (sfile->browse_mode == FILE_BROWSE_MODE_ASSETS &&
+ (file->typeflag & FILE_TYPE_ASSET) != 0) {
   char blend_path[FILE_MAX_LIBEXTRA];
 
   if (BLO_library_path_explode(path, blend_path, NULL, NULL)) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [cf028a8f680] cycles-x: Cycles X: Avoid device copy for every pass

2021-06-29 Thread Sergey Sharybin
Commit: cf028a8f680650a0d33ce8dd288523b494b0fa00
Author: Sergey Sharybin
Date:   Tue Jun 29 13:03:51 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBcf028a8f680650a0d33ce8dd288523b494b0fa00

Cycles X: Avoid device copy for every pass

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

===

M   intern/cycles/blender/blender_session.cpp
M   intern/cycles/integrator/path_trace.cpp
M   intern/cycles/integrator/path_trace.h
M   intern/cycles/integrator/path_trace_work.cpp
M   intern/cycles/integrator/path_trace_work.h
M   intern/cycles/render/session.cpp
M   intern/cycles/render/session.h

===

diff --git a/intern/cycles/blender/blender_session.cpp 
b/intern/cycles/blender/blender_session.cpp
index 61f20b018af..373cc821401 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -683,6 +683,10 @@ void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
 
 void BlenderSession::write_render_result(BL::RenderLayer &b_rlay)
 {
+  if (!session->copy_render_tile_from_device()) {
+return;
+  }
+
   const int2 tile_size = session->get_render_tile_size();
   vector pixels(tile_size.x * tile_size.y * 4);
 
@@ -698,6 +702,10 @@ void BlenderSession::write_render_result(BL::RenderLayer 
&b_rlay)
 
 void BlenderSession::update_render_result(BL::RenderLayer &b_rlay)
 {
+  if (!session->copy_render_tile_from_device()) {
+return;
+  }
+
   const int2 tile_size = session->get_render_tile_size();
   vector pixels(tile_size.x * tile_size.y * 4);
 
diff --git a/intern/cycles/integrator/path_trace.cpp 
b/intern/cycles/integrator/path_trace.cpp
index 09aa4e8a8da..ffbd7b19db6 100644
--- a/intern/cycles/integrator/path_trace.cpp
+++ b/intern/cycles/integrator/path_trace.cpp
@@ -578,6 +578,22 @@ void PathTrace::copy_from_render_buffers(RenderBuffers 
*render_buffers)
  });
 }
 
+bool PathTrace::copy_render_tile_from_device()
+{
+  bool success = true;
+
+  tbb::parallel_for_each(path_trace_works_, [&](unique_ptr 
&path_trace_work) {
+if (!success) {
+  return;
+}
+if (!path_trace_work->copy_render_tile_from_device()) {
+  success = false;
+}
+  });
+
+  return success;
+}
+
 bool PathTrace::get_render_tile_pixels(const PassAccessor &pass_accessor,
const PassAccessor::Destination 
&destination)
 {
diff --git a/intern/cycles/integrator/path_trace.h 
b/intern/cycles/integrator/path_trace.h
index 4985aa62d12..57f9ae885ca 100644
--- a/intern/cycles/integrator/path_trace.h
+++ b/intern/cycles/integrator/path_trace.h
@@ -107,9 +107,15 @@ class PathTrace {
* buffers and will be copied to all devices of the path trace. */
   void copy_from_render_buffers(RenderBuffers *render_buffers);
 
+  /* Copy render buffers of the big tile from the device to hsot.
+   * Return true if all copies are successful. */
+  bool copy_render_tile_from_device();
+
   /* Get pass data of the entire big tile.
* This call puts pass render result from all devices into the final pixels 
storage.
*
+   * NOTE: Expects buffers to be copied to the host using 
`copy_render_tile_from_device()`.
+   *
* Returns false if any of the accessor's `get_render_tile_pixels()` 
returned false. */
   bool get_render_tile_pixels(const PassAccessor &pass_accessor,
   const PassAccessor::Destination &destination);
diff --git a/intern/cycles/integrator/path_trace_work.cpp 
b/intern/cycles/integrator/path_trace_work.cpp
index 54446f25f83..c7e0c06145c 100644
--- a/intern/cycles/integrator/path_trace_work.cpp
+++ b/intern/cycles/integrator/path_trace_work.cpp
@@ -112,13 +112,14 @@ void PathTraceWork::copy_from_render_buffers(const 
RenderBuffers *render_buffers
   buffers_->copy_to_device();
 }
 
+bool PathTraceWork::copy_render_tile_from_device()
+{
+  return buffers_->copy_from_device();
+}
+
 bool PathTraceWork::get_render_tile_pixels(const PassAccessor &pass_accessor,
const PassAccessor::Destination 
&destination)
 {
-  if (!buffers_->copy_from_device()) {
-return false;
-  }
-
   const int offset_y = effective_buffer_params_.full_y - 
effective_big_tile_params_.full_y;
   const int width = effective_buffer_params_.width;
 
diff --git a/intern/cycles/integrator/path_trace_work.h 
b/intern/cycles/integrator/path_trace_work.h
index d588528d086..3cc9abacc00 100644
--- a/intern/cycles/integrator/path_trace_work.h
+++ b/intern/cycles/integrator/path_trace_work.h
@@ -91,8 +91,13 @@ class PathTraceWork {
* - Copies work's render buffer to its device. */
   void copy_from_render_buffers(const RenderBuffers *render_buffers);
 
+  bool copy_render_tile_from_device();
+
   /* Access pixels rendered by this work and copy them to the coresponding 
location in the
-   * destination. */
+   *

[Bf-blender-cvs] [516a060bb38] master: Fix T89523: Cycles OpenCL compile error after recent changes

2021-06-29 Thread Brecht Van Lommel
Commit: 516a060bb38d119a397848d30f6e5923d95f135f
Author: Brecht Van Lommel
Date:   Tue Jun 29 19:23:36 2021 +0200
Branches: master
https://developer.blender.org/rB516a060bb38d119a397848d30f6e5923d95f135f

Fix T89523: Cycles OpenCL compile error after recent changes

Also correctly used inverse transposed matrix for normal transform.

===

M   intern/cycles/kernel/bvh/bvh_util.h

===

diff --git a/intern/cycles/kernel/bvh/bvh_util.h 
b/intern/cycles/kernel/bvh/bvh_util.h
index 168c2939136..6c152cbb249 100644
--- a/intern/cycles/kernel/bvh/bvh_util.h
+++ b/intern/cycles/kernel/bvh/bvh_util.h
@@ -85,7 +85,9 @@ ccl_device_inline float3 smooth_surface_offset(KernelGlobals 
*kg, ShaderData *sd
   const float w = 1 - u - v;
   float3 P = V[0] * u + V[1] * v + V[2] * w; /* Local space */
   float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without 
normalization */
-  n = transform_direction(&(sd->ob_tfm), n); /* Normal x scale, world space */
+
+  n = normalize(
+  transform_direction_transposed_auto(&sd->ob_itfm, n)); /* Normal x 
scale, world space */
 
   /* Parabolic approximation */
   float a = dot(N[2] - N[0], V[0] - V[2]);

___
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] [999f1f75045] master: Win32: Window Placement DPI and Scale Adjustment

2021-06-29 Thread Harley Acheson
Commit: 999f1f75045c38a63f960d29e8bc7b9fd19ad0e7
Author: Harley Acheson
Date:   Tue Jun 29 09:28:20 2021 -0700
Branches: master
https://developer.blender.org/rB999f1f75045c38a63f960d29e8bc7b9fd19ad0e7

Win32: Window Placement DPI and Scale Adjustment

When using multiple monitors that differ in scale and/or dpi, the
varying sizes of the window titles and borders can cause the placement
of those windows to be out by a small amount. This patch adjusts for
those differences on Windows 10 and newer.

see D10863 for details and examples.

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

Reviewed by Ray Molenkamp

===

M   intern/ghost/intern/GHOST_WindowWin32.cpp
M   intern/ghost/intern/GHOST_WindowWin32.h

===

diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp 
b/intern/ghost/intern/GHOST_WindowWin32.cpp
index ac9961c..4f85e2ea8d0 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -38,6 +38,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -80,13 +81,10 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 
*system,
   m_wintab(NULL),
   m_lastPointerTabletData(GHOST_TABLET_DATA_NONE),
   m_normal_state(GHOST_kWindowStateNormal),
-  m_user32(NULL),
+  m_user32(::LoadLibrary("user32.dll")),
   m_parentWindowHwnd(parentwindow ? parentwindow->m_hWnd : HWND_DESKTOP),
   m_debug_context(is_debug)
 {
-  wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
-  RECT win_rect = {left, top, (long)(left + width), (long)(top + height)};
-
   DWORD style = parentwindow ?
 WS_POPUPWINDOW | WS_CAPTION | WS_MAXIMIZEBOX | 
WS_MINIMIZEBOX | WS_SIZEBOX :
 WS_OVERLAPPEDWINDOW;
@@ -105,27 +103,10 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 
*system,
  */
   }
 
-  /* Monitor details. */
-  MONITORINFOEX monitor;
-  monitor.cbSize = sizeof(MONITORINFOEX);
-  monitor.dwFlags = 0;
-  GetMonitorInfo(MonitorFromRect(&win_rect, MONITOR_DEFAULTTONEAREST), 
&monitor);
-
-  /* Constrain requested size and position to fit within this monitor. */
-  width = min(monitor.rcWork.right - monitor.rcWork.left, win_rect.right - 
win_rect.left);
-  height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect.bottom - 
win_rect.top);
-  win_rect.left = min(max(monitor.rcWork.left, win_rect.left), 
monitor.rcWork.right - width);
-  win_rect.right = win_rect.left + width;
-  win_rect.top = min(max(monitor.rcWork.top, win_rect.top), 
monitor.rcWork.bottom - height);
-  win_rect.bottom = win_rect.top + height;
-
-  /* Adjust to allow for caption, borders, shadows, scaling, etc. Resulting 
values can be
-   * correctly outside of monitor bounds. Note: You cannot specify 
WS_OVERLAPPED when calling. */
-  AdjustWindowRectEx(&win_rect, style & ~WS_OVERLAPPED, FALSE, extended_style);
-
-  /* But never allow a top position that can hide part of the title bar. */
-  win_rect.top = max(monitor.rcWork.top, win_rect.top);
+  RECT win_rect = {left, top, (long)(left + width), (long)(top + height)};
+  adjustWindowRectForClosestMonitor(&win_rect, style, extended_style);
 
+  wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
   m_hWnd = ::CreateWindowExW(extended_style,  // window 
extended style
  s_windowClassName,   // pointer to 
registered class name
  title_16,// pointer to 
window name
@@ -153,8 +134,6 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 
*system,
 return;
   }
 
-  m_user32 = ::LoadLibrary("user32.dll");
-
   RegisterTouchWindow(m_hWnd, 0);
 
   /* Register as droptarget. OleInitialize(0) required first, done in 
GHOST_SystemWin32. */
@@ -187,22 +166,22 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 
*system,
   ::ShowWindow(m_hWnd, nCmdShow);
 
 #ifdef WIN32_COMPOSITING
-  if (alphaBackground && parentwindowhwnd == 0) {
+  if (alphaBackground && parentwindowhwnd == 0) {
 
-HRESULT hr = S_OK;
+HRESULT hr = S_OK;
 
-/* Create and populate the Blur Behind structure. */
-DWM_BLURBEHIND bb = {0};
+/* Create and populate the Blur Behind structure. */
+DWM_BLURBEHIND bb = {0};
 
-/* Enable Blur Behind and apply to the entire client area. */
-bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
-bb.fEnable = true;
-bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
+/* Enable Blur Behind and apply to the entire client area. */
+bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
+bb.fEnable = true;
+bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
 
-/* Apply Blur Behind. */
-hr = DwmEnableBlurBehindWindow(m_hWnd, &bb);
-DeleteObject(bb.hRgnBlur);
-  }
+/* Apply Blur Behind. */
+hr = DwmEnableBl

[Bf-blender-cvs] [2ff714269e5] master: UI: Support setting operator properties for `UILayout.operator_menu_enum()`

2021-06-29 Thread Julian Eisel
Commit: 2ff714269e53f9a744242cd6c039ec65a47ec7ec
Author: Julian Eisel
Date:   Tue Jun 29 17:20:33 2021 +0200
Branches: master
https://developer.blender.org/rB2ff714269e53f9a744242cd6c039ec65a47ec7ec

UI: Support setting operator properties for `UILayout.operator_menu_enum()`

`UILayout.operator_menu_enum()` now returns the operator properties, just like
`UILayout.operator()`. This makes it possible to set options for the operator
displayed in the menu. In C it can be done through the new
`uiItemMenuEnumFullO()` or `uiItemMenuEnumFullO_ptr()`.

It's reasonable to have this, probably just a small thing never bothered to
add. D10912 could use it, the following comment can be addressed now too:
https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/space_nla/nla_buttons.c$583-586

===

M   source/blender/editors/include/UI_interface.h
M   source/blender/editors/interface/interface_layout.c
M   source/blender/makesrna/intern/rna_ui_api.c

===

diff --git a/source/blender/editors/include/UI_interface.h 
b/source/blender/editors/include/UI_interface.h
index b8443b952a8..b23f3e29551 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -2425,12 +2425,20 @@ void uiItemPopoverPanelFromGroup(uiLayout *layout,
 
 void uiItemMenuF(uiLayout *layout, const char *name, int icon, 
uiMenuCreateFunc func, void *arg);
 void uiItemMenuFN(uiLayout *layout, const char *name, int icon, 
uiMenuCreateFunc func, void *argN);
-void uiItemMenuEnumO_ptr(uiLayout *layout,
+void uiItemMenuEnumFullO_ptr(uiLayout *layout,
+ struct bContext *C,
+ struct wmOperatorType *ot,
+ const char *propname,
+ const char *name,
+ int icon,
+ struct PointerRNA *r_opptr);
+void uiItemMenuEnumFullO(uiLayout *layout,
  struct bContext *C,
- struct wmOperatorType *ot,
+ const char *opname,
  const char *propname,
  const char *name,
- int icon);
+ int icon,
+ struct PointerRNA *r_opptr);
 void uiItemMenuEnumO(uiLayout *layout,
  struct bContext *C,
  const char *opname,
diff --git a/source/blender/editors/interface/interface_layout.c 
b/source/blender/editors/interface/interface_layout.c
index cf3abc9be4a..a17a527c868 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -3381,10 +3381,13 @@ typedef struct MenuItemLevel {
 
 static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, 
void *arg)
 {
-  MenuItemLevel *lvl = (MenuItemLevel *)(((uiBut *)arg)->func_argN);
+  uiBut *but = arg;
+  MenuItemLevel *lvl = but->func_argN;
+  /* Use the operator properties from the button owning the menu. */
+  IDProperty *op_props = but->opptr ? but->opptr->data : NULL;
 
   uiLayoutSetOperatorContext(layout, lvl->opcontext);
-  uiItemsEnumO(layout, lvl->opname, lvl->propname);
+  uiItemsFullEnumO(layout, lvl->opname, lvl->propname, op_props, 
lvl->opcontext, 0);
 
   layout->root->block->flag |= UI_BLOCK_IS_FLIP;
 
@@ -3392,12 +3395,13 @@ static void menu_item_enum_opname_menu(bContext 
*UNUSED(C), uiLayout *layout, vo
   UI_block_direction_set(layout->root->block, UI_DIR_DOWN);
 }
 
-void uiItemMenuEnumO_ptr(uiLayout *layout,
- bContext *C,
- wmOperatorType *ot,
- const char *propname,
- const char *name,
- int icon)
+void uiItemMenuEnumFullO_ptr(uiLayout *layout,
+ bContext *C,
+ wmOperatorType *ot,
+ const char *propname,
+ const char *name,
+ int icon,
+ PointerRNA *r_opptr)
 {
   /* Caller must check */
   BLI_assert(ot->srna != NULL);
@@ -3416,6 +3420,15 @@ void uiItemMenuEnumO_ptr(uiLayout *layout,
   lvl->opcontext = layout->root->opcontext;
 
   uiBut *but = ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, 
NULL, lvl, NULL, true);
+  /* Use the menu button as owner for the operator properties, which will then 
be passed to the
+   * individual menu items. */
+  if (r_opptr) {
+but->opptr = MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
+WM_operator_properties_create_ptr(but->opptr, ot);
+BLI_assert(but->opptr->data == NULL);
+WM_operator_properties_alloc(&but->opptr, (IDProperty 
**)&but->opptr->data, ot->idname);
+*r_opptr = *but->opptr;
+  }
 

[Bf-blender-cvs] [1129b5dc7fe] cycles-x: Cycles X: Remove zero_to_device from RenderBuffers::reset()

2021-06-29 Thread Sergey Sharybin
Commit: 1129b5dc7fe2191c7608d9d5dad55e8415790387
Author: Sergey Sharybin
Date:   Tue Jun 29 17:13:34 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB1129b5dc7fe2191c7608d9d5dad55e8415790387

Cycles X: Remove zero_to_device from RenderBuffers::reset()

In all the current usages of RenderBuffers::reset the zero was
actually redundant.

This change makes it easier to allocate temporary render buffer
and copy data to it as a part of a specific stream without zero
(which happens in the default stream) conflicting.

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

===

M   intern/cycles/integrator/denoiser_device.cpp
M   intern/cycles/render/buffers.cpp

===

diff --git a/intern/cycles/integrator/denoiser_device.cpp 
b/intern/cycles/integrator/denoiser_device.cpp
index e13cf467204..8a0bff8dc21 100644
--- a/intern/cycles/integrator/denoiser_device.cpp
+++ b/intern/cycles/integrator/denoiser_device.cpp
@@ -195,7 +195,6 @@ void DeviceDenoiser::denoise_buffer_on_device(Device 
*device,
 
 render_buffers->copy_from_device();
 
-/* TODO(sergey): Avoid `zero_to_device()`. */
 local_render_buffers.reset(buffer_params);
 
 /* NOTE: The local buffer is allocated for an exact size of the effective 
render size, while
diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp
index 775190fa6c0..5ce31e4e308 100644
--- a/intern/cycles/render/buffers.cpp
+++ b/intern/cycles/render/buffers.cpp
@@ -159,7 +159,6 @@ void RenderBuffers::reset(const BufferParams ¶ms_)
 
   /* re-allocate buffer */
   buffer.alloc(params.width * params.pass_stride, params.height);
-  buffer.zero_to_device();
 }
 
 void RenderBuffers::zero()

___
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] [7524525d993] cycles-x: Fix CPU rendering and OptiX denoiser in Cycles X

2021-06-29 Thread Sergey Sharybin
Commit: 7524525d993fbaea23b9daa4b34b75f75256d430
Author: Sergey Sharybin
Date:   Tue Jun 29 17:54:28 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB7524525d993fbaea23b9daa4b34b75f75256d430

Fix CPU rendering and OptiX denoiser in Cycles X

Make sure copying of temporary render buffers to the device
happens as part of the denoiser queue.

Initially thought this will be fixed by some more global changes
related to multi-GPU support, but:

- It is a simple and clear change.
- It brings multi-device support to a working state, which makes
  it easier to verify changes.
- Multi-device is supported at a higher level, and it could still
  be useful to support current usecases of DeviceDenoiser (where
  input render buffers are allocated on a different device).

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

===

M   intern/cycles/device/device.h
M   intern/cycles/device/optix/device_impl.cpp
M   intern/cycles/device/optix/device_impl.h
M   intern/cycles/integrator/denoiser_device.cpp

===

diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h
index a39f5b328c2..de3920f1cf3 100644
--- a/intern/cycles/device/device.h
+++ b/intern/cycles/device/device.h
@@ -381,6 +381,12 @@ class Device {
 LOG(ERROR) << "Request buffer denoising from a device which does not 
support it.";
   }
 
+  virtual DeviceQueue *get_denoise_queue()
+  {
+LOG(ERROR) << "Request denoising queue from a device which does not 
support it.";
+return nullptr;
+  }
+
   /* Sub-devices */
 
   /* Run given callback for every individual device which will be handling 
rendering.
diff --git a/intern/cycles/device/optix/device_impl.cpp 
b/intern/cycles/device/optix/device_impl.cpp
index e4b78ece648..85b1934399c 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -590,6 +590,11 @@ void OptiXDevice::denoise_buffer(const DeviceDenoiseTask 
&task)
   denoise_pass(context, PASS_SHADOW_CATCHER_MATTE);
 }
 
+DeviceQueue *OptiXDevice::get_denoise_queue()
+{
+  return &denoiser_.queue;
+}
+
 void OptiXDevice::denoise_pass(DenoiseContext &context, PassType pass_type)
 {
   const BufferParams &buffer_params = context.buffer_params;
diff --git a/intern/cycles/device/optix/device_impl.h 
b/intern/cycles/device/optix/device_impl.h
index caab62c4f05..78a7d382440 100644
--- a/intern/cycles/device/optix/device_impl.h
+++ b/intern/cycles/device/optix/device_impl.h
@@ -145,6 +145,7 @@ class OptiXDevice : public CUDADevice {
   class DenoisePass;
 
   virtual void denoise_buffer(const DeviceDenoiseTask &task) override;
+  virtual DeviceQueue *get_denoise_queue();
 
   void denoise_pass(DenoiseContext &context, PassType pass_type);
 
diff --git a/intern/cycles/integrator/denoiser_device.cpp 
b/intern/cycles/integrator/denoiser_device.cpp
index 8a0bff8dc21..8b11947a028 100644
--- a/intern/cycles/integrator/denoiser_device.cpp
+++ b/intern/cycles/integrator/denoiser_device.cpp
@@ -19,6 +19,7 @@
 #include "device/device.h"
 #include "device/device_denoise.h"
 #include "device/device_memory.h"
+#include "device/device_queue.h"
 #include "render/buffers.h"
 #include "util/util_logging.h"
 #include "util/util_progress.h"
@@ -186,6 +187,8 @@ void DeviceDenoiser::denoise_buffer_on_device(Device 
*device,
 task.render_buffers = render_buffers;
   }
   else {
+DeviceQueue *queue = device->get_denoise_queue();
+
 /* Create buffer which is available by the device used by denoiser. */
 
 /* TODO(sergey): Optimize data transfers. For example, only copy denoising 
related passes,
@@ -203,7 +206,8 @@ void DeviceDenoiser::denoise_buffer_on_device(Device 
*device,
 memcpy(local_render_buffers.buffer.data(),
render_buffers->buffer.data(),
sizeof(float) * local_render_buffers.buffer.size());
-local_render_buffers.copy_to_device();
+
+queue->copy_to_device(local_render_buffers.buffer);
 
 task.render_buffers = &local_render_buffers;
   }

___
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] [14b32883b20] cycles-x: Cycles X: Ensure OptiX denoiser setup and usage uses the same stream

2021-06-29 Thread Sergey Sharybin
Commit: 14b32883b20173fca0e403bc7abb6e9c08ac5cf2
Author: Sergey Sharybin
Date:   Tue Jun 29 16:39:11 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB14b32883b20173fca0e403bc7abb6e9c08ac5cf2

Cycles X: Ensure OptiX denoiser setup and usage uses the same stream

Avoids possible access of denoiser non-initialized state without
explicit sync.

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

===

M   intern/cycles/device/optix/device_impl.cpp
M   intern/cycles/device/optix/device_impl.h

===

diff --git a/intern/cycles/device/optix/device_impl.cpp 
b/intern/cycles/device/optix/device_impl.cpp
index 44f7964304d..e4b78ece648 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -41,8 +41,8 @@
 
 CCL_NAMESPACE_BEGIN
 
-OptiXDevice::Denoiser::Denoiser(CUDADevice *device)
-: device(device), state(device, "__denoiser_state")
+OptiXDevice::Denoiser::Denoiser(OptiXDevice *device)
+: device(device), queue(device), state(device, "__denoiser_state")
 {
 }
 
@@ -542,8 +542,7 @@ static int denoise_buffer_pass_stride(const DenoiseParams 
¶ms)
 class OptiXDevice::DenoiseContext {
  public:
   explicit DenoiseContext(OptiXDevice *device, const DeviceDenoiseTask &task)
-  : queue(device),
-denoise_params(task.params),
+  : denoise_params(task.params),
 render_buffers(task.render_buffers),
 buffer_params(task.buffer_params),
 input_rgb(device, "denoiser input rgb"),
@@ -555,8 +554,6 @@ class OptiXDevice::DenoiseContext {
 pass_sample_count = buffer_params.get_pass_offset(PASS_SAMPLE_COUNT);
   }
 
-  OptiXDeviceQueue queue;
-
   const DenoiseParams &denoise_params;
 
   RenderBuffers *render_buffers;
@@ -635,10 +632,10 @@ void OptiXDevice::denoise_pass(DenoiseContext &context, 
PassType pass_type)
 return;
   }
 
-  context.queue.synchronize();
+  denoiser_.queue.synchronize();
 }
 
-void OptiXDevice::denoise_read_input_pixels(DenoiseContext &context, const 
DenoisePass &pass) const
+void OptiXDevice::denoise_read_input_pixels(DenoiseContext &context, const 
DenoisePass &pass)
 {
   PassAccessor::PassAccessInfo pass_access_info;
   pass_access_info.type = pass.type;
@@ -653,7 +650,8 @@ void OptiXDevice::denoise_read_input_pixels(DenoiseContext 
&context, const Denoi
 
   /* TODO(sergey): Consider adding support of actual exposure, to avoid 
clamping in extreme cases.
*/
-  const PassAccessorGPU pass_accessor(&context.queue, pass_access_info, 1.0f, 
context.num_samples);
+  const PassAccessorGPU pass_accessor(
+  &denoiser_.queue, pass_access_info, 1.0f, context.num_samples);
 
   PassAccessor::Destination destination(pass_access_info.type);
   destination.d_pixels = context.input_rgb.device_pointer;
@@ -692,7 +690,7 @@ bool 
OptiXDevice::denoise_filter_convert_to_rgb(DenoiseContext &context, const D
   const_cast(&context.num_samples),
   const_cast(&context.pass_sample_count)};
 
-  return context.queue.enqueue(DEVICE_KERNEL_FILTER_CONVERT_TO_RGB, work_size, 
args);
+  return denoiser_.queue.enqueue(DEVICE_KERNEL_FILTER_CONVERT_TO_RGB, 
work_size, args);
 }
 
 bool OptiXDevice::denoise_filter_convert_from_rgb(DenoiseContext &context, 
const DenoisePass &pass)
@@ -715,7 +713,7 @@ bool 
OptiXDevice::denoise_filter_convert_from_rgb(DenoiseContext &context, const
   const_cast(&pass.denoised_offset),
   const_cast(&context.pass_sample_count)};
 
-  return context.queue.enqueue(DEVICE_KERNEL_FILTER_CONVERT_FROM_RGB, 
work_size, args);
+  return denoiser_.queue.enqueue(DEVICE_KERNEL_FILTER_CONVERT_FROM_RGB, 
work_size, args);
 }
 
 bool OptiXDevice::denoise_ensure(const DeviceDenoiseTask &task)
@@ -808,7 +806,7 @@ bool OptiXDevice::denoise_configure_if_needed(const 
DeviceDenoiseTask &task)
 
   /* Initialize denoiser state for the current tile size. */
   const OptixResult result = optixDenoiserSetup(denoiser_.optix_denoiser,
-0,
+denoiser_.queue.stream(),
 task.buffer_params.width,
 task.buffer_params.height,
 denoiser_.state.device_pointer,
@@ -868,7 +866,7 @@ bool OptiXDevice::denoise_run(DenoiseContext &context)
   guide_layers.normal = input_layers[2];
 
   optix_assert(optixDenoiserInvoke(denoiser_.optix_denoiser,
-   context.queue.stream(),
+   denoiser_.queue.stream(),
¶ms,
denoiser_.state.device_pointer,
denoiser_.scratch_offset,
@@ -883,7 +881,7 @@ bool OptiXDevice::denoise_run(De

[Bf-blender-cvs] [63aa6dd845e] master: Cleanup: Win32 Window Creation

2021-06-29 Thread Harley Acheson
Commit: 63aa6dd845ebdb0f62c95a720e82e554c0208d95
Author: Harley Acheson
Date:   Tue Jun 29 08:51:51 2021 -0700
Branches: master
https://developer.blender.org/rB63aa6dd845ebdb0f62c95a720e82e554c0208d95

Cleanup: Win32 Window Creation

This is just some cleanup of the Win32 window creation code. After
CreateWindowExW() this patch uses some early exits to replace some
potentially confusing if blocks. No functional changes.

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

Reviewed by Ray Molenkamp

===

M   intern/ghost/intern/GHOST_WindowWin32.cpp

===

diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp 
b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 82b86863125..ac9961c 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -140,81 +140,80 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 
*system,
  0);// pointer to 
window-creation data
   free(title_16);
 
+  if (m_hWnd == NULL) {
+return;
+  }
+
+  /*  Store the device context. */
+  m_hDC = ::GetDC(m_hWnd);
+
+  if (!setDrawingContextType(type)) {
+::DestroyWindow(m_hWnd);
+m_hWnd = NULL;
+return;
+  }
+
   m_user32 = ::LoadLibrary("user32.dll");
 
-  if (m_hWnd) {
-RegisterTouchWindow(m_hWnd, 0);
+  RegisterTouchWindow(m_hWnd, 0);
 
-// Register this window as a droptarget. Requires m_hWnd to be valid.
-// Note that OleInitialize(0) has to be called prior to this. Done in 
GHOST_SystemWin32.
-m_dropTarget = new GHOST_DropTargetWin32(this, m_system);
-if (m_dropTarget) {
-  ::RegisterDragDrop(m_hWnd, m_dropTarget);
-}
+  /* Register as droptarget. OleInitialize(0) required first, done in 
GHOST_SystemWin32. */
+  m_dropTarget = new GHOST_DropTargetWin32(this, m_system);
+  ::RegisterDragDrop(m_hWnd, m_dropTarget);
 
-// Store a pointer to this class in the window structure
-::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
+  /* Store a pointer to this class in the window structure. */
+  ::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
 
-if (!m_system->m_windowFocus) {
-  // Lower to bottom and don't activate if we don't want focus
-  ::SetWindowPos(m_hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE 
| SWP_NOACTIVATE);
-}
+  if (!m_system->m_windowFocus) {
+/* If we don't want focus then lower to bottom. */
+::SetWindowPos(m_hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | 
SWP_NOACTIVATE);
+  }
 
-// Store the device context
-m_hDC = ::GetDC(m_hWnd);
-
-GHOST_TSuccess success = setDrawingContextType(type);
-
-if (success) {
-  // Show the window
-  int nCmdShow;
-  switch (state) {
-case GHOST_kWindowStateMaximized:
-  nCmdShow = SW_SHOWMAXIMIZED;
-  break;
-case GHOST_kWindowStateMinimized:
-  nCmdShow = (m_system->m_windowFocus) ? SW_SHOWMINIMIZED : 
SW_SHOWMINNOACTIVE;
-  break;
-case GHOST_kWindowStateNormal:
-default:
-  nCmdShow = (m_system->m_windowFocus) ? SW_SHOWNORMAL : 
SW_SHOWNOACTIVATE;
-  break;
-  }
+  /* Show the window. */
+  int nCmdShow;
+  switch (state) {
+case GHOST_kWindowStateMaximized:
+  nCmdShow = SW_SHOWMAXIMIZED;
+  break;
+case GHOST_kWindowStateMinimized:
+  nCmdShow = (m_system->m_windowFocus) ? SW_SHOWMINIMIZED : 
SW_SHOWMINNOACTIVE;
+  break;
+case GHOST_kWindowStateNormal:
+default:
+  nCmdShow = (m_system->m_windowFocus) ? SW_SHOWNORMAL : SW_SHOWNOACTIVATE;
+  break;
+  }
+
+  ::ShowWindow(m_hWnd, nCmdShow);
 
-  ::ShowWindow(m_hWnd, nCmdShow);
 #ifdef WIN32_COMPOSITING
   if (alphaBackground && parentwindowhwnd == 0) {
 
 HRESULT hr = S_OK;
 
-// Create and populate the Blur Behind structure
+/* Create and populate the Blur Behind structure. */
 DWM_BLURBEHIND bb = {0};
 
-// Enable Blur Behind and apply to the entire client area
+/* Enable Blur Behind and apply to the entire client area. */
 bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
 bb.fEnable = true;
 bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
 
-// Apply Blur Behind
+/* Apply Blur Behind. */
 hr = DwmEnableBlurBehindWindow(m_hWnd, &bb);
 DeleteObject(bb.hRgnBlur);
   }
 #endif
-  // Force an initial paint of the window
-  ::UpdateWindow(m_hWnd);
-}
-else {
-  // invalidate the window
-  ::DestroyWindow(m_hWnd);
-  m_hWnd = NULL;
-}
-  }
 
-  // Initialize Wintab
+  /* Force an initial paint of the window. */
+  ::UpdateWindow(m_hWnd);
+
+  /* Initialize Wintab. */
   if (system->getTabletAPI() != GHOST_kTabletWinPointer) {
 loadWintab(GHOST_kWindowStateMinimized != state);
   }
 
+  /* Allow

[Bf-blender-cvs] [2ea87253396] tmp-vulkan: Vulkan: Retrieve platform information.

2021-06-29 Thread Jeroen Bakker
Commit: 2ea87253396b48608f32893a67fd8f92668311bb
Author: Jeroen Bakker
Date:   Tue Jun 29 16:46:51 2021 +0200
Branches: tmp-vulkan
https://developer.blender.org/rB2ea87253396b48608f32893a67fd8f92668311bb

Vulkan: Retrieve platform information.

Retrieve device platform information for `GPUPlatformGlobal`.
As vulkan needs a physical device it was moved from the GPUBackend
constructor to an init method that is called when an initial context
is created.

Still need to find out how to extract the driver type.

===

M   source/blender/gpu/GPU_context.h
M   source/blender/gpu/intern/gpu_backend.hh
M   source/blender/gpu/intern/gpu_context.cc
M   source/blender/gpu/opengl/gl_backend.hh
M   source/blender/gpu/vulkan/vk_backend.cc
M   source/blender/gpu/vulkan/vk_backend.hh
M   source/blender/gpu/vulkan/vk_context.hh

===

diff --git a/source/blender/gpu/GPU_context.h b/source/blender/gpu/GPU_context.h
index 6ef8427b6f9..9939f844ff8 100644
--- a/source/blender/gpu/GPU_context.h
+++ b/source/blender/gpu/GPU_context.h
@@ -40,7 +40,7 @@ typedef enum eGPUBackendType {
 #endif
 } eGPUBackendType;
 
-void GPU_backend_init(eGPUBackendType backend);
+void GPU_backend_create(eGPUBackendType backend);
 void GPU_backend_exit(void);
 
 /** Opaque type hiding blender::gpu::Context. */
diff --git a/source/blender/gpu/intern/gpu_backend.hh 
b/source/blender/gpu/intern/gpu_backend.hh
index 5750b4f81bb..c0774c3b61e 100644
--- a/source/blender/gpu/intern/gpu_backend.hh
+++ b/source/blender/gpu/intern/gpu_backend.hh
@@ -46,6 +46,8 @@ class GPUBackend {
 
   static GPUBackend *get(void);
 
+  virtual void init() = 0;
+
   virtual void samplers_update(void) = 0;
   virtual void compute_dispatch(int groups_x_len, int groups_y_len, int 
groups_z_len) = 0;
 
diff --git a/source/blender/gpu/intern/gpu_context.cc 
b/source/blender/gpu/intern/gpu_context.cc
index 56232cbd7d3..4e2b2433ecd 100644
--- a/source/blender/gpu/intern/gpu_context.cc
+++ b/source/blender/gpu/intern/gpu_context.cc
@@ -105,6 +105,7 @@ Context *Context::get()
 
 GPUContext *GPU_context_create(void *ghost_window, void *ghost_context)
 {
+  bool backend_created = false;
   if (GPUBackend::get() == nullptr) {
 /* FIXME We should get the context type from ghost instead of guessing it. 
*/
 eGPUBackendType type = GPU_BACKEND_OPENGL;
@@ -113,12 +114,16 @@ GPUContext *GPU_context_create(void *ghost_window, void 
*ghost_context)
   type = GPU_BACKEND_VULKAN;
 }
 #endif
-GPU_backend_init(type);
+backend_created = true;
+GPU_backend_create(type);
   }
-
-  Context *ctx = GPUBackend::get()->context_alloc(ghost_window, ghost_context);
-
+  GPUBackend *backend = GPUBackend::get();
+  Context *ctx = backend->context_alloc(ghost_window, ghost_context);
   GPU_context_active_set(wrap(ctx));
+
+  if (backend_created) {
+backend->init();
+  }
   return wrap(ctx);
 }
 
@@ -177,7 +182,7 @@ void GPU_context_main_unlock(void)
 
 static GPUBackend *g_backend;
 
-void GPU_backend_init(eGPUBackendType backend_type)
+void GPU_backend_create(eGPUBackendType backend_type)
 {
   BLI_assert(g_backend == nullptr);
 
diff --git a/source/blender/gpu/opengl/gl_backend.hh 
b/source/blender/gpu/opengl/gl_backend.hh
index 88c7bf49f35..bb220a699ae 100644
--- a/source/blender/gpu/opengl/gl_backend.hh
+++ b/source/blender/gpu/opengl/gl_backend.hh
@@ -47,7 +47,14 @@ class GLBackend : public GPUBackend {
   GLSharedOrphanLists shared_orphan_list_;
 
  public:
-  GLBackend()
+  ~GLBackend()
+  {
+GLTexture::samplers_free();
+
+GLBackend::platform_exit();
+  }
+
+  void init() override
   {
 /* platform_init needs to go first. */
 GLBackend::platform_init();
@@ -55,12 +62,6 @@ class GLBackend : public GPUBackend {
 GLBackend::capabilities_init();
 GLTexture::samplers_init();
   }
-  ~GLBackend()
-  {
-GLTexture::samplers_free();
-
-GLBackend::platform_exit();
-  }
 
   static GLBackend *get(void)
   {
diff --git a/source/blender/gpu/vulkan/vk_backend.cc 
b/source/blender/gpu/vulkan/vk_backend.cc
index 0018cbd342c..1c75e0dc193 100644
--- a/source/blender/gpu/vulkan/vk_backend.cc
+++ b/source/blender/gpu/vulkan/vk_backend.cc
@@ -34,13 +34,57 @@ namespace blender::gpu {
 /** \name Platform
  * \{ */
 
+static std::string api_version_get(VkPhysicalDeviceProperties &properties)
+{
+  uint32_t major = VK_VERSION_MAJOR(properties.driverVersion);
+  uint32_t minor = VK_VERSION_MINOR(properties.driverVersion);
+  uint32_t patch = VK_VERSION_PATCH(properties.driverVersion);
+
+  std::stringstream version;
+  version << major << "." << minor << "." << patch;
+  return version.str();
+}
+
+enum class VendorID : uint32_t {
+  AMD = 0x1002,
+  Intel = 0x1F96,
+  NVIDIA = 0x10de,
+};
+static constexpr StringRef VENDOR_NAME_AMD = "Advanced Micro Devices";
+static constexpr StringRef VENDOR_NAME_INTEL = "Intel";
+s

[Bf-blender-cvs] [ae636994cdf] master: Fix Cycles hair render error on GPU after recent changes

2021-06-29 Thread Brecht Van Lommel
Commit: ae636994cdf2241d8de3eaf7f2405fa1976c0a5e
Author: Brecht Van Lommel
Date:   Tue Jun 29 16:34:32 2021 +0200
Branches: master
https://developer.blender.org/rBae636994cdf2241d8de3eaf7f2405fa1976c0a5e

Fix Cycles hair render error on GPU after recent changes

Volumes primitive needs to be part of traceable primitives.

===

M   intern/cycles/kernel/kernel_types.h

===

diff --git a/intern/cycles/kernel/kernel_types.h 
b/intern/cycles/kernel/kernel_types.h
index 48aa2ca76e6..d224db91edc 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -689,12 +689,11 @@ typedef enum PrimitiveType {
   PRIMITIVE_MOTION_CURVE_THICK = (1 << 3),
   PRIMITIVE_CURVE_RIBBON = (1 << 4),
   PRIMITIVE_MOTION_CURVE_RIBBON = (1 << 5),
+  PRIMITIVE_VOLUME = (1 << 6),
   /* Lamp primitive is not included below on purpose,
* since it is no real traceable primitive.
*/
-  PRIMITIVE_LAMP = (1 << 6),
-
-  PRIMITIVE_VOLUME = (1 << 7),
+  PRIMITIVE_LAMP = (1 << 7),
 
   PRIMITIVE_ALL_TRIANGLE = (PRIMITIVE_TRIANGLE | PRIMITIVE_MOTION_TRIANGLE),
   PRIMITIVE_ALL_CURVE = (PRIMITIVE_CURVE_THICK | PRIMITIVE_MOTION_CURVE_THICK |

___
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] [037035921bf] master: Cleanup: Remove unused function in lineart_cpu.c

2021-06-29 Thread YimingWu
Commit: 037035921bf6cfc76069c508e35c8303ff60bf4e
Author: YimingWu
Date:   Tue Jun 29 22:32:38 2021 +0800
Branches: master
https://developer.blender.org/rB037035921bf6cfc76069c508e35c8303ff60bf4e

Cleanup: Remove unused function in lineart_cpu.c

===

M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

===

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 477b99d85d0..c05749061a9 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -1932,21 +1932,6 @@ static void lineart_object_load_worker(TaskPool 
*__restrict UNUSED(pool),
   }
 }
 
-static bool _lineart_object_not_in_source_collection(Collection *source, 
Object *ob)
-{
-  CollectionChild *cc;
-  Collection *c = source->id.orig_id ? (Collection *)source->id.orig_id : 
source;
-  if (BKE_collection_has_object_recursive_instanced(c, (Object 
*)(ob->id.orig_id))) {
-return false;
-  }
-  for (cc = source->children.first; cc; cc = cc->next) {
-if (!_lineart_object_not_in_source_collection(cc->collection, ob)) {
-  return false;
-}
-  }
-  return true;
-}
-
 static uchar lineart_intersection_mask_check(Collection *c, Object *ob)
 {
   LISTBASE_FOREACH (CollectionChild *, cc, &c->children) {

___
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] [d66d5b431e3] temp_bmesh_multires: Clean up a few warnings

2021-06-29 Thread Joseph Eagar
Commit: d66d5b431e359e8938b8bc00090d4a73dbe12168
Author: Joseph Eagar
Date:   Tue Jun 29 05:50:40 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rBd66d5b431e359e8938b8bc00090d4a73dbe12168

Clean up a few warnings

===

M   source/blender/bmesh/intern/bmesh_construct.c
M   source/blender/bmesh/intern/bmesh_interp.c
M   source/blender/bmesh/intern/bmesh_log.c
M   source/blender/bmesh/intern/bmesh_mesh_convert.c

===

diff --git a/source/blender/bmesh/intern/bmesh_construct.c 
b/source/blender/bmesh/intern/bmesh_construct.c
index 9fa73e541b1..ea144e1daea 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -671,7 +671,6 @@ void BM_mesh_copy_init_customdata(BMesh *bm_dst, BMesh 
*bm_src, const BMAllocTem
 
   for (int i = 0; i < 4; i++) {
 CustomData *cdata = srcdatas[i];
-int type = 1 << i;
 
 if (CustomData_has_layer(cdata, CD_MESH_ID)) {
   int idx = CustomData_get_layer_index(cdata, CD_MESH_ID);
@@ -697,7 +696,6 @@ void BM_mesh_copy_init_customdata(BMesh *bm_dst, BMesh 
*bm_src, const BMAllocTem
   // flag mesh id layer as temporary
   for (int i = 0; i < 4; i++) {
 CustomData *cdata = dstdatas[i];
-int type = 1 << i;
 
 if (CustomData_has_layer(cdata, CD_MESH_ID)) {
   int idx = CustomData_get_layer_index(cdata, CD_MESH_ID);
@@ -790,8 +788,6 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
 bm_init_idmap_cdlayers(bm_new);
   }
 
-  const int idflag = bm_new->idmap.flag;
-
   vtable = MEM_mallocN(sizeof(BMVert *) * bm_old->totvert, "BM_mesh_copy 
vtable");
   etable = MEM_mallocN(sizeof(BMEdge *) * bm_old->totedge, "BM_mesh_copy 
etable");
   ftable = MEM_mallocN(sizeof(BMFace *) * bm_old->totface, "BM_mesh_copy 
ftable");
diff --git a/source/blender/bmesh/intern/bmesh_interp.c 
b/source/blender/bmesh/intern/bmesh_interp.c
index e4a81aa5a31..f745f243ed6 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -1402,7 +1402,7 @@ void BM_data_layers_ensure(BMesh *bm, CustomData *data, 
BMCustomLayerReq *layers
 BMCustomLayerReq *req = layers + i;
 int idx;
 
-mask |= 1 << req->type;
+mask |= 1LL << req->type;
 
 if (req->name) {
   idx = CustomData_get_named_layer_index(data, req->type, req->name);
diff --git a/source/blender/bmesh/intern/bmesh_log.c 
b/source/blender/bmesh/intern/bmesh_log.c
index 8182681f278..eb304a0b14a 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -433,7 +433,7 @@ static void bm_log_verts_unmake(
   }
 }
 
-ATTR_NO_OPT static void bm_log_faces_unmake(
+static void bm_log_faces_unmake(
 BMesh *bm, BMLog *log, GHash *faces, BMLogEntry *entry, BMLogCallbacks 
*callbacks)
 {
   GHashIterator gh_iter;
@@ -796,7 +796,6 @@ void BM_log_set_bm(BMesh *bm, BMLog *log)
 BMLog *BM_log_create(BMesh *bm, int cd_dyn_vert)
 {
   BMLog *log = MEM_callocN(sizeof(*log), __func__);
-  const uint reserve_num = (uint)(bm->totvert + bm->totface);
 
   BLI_rw_mutex_init(&log->lock);
 
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.c 
b/source/blender/bmesh/intern/bmesh_mesh_convert.c
index 9ee9791ad43..9f6bdbf2e65 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.c
@@ -804,7 +804,6 @@ void BM_mesh_bm_to_me(
 // clear mesh id layer flags
 if (params->copy_mesh_id_layers) {
   CustomData *srcdatas[] = {&bm->vdata, &bm->edata, &bm->ldata, 
&bm->pdata};
-  CustomData *dstdatas[] = {&me->vdata, &me->edata, &me->ldata, 
&me->pdata};
 
   for (int i = 0; i < 4; i++) {
 int idx = CustomData_get_layer_index(srcdatas[i], CD_MESH_ID);
@@ -1184,7 +1183,6 @@ void BM_mesh_bm_to_me(
   if (params->copy_mesh_id_layers) {
 // restore mesh id layer flags in bm
 CustomData *srcdatas[] = {&bm->vdata, &bm->edata, &bm->ldata, &bm->pdata};
-CustomData *dstdatas[] = {&me->vdata, &me->edata, &me->ldata, &me->pdata};
 
 for (int i = 0; i < 4; i++) {
   int idx = CustomData_get_layer_index(srcdatas[i], CD_MESH_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] [43a0fe378f7] temp_bmesh_multires: Merge branch 'master' into temp_bmesh_multires

2021-06-29 Thread Joseph Eagar
Commit: 43a0fe378f7c9393f60d378ed4dc8a8007ffb1de
Author: Joseph Eagar
Date:   Tue Jun 29 04:35:53 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB43a0fe378f7c9393f60d378ed4dc8a8007ffb1de

Merge branch 'master' into temp_bmesh_multires

===



===



___
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] [d1e0059eac9] master: LineArt: Filtering intersection lines using mask numbers

2021-06-29 Thread YimingWu
Commit: d1e0059eac99654624edee2a2390a3e2fdc4c7cb
Author: YimingWu
Date:   Tue Jun 29 20:47:55 2021 +0800
Branches: master
https://developer.blender.org/rBd1e0059eac99654624edee2a2390a3e2fdc4c7cb

LineArt: Filtering intersection lines using mask numbers

Mask value works just like transparency mask.

You are able to select intersection lines inside a
collection or, between collections.

Reviewed By: Sebastian Parborg (zeddb)

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

===

M   release/scripts/startup/bl_ui/properties_collection.py
M   source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M   source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
M   source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M   source/blender/gpencil_modifiers/intern/lineart/lineart_ops.c
M   source/blender/makesdna/DNA_collection_types.h
M   source/blender/makesdna/DNA_gpencil_modifier_types.h
M   source/blender/makesdna/intern/dna_rename_defs.h
M   source/blender/makesrna/intern/rna_collection.c
M   source/blender/makesrna/intern/rna_gpencil_modifier.c

===

diff --git a/release/scripts/startup/bl_ui/properties_collection.py 
b/release/scripts/startup/bl_ui/properties_collection.py
index 5a98e638992..27de80bb88d 100644
--- a/release/scripts/startup/bl_ui/properties_collection.py
+++ b/release/scripts/startup/bl_ui/properties_collection.py
@@ -86,6 +86,13 @@ class 
COLLECTION_PT_lineart_collection(CollectionButtonsPanel, Panel):
 row = layout.row()
 row.prop(collection, "lineart_usage")
 
+layout.prop(collection, "lineart_use_intersection_mask")
+
+row = layout.row(align=True, heading="Masks")
+row.active = collection.lineart_use_intersection_mask
+for i in range(0,8):
+row.prop(collection, "lineart_intersection_mask", index=i, 
text=str(i), toggle=True)
+
 
 classes = (
 COLLECTION_PT_collection_flags,
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index f205559b941..9593a1364e7 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -101,8 +101,9 @@ static void generate_strokes_actual(
   lmd->use_multiple_levels ? lmd->level_end : lmd->level_start,
   lmd->target_material ? BKE_gpencil_object_material_index_get(ob, 
lmd->target_material) : 0,
   lmd->edge_types,
-  lmd->material_mask_flags,
+  lmd->mask_switches,
   lmd->material_mask_bits,
+  lmd->intersection_mask,
   lmd->thickness,
   lmd->opacity,
   lmd->source_vertex_group,
@@ -462,6 +463,32 @@ static void material_mask_panel_draw(const bContext 
*UNUSED(C), Panel *panel)
   uiItemR(col, ptr, "use_material_mask_match", 0, IFACE_("Match All Masks"), 
ICON_NONE);
 }
 
+static void intersection_panel_draw(const bContext *UNUSED(C), Panel *panel)
+{
+  uiLayout *layout = panel->layout;
+  PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
+
+  const bool is_baked = RNA_boolean_get(ptr, "is_baked");
+  uiLayoutSetEnabled(layout, !is_baked);
+
+  uiLayoutSetPropSep(layout, true);
+
+  uiLayoutSetActive(layout, RNA_boolean_get(ptr, "use_intersection"));
+
+  uiLayout *row = uiLayoutRow(layout, true);
+  uiLayoutSetPropDecorate(row, false);
+  uiLayout *sub = uiLayoutRowWithHeading(row, true, IFACE_("Masks"));
+  char text[2] = "0";
+
+  PropertyRNA *prop = RNA_struct_find_property(ptr, "use_intersection_mask");
+  for (int i = 0; i < 8; i++, text[0]++) {
+uiItemFullR(sub, ptr, prop, i, 0, UI_ITEM_R_TOGGLE, text, ICON_NONE);
+  }
+  uiItemL(row, "", ICON_BLANK1); /* Space for decorator. */
+
+  uiLayout *col = uiLayoutColumn(layout, true);
+  uiItemR(col, ptr, "use_intersection_match", 0, IFACE_("Match All Masks"), 
ICON_NONE);
+}
 static void face_mark_panel_draw_header(const bContext *UNUSED(C), Panel 
*panel)
 {
   uiLayout *layout = panel->layout;
@@ -626,6 +653,8 @@ static void panelRegister(ARegionType *region_type)
  material_mask_panel_draw_header,
  material_mask_panel_draw,
  occlusion_panel);
+  gpencil_modifier_subpanel_register(
+  region_type, "intersection", "Intersection", NULL, 
intersection_panel_draw, panel_type);
   gpencil_modifier_subpanel_register(
   region_type, "face_mark", "", face_mark_panel_draw_header, 
face_mark_panel_draw, panel_type);
   gpencil_modifier_subpanel_register(
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h 
b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index debfabae869..247b0b3f57b 100644

[Bf-blender-cvs] [c6c6d20b15b] cycles-x: Cycles X: Fix crash using CPU and OptiX denoiser in viewport

2021-06-29 Thread Sergey Sharybin
Commit: c6c6d20b15b84397ee1bc7a845e29d37f0c0eee4
Author: Sergey Sharybin
Date:   Tue Jun 29 14:16:26 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBc6c6d20b15b84397ee1bc7a845e29d37f0c0eee4

Cycles X: Fix crash using CPU and OptiX denoiser in viewport

Not sure why it is only visible now, there was a buffer overrun since
the initial CPU Render + OptiX denoise support commit by the looks of
it.

There now seems to be a synchronization issue between queues, leading
to only partial buffer update in the viewport. Investigating this now.

===

M   intern/cycles/integrator/denoiser_device.cpp

===

diff --git a/intern/cycles/integrator/denoiser_device.cpp 
b/intern/cycles/integrator/denoiser_device.cpp
index dec5b69e9a1..e13cf467204 100644
--- a/intern/cycles/integrator/denoiser_device.cpp
+++ b/intern/cycles/integrator/denoiser_device.cpp
@@ -198,9 +198,12 @@ void DeviceDenoiser::denoise_buffer_on_device(Device 
*device,
 /* TODO(sergey): Avoid `zero_to_device()`. */
 local_render_buffers.reset(buffer_params);
 
+/* NOTE: The local buffer is allocated for an exact size of the effective 
render size, while
+ * the input render buffer is allcoated for the lowest resolution divider 
possible. So it is
+ * important to only copy actually needed part of the input buffer. */
 memcpy(local_render_buffers.buffer.data(),
render_buffers->buffer.data(),
-   sizeof(float) * render_buffers->buffer.size());
+   sizeof(float) * local_render_buffers.buffer.size());
 local_render_buffers.copy_to_device();
 
 task.render_buffers = &local_render_buffers;
@@ -213,7 +216,7 @@ void DeviceDenoiser::denoise_buffer_on_device(Device 
*device,
 local_render_buffers.copy_from_device();
 memcpy(render_buffers->buffer.data(),
local_render_buffers.buffer.data(),
-   sizeof(float) * render_buffers->buffer.size());
+   sizeof(float) * local_render_buffers.buffer.size());
 render_buffers->copy_to_device();
   }
 }

___
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] [5d5cf530812] master: Fix T89484: NLA "Remove Empty Animation Data" missing Outliner refresh

2021-06-29 Thread Philipp Oeser
Commit: 5d5cf5308129f1632cd6e303df52dadf63026675
Author: Philipp Oeser
Date:   Mon Jun 28 10:38:46 2021 +0200
Branches: master
https://developer.blender.org/rB5d5cf5308129f1632cd6e303df52dadf63026675

Fix T89484: NLA "Remove Empty Animation Data" missing Outliner refresh

Similar to rBb4530deec478, just add appropriate notifier.

Maniphest Tasks: T89484

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

===

M   source/blender/editors/animation/anim_channels_edit.c

===

diff --git a/source/blender/editors/animation/anim_channels_edit.c 
b/source/blender/editors/animation/anim_channels_edit.c
index 58e257259c2..136cdefd2ec 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -2434,6 +2434,7 @@ static int animchannels_clean_empty_exec(bContext *C, 
wmOperator *UNUSED(op))
 
   /* send notifier that things have changed */
   WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+  WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL);
 
   return OPERATOR_FINISHED;
 }

___
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] [91c4e3e2a5b] soc-2021-vse-strip-thumbnails: Changed ordering of drawing function in draw_seq_strip

2021-06-29 Thread Aditya Y Jeppu
Commit: 91c4e3e2a5b847210c4c825105e9f3997b9f307b
Author: Aditya Y Jeppu
Date:   Tue Jun 29 17:22:03 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rB91c4e3e2a5b847210c4c825105e9f3997b9f307b

Changed ordering of drawing function in draw_seq_strip

===

M   source/blender/editors/space_sequencer/sequencer_draw.c

===

diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c 
b/source/blender/editors/space_sequencer/sequencer_draw.c
index 9005161c71f..5c38838039c 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -1260,6 +1260,10 @@ static void draw_seq_strip(const bContext *C,
 drawmeta_contents(scene, seq, x1, y1, x2, y2);
   }
 
+  if (seq->type == SEQ_TYPE_MOVIE || seq->type == SEQ_TYPE_IMAGE) {
+draw_seq_strip_thumbnail(v2d, C, sseq, scene, seq, x1, y1, x2, y2, pixelx, 
pixely);
+  }
+
   if ((sseq->flag & SEQ_SHOW_STRIP_OVERLAY) && (sseq->flag & 
SEQ_SHOW_FCURVES)) {
 draw_seq_fcurve_overlay(scene, v2d, seq, x1, y1, x2, y2, pixelx);
   }
@@ -1288,10 +1292,6 @@ static void draw_seq_strip(const bContext *C,
 draw_seq_invalid(x1, x2, y2, text_margin_y);
   }
 
-  if (seq->type == SEQ_TYPE_MOVIE || seq->type == SEQ_TYPE_IMAGE) {
-draw_seq_strip_thumbnail(v2d, C, sseq, scene, seq, x1, y1, x2, y2, pixelx, 
pixely);
-  }
-
   pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, 
GPU_FETCH_FLOAT);
   immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);

___
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] [a28c412b466] soc-2021-vse-strip-thumbnails: Merge branch 'master' into soc-2021-vse-strip-thumbnails

2021-06-29 Thread Aditya Y Jeppu
Commit: a28c412b46683b82ecb27c269055a2825b98b75e
Author: Aditya Y Jeppu
Date:   Tue Jun 29 14:15:18 2021 +0530
Branches: soc-2021-vse-strip-thumbnails
https://developer.blender.org/rBa28c412b46683b82ecb27c269055a2825b98b75e

Merge branch 'master' into soc-2021-vse-strip-thumbnails

===



===



___
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] [ef85fcb2feb] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained

2021-06-29 Thread YimingWu
Commit: ef85fcb2feb6fcbefc2f28d799495f3b81b4ae41
Author: YimingWu
Date:   Tue Jun 29 19:41:23 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBef85fcb2feb6fcbefc2f28d799495f3b81b4ae41

Merge remote-tracking branch 'origin/master' into temp-lineart-contained

===



===

diff --cc source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 45c1281b4ee,8739747082b..c9eceb4893f
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@@ -373,16 -358,7 +373,18 @@@ static void edge_types_panel_draw(cons
  uiItemR(entry, ptr, "crease_threshold", UI_ITEM_R_SLIDER, " ", ICON_NONE);
}
  
 +  sub = uiLayoutRowWithHeading(col, false, IFACE_("Light Contour"));
 +  uiItemR(sub, ptr, "use_light_contour", 0, "", ICON_NONE);
 +  entry = uiLayoutRow(sub, false);
 +  uiLayoutSetActive(entry, (RNA_boolean_get(ptr, "use_light_contour")) || 
is_first);
 +  if (use_cache && !is_first) {
 +uiItemL(entry, IFACE_("Reference Cached"), ICON_INFO);
 +  }
 +  else {
 +uiItemR(entry, ptr, "light_contour_object", 0, "", ICON_NONE);
 +  }
++
+   uiItemR(layout, ptr, "use_overlap_edge_type_support", 0, IFACE_("Allow 
Overlap"), ICON_NONE);
  }
  
  static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
@@@ -403,23 -379,12 +405,22 @@@
  return;
}
  
 -  uiLayout *col = uiLayoutColumn(layout, true);
 +  uiLayout *row = uiLayoutRowWithHeading(layout, false, IFACE_("Custom 
Camera"));
 +  uiItemR(row, ptr, "use_custom_camera", 0, "", 0);
 +  uiLayout *subrow = uiLayoutRow(row, true);
 +  uiLayoutSetActive(subrow, RNA_boolean_get(ptr, "use_custom_camera"));
 +  uiLayoutSetPropSep(subrow, true);
 +  uiItemR(subrow, ptr, "source_camera", 0, "", ICON_OBJECT_DATA);
  
 -  uiItemR(col, ptr, "use_remove_doubles", 0, NULL, ICON_NONE);
 -  uiItemR(col, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As 
Contour"), ICON_NONE);
 -  uiItemR(col, ptr, "use_object_instances", 0, NULL, ICON_NONE);
 -  uiItemR(col, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE);
 +  uiItemR(layout, ptr, "overscan", 0, NULL, ICON_NONE);
 +
 +  uiItemR(layout, ptr, "use_remove_doubles", 0, NULL, ICON_NONE);
 +  uiItemR(layout, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As 
Contour"), ICON_NONE);
 +  uiItemR(layout, ptr, "use_object_instances", 0, NULL, ICON_NONE);
 +  uiItemR(layout, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE);
-   uiItemR(layout, ptr, "use_overlap_edge_type_support", 0, NULL, ICON_NONE);
 +  uiItemR(layout, ptr, "use_crease_on_smooth", 0, IFACE_("Crease On Smooth"), 
ICON_NONE);
 +  uiItemR(layout, ptr, "use_crease_on_sharp", 0, IFACE_("Crease On Sharp"), 
ICON_NONE);
 +  uiItemR(layout, ptr, "use_back_face_culling", 0, NULL, ICON_NONE);
  }
  
  static void style_panel_draw(const bContext *UNUSED(C), Panel *panel)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8f6a9c51764] master: Fix T89526: "Toggle Maximize Area" clears context screen properties

2021-06-29 Thread Campbell Barton
Commit: 8f6a9c5176453c83187f90eba3a53a01a9c526d2
Author: Campbell Barton
Date:   Tue Jun 29 20:50:53 2021 +1000
Branches: master
https://developer.blender.org/rB8f6a9c5176453c83187f90eba3a53a01a9c526d2

Fix T89526: "Toggle Maximize Area" clears context screen properties

Removed in b787581c9cda5a0cd4bc8b03bbdd1f9832438db4 as it's comment
noted it was bad code, the reason for it's necessity was no longer valid.

Add this back with comment explaining why it's still needed.

===

M   source/blender/editors/screen/screen_edit.c

===

diff --git a/source/blender/editors/screen/screen_edit.c 
b/source/blender/editors/screen/screen_edit.c
index 21800536503..e2d95035ba8 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1564,6 +1564,14 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow 
*win, ScrArea *area, const
   BLI_assert(CTX_wm_screen(C) == screen);
   BLI_assert(CTX_wm_area(C) == NULL); /* May have been freed. */
 
+  /* Setting the area is only needed for Python scripts that call
+   * operators in succession before returning to the main event loop.
+   * Without this, scripts can't run any operators that require
+   * an area after toggling full-screen for example (see: T89526).
+   * NOTE: an old comment stated this was "bad code",
+   * however it doesn't cause problems so leave as-is. */
+  CTX_wm_area_set(C, screen->areabase.first);
+
   return screen->areabase.first;
 }

___
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] [5130bb116a6] master: Cleanup: unused warnings

2021-06-29 Thread Campbell Barton
Commit: 5130bb116a69f9ebb34914a79c0d5763361b373e
Author: Campbell Barton
Date:   Tue Jun 29 21:08:48 2021 +1000
Branches: master
https://developer.blender.org/rB5130bb116a69f9ebb34914a79c0d5763361b373e

Cleanup: unused warnings

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 8739747082b..f205559b941 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -280,8 +280,6 @@ static void panel_draw(const bContext *UNUSED(C), Panel 
*panel)
 
   const int source_type = RNA_enum_get(ptr, "source_type");
   const bool is_baked = RNA_boolean_get(ptr, "is_baked");
-  const bool use_cache = RNA_boolean_get(ptr, "use_cache");
-  const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, 
ptr->data);
 
   uiLayoutSetPropSep(layout, true);
   uiLayoutSetEnabled(layout, !is_baked);

___
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] [df7db41e1b6] master: LineArt: Use separate sub panel for line types.

2021-06-29 Thread YimingWu
Commit: df7db41e1b6a349230870db3131bc954533af8f9
Author: YimingWu
Date:   Tue Jun 29 18:47:28 2021 +0800
Branches: master
https://developer.blender.org/rBdf7db41e1b6a349230870db3131bc954533af8f9

LineArt: Use separate sub panel for line types.

Reviewed By: Sebastian Parborg (zeddb)

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

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 2a1eec80dd1..8739747082b 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -301,26 +301,6 @@ static void panel_draw(const bContext *UNUSED(C), Panel 
*panel)
   else {
 /* Source is Scene. */
   }
-
-  uiLayout *col = uiLayoutColumnWithHeading(layout, true, IFACE_("Edge 
Types"));
-
-  uiItemR(col, ptr, "use_contour", 0, IFACE_("Contour"), ICON_NONE);
-  uiItemR(col, ptr, "use_loose", 0, IFACE_("Loose"), ICON_NONE);
-  uiItemR(col, ptr, "use_material", 0, IFACE_("Material Borders"), ICON_NONE);
-  uiItemR(col, ptr, "use_edge_mark", 0, IFACE_("Edge Marks"), ICON_NONE);
-  uiItemR(col, ptr, "use_intersection", 0, IFACE_("Intersections"), ICON_NONE);
-
-  uiLayout *sub = uiLayoutRowWithHeading(col, false, IFACE_("Crease"));
-  uiItemR(sub, ptr, "use_crease", 0, "", ICON_NONE);
-  uiLayout *entry = uiLayoutRow(sub, false);
-  uiLayoutSetEnabled(entry, RNA_boolean_get(ptr, "use_crease") || is_first);
-  if (use_cache && !is_first) {
-uiItemL(entry, IFACE_("Angle Cached"), ICON_INFO);
-  }
-  else {
-uiItemR(entry, ptr, "crease_threshold", UI_ITEM_R_SLIDER, " ", ICON_NONE);
-  }
-
   uiItemPointerR(layout, ptr, "target_layer", &obj_data_ptr, "layers", NULL, 
ICON_GREASEPENCIL);
 
   /* Material has to be used by grease pencil object already, it was possible 
to assign materials
@@ -345,6 +325,42 @@ static void panel_draw(const bContext *UNUSED(C), Panel 
*panel)
   gpencil_modifier_panel_end(layout, ptr);
 }
 
+static void edge_types_panel_draw(const bContext *UNUSED(C), Panel *panel)
+{
+  uiLayout *layout = panel->layout;
+  PointerRNA ob_ptr;
+  PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, 
&ob_ptr);
+
+  const bool is_baked = RNA_boolean_get(ptr, "is_baked");
+  const bool use_cache = RNA_boolean_get(ptr, "use_cached_result");
+  const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, 
ptr->data);
+
+  uiLayoutSetEnabled(layout, !is_baked);
+
+  uiLayoutSetPropSep(layout, true);
+
+  uiLayout *col = uiLayoutColumn(layout, true);
+
+  uiItemR(col, ptr, "use_contour", 0, IFACE_("Contour"), ICON_NONE);
+  uiItemR(col, ptr, "use_loose", 0, IFACE_("Loose"), ICON_NONE);
+  uiItemR(col, ptr, "use_material", 0, IFACE_("Material Borders"), ICON_NONE);
+  uiItemR(col, ptr, "use_edge_mark", 0, IFACE_("Edge Marks"), ICON_NONE);
+  uiItemR(col, ptr, "use_intersection", 0, IFACE_("Intersections"), ICON_NONE);
+
+  uiLayout *sub = uiLayoutRowWithHeading(col, false, IFACE_("Crease"));
+  uiItemR(sub, ptr, "use_crease", 0, "", ICON_NONE);
+  uiLayout *entry = uiLayoutRow(sub, false);
+  uiLayoutSetEnabled(entry, RNA_boolean_get(ptr, "use_crease") || is_first);
+  if (use_cache && !is_first) {
+uiItemL(entry, IFACE_("Angle Cached"), ICON_INFO);
+  }
+  else {
+uiItemR(entry, ptr, "crease_threshold", UI_ITEM_R_SLIDER, " ", ICON_NONE);
+  }
+
+  uiItemR(layout, ptr, "use_overlap_edge_type_support", 0, IFACE_("Allow 
Overlap"), ICON_NONE);
+}
+
 static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
 {
   uiLayout *layout = panel->layout;
@@ -369,7 +385,6 @@ static void options_panel_draw(const bContext *UNUSED(C), 
Panel *panel)
   uiItemR(col, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As 
Contour"), ICON_NONE);
   uiItemR(col, ptr, "use_object_instances", 0, NULL, ICON_NONE);
   uiItemR(col, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE);
-  uiItemR(col, ptr, "use_overlap_edge_type_support", 0, NULL, ICON_NONE);
 }
 
 static void style_panel_draw(const bContext *UNUSED(C), Panel *panel)
@@ -599,6 +614,8 @@ static void panelRegister(ARegionType *region_type)
   PanelType *panel_type = gpencil_modifier_panel_register(
   region_type, eGpencilModifierType_Lineart, panel_draw);
 
+  gpencil_modifier_subpanel_register(
+  region_type, "edge_types", "Edge Types", NULL, edge_types_panel_draw, 
panel_type);
   gpencil_modifier_subpanel_register(
   region_type, "geometry", "Geometry Processing", NULL, 
options_panel_draw, panel_type);
   gpencil_modifier_subpanel_register(

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org

[Bf-blender-cvs] [f2c52aa0e1a] master: Cleanup: use 'const' arguments in transform calculation

2021-06-29 Thread Campbell Barton
Commit: f2c52aa0e1a5a6905849daa299ab907e60cab983
Author: Campbell Barton
Date:   Tue Jun 29 20:13:55 2021 +1000
Branches: master
https://developer.blender.org/rBf2c52aa0e1a5a6905849daa299ab907e60cab983

Cleanup: use 'const' arguments in transform calculation

Use const arguments to simplify further optimizations.

Transforming elements shouldn't need to change their containers
data-structures.
ElementResize for grease pencil stroke thickness was
modifying TransInfo.num & TransInfo.values_final.

Now copies are operated on to preserve const correctness although
it's worth investigating if this can be avoided altogether.

===

M   source/blender/editors/transform/transform.h
M   source/blender/editors/transform/transform_constraints.c
M   source/blender/editors/transform/transform_constraints.h
M   source/blender/editors/transform/transform_mode.c
M   source/blender/editors/transform/transform_mode.h
M   source/blender/editors/transform/transform_snap.c
M   source/blender/editors/transform/transform_snap.h

===

diff --git a/source/blender/editors/transform/transform.h 
b/source/blender/editors/transform/transform.h
index 2df0d86d02b..4f97c3b6713 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -356,22 +356,22 @@ typedef struct TransCon {
 
   /** Apply function pointer for linear vectorial transformation
* The last three parameters are pointers to the in/out/printable vectors. */
-  void (*applyVec)(struct TransInfo *t,
-   struct TransDataContainer *tc,
+  void (*applyVec)(const struct TransInfo *t,
+   const struct TransDataContainer *tc,
struct TransData *td,
const float in[3],
-   float out[3]);
+   float r_out[3]);
   /** Apply function pointer for size transformation. */
-  void (*applySize)(struct TransInfo *t,
-struct TransDataContainer *tc,
+  void (*applySize)(const struct TransInfo *t,
+const struct TransDataContainer *tc,
 struct TransData *td,
-float smat[3][3]);
+float r_smat[3][3]);
   /** Apply function pointer for rotation transformation */
-  void (*applyRot)(struct TransInfo *t,
-   struct TransDataContainer *tc,
+  void (*applyRot)(const struct TransInfo *t,
+   const struct TransDataContainer *tc,
struct TransData *td,
-   float vec[3],
-   float *angle);
+   float r_axis[3],
+   float *r_angle);
 } TransCon;
 
 typedef struct MouseInput {
diff --git a/source/blender/editors/transform/transform_constraints.c 
b/source/blender/editors/transform/transform_constraints.c
index 8c74d5349ba..78fc6575e6e 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -97,7 +97,7 @@ static void view_vector_calc(const TransInfo *t, const float 
focus[3], float r_v
 /* ** CONSTRAINTS * */
 #define CONSTRAIN_EPSILON 0.0001f
 
-static void constraint_plane_calc(TransInfo *t, float r_plane[4])
+static void constraint_plane_calc(const TransInfo *t, float r_plane[4])
 {
   const float *constraint_vector[2];
   int n = 0;
@@ -391,8 +391,11 @@ static void planeProjection(const TransInfo *t, const 
float in[3], float out[3])
  * projected along the view vector.
  * (in perspective mode, the view vector is relative to the position on screen)
  */
-static void applyAxisConstraintVec(
-TransInfo *t, TransDataContainer *UNUSED(tc), TransData *td, const float 
in[3], float out[3])
+static void applyAxisConstraintVec(const TransInfo *t,
+   const TransDataContainer *UNUSED(tc),
+   TransData *td,
+   const float in[3],
+   float out[3])
 {
   copy_v3_v3(out, in);
   if (!td && t->con.mode & CON_APPLY) {
@@ -472,8 +475,11 @@ static void applyAxisConstraintVec(
  *
  * Further down, that vector is mapped to each data's space.
  */
-static void applyObjectConstraintVec(
-TransInfo *t, TransDataContainer *tc, TransData *td, const float in[3], 
float out[3])
+static void applyObjectConstraintVec(const TransInfo *t,
+ const TransDataContainer *tc,
+ TransData *td,
+ const float in[3],
+ float out[3])
 {
   if (!td) {
 applyAxisConstraintVec(t, tc, td, in, out);
@@ -494,36 +500,36 @@ static void applyObjectConstraintVec(
 /**
  * Generic callback for constant spatial constraints applied t

[Bf-blender-cvs] [855f7fee63c] master: Cleanup: clang-format

2021-06-29 Thread Campbell Barton
Commit: 855f7fee63c4bc57d5e154ced0e7e51bf315ea32
Author: Campbell Barton
Date:   Tue Jun 29 20:13:24 2021 +1000
Branches: master
https://developer.blender.org/rB855f7fee63c4bc57d5e154ced0e7e51bf315ea32

Cleanup: clang-format

===

M   intern/cycles/kernel/geom/geom_triangle.h
M   source/blender/editors/object/object_modifier.c
M   source/blender/gpu/intern/gpu_shader.cc

===

diff --git a/intern/cycles/kernel/geom/geom_triangle.h 
b/intern/cycles/kernel/geom/geom_triangle.h
index 0a9460aa166..208338a934b 100644
--- a/intern/cycles/kernel/geom/geom_triangle.h
+++ b/intern/cycles/kernel/geom/geom_triangle.h
@@ -77,7 +77,10 @@ ccl_device_inline void triangle_vertices(KernelGlobals *kg, 
int prim, float3 P[3
 
 /* Triangle vertex locations and vertex normals */
 
-ccl_device_inline void triangle_vertices_and_normals(KernelGlobals *kg, int 
prim, float3 P[3], float3 N[3])
+ccl_device_inline void triangle_vertices_and_normals(KernelGlobals *kg,
+ int prim,
+ float3 P[3],
+ float3 N[3])
 {
   const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
   P[0] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 
0));
diff --git a/source/blender/editors/object/object_modifier.c 
b/source/blender/editors/object/object_modifier.c
index c5c60c94d4a..620c58196dd 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1923,8 +1923,8 @@ static int multires_subdivide_exec(bContext *C, 
wmOperator *op)
 return OPERATOR_CANCELLED;
   }
 
-  const eMultiresSubdivideModeType subdivide_mode = 
(eMultiresSubdivideModeType)(RNA_enum_get(
-  op->ptr, "mode"));
+  const eMultiresSubdivideModeType subdivide_mode = 
(eMultiresSubdivideModeType)(
+  RNA_enum_get(op->ptr, "mode"));
   multiresModifier_subdivide(object, mmd, subdivide_mode);
 
   ED_object_iter_other(
diff --git a/source/blender/gpu/intern/gpu_shader.cc 
b/source/blender/gpu/intern/gpu_shader.cc
index 81430d41327..c754a649924 100644
--- a/source/blender/gpu/intern/gpu_shader.cc
+++ b/source/blender/gpu/intern/gpu_shader.cc
@@ -35,7 +35,6 @@
 
 extern "C" char datatoc_gpu_shader_colorspace_lib_glsl[];
 
-
 using namespace blender;
 using namespace blender::gpu;

___
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] [203d4052998] master: Cleanup: spelling

2021-06-29 Thread Campbell Barton
Commit: 203d4052998479439a9d92d5e163b634a45d08bc
Author: Campbell Barton
Date:   Tue Jun 29 20:12:51 2021 +1000
Branches: master
https://developer.blender.org/rB203d4052998479439a9d92d5e163b634a45d08bc

Cleanup: spelling

===

M   source/blender/editors/object/object_transform.c
M   source/blender/makesdna/DNA_material_types.h

===

diff --git a/source/blender/editors/object/object_transform.c 
b/source/blender/editors/object/object_transform.c
index 28c7ba0a774..d1e912b2f37 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -709,7 +709,7 @@ static int apply_objects_internal(bContext *C,
   if (has_unparented_layers == false) {
 BKE_reportf(reports,
 RPT_ERROR,
-"Can't apply to a GP datablock where all layers are 
parented: Object "
+"Can't apply to a GP data-block where all layers are 
parented: Object "
 "\"%s\", %s \"%s\", aborting",
 ob->id.name + 2,
 BKE_idtype_idcode_to_name(ID_GD),
@@ -722,7 +722,7 @@ static int apply_objects_internal(bContext *C,
   BKE_reportf(
   reports,
   RPT_ERROR,
-  "Can't apply to GP datablock with no layers: Object \"%s\", %s 
\"%s\", aborting",
+  "Can't apply to GP data-block with no layers: Object \"%s\", %s 
\"%s\", aborting",
   ob->id.name + 2,
   BKE_idtype_idcode_to_name(ID_GD),
   gpd->id.name + 2);
@@ -1255,7 +1255,7 @@ static int object_origin_set_exec(bContext *C, wmOperator 
*op)
 }
   }
   else if (ob->type == OB_FONT) {
-/* Det from bounding-box. */
+/* Get from bounding-box. */
 
 Curve *cu = ob->data;
 
@@ -1490,7 +1490,7 @@ static int object_origin_set_exec(bContext *C, wmOperator 
*op)
   BKE_object_batch_cache_dirty_tag(tob);
   DEG_id_tag_update(&tob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
 }
-/* special support for dupligroups */
+/* Special support for dupli-groups. */
 else if (tob->instance_collection && tob->instance_collection->id.tag & 
LIB_TAG_DOIT) {
   DEG_id_tag_update(&tob->id, ID_RECALC_TRANSFORM);
   DEG_id_tag_update(&tob->instance_collection->id, 
ID_RECALC_COPY_ON_WRITE);
diff --git a/source/blender/makesdna/DNA_material_types.h 
b/source/blender/makesdna/DNA_material_types.h
index 62933d44afd..b7354aaa724 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -152,7 +152,7 @@ typedef struct MaterialLineArt {
   /* Used to filter line art occlusion edges */
   unsigned char material_mask_bits;
 
-  /** Maximum 255 levels of equavalent occlusion. */
+  /** Maximum 255 levels of equivalent occlusion. */
   unsigned char mat_occlusion;
 
   unsigned char _pad[2];

___
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] [8b4acade6c1] cycles-x: Cycles X: Initial support of multi-GPU and GPU+CPU rendering

2021-06-29 Thread Sergey Sharybin
Commit: 8b4acade6c10d2978584e5819aace106046435f8
Author: Sergey Sharybin
Date:   Wed Jun 23 09:57:06 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB8b4acade6c10d2978584e5819aace106046435f8

Cycles X: Initial support of multi-GPU and GPU+CPU rendering

This change makes it possible to render single frame on multiple GPUs
and/or GPU(s)+CPU. (as configured in the User Preferences).

Work is split equally along the height of the big tile.
In the future this will be looked into to perform better initial guess
based on devices performance, dynamic re-scheduling, and interleaving
scanlines across devices.

The main idea is to move render buffers to per-work basis, so that the
ender buffers are always associated with the device work is being done
by. And then upon access delegate the read/write to the work, so that
it operates with a specific slice in the source/destination,

There are some multiple memory and performance improvements possible,
like:

- Copy render result to GPUDisplay from multiple threads (now when it
  is clear graphics inetrop can not be mixed in with naive update).
- Avoid denoiser buffer re-allocation.
- Avoid creation of temporary buffers in the denoisers when we know
  that we have a copy of real buffers.
- Only copy passes needed for denoiser, and results of denoiser.

The current state of the `PathTrace::denoise()` is not entirely ideal:
it could be split up, and memory usage could be improved. But think it
is good enough for the initial implementation. The further improvements
would require changes in the Denoiser API.

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

===

M   intern/cycles/blender/blender_gpu_display.cpp
M   intern/cycles/blender/blender_gpu_display.h
M   intern/cycles/integrator/denoiser_device.cpp
M   intern/cycles/integrator/pass_accessor.cpp
M   intern/cycles/integrator/pass_accessor.h
M   intern/cycles/integrator/pass_accessor_cpu.cpp
M   intern/cycles/integrator/pass_accessor_gpu.cpp
M   intern/cycles/integrator/path_trace.cpp
M   intern/cycles/integrator/path_trace.h
M   intern/cycles/integrator/path_trace_work.cpp
M   intern/cycles/integrator/path_trace_work.h
M   intern/cycles/integrator/path_trace_work_cpu.cpp
M   intern/cycles/integrator/path_trace_work_cpu.h
M   intern/cycles/integrator/path_trace_work_gpu.cpp
M   intern/cycles/integrator/path_trace_work_gpu.h
M   intern/cycles/kernel/device/cuda/kernel.cu
M   intern/cycles/render/gpu_display.cpp
M   intern/cycles/render/gpu_display.h

===

diff --git a/intern/cycles/blender/blender_gpu_display.cpp 
b/intern/cycles/blender/blender_gpu_display.cpp
index 2cac31d826f..a02547fb5c6 100644
--- a/intern/cycles/blender/blender_gpu_display.cpp
+++ b/intern/cycles/blender/blender_gpu_display.cpp
@@ -372,22 +372,35 @@ void BlenderGPUDisplay::do_update_end()
  * Texture update from CPU buffer.
  */
 
-void BlenderGPUDisplay::do_copy_pixels_to_texture(const half4 *rgba_pixels)
+void BlenderGPUDisplay::do_copy_pixels_to_texture(
+const half4 *rgba_pixels, int texture_x, int texture_y, int pixels_width, 
int pixels_height)
 {
   /* This call copies pixels to a Pixel Buffer Object (PBO) which is much 
cheaper from CPU time
* point of view than to copy data directly to the OpenGL texture.
*
* The possible downside of this approach is that it might require a higher 
peak memory when
* doing partial updates of the texture (although, in practice even partial 
updates might peak
-   * with a full-frame buffer stored on the CPU if the GPU is currently 
occupied), */
+   * with a full-frame buffer stored on the CPU if the GPU is currently 
occupied). */
 
   half4 *mapped_rgba_pixels = map_texture_buffer();
   if (!mapped_rgba_pixels) {
 return;
   }
 
-  const size_t size_in_bytes = sizeof(half4) * texture_.width * 
texture_.height;
-  memcpy(mapped_rgba_pixels, rgba_pixels, size_in_bytes);
+  if (texture_x == 0 && texture_y == 0 && pixels_width == texture_.width &&
+  pixels_height == texture_.height) {
+const size_t size_in_bytes = sizeof(half4) * texture_.width * 
texture_.height;
+memcpy(mapped_rgba_pixels, rgba_pixels, size_in_bytes);
+  }
+  else {
+const half4 *rgba_row = rgba_pixels;
+half4 *mapped_rgba_row = mapped_rgba_pixels + texture_y * texture_.width;
+for (int y = 0; y < pixels_height;
+ ++y, rgba_row += pixels_width, mapped_rgba_row += texture_.width) {
+  memcpy(mapped_rgba_row, rgba_row, sizeof(half4) * pixels_width);
+}
+  }
+
   unmap_texture_buffer();
 }
 
diff --git a/intern/cycles/blender/blender_gpu_display.h 
b/intern/cycles/blender/blender_gpu_display.h
index dc4d9bbcca0..ccfbc358171 100644
--- a/intern/cycles/blender/blender_gpu_display.h
+++ b/intern/cycles/blender/blender_gpu_display.h
@@ -104,7 +104,11 @@ class Bl

[Bf-blender-cvs] [56e4d350fbd] cycles-x: Cycles X: Remove redundant field in path trace works

2021-06-29 Thread Sergey Sharybin
Commit: 56e4d350fbda6a5d6c76417b92e500ef13348c95
Author: Sergey Sharybin
Date:   Mon Jun 21 17:19:38 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB56e4d350fbda6a5d6c76417b92e500ef13348c95

Cycles X: Remove redundant field in path trace works

Render buffers are available via the base class, no need to duplicate
it in the derived classes.

===

M   intern/cycles/integrator/path_trace_work_cpu.cpp
M   intern/cycles/integrator/path_trace_work_cpu.h
M   intern/cycles/integrator/path_trace_work_gpu.cpp
M   intern/cycles/integrator/path_trace_work_gpu.h

===

diff --git a/intern/cycles/integrator/path_trace_work_cpu.cpp 
b/intern/cycles/integrator/path_trace_work_cpu.cpp
index a7f7bb49f29..6da81903240 100644
--- a/intern/cycles/integrator/path_trace_work_cpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_cpu.cpp
@@ -56,8 +56,7 @@ PathTraceWorkCPU::PathTraceWorkCPU(Device *device,
RenderBuffers *buffers,
bool *cancel_requested_flag)
 : PathTraceWork(device, device_scene, buffers, cancel_requested_flag),
-  kernels_(*(device->get_cpu_kernels())),
-  render_buffers_(buffers)
+  kernels_(*(device->get_cpu_kernels()))
 {
   DCHECK_EQ(device->info.type, DEVICE_CPU);
 }
@@ -114,7 +113,7 @@ void 
PathTraceWorkCPU::render_samples_full_pipeline(KernelGlobals *kernel_global
   IntegratorState *shadow_catcher_state = &integrator_states[1];
 
   KernelWorkTile sample_work_tile = work_tile;
-  float *render_buffer = render_buffers_->buffer.data();
+  float *render_buffer = buffers_->buffer.data();
 
   for (int sample = 0; sample < samples_num; ++sample) {
 if (is_cancel_requested()) {
@@ -164,7 +163,7 @@ void PathTraceWorkCPU::copy_to_gpu_display(GPUDisplay 
*gpu_display,
 
   tbb::task_arena local_arena = local_tbb_arena_create(device_);
   local_arena.execute([&]() {
-pass_accessor.get_render_tile_pixels(render_buffers_, 
effective_buffer_params_, destination);
+pass_accessor.get_render_tile_pixels(buffers_, effective_buffer_params_, 
destination);
   });
 
   gpu_display->unmap_texture_buffer();
@@ -179,7 +178,7 @@ int 
PathTraceWorkCPU::adaptive_sampling_converge_filter_count_active(float thres
   const int offset = effective_buffer_params_.offset;
   const int stride = effective_buffer_params_.stride;
 
-  float *render_buffer = render_buffers_->buffer.data();
+  float *render_buffer = buffers_->buffer.data();
 
   uint num_active_pixels = 0;
 
diff --git a/intern/cycles/integrator/path_trace_work_cpu.h 
b/intern/cycles/integrator/path_trace_work_cpu.h
index 9f42212e9fd..016bed0d25f 100644
--- a/intern/cycles/integrator/path_trace_work_cpu.h
+++ b/intern/cycles/integrator/path_trace_work_cpu.h
@@ -69,9 +69,6 @@ class PathTraceWorkCPU : public PathTraceWork {
* accessing it, but some "localization" is required to decouple from kernel 
globals stored
* on the device level. */
   vector kernel_thread_globals_;
-
-  /* Render output buffers. */
-  RenderBuffers *render_buffers_;
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/integrator/path_trace_work_gpu.cpp 
b/intern/cycles/integrator/path_trace_work_gpu.cpp
index 3b8372d4da2..f543809e5f4 100644
--- a/intern/cycles/integrator/path_trace_work_gpu.cpp
+++ b/intern/cycles/integrator/path_trace_work_gpu.cpp
@@ -36,7 +36,6 @@ PathTraceWorkGPU::PathTraceWorkGPU(Device *device,
bool *cancel_requested_flag)
 : PathTraceWork(device, device_scene, buffers, cancel_requested_flag),
   queue_(device->gpu_queue_create()),
-  render_buffers_(buffers),
   integrator_queue_counter_(device, "integrator_queue_counter", 
MEM_READ_WRITE),
   integrator_shader_sort_counter_(device, 
"integrator_shader_sort_counter", MEM_READ_WRITE),
   integrator_shader_raytrace_sort_counter_(
@@ -332,7 +331,7 @@ void PathTraceWorkGPU::enqueue_path_iteration(DeviceKernel 
kernel)
 case DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE:
 case DEVICE_KERNEL_INTEGRATOR_SHADE_VOLUME: {
   /* Shading kernels with integrator state and render buffer. */
-  void *d_render_buffer = (void *)render_buffers_->buffer.device_pointer;
+  void *d_render_buffer = (void *)buffers_->buffer.device_pointer;
   void *args[] = {&d_path_index, &d_render_buffer, const_cast(&work_size)};
 
   queue_->enqueue(kernel, work_size, args);
@@ -562,7 +561,7 @@ void PathTraceWorkGPU::enqueue_work_tiles(DeviceKernel 
kernel,
 
   void *d_work_tiles = (void *)work_tiles_.device_pointer;
   void *d_path_index = (void *)nullptr;
-  void *d_render_buffer = (void *)render_buffers_->buffer.device_pointer;
+  void *d_render_buffer = (void *)buffers_->buffer.device_pointer;
 
   if (max_active_path_index_ != 0) {
 queue_->zero_to_device(num_queued_paths_);
@@ -668,8 +667,8 @@ void PathTraceWo

[Bf-blender-cvs] [01363b5dc4f] cycles-x: Cycles X: Initialize all fields of buffer params

2021-06-29 Thread Sergey Sharybin
Commit: 01363b5dc4f8c9ef84fbcfaa6d971b6622e1fc4c
Author: Sergey Sharybin
Date:   Mon Jun 21 17:31:16 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB01363b5dc4f8c9ef84fbcfaa6d971b6622e1fc4c

Cycles X: Initialize all fields of buffer params

Allows to rely on default constructor and follow-up call of
modified() without accessing non-initialized fields.

===

M   intern/cycles/render/buffers.h

===

diff --git a/intern/cycles/render/buffers.h b/intern/cycles/render/buffers.h
index 76ac3c393b6..93ea5393554 100644
--- a/intern/cycles/render/buffers.h
+++ b/intern/cycles/render/buffers.h
@@ -40,14 +40,14 @@ struct float4;
 class BufferParams {
  public:
   /* width/height of the physical buffer */
-  int width;
-  int height;
+  int width = 0;
+  int height = 0;
 
   /* offset into and width/height of the full buffer */
-  int full_x;
-  int full_y;
-  int full_width;
-  int full_height;
+  int full_x = 0;
+  int full_y = 0;
+  int full_width = 0;
+  int full_height = 0;
 
   /* Runtime fields, only valid after `update_passes()` or 
`update_offset_stride()`. */
   int offset = -1, stride = -1;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [a418d1bc9e5] cycles-x: Cycles X: Move need-to-zero-render-buffers check to render scheduler

2021-06-29 Thread Sergey Sharybin
Commit: a418d1bc9e5ca25e46d131d5fd608adc8f259f9e
Author: Sergey Sharybin
Date:   Mon Jun 21 17:10:52 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBa418d1bc9e5ca25e46d131d5fd608adc8f259f9e

Cycles X: Move need-to-zero-render-buffers check to render scheduler

No functional changes, but localizes handling of the render buffers,
helping with the coming further development.

===

M   intern/cycles/integrator/path_trace.cpp
M   intern/cycles/integrator/path_trace.h
M   intern/cycles/integrator/render_scheduler.cpp
M   intern/cycles/integrator/render_scheduler.h

===

diff --git a/intern/cycles/integrator/path_trace.cpp 
b/intern/cycles/integrator/path_trace.cpp
index a3f34346764..42efb845c66 100644
--- a/intern/cycles/integrator/path_trace.cpp
+++ b/intern/cycles/integrator/path_trace.cpp
@@ -134,15 +134,11 @@ void PathTrace::render(const RenderWork &render_work)
 
 void PathTrace::render_pipeline(RenderWork render_work)
 {
-  /* TODO(sergey): For truly resumable render might need to avoid zero-ing. */
-  if (render_work.path_trace.start_sample == 
render_scheduler_.get_start_sample()) {
-full_render_buffers_->zero();
-buffer_read();
-  }
-
   render_init_kernel_execution();
   render_update_resolution_divider(render_work.resolution_divider);
 
+  init_render_buffers(render_work);
+
   path_trace(render_work);
   if (is_cancel_requested()) {
 return;
@@ -174,6 +170,16 @@ void PathTrace::render_init_kernel_execution()
   }
 }
 
+void PathTrace::init_render_buffers(const RenderWork &render_work)
+{
+  if (!render_work.init_render_buffers) {
+return;
+  }
+
+  full_render_buffers_->zero();
+  buffer_read();
+}
+
 void PathTrace::path_trace(RenderWork &render_work)
 {
   if (!render_work.path_trace.num_samples) {
diff --git a/intern/cycles/integrator/path_trace.h 
b/intern/cycles/integrator/path_trace.h
index 6db8b286cbb..4018f582916 100644
--- a/intern/cycles/integrator/path_trace.h
+++ b/intern/cycles/integrator/path_trace.h
@@ -158,6 +158,7 @@ class PathTrace {
*
* Note that some steps might modify the work, forcing some steps to happen 
within this iteration
* of rendering. */
+  void init_render_buffers(const RenderWork &render_work);
   void path_trace(RenderWork &render_work);
   void adaptive_sample(RenderWork &render_work);
   void denoise(const RenderWork &render_work);
diff --git a/intern/cycles/integrator/render_scheduler.cpp 
b/intern/cycles/integrator/render_scheduler.cpp
index 06fcc1d0b80..8e9d4019899 100644
--- a/intern/cycles/integrator/render_scheduler.cpp
+++ b/intern/cycles/integrator/render_scheduler.cpp
@@ -223,6 +223,8 @@ RenderWork RenderScheduler::get_render_work()
   render_work.path_trace.start_sample = get_start_sample_to_path_trace();
   render_work.path_trace.num_samples = get_num_samples_to_path_trace();
 
+  render_work.init_render_buffers = (render_work.path_trace.start_sample == 
get_start_sample());
+
   /* NOTE: Advance number of samples now, so that filter and denoising check 
can see that all the
* samples are rendered. */
   state_.num_rendered_samples += render_work.path_trace.num_samples;
diff --git a/intern/cycles/integrator/render_scheduler.h 
b/intern/cycles/integrator/render_scheduler.h
index bdf4cde40b3..ffb5ee8c947 100644
--- a/intern/cycles/integrator/render_scheduler.h
+++ b/intern/cycles/integrator/render_scheduler.h
@@ -27,6 +27,11 @@ class RenderWork {
  public:
   int resolution_divider = 1;
 
+  /* Initialize render buffers.
+   * Includes steps like zero-ing the buffer on the device, and optional 
reading of pixels from the
+   * baking target. */
+  bool init_render_buffers = false;
+
   /* Path tracing samples information. */
   struct {
 int start_sample = 0;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [64c9077d792] cycles-x: Fix Cycles X multi-device type generation

2021-06-29 Thread Sergey Sharybin
Commit: 64c9077d792fcfe32960ef4651d300496122fc74
Author: Sergey Sharybin
Date:   Mon Jun 28 18:07:13 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB64c9077d792fcfe32960ef4651d300496122fc74

Fix Cycles X multi-device type generation

The info type can not be set to first device type because the device
might be ignored. So delay type assignment until we have a device which
is known to be used.

Fixes issue in viewport when OptiX+OptiX will be considered an OptiX
device with 2 sub-devices, and OptiX+OptiX+CPU will be considered a
Multi device. The issue with the latter one is that the info IDs in
both cases are the same, but not the type, making it a wrong comparison
in `DeviceInfo::operator==`.

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

===

M   intern/cycles/device/device.cpp

===

diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index 81a0807bad3..a5eb56f1e00 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -310,7 +310,7 @@ DeviceInfo Device::get_multi_device(const 
vector &subdevices,
   }
 
   DeviceInfo info;
-  info.type = subdevices.front().type;
+  info.type = DEVICE_NONE;
   info.id = "MULTI";
   info.description = "Multi Device";
   info.num = 0;
@@ -355,7 +355,10 @@ DeviceInfo Device::get_multi_device(const 
vector &subdevices,
 info.id += device.id;
 
 /* Set device type to MULTI if subdevices are not of a common type. */
-if (device.type != info.type) {
+if (info.type == DEVICE_NONE) {
+  info.type = device.type;
+}
+else if (device.type != info.type) {
   info.type = DEVICE_MULTI;
 }

___
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] [8faaa9873f3] temp-lineart-contained: LineArt: Back face culling.

2021-06-29 Thread YimingWu
Commit: 8faaa9873f3123274cfb6d22ae683f8d7daf3269
Author: YimingWu
Date:   Tue Jun 29 17:28:56 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB8faaa9873f3123274cfb6d22ae683f8d7daf3269

LineArt: Back face culling.

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M   source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M   source/blender/makesdna/DNA_lineart_types.h
M   source/blender/makesrna/intern/rna_gpencil_modifier.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 51df49c6f55..45c1281b4ee 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -419,6 +419,7 @@ static void options_panel_draw(const bContext *UNUSED(C), 
Panel *panel)
   uiItemR(layout, ptr, "use_overlap_edge_type_support", 0, NULL, ICON_NONE);
   uiItemR(layout, ptr, "use_crease_on_smooth", 0, IFACE_("Crease On Smooth"), 
ICON_NONE);
   uiItemR(layout, ptr, "use_crease_on_sharp", 0, IFACE_("Crease On Sharp"), 
ICON_NONE);
+  uiItemR(layout, ptr, "use_back_face_culling", 0, NULL, ICON_NONE);
 }
 
 static void style_panel_draw(const bContext *UNUSED(C), Panel *panel)
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h 
b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 3f6e7ba717a..1d1c91cf5c2 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -300,6 +300,7 @@ typedef struct LineartRenderBuffer {
   bool use_loose_as_contour;
   bool use_loose_edge_chain;
   bool use_geometry_space_chain;
+  bool use_back_face_culling;
 
   bool filter_face_mark;
   bool filter_face_mark_invert;
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index ed54c4a879c..611357d4815 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -1335,6 +1335,10 @@ static void 
lineart_main_cull_triangles(LineartRenderBuffer *rb, bool clip_far)
   /* Select the triangle in the array. */
   tri = (void *)(((uchar *)eln->pointer) + rb->triangle_size * i);
 
+  if (tri->flags & LRT_CULL_DISCARD) {
+continue;
+  }
+
   LRT_CULL_DECIDE_INSIDE
   LRT_CULL_ENSURE_MEMORY
   lineart_triangle_cull_single(rb,
@@ -1547,7 +1551,7 @@ static uint16_t 
lineart_identify_feature_line(LineartRenderBuffer *rb,
   double dot_1 = 0, dot_2 = 0;
   double result;
 
-  if (rb->use_contour) {
+  if (rb->use_contour || rb->use_back_face_culling) {
 
 if (rb->cam_is_persp) {
   sub_v3_v3v3_db(view_vector, l->gloc, rb->camera_pos);
@@ -1559,9 +1563,19 @@ static uint16_t 
lineart_identify_feature_line(LineartRenderBuffer *rb,
 dot_1 = dot_v3v3_db(view_vector, tri1->gn);
 dot_2 = dot_v3v3_db(view_vector, tri2->gn);
 
-if ((result = dot_1 * dot_2) <= 0 && (dot_1 + dot_2)) {
+if (rb->use_contour && (result = dot_1 * dot_2) <= 0 && (dot_1 + dot_2)) {
   edge_flag_result |= LRT_EDGE_FLAG_CONTOUR;
 }
+
+/* Because the camera ray starts from camera, so backface is when dot 
value being positive. */
+if (rb->use_back_face_culling) {
+  if (dot_1 > 0) {
+tri1->flags |= LRT_CULL_DISCARD;
+  }
+  if (dot_2 > 0) {
+tri2->flags |= LRT_CULL_DISCARD;
+  }
+}
   }
 
   /* For when face mark filtering decided that we discard the face but 
keep_contour option is on.
@@ -3150,6 +3164,18 @@ static LineartRenderBuffer 
*lineart_create_render_buffer(Scene *scene,
   rb->force_crease = (lmd->calculation_flags & 
LRT_USE_CREASE_ON_SMOOTH_SURFACES) != 0;
   rb->sharp_as_crease = (lmd->calculation_flags & 
LRT_USE_CREASE_ON_SHARP_EDGES) != 0;
 
+  /* This is used to limit calculation to a certain level to save time, lines 
who have higher
+   * occlusion levels will get ignored. */
+  rb->max_occlusion_level = lmd->level_end_override;
+
+  rb->use_back_face_culling = (lmd->calculation_flags & 
LRT_USE_BACK_FACE_CULLING) != 0;
+  if (rb->max_occlusion_level < 1) {
+rb->use_back_face_culling = true;
+if (G.debug_value = 4000) {
+  printf("Backface culling enabled automatically.\n");
+}
+  }
+
   int16_t edge_types = lmd->edge_types_override;
 
   /* lmd->edge_types_override contains all used flags in the modifier stack. */
@@ -4190,10 +4216,6 @@ bool MOD_lineart_compute_feature_lines(Depsgraph 
*depsgraph,
* See definition of LineartTriangleThread for details. */
   rb->triangle_size = lineart_triangle_size_get(scene, rb);
 
-  /* This

[Bf-blender-cvs] [9ea178f3c38] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained

2021-06-29 Thread YimingWu
Commit: 9ea178f3c386c79bbae3da8e8996537c7918bdf7
Author: YimingWu
Date:   Tue Jun 29 11:45:34 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB9ea178f3c386c79bbae3da8e8996537c7918bdf7

Merge remote-tracking branch 'origin/master' into temp-lineart-contained

===



===



___
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] [e82b3a312dd] temp-lineart-contained: LineArt: naming change floating->loose

2021-06-29 Thread YimingWu
Commit: e82b3a312dd77352742c80e15c1e2a55f8cba1f9
Author: YimingWu
Date:   Tue Jun 29 11:04:45 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rBe82b3a312dd77352742c80e15c1e2a55f8cba1f9

LineArt: naming change floating->loose

===

M   source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
M   source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
M   source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
M   source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
M   source/blender/makesdna/DNA_lineart_types.h
M   source/blender/makesrna/intern/rna_gpencil_modifier.c

===

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 12c0d121362..51df49c6f55 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -357,7 +357,7 @@ static void line_types_panel_draw(const bContext 
*UNUSED(C), Panel *panel)
   uiLayout *col = uiLayoutColumn(layout, false);
 
   uiItemR(col, ptr, "use_contour", 0, IFACE_("Contour"), ICON_NONE);
-  uiItemR(col, ptr, "use_floating", 0, IFACE_("Floating"), ICON_NONE);
+  uiItemR(col, ptr, "use_loose", 0, IFACE_("Loose"), ICON_NONE);
   uiItemR(col, ptr, "use_material", 0, IFACE_("Material Borders"), ICON_NONE);
   uiItemR(col, ptr, "use_edge_mark", 0, IFACE_("Edge Marks"), ICON_NONE);
   uiItemR(col, ptr, "use_intersection", 0, IFACE_("Intersections"), ICON_NONE);
@@ -416,7 +416,7 @@ static void options_panel_draw(const bContext *UNUSED(C), 
Panel *panel)
   uiItemR(layout, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As 
Contour"), ICON_NONE);
   uiItemR(layout, ptr, "use_object_instances", 0, NULL, ICON_NONE);
   uiItemR(layout, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE);
-  uiItemR(layout, ptr, "allow_overlap_edge_types", 0, NULL, ICON_NONE);
+  uiItemR(layout, ptr, "use_overlap_edge_type_support", 0, NULL, ICON_NONE);
   uiItemR(layout, ptr, "use_crease_on_smooth", 0, IFACE_("Crease On Smooth"), 
ICON_NONE);
   uiItemR(layout, ptr, "use_crease_on_sharp", 0, IFACE_("Crease On Sharp"), 
ICON_NONE);
 }
@@ -610,7 +610,7 @@ static void chaining_panel_draw(const bContext *UNUSED(C), 
Panel *panel)
   const bool is_baked = RNA_boolean_get(ptr, "is_baked");
   const bool use_cache = RNA_boolean_get(ptr, "use_cache");
   const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, 
ptr->data);
-  const bool is_geom = RNA_boolean_get(ptr, "chain_geometry_space");
+  const bool is_geom = RNA_boolean_get(ptr, "use_geometry_space_chain");
 
   uiLayoutSetPropSep(layout, true);
   uiLayoutSetEnabled(layout, !is_baked);
@@ -624,8 +624,8 @@ static void chaining_panel_draw(const bContext *UNUSED(C), 
Panel *panel)
   uiItemR(col, ptr, "use_fuzzy_intersections", 0, NULL, ICON_NONE);
   uiItemR(col, ptr, "use_fuzzy_all", 0, NULL, ICON_NONE);
 
-  uiItemR(col, ptr, "chain_floating_edges", 0, IFACE_("Floating Edges"), 
ICON_NONE);
-  uiItemR(col, ptr, "chain_geometry_space", 0, NULL, ICON_NONE);
+  uiItemR(col, ptr, "use_loose_edge_chain", 0, IFACE_("Loose Edges"), 
ICON_NONE);
+  uiItemR(col, ptr, "use_geometry_space_chain", 0, NULL, ICON_NONE);
 
   uiItemR(layout,
   ptr,
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h 
b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 48f79e9c629..3f6e7ba717a 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -289,7 +289,7 @@ typedef struct LineartRenderBuffer {
   bool use_material;
   bool use_edge_marks;
   bool use_intersections;
-  bool use_floating;
+  bool use_loose;
   bool use_light_contour;
   bool fuzzy_intersections;
   bool fuzzy_everything;
@@ -297,9 +297,9 @@ typedef struct LineartRenderBuffer {
   bool allow_overlapping_edges;
   bool allow_duplicated_types;
   bool remove_doubles;
-  bool floating_as_contour;
-  bool chain_floating_edges;
-  bool chain_geometry_space;
+  bool use_loose_as_contour;
+  bool use_loose_edge_chain;
+  bool use_geometry_space_chain;
 
   bool filter_face_mark;
   bool filter_face_mark_invert;
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
index 321e4a2b47b..d8369a15aac 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
@@ -739,8 +739,8 @@ static LineartChainRegisterEntry 
*lineart_chain_get_closest_cre(LineartRenderBuf
   }
 }
 
-float new_len = rb->chain_geometry_space ? len_v3v3(cre->eci->gpos, 
eci->gpos) :
-   len_v2v2(

[Bf-blender-cvs] [3d7cf4faf3f] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained

2021-06-29 Thread YimingWu
Commit: 3d7cf4faf3f8cea5b574b9e25df04e48ba3c1cdb
Author: YimingWu
Date:   Tue Jun 29 16:57:41 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB3d7cf4faf3f8cea5b574b9e25df04e48ba3c1cdb

Merge remote-tracking branch 'origin/master' into temp-lineart-contained

===



===



___
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] [a55bbedc063] tmp-vulkan: Merge branch 'master' into tmp-vulkan

2021-06-29 Thread Jeroen Bakker
Commit: a55bbedc063a13b8e3c0c2f161b6f1e7030d18b2
Author: Jeroen Bakker
Date:   Tue Jun 29 09:59:34 2021 +0200
Branches: tmp-vulkan
https://developer.blender.org/rBa55bbedc063a13b8e3c0c2f161b6f1e7030d18b2

Merge branch 'master' into tmp-vulkan

===



===

diff --cc source/blender/gpu/vulkan/vk_shader_log.cc
index 4a5e752a0cb,000..2958adef903
mode 100644,00..100644
--- a/source/blender/gpu/vulkan/vk_shader_log.cc
+++ b/source/blender/gpu/vulkan/vk_shader_log.cc
@@@ -1,65 -1,0 +1,65 @@@
 +/*
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * as published by the Free Software Foundation; either version 2
 + * of the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software Foundation,
 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 + *
 + * The Original Code is Copyright (C) 2021 Blender Foundation.
 + * All rights reserved.
 + */
 +
 +/** \file
 + * \ingroup gpu
 + */
 +
 +#include "vk_shader.hh"
 +
 +#include "GPU_platform.h"
 +
 +namespace blender::gpu {
 +
 +char *VKLogParser::parse_line(char *log_line, GPULogItem &log_item)
 +{
 +  log_line = skip_name_and_stage(log_line);
-   log_line = skip_separator(log_line, ':');
++  log_line = skip_separators(log_line, ":");
 +
 +  /* Parse error line & char numbers. */
-   if (log_line[0] >= '0' && log_line[0] <= '9') {
++  if (at_number(log_line)) {
 +char *error_line_number_end;
- log_item.cursor.row = (int)strtol(log_line, &error_line_number_end, 10);
++log_item.cursor.row = parse_number(log_line, &error_line_number_end);
 +log_line = error_line_number_end;
 +  }
-   log_line = skip_separators(log_line, ':', ' ');
++  log_line = skip_separators(log_line, ": ");
 +
 +  /* Skip to message. Avoid redundant info. */
 +  log_line = skip_severity_keyword(log_line, log_item);
-   log_line = skip_separators(log_line, ':', ' ');
++  log_line = skip_separators(log_line, ": ");
 +
 +  return log_line;
 +}
 +
 +char *VKLogParser::skip_name_and_stage(char *log_line)
 +{
 +  char *name_skip = skip_until(log_line, '.');
 +  if (name_skip == log_line) {
 +return log_line;
 +  }
 +
 +  return skip_until(name_skip, ':');
 +}
 +
 +char *VKLogParser::skip_severity_keyword(char *log_line, GPULogItem &log_item)
 +{
 +  return skip_severity(log_line, log_item, "error", "warning");
 +}
 +
 +}  // namespace blender::gpu

___
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] [66d48b272e6] master: Cleanup: GPU Shader Log Parsing.

2021-06-29 Thread Jeroen Bakker
Commit: 66d48b272e6379acb5ee5f1df532e472e1b142fd
Author: Jeroen Bakker
Date:   Tue Jun 29 09:52:31 2021 +0200
Branches: master
https://developer.blender.org/rB66d48b272e6379acb5ee5f1df532e472e1b142fd

Cleanup: GPU Shader Log Parsing.

- Added functions to check if the cursor is at a number.
- Added function to parse a number.
- Joined skip_separator functions.
- Added function to check if cursor is at any given set of characters.

===

M   source/blender/gpu/intern/gpu_shader_log.cc
M   source/blender/gpu/intern/gpu_shader_private.hh
M   source/blender/gpu/opengl/gl_shader_log.cc

===

diff --git a/source/blender/gpu/intern/gpu_shader_log.cc 
b/source/blender/gpu/intern/gpu_shader_log.cc
index 5859afb7fbf..12459b4b721 100644
--- a/source/blender/gpu/intern/gpu_shader_log.cc
+++ b/source/blender/gpu/intern/gpu_shader_log.cc
@@ -177,14 +177,41 @@ char *GPULogParser::skip_severity(char *log_line,
   return log_line;
 }
 
-char *GPULogParser::skip_separators(char *log_line, char sep1, char sep2, char 
sep3) const
+char *GPULogParser::skip_separators(char *log_line, const StringRef 
separators) const
 {
-  while (ELEM(log_line[0], sep1, sep2, sep3)) {
+  while (at_any(log_line, separators)) {
 log_line++;
   }
   return log_line;
 }
 
+char *GPULogParser::skip_until(char *log_line, char stop_char) const
+{
+  char *cursor = log_line;
+  while (!ELEM(cursor[0], '\n', '\0')) {
+if (cursor[0] == stop_char) {
+  return cursor;
+}
+cursor++;
+  }
+  return log_line;
+}
+
+bool GPULogParser::at_number(const char *log_line) const
+{
+  return log_line[0] >= '0' && log_line[0] <= '9';
+}
+
+bool GPULogParser::at_any(const char *log_line, const StringRef chars) const
+{
+  return chars.find(log_line[0]) != StringRef::not_found;
+}
+
+int GPULogParser::parse_number(const char *log_line, char **r_new_position) 
const
+{
+  return (int)strtol(log_line, r_new_position, 10);
+}
+
 /** \} */
 
 }  // namespace blender::gpu
diff --git a/source/blender/gpu/intern/gpu_shader_private.hh 
b/source/blender/gpu/intern/gpu_shader_private.hh
index ebdfc3478f8..65720e457d8 100644
--- a/source/blender/gpu/intern/gpu_shader_private.hh
+++ b/source/blender/gpu/intern/gpu_shader_private.hh
@@ -21,6 +21,7 @@
 #pragma once
 
 #include "BLI_span.hh"
+#include "BLI_string_ref.hh"
 
 #include "GPU_shader.h"
 #include "gpu_shader_interface.hh"
@@ -123,7 +124,11 @@ class GPULogParser {
   GPULogItem &log_item,
   const char *error_msg,
   const char *warning_msg) const;
-  char *skip_separators(char *log_line, char sep1, char sep2, char sep3) const;
+  char *skip_separators(char *log_line, const StringRef separators) const;
+  char *skip_until(char *log_line, char stop_char) const;
+  bool at_number(const char *log_line) const;
+  bool at_any(const char *log_line, const StringRef chars) const;
+  int parse_number(const char *log_line, char **r_new_position) const;
 
   MEM_CXX_CLASS_ALLOC_FUNCS("GPULogParser");
 };
diff --git a/source/blender/gpu/opengl/gl_shader_log.cc 
b/source/blender/gpu/opengl/gl_shader_log.cc
index 393f852b463..174cc63ad81 100644
--- a/source/blender/gpu/opengl/gl_shader_log.cc
+++ b/source/blender/gpu/opengl/gl_shader_log.cc
@@ -31,24 +31,24 @@ char *GLLogParser::parse_line(char *log_line, GPULogItem 
&log_item)
 {
   /* Skip ERROR: or WARNING:. */
   log_line = skip_severity_prefix(log_line, log_item);
-  log_line = skip_separators(log_line, ':', '(', ' ');
+  log_line = skip_separators(log_line, "(: ");
 
   /* Parse error line & char numbers. */
-  if (log_line[0] >= '0' && log_line[0] <= '9') {
+  if (at_number(log_line)) {
 char *error_line_number_end;
-log_item.cursor.row = (int)strtol(log_line, &error_line_number_end, 10);
+log_item.cursor.row = parse_number(log_line, &error_line_number_end);
 /* Try to fetch the error character (not always available). */
-if (ELEM(error_line_number_end[0], '(', ':') && error_line_number_end[1] 
!= ' ') {
-  log_item.cursor.column = (int)strtol(error_line_number_end + 1, 
&log_line, 10);
+if (at_any(error_line_number_end, "(:") && 
at_number(&error_line_number_end[1])) {
+  log_item.cursor.column = parse_number(error_line_number_end + 1, 
&log_line);
 }
 else {
   log_line = error_line_number_end;
 }
 /* There can be a 3rd number (case of mesa driver). */
-if (ELEM(log_line[0], '(', ':') && log_line[1] >= '0' && log_line[1] <= 
'9') {
+if (at_any(log_line, "(:") && at_number(&log_line[1])) {
   log_item.cursor.source = log_item.cursor.row;
   log_item.cursor.row = log_item.cursor.column;
-  log_item.cursor.column = (int)strtol(log_line + 1, 
&error_line_number_end, 10);
+  log_item.cursor.column = parse_number(log_line + 1, 
&error_line_number_end);
   log_line = error_line_number_end;
  

[Bf-blender-cvs] [ee0c3081b08] master: Fixed issue in previous commit.

2021-06-29 Thread Jeroen Bakker
Commit: ee0c3081b08ab2c97dd86215cb9e444d16c2e19a
Author: Jeroen Bakker
Date:   Tue Jun 29 09:08:33 2021 +0200
Branches: master
https://developer.blender.org/rBee0c3081b08ab2c97dd86215cb9e444d16c2e19a

Fixed issue in previous commit.

During development a test was disabled. Enabling it again.

===

M   source/blender/gpu/opengl/gl_backend.cc

===

diff --git a/source/blender/gpu/opengl/gl_backend.cc 
b/source/blender/gpu/opengl/gl_backend.cc
index feda59b1639..1ae68d6813c 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -298,7 +298,7 @@ static void detect_workarounds()
* `GL_INT_2_10_10_10_REV` data type correctly. This data type is used to 
pack normals and flags.
* The work around uses `GPU_RGBA16I`.
*/
-  if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) {
+  if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_OFFICIAL)) {
 const Vector matches = {"RX 460",
  "RX 470",
  "RX 480",

___
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] [2262d6c45ad] master: Fix T89405: Viewport Render Preview glitching (AMD)

2021-06-29 Thread Jeroen Bakker
Commit: 2262d6c45adff2cca06dc0c7f758e8c2a0de74f2
Author: Jeroen Bakker
Date:   Tue Jun 29 08:23:45 2021 +0200
Branches: master
https://developer.blender.org/rB2262d6c45adff2cca06dc0c7f758e8c2a0de74f2

Fix T89405: Viewport Render Preview glitching (AMD)

AMD Drivers didn't report an additional space in the rendered. This made
testing for the HQ workaround fail and the issue appeared back on
certain cards.

This fix will test with surrounding spaces or if the renderer name
endswith the given string. If any of these are the case the hq normals
workaround will be enabled.

===

M   source/blender/gpu/opengl/gl_backend.cc

===

diff --git a/source/blender/gpu/opengl/gl_backend.cc 
b/source/blender/gpu/opengl/gl_backend.cc
index d85f9f7684d..feda59b1639 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -38,6 +38,17 @@ namespace blender::gpu {
 /** \name Platform
  * \{ */
 
+static bool match_renderer(StringRef renderer, const Vector 
&items)
+{
+  for (const std::string &item : items) {
+const std::string wrapped = " " + item + " ";
+if (renderer.endswith(item) || renderer.find(wrapped) != 
StringRef::not_found) {
+  return true;
+}
+  }
+  return false;
+}
+
 void GLBackend::platform_init()
 {
   BLI_assert(!GPG.initialized);
@@ -287,15 +298,26 @@ static void detect_workarounds()
* `GL_INT_2_10_10_10_REV` data type correctly. This data type is used to 
pack normals and flags.
* The work around uses `GPU_RGBA16I`.
*/
-  if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_OFFICIAL)) {
-if (strstr(renderer, " RX 460 ") || strstr(renderer, " RX 470 ") ||
-strstr(renderer, " RX 480 ") || strstr(renderer, " RX 490 ") ||
-strstr(renderer, " RX 560 ") || strstr(renderer, " RX 560X ") ||
-strstr(renderer, " RX 570 ") || strstr(renderer, " RX 580 ") ||
-strstr(renderer, " RX 580X ") || strstr(renderer, " RX 590 ") ||
-strstr(renderer, " RX550/550 ") || strstr(renderer, "(TM) 520 ") ||
-strstr(renderer, "(TM) 530 ") || strstr(renderer, "(TM) 535 ") ||
-strstr(renderer, " R5 ") || strstr(renderer, " R7 ") || 
strstr(renderer, " R9 ")) {
+  if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_ANY)) {
+const Vector matches = {"RX 460",
+ "RX 470",
+ "RX 480",
+ "RX 490",
+ "RX 560",
+ "RX 560X",
+ "RX 570",
+ "RX 580",
+ "RX 580X",
+ "RX 590",
+ "RX550/550",
+ "(TM) 520",
+ "(TM) 530",
+ "(TM) 535",
+ "R5",
+ "R7",
+ "R9"};
+
+if (match_renderer(renderer, matches)) {
   GCaps.use_hq_normals_workaround = true;
 }
   }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs