[Bf-blender-cvs] [3642fba679c] soc-2022-many-lights-sampling: Fix: Cycles light tree triangle sampling

2022-07-01 Thread Jeffrey Liu
Commit: 3642fba679c1300d21524a2d645c88a622d42eab
Author: Jeffrey Liu
Date:   Fri Jul 1 11:01:02 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB3642fba679c1300d21524a2d645c88a622d42eab

Fix: Cycles light tree triangle sampling

This currently reverts some of the distant light sampling changes,
so that I could isolate the issues with triangle light sampling.

The fix ensures that the light distribution still computes the correct
cdf (if needed), and removes the light tree kernel's dependency on the
light distribution. This also corrects the triangle PDFs.

===

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

===

diff --git a/intern/cycles/kernel/light/light_tree.h 
b/intern/cycles/kernel/light/light_tree.h
index 679dcda39f9..9cf601407b7 100644
--- a/intern/cycles/kernel/light/light_tree.h
+++ b/intern/cycles/kernel/light/light_tree.h
@@ -185,16 +185,16 @@ ccl_device int light_tree_sample(KernelGlobals kg,
 emitter_cdf += emitter_pdf;
 if (tree_u < emitter_cdf) {
   *pdf_factor *= emitter_pdf;
-  ccl_global const KernelLightDistribution *kdistribution = 
&kernel_data_fetch(
-  light_distribution, prim_index);
+  ccl_global const KernelLightTreeEmitter *kemitter = &kernel_data_fetch(
+  light_tree_emitters, prim_index);
 
   /* to-do: this is the same code as light_distribution_sample, except the 
index is determined
* differently. Would it be better to refactor this into a separate 
function? */
-  const int prim = kdistribution->prim;
+  const int prim = kemitter->prim_id;
 
   if (prim >= 0) {
 /* Mesh light. */
-const int object = kdistribution->mesh_light.object_id;
+const int object = kemitter->mesh_light.object_id;
 
 /* Exclude synthetic meshes from shadow catcher pass. */
 if ((path_flag & PATH_RAY_SHADOW_CATCHER_PASS) &&
@@ -202,9 +202,32 @@ ccl_device int light_tree_sample(KernelGlobals kg,
   return false;
 }
 
-const int shader_flag = kdistribution->mesh_light.shader_flag;
+const int shader_flag = kemitter->mesh_light.shader_flag;
 triangle_light_sample(kg, prim, object, randu, 
randv, time, ls, P);
 ls->shader |= shader_flag;
+
+/* triangle_light sample also multiplies the pdf by the triangle's area
+ * because of the precomputed light distribution PDF.
+ * We need to reverse this because it's not needed here.*/
+float area = 0.0f;
+
+float3 V[3];
+bool has_motion = triangle_world_space_vertices(kg, object, prim, 
time, V);
+
+const float3 e0 = V[1] - V[0];
+const float3 e1 = V[2] - V[0];
+const float3 e2 = V[2] - V[1];
+
+const float3 N0 = cross(e0, e1);
+if (has_motion) {
+  /* get the center frame vertices, this is what the PDF was 
calculated from */
+  triangle_world_space_vertices(kg, object, prim, -1.0f, V);
+  area = triangle_area(V[0], V[1], V[2]);
+}
+else {
+  area = 0.5f * len(N0);
+}
+ls->pdf /= area;
 return (ls->pdf > 0.0f);
   }
 
@@ -225,6 +248,8 @@ ccl_device int light_tree_sample(KernelGlobals kg,
 
 /* to-do: assign relative importances for the background and distant lights.
  * Can we somehow adjust the importance measure to account for these as well? 
*/
+
+/*
 ccl_device float light_tree_distant_light_importance(KernelGlobals kg,
  const float3 P,
  const float3 N,
@@ -276,6 +301,7 @@ ccl_device int 
light_tree_sample_distant_lights(KernelGlobals kg,
 }
   }
 }
+*/
 
 ccl_device bool light_tree_sample_from_position(KernelGlobals kg,
 ccl_private const RNGState 
*rng_state,
@@ -288,10 +314,15 @@ ccl_device bool 
light_tree_sample_from_position(KernelGlobals kg,
 const uint32_t path_flag,
 ccl_private LightSample *ls)
 {
+  /*
   const int num_distant_lights = kernel_data.integrator.num_distant_lights;
   const int num_light_tree_prims = kernel_data.integrator.num_distribution - 
num_distant_lights;
+  */
 
   float pdf_factor = 1.0f;
+  bool ret = light_tree_sample(
+kg, rng_state, randu, randv, time, N, P, bounce, path_flag, ls, 
&pdf_factor);
+  /*
   bool ret = false;
   if (num_distant_lights == 0) {
 ret = light_tree_sample(
@@ -321,6 +352,7 @@ ccl_device bool 
light_tree_sample_from_position(KernelGlobals kg,
   pdf_factor *= (1 - light_tree_probability);
 }
   }
+  */
 
   ls->pdf *= pdf_factor;
   return ret;
diff -

[Bf-blender-cvs] [3f81ab1d0ec] soc-2022-many-lights-sampling: Merge branch 'master' into soc-2022-many-lights-sampling

2022-07-01 Thread Jeffrey Liu
Commit: 3f81ab1d0ecf71bdf55fd24c2d2d0a7e8fa310ee
Author: Jeffrey Liu
Date:   Fri Jul 1 11:05:53 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB3f81ab1d0ecf71bdf55fd24c2d2d0a7e8fa310ee

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

===



===



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


[Bf-blender-cvs] [d0e3388848a] master: Cleanup: Simplify logic building in length parameterization

2022-07-01 Thread Hans Goudey
Commit: d0e3388848a66eb4ca2f7e16278fabd5832e568a
Author: Hans Goudey
Date:   Fri Jul 1 09:46:27 2022 -0500
Branches: master
https://developer.blender.org/rBd0e3388848a66eb4ca2f7e16278fabd5832e568a

Cleanup: Simplify logic building in length parameterization

We can construct an IndexRange directly rather than retrieving it.

===

M   source/blender/blenlib/intern/length_parameterize.cc

===

diff --git a/source/blender/blenlib/intern/length_parameterize.cc 
b/source/blender/blenlib/intern/length_parameterize.cc
index 7c0fc860b53..e18b048e96d 100644
--- a/source/blender/blenlib/intern/length_parameterize.cc
+++ b/source/blender/blenlib/intern/length_parameterize.cc
@@ -47,7 +47,7 @@ void create_uniform_samples(const Span lengths,
 const int segment_samples_num = std::ceil(next_length * step_length_inv - 
i_dst);
 indices.slice(i_dst, segment_samples_num).fill(i_src);
 
-for (const int i : factors.index_range().slice(i_dst, 
segment_samples_num)) {
+for (const int i : IndexRange(i_dst, segment_samples_num)) {
   const float length_in_segment = step_length * i - prev_length;
   factors[i] = length_in_segment * segment_length_inv;
 }

___
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] [da00d62c491] master: Fix crash with window decorations (libdecor) in Wayland

2022-07-01 Thread Campbell Barton
Commit: da00d62c4913a71e116f74f874d7a17cfee9c14e
Author: Campbell Barton
Date:   Fri Jul 1 22:45:10 2022 +1000
Branches: master
https://developer.blender.org/rBda00d62c4913a71e116f74f874d7a17cfee9c14e

Fix crash with window decorations (libdecor) in Wayland

Surfaces from window decorations were passed into GHOST's listeners
since libdecor & GHOST share a connection.

This error introduced by recent changes that assumed surfaces passed to
GHOST's handler functions were owned by GHOST.

Tag GHOST surfaces & outputs to ensure GHOST only attempts to access
data it created.

===

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

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 6a419fc718d..c360423c256 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -786,7 +786,7 @@ static void relative_pointer_handle_relative_motion(
 {
   input_t *input = static_cast(data);
   if (wl_surface *focus_surface = input->pointer.wl_surface) {
-GHOST_WindowWayland *win = 
GHOST_WindowWayland::from_surface_mut(focus_surface);
+GHOST_WindowWayland *win = ghost_wl_surface_user_data(focus_surface);
 const wl_fixed_t scale = win->scale();
 const wl_fixed_t xy_next[2] = {
 input->pointer.xy[0] + (dx / scale),
@@ -810,7 +810,7 @@ static void dnd_events(const input_t *const input, const 
GHOST_TEventType event)
 {
   /* NOTE: `input->data_offer_dnd_mutex` must already be locked. */
   if (wl_surface *focus_surface = input->focus_dnd) {
-GHOST_WindowWayland *win = 
GHOST_WindowWayland::from_surface_mut(focus_surface);
+GHOST_WindowWayland *win = ghost_wl_surface_user_data(focus_surface);
 const wl_fixed_t scale = win->scale();
 const int event_xy[2] = {
 wl_fixed_to_int(scale * input->data_offer_dnd->dnd.xy[0]),
@@ -992,6 +992,10 @@ static void data_device_handle_enter(void *data,
  const wl_fixed_t y,
  struct wl_data_offer *id)
 {
+  if (!ghost_wl_surface_own(surface)) {
+return;
+  }
+
   input_t *input = static_cast(data);
   std::lock_guard lock{input->data_offer_dnd_mutex};
 
@@ -1077,9 +1081,7 @@ static void data_device_handle_drop(void *data, struct 
wl_data_device * /*wl_dat
   static constexpr const char *file_proto = "file://";
   static constexpr const char *crlf = "\r\n";
 
-  GHOST_WindowWayland *win = 
GHOST_WindowWayland::from_surface_find(surface);
-  GHOST_ASSERT(win != nullptr, "Unable to find window for drop event from 
surface");
-
+  GHOST_WindowWayland *win = ghost_wl_surface_user_data(surface);
   std::vector uris;
 
   size_t pos = 0;
@@ -1238,12 +1240,13 @@ static void cursor_surface_handle_enter(void *data,
 struct wl_surface * /*wl_surface*/,
 struct wl_output *output)
 {
-  input_t *input = static_cast(data);
-  for (const output_t *reg_output : input->system->outputs()) {
-if (reg_output->wl_output == output) {
-  input->cursor.outputs.insert(reg_output);
-}
+  if (!ghost_wl_output_own(output)) {
+return;
   }
+
+  input_t *input = static_cast(data);
+  const output_t *reg_output = ghost_wl_output_user_data(output);
+  input->cursor.outputs.insert(reg_output);
   update_cursor_scale(input->cursor, input->system->shm());
 }
 
@@ -1251,12 +1254,13 @@ static void cursor_surface_handle_leave(void *data,
 struct wl_surface * /*wl_surface*/,
 struct wl_output *output)
 {
-  input_t *input = static_cast(data);
-  for (const output_t *reg_output : input->system->outputs()) {
-if (reg_output->wl_output == output) {
-  input->cursor.outputs.erase(reg_output);
-}
+  if (!(output && ghost_wl_output_own(output))) {
+return;
   }
+
+  input_t *input = static_cast(data);
+  const output_t *reg_output = ghost_wl_output_user_data(output);
+  input->cursor.outputs.erase(reg_output);
   update_cursor_scale(input->cursor, input->system->shm());
 }
 
@@ -1278,7 +1282,11 @@ static void pointer_handle_enter(void *data,
  const wl_fixed_t surface_x,
  const wl_fixed_t surface_y)
 {
-  GHOST_WindowWayland *win = GHOST_WindowWayland::from_surface_mut(surface);
+  if (!ghost_wl_surface_own(surface)) {
+return;
+  }
+
+  GHOST_WindowWayland *win = ghost_wl_surface_user_data(surface);
 
   win->activate();
 
@@ -1307,8 +1315,8 @@ static void pointer_handle_leave(void *data,
 {
   /* First clear the `pointer.wl_surface`, since the win

[Bf-blender-cvs] [56b218296c2] master: Fix T99268: LineArt better handling for dense overlappings.

2022-07-01 Thread Yiming Wu
Commit: 56b218296c228acbe00940d50336a3b6f0df2915
Author: Yiming Wu
Date:   Fri Jul 1 16:55:15 2022 +0800
Branches: master
https://developer.blender.org/rB56b218296c228acbe00940d50336a3b6f0df2915

Fix T99268: LineArt better handling for dense overlappings.

Two main fixes:
- Split tiles only when we are more sure that it will improve distribution.
- Discard edges and chains that are not gonna be used afterwards before 
chaining.

This speeds up the whole process and also eliminates unnecessary tile splitting.

Reviewed By: Sebastian Parborg (zeddb)

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

===

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

===

diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h 
b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index d7005a4bc61..5dd833fb12b 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -549,7 +549,7 @@ typedef struct LineartBoundingArea {
   uint32_t max_triangle_count;
   uint32_t line_count;
   uint32_t max_line_count;
-  uint32_t user_count;
+  uint32_t insider_triangle_count;
 
   /* Use array for speeding up multiple accesses. */
   struct LineartTriangle **linked_triangles;
@@ -845,7 +845,7 @@ void 
MOD_lineart_chain_split_for_fixed_occlusion(LineartData *ld);
  * implemented yet.
  */
 void MOD_lineart_chain_connect(LineartData *ld);
-void MOD_lineart_chain_discard_short(LineartData *ld, float threshold);
+void MOD_lineart_chain_discard_unused(LineartData *ld, float threshold, 
uint8_t max_occlusion);
 void MOD_lineart_chain_clip_at_border(LineartData *ld);
 /**
  * This should always be the last stage!, see the end of
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
index 988698771bf..7c8e0c5a6f5 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c
@@ -725,8 +725,9 @@ void 
MOD_lineart_chain_split_for_fixed_occlusion(LineartData *ld)
   }
 }
   }
-  /* Get rid of those very short "zig-zag" lines that jumps around visibility. 
*/
-  MOD_lineart_chain_discard_short(ld, DBL_EDGE_LIM);
+
+  MOD_lineart_chain_discard_unused(ld, DBL_EDGE_LIM, 
ld->conf.max_occlusion_level);
+
   LISTBASE_FOREACH (LineartEdgeChain *, iec, &ld->chains) {
 lineart_bounding_area_link_chain(ld, iec);
   }
@@ -1018,12 +1019,14 @@ float MOD_lineart_chain_compute_length(LineartEdgeChain 
*ec)
   return offset_accum;
 }
 
-void MOD_lineart_chain_discard_short(LineartData *ld, const float threshold)
+void MOD_lineart_chain_discard_unused(LineartData *ld,
+  const float threshold,
+  uint8_t max_occlusion)
 {
   LineartEdgeChain *ec, *next_ec;
   for (ec = ld->chains.first; ec; ec = next_ec) {
 next_ec = ec->next;
-if (MOD_lineart_chain_compute_length(ec) < threshold) {
+if (ec->level > max_occlusion || MOD_lineart_chain_compute_length(ec) < 
threshold) {
   BLI_remlink(&ld->chains, ec);
 }
   }
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c 
b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 236e2df1537..874da3b88c9 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -494,10 +494,10 @@ static bool lineart_point_inside_triangle(const double 
v[2],
   const double v1[2],
   const double v2[2])
 {
-  double cl, c;
+  double cl, c, cl0;
 
   cl = (v0[0] - v[0]) * (v1[1] - v[1]) - (v0[1] - v[1]) * (v1[0] - v[0]);
-  c = cl;
+  c = cl0 = cl;
 
   cl = (v1[0] - v[0]) * (v2[1] - v[1]) - (v1[1] - v[1]) * (v2[0] - v[0]);
   if (c * cl <= 0) {
@@ -513,8 +513,7 @@ static bool lineart_point_inside_triangle(const double v[2],
 
   c = cl;
 
-  cl = (v0[0] - v[0]) * (v1[1] - v[1]) - (v0[1] - v[1]) * (v1[0] - v[0]);
-  if (c * cl <= 0) {
+  if (c * cl0 <= 0) {
 return false;
   }
 
@@ -3972,7 +3971,7 @@ static void lineart_bounding_area_split(LineartData *ld,
 BLI_spin_init(&ba[i].lock);
   }
 
-  for (int i = 0; i < root->triangle_count; i++) {
+  for (uint32_t i = 0; i < root->triangle_count; i++) {
 LineartTriangle *tri = root->linked_triangles[i];
 
 double b[4];
@@ -4011,10 +4010,8 @@ static bool 
lineart_bounding_area_edge_intersect(LineartData *UNUSED(fb),
   double converted[4];
   double c1, c;
 
-  if (((converted[0] = (double)ba->l) > MAX

[Bf-blender-cvs] [ce9b36cb7d5] temp-T95933-object-mode-curve-selection: Always offset the outline with a single pixel.

2022-07-01 Thread Jeroen Bakker
Commit: ce9b36cb7d551b6f55fcb542a7da52958c922b73
Author: Jeroen Bakker
Date:   Fri Jul 1 13:26:11 2022 +0200
Branches: temp-T95933-object-mode-curve-selection
https://developer.blender.org/rBce9b36cb7d551b6f55fcb542a7da52958c922b73

Always offset the outline with a single pixel.

===

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

===

diff --git 
a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
 
b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
index 8dc240996ed..6ee32c37b27 100644
--- 
a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
+++ 
b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
@@ -55,10 +55,9 @@ void main()
 pos_ndc = point_world_to_ndc(world_pos);
 vec4 orig_pos_ndc = point_world_to_ndc(center_world_pos);
 vec4 d = pos_ndc - orig_pos_ndc;
-float distance = max(length(d.xy),
- (drw_view.viewport_size_inverse.x * 
drw_view.wininv[0][0] +
-  drw_view.viewport_size_inverse.y * 
drw_view.wininv[1][1]) /
- 2.0);
+float distance = (length(d.xy) + (drw_view.viewport_size_inverse.x * 
drw_view.wininv[0][0] +
+  drw_view.viewport_size_inverse.y * 
drw_view.wininv[1][1]) /
+ 2.0);
 pos_ndc = orig_pos_ndc + distance * normalize(d);
   }
   else {

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


[Bf-blender-cvs] [1f47e3b49cd] temp-T95933-object-mode-curve-selection: Viewport size aware.

2022-07-01 Thread Jeroen Bakker
Commit: 1f47e3b49cd7be838b8d730912d05c6e87897cf6
Author: Jeroen Bakker
Date:   Fri Jul 1 13:19:27 2022 +0200
Branches: temp-T95933-object-mode-curve-selection
https://developer.blender.org/rB1f47e3b49cd7be838b8d730912d05c6e87897cf6

Viewport size aware.

===

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

===

diff --git 
a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
 
b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
index 6b57cb27169..8dc240996ed 100644
--- 
a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
+++ 
b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
@@ -45,23 +45,24 @@ void main()
  thickness,
  thick_time);
 
-  vec4 pos_ndc = point_world_to_ndc(world_pos);
+  vec4 pos_ndc;
 
   if (hairThicknessRes > 1) {
 if (thick_time == 0.0) {
-  float thick_time = ((gl_VertexID % hairThicknessRes) == 0 ? -1.0 : 1.0) 
* 0.0001;
+  float thick_time = ((gl_VertexID % hairThicknessRes) == 0 ? -1.0 : 1.0) 
* 0.1;
   world_pos = center_world_pos + binor * thick_time;
 }
-vec3 pos_view = point_world_to_view(world_pos);
-vec3 orig_pos_view = point_world_to_view(center_world_pos);
-vec3 d = pos_view - orig_pos_view;
-/* TODO: make screen size aware. */
-float distance = length(d.xy);
-if (distance < 0.0001) {
-  distance = 0.0001;
-}
-pos_view = orig_pos_view + distance * normalize(d);
-pos_ndc = point_view_to_ndc(pos_view);
+pos_ndc = point_world_to_ndc(world_pos);
+vec4 orig_pos_ndc = point_world_to_ndc(center_world_pos);
+vec4 d = pos_ndc - orig_pos_ndc;
+float distance = max(length(d.xy),
+ (drw_view.viewport_size_inverse.x * 
drw_view.wininv[0][0] +
+  drw_view.viewport_size_inverse.y * 
drw_view.wininv[1][1]) /
+ 2.0);
+pos_ndc = orig_pos_ndc + distance * normalize(d);
+  }
+  else {
+pos_ndc = point_world_to_ndc(world_pos);
   }
 
   gl_Position = pos_ndc;

___
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] [5e5fe217caa] master: Cleanup: rename internal cursor grabbing function

2022-07-01 Thread Campbell Barton
Commit: 5e5fe217caaed35d6a39744d4f22b38793beae8f
Author: Campbell Barton
Date:   Fri Jul 1 20:35:11 2022 +1000
Branches: master
https://developer.blender.org/rB5e5fe217caaed35d6a39744d4f22b38793beae8f

Cleanup: rename internal cursor grabbing function

This function was named as if it was part of GHOST's API but was
in fact an internal utility.

===

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

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 09784c67fda..6a419fc718d 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -3281,10 +3281,106 @@ static input_grab_state_t 
input_grab_state_from_mode(const GHOST_TGrabCursorMode
   return grab_state;
 }
 
-GHOST_TSuccess GHOST_SystemWayland::setCursorGrab(const GHOST_TGrabCursorMode 
mode,
-  const GHOST_TGrabCursorMode 
mode_current,
-  int32_t init_grab_xy[2],
-  wl_surface *surface)
+/** \} */
+
+/*  */
+/** \name Public WAYLAND Direct Data Access
+ *
+ * Expose some members via methods.
+ * \{ */
+
+wl_display *GHOST_SystemWayland::display()
+{
+  return d->display;
+}
+
+wl_compositor *GHOST_SystemWayland::compositor()
+{
+  return d->compositor;
+}
+
+#ifdef WITH_GHOST_WAYLAND_LIBDECOR
+
+libdecor *GHOST_SystemWayland::decor_context()
+{
+  return d->decor_context;
+}
+
+#else /* WITH_GHOST_WAYLAND_LIBDECOR */
+
+xdg_wm_base *GHOST_SystemWayland::xdg_shell()
+{
+  return d->xdg_shell;
+}
+
+zxdg_decoration_manager_v1 *GHOST_SystemWayland::xdg_decoration_manager()
+{
+  return d->xdg_decoration_manager;
+}
+
+#endif /* !WITH_GHOST_WAYLAND_LIBDECOR */
+
+const std::vector &GHOST_SystemWayland::outputs() const
+{
+  return d->outputs;
+}
+
+wl_shm *GHOST_SystemWayland::shm() const
+{
+  return d->shm;
+}
+
+/** \} */
+
+/*  */
+/** \name Public WAYLAND Query Access
+ * \{ */
+
+output_t *GHOST_SystemWayland::output_find_by_wl(const struct wl_output 
*output) const
+{
+  for (output_t *reg_output : this->outputs()) {
+if (reg_output->wl_output == output) {
+  return reg_output;
+}
+  }
+  return nullptr;
+}
+
+/** \} */
+
+/*  */
+/** \name Public WAYLAND Utility Functions
+ *
+ * Functionality only used for the WAYLAND implementation.
+ * \{ */
+
+void GHOST_SystemWayland::selection_set(const std::string &selection)
+{
+  this->selection = selection;
+}
+
+void GHOST_SystemWayland::window_surface_unref(const wl_surface *surface)
+{
+#define SURFACE_CLEAR_PTR(surface_test) \
+  if (surface_test == surface) { \
+surface_test = nullptr; \
+  } \
+  ((void)0);
+
+  /* Only clear window surfaces (not cursors, off-screen surfaces etc). */
+  for (input_t *input : d->inputs) {
+SURFACE_CLEAR_PTR(input->pointer.wl_surface);
+SURFACE_CLEAR_PTR(input->tablet.wl_surface);
+SURFACE_CLEAR_PTR(input->keyboard.wl_surface);
+SURFACE_CLEAR_PTR(input->focus_dnd);
+  }
+#undef SURFACE_CLEAR_PTR
+}
+
+bool GHOST_SystemWayland::window_cursor_grab_set(const GHOST_TGrabCursorMode 
mode,
+ const GHOST_TGrabCursorMode 
mode_current,
+ int32_t init_grab_xy[2],
+ wl_surface *surface)
 {
   /* Ignore, if the required protocols are not supported. */
   if (!d->relative_pointer_manager || !d->pointer_constraints) {
@@ -3461,99 +3557,3 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorGrab(const 
GHOST_TGrabCursorMode mo
 }
 
 /** \} */
-
-/*  */
-/** \name Public WAYLAND Direct Data Access
- *
- * Expose some members via methods.
- * \{ */
-
-wl_display *GHOST_SystemWayland::display()
-{
-  return d->display;
-}
-
-wl_compositor *GHOST_SystemWayland::compositor()
-{
-  return d->compositor;
-}
-
-#ifdef WITH_GHOST_WAYLAND_LIBDECOR
-
-libdecor *GHOST_SystemWayland::decor_context()
-{
-  return d->decor_context;
-}
-
-#else /* WITH_GHOST_WAYLAND_LIBDECOR */
-
-xdg_wm_base *GHOST_SystemWayland::xdg_shell()
-{
-  return d->xdg_shell;
-}
-
-zxdg_decoration_manager_v1 *GHOST_SystemWayland::xdg_decoration_manager()
-{
-  return d->xdg_decoration_manager;
-}
-
-#endif /* !WITH_GHOST_WAYLAND_LIBDECOR */
-
-const std::vector &GHOST_SystemWayland::outputs() const
-{
-  return d->outputs;
-}
-
-wl_shm *GHOST_SystemWayland::shm() const
-{
-  return d->shm;
-}
-
-/** \} *

[Bf-blender-cvs] [b683a37824a] master: Fix T99301: RNA_boolean_get warning when saving a file for the first time

2022-07-01 Thread Campbell Barton
Commit: b683a37824aa2fb22efe22a1dbce667b8155698f
Author: Campbell Barton
Date:   Fri Jul 1 20:52:00 2022 +1000
Branches: master
https://developer.blender.org/rBb683a37824aa2fb22efe22a1dbce667b8155698f

Fix T99301: RNA_boolean_get warning when saving a file for the first time

Caused by [0], RNA_struct_property_is_set also functioned to check if
the property existed.

[0]: 6a2c42a0d58e0f36cca1cf4ca0c5c98ec3612f6f

===

M   source/blender/windowmanager/intern/wm_files.c

===

diff --git a/source/blender/windowmanager/intern/wm_files.c 
b/source/blender/windowmanager/intern/wm_files.c
index 5f4c39e33f7..a4d5bed21da 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -3063,7 +3063,7 @@ static int wm_save_as_mainfile_exec(bContext *C, 
wmOperator *op)
   Main *bmain = CTX_data_main(C);
   char path[FILE_MAX];
   const bool is_save_as = (op->type->invoke == wm_save_as_mainfile_invoke);
-  const bool use_save_as_copy = RNA_boolean_get(op->ptr, "copy");
+  const bool use_save_as_copy = is_save_as && RNA_boolean_get(op->ptr, "copy");
 
   /* We could expose all options to the users however in most cases remapping
* existing relative paths is a good default.

___
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] [18c0ec80c90] temp-T95933-object-mode-curve-selection: Merge branch 'master' into temp-T95933-object-mode-curve-selection

2022-07-01 Thread Jeroen Bakker
Commit: 18c0ec80c900ab39c5567415fbe143f45ab7c2f1
Author: Jeroen Bakker
Date:   Fri Jul 1 09:02:45 2022 +0200
Branches: temp-T95933-object-mode-curve-selection
https://developer.blender.org/rB18c0ec80c900ab39c5567415fbe143f45ab7c2f1

Merge branch 'master' into temp-T95933-object-mode-curve-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] [19c9b054419] temp-T95933-object-mode-curve-selection: Removed hack where thick_time was in world space (shading artifacts).

2022-07-01 Thread Jeroen Bakker
Commit: 19c9b054419e8db0e2474edc2a93f73c081b555f
Author: Jeroen Bakker
Date:   Fri Jul 1 09:22:49 2022 +0200
Branches: temp-T95933-object-mode-curve-selection
https://developer.blender.org/rB19c9b054419e8db0e2474edc2a93f73c081b555f

Removed hack where thick_time was in world space (shading artifacts).

===

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

===

diff --git a/source/blender/draw/intern/shaders/common_hair_lib.glsl 
b/source/blender/draw/intern/shaders/common_hair_lib.glsl
index 097a1af0fea..3ffd15b32e7 100644
--- a/source/blender/draw/intern/shaders/common_hair_lib.glsl
+++ b/source/blender/draw/intern/shaders/common_hair_lib.glsl
@@ -203,22 +203,22 @@ void hair_get_pos_tan_binor_time_ex(bool is_persp,
   wbinor = normalize(cross(camera_vec, wtan));
 
   thickness = hair_shaperadius(hairRadShape, hairRadRoot, hairRadTip, time);
-
+  float scale;
   if (hairThicknessRes > 1) {
 thick_time = float(gl_VertexID % hairThicknessRes) / 
float(hairThicknessRes - 1);
 thick_time = thickness * (thick_time * 2.0 - 1.0);
 
 /* Take object scale into account.
  * NOTE: This only works fine with uniform scaling. */
-float scale = 1.0 / length(mat3(invmodel_mat) * wbinor);
-thick_time *= scale;  // HACK: thick_time is now in world space...
+scale = 1.0 / length(mat3(invmodel_mat) * wbinor);
   }
   else {
 /* NOTE: Ensures 'hairThickTime' is initialized -
  * avoids undefined behavior on certain macOS configurations. */
 thick_time = 0.0;
+scale = 1.0;
   }
-  wpos = orig_wpos + wbinor * thick_time;
+  wpos = orig_wpos + wbinor * thick_time * scale;
 }
 
 void hair_get_pos_tan_binor_time(bool is_persp,

___
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] [e82f59eaa91] gpencil-new-data-proposal: Merge branch 'master' into gpencil-new-data-proposal

2022-07-01 Thread Antonio Vazquez
Commit: e82f59eaa91994467f6d081ecb3697e58159c7db
Author: Antonio Vazquez
Date:   Fri Jul 1 11:36:26 2022 +0200
Branches: gpencil-new-data-proposal
https://developer.blender.org/rBe82f59eaa91994467f6d081ecb3697e58159c7db

Merge branch 'master' into gpencil-new-data-proposal

===



===



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


[Bf-blender-cvs] [f4e396584fc] epoxy: Cycles: replace GLEW by libepoxy

2022-07-01 Thread Christian Rauch
Commit: f4e396584fc10cb4ad08239647a9a15d14b4d69e
Author: Christian Rauch
Date:   Sat Jun 25 03:29:57 2022 +0100
Branches: epoxy
https://developer.blender.org/rBf4e396584fc10cb4ad08239647a9a15d14b4d69e

Cycles: replace GLEW by libepoxy

===

M   intern/cycles/app/opengl/display_driver.cpp
M   intern/cycles/app/opengl/shader.cpp
M   intern/cycles/app/opengl/window.cpp
M   intern/cycles/hydra/display_driver.cpp
M   intern/cycles/util/opengl.h

===

diff --git a/intern/cycles/app/opengl/display_driver.cpp 
b/intern/cycles/app/opengl/display_driver.cpp
index 8b99f3b6feb..d9c72c07ae4 100644
--- a/intern/cycles/app/opengl/display_driver.cpp
+++ b/intern/cycles/app/opengl/display_driver.cpp
@@ -7,8 +7,8 @@
 #include "util/log.h"
 #include "util/string.h"
 
-#include 
 #include 
+#include 
 
 CCL_NAMESPACE_BEGIN
 
diff --git a/intern/cycles/app/opengl/shader.cpp 
b/intern/cycles/app/opengl/shader.cpp
index 9db9ea7fce9..4d22fc2b763 100644
--- a/intern/cycles/app/opengl/shader.cpp
+++ b/intern/cycles/app/opengl/shader.cpp
@@ -6,7 +6,7 @@
 #include "util/log.h"
 #include "util/string.h"
 
-#include 
+#include 
 
 CCL_NAMESPACE_BEGIN
 
diff --git a/intern/cycles/app/opengl/window.cpp 
b/intern/cycles/app/opengl/window.cpp
index 7351ae3eecd..f3352decd08 100644
--- a/intern/cycles/app/opengl/window.cpp
+++ b/intern/cycles/app/opengl/window.cpp
@@ -11,8 +11,8 @@
 #include "util/time.h"
 #include "util/version.h"
 
-#include 
 #include 
+#include 
 
 CCL_NAMESPACE_BEGIN
 
@@ -294,7 +294,6 @@ void window_main_loop(const char *title,
   SDL_RaiseWindow(V.window);
 
   V.gl_context = SDL_GL_CreateContext(V.window);
-  glewInit();
   SDL_GL_MakeCurrent(V.window, nullptr);
 
   window_reshape(width, height);
diff --git a/intern/cycles/hydra/display_driver.cpp 
b/intern/cycles/hydra/display_driver.cpp
index 0c0b577c358..1a989605335 100644
--- a/intern/cycles/hydra/display_driver.cpp
+++ b/intern/cycles/hydra/display_driver.cpp
@@ -11,7 +11,7 @@
 #include "hydra/render_buffer.h"
 #include "hydra/session.h"
 
-#include 
+#include 
 #include 
 
 HDCYCLES_NAMESPACE_OPEN_SCOPE
diff --git a/intern/cycles/util/opengl.h b/intern/cycles/util/opengl.h
index 090deb861c4..fefee4ec022 100644
--- a/intern/cycles/util/opengl.h
+++ b/intern/cycles/util/opengl.h
@@ -7,6 +7,6 @@
 /* OpenGL header includes, used everywhere we use OpenGL, to deal with
  * platform differences in one central place. */
 
-#include 
+#include 
 
 #endif /* __UTIL_OPENGL_H__ */

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


[Bf-blender-cvs] [65d730df051] epoxy: OpenSubdiv: replace GLEW by libepoxy

2022-07-01 Thread Christian Rauch
Commit: 65d730df051844483f039e94b1f55964ef0b1eb1
Author: Christian Rauch
Date:   Sat Jun 25 01:56:47 2022 +0100
Branches: epoxy
https://developer.blender.org/rB65d730df051844483f039e94b1f55964ef0b1eb1

OpenSubdiv: replace GLEW by libepoxy

===

M   intern/opensubdiv/internal/device/device_context_glsl_compute.cc
M   
intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.cc
M   intern/opensubdiv/internal/evaluator/eval_output.h
M   intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc
M   intern/opensubdiv/internal/evaluator/gl_compute_evaluator.h

===

diff --git a/intern/opensubdiv/internal/device/device_context_glsl_compute.cc 
b/intern/opensubdiv/internal/device/device_context_glsl_compute.cc
index 7b416976099..5e627e290f5 100644
--- a/intern/opensubdiv/internal/device/device_context_glsl_compute.cc
+++ b/intern/opensubdiv/internal/device/device_context_glsl_compute.cc
@@ -18,14 +18,14 @@
 
 #include "internal/device/device_context_glsl_compute.h"
 
-#include 
+#include 
 
 namespace blender {
 namespace opensubdiv {
 
 bool GLSLComputeDeviceContext::isSupported()
 {
-  return GLEW_VERSION_4_3 || GLEW_ARB_compute_shader;
+  return epoxy_gl_version() >= 43 || 
epoxy_has_gl_extension("GL_ARB_compute_shader");
 }
 
 GLSLComputeDeviceContext::GLSLComputeDeviceContext()
diff --git 
a/intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.cc 
b/intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.cc
index ef897608b6e..1768da8e9d4 100644
--- 
a/intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.cc
+++ 
b/intern/opensubdiv/internal/device/device_context_glsl_transform_feedback.cc
@@ -18,14 +18,14 @@
 
 #include "internal/device/device_context_glsl_transform_feedback.h"
 
-#include 
+#include 
 
 namespace blender {
 namespace opensubdiv {
 
 bool GLSLTransformFeedbackDeviceContext::isSupported()
 {
-  return GLEW_VERSION_4_1;
+  return epoxy_gl_version() >= 41;
 }
 
 GLSLTransformFeedbackDeviceContext::GLSLTransformFeedbackDeviceContext()
diff --git a/intern/opensubdiv/internal/evaluator/eval_output.h 
b/intern/opensubdiv/internal/evaluator/eval_output.h
index e8480e8d816..286ffaafecb 100644
--- a/intern/opensubdiv/internal/evaluator/eval_output.h
+++ b/intern/opensubdiv/internal/evaluator/eval_output.h
@@ -19,6 +19,8 @@
 #ifndef OPENSUBDIV_EVAL_OUTPUT_H_
 #define OPENSUBDIV_EVAL_OUTPUT_H_
 
+#undef OSD_USES_GLEW
+
 #include 
 #include 
 #include 
diff --git a/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc 
b/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc
index c2ab2a522d2..df747e23d2a 100644
--- a/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc
+++ b/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.cc
@@ -22,9 +22,9 @@
 //   language governing permissions and limitations under the Apache License.
 //
 
-#include "gl_compute_evaluator.h"
+#include 
 
-#include 
+#include "gl_compute_evaluator.h"
 
 #include 
 #include 
@@ -57,7 +57,7 @@ template GLuint createSSBO(std::vector const &src)
   GLuint devicePtr = 0;
 
 #if defined(GL_ARB_direct_state_access)
-  if (GLEW_ARB_direct_state_access) {
+  if (epoxy_has_gl_extension("GL_ARB_direct_state_access")) {
 glCreateBuffers(1, &devicePtr);
 glNamedBufferData(devicePtr, src.size() * sizeof(T), &src.at(0), 
GL_STATIC_DRAW);
   }
diff --git a/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.h 
b/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.h
index 85c12f73b08..07d13aa21bd 100644
--- a/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.h
+++ b/intern/opensubdiv/internal/evaluator/gl_compute_evaluator.h
@@ -25,6 +25,8 @@
 #ifndef OPENSUBDIV_GL_COMPUTE_EVALUATOR_H_
 #define OPENSUBDIV_GL_COMPUTE_EVALUATOR_H_
 
+#undef OSD_USES_GLEW
+
 #include 
 #include 
 #include 

___
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] [bfce13dc43b] epoxy: WGL: replace GLEW by libepoxy

2022-07-01 Thread Christian Rauch
Commit: bfce13dc43b97afa56e7c1513badc9c2ad457a49
Author: Christian Rauch
Date:   Wed Jun 29 18:45:41 2022 +0100
Branches: epoxy
https://developer.blender.org/rBbfce13dc43b97afa56e7c1513badc9c2ad457a49

WGL: replace GLEW by libepoxy

===

M   intern/ghost/intern/GHOST_Context.cpp
M   intern/ghost/intern/GHOST_ContextD3D.cpp
M   intern/ghost/intern/GHOST_ContextWGL.cpp
M   intern/ghost/intern/GHOST_ContextWGL.h

===

diff --git a/intern/ghost/intern/GHOST_Context.cpp 
b/intern/ghost/intern/GHOST_Context.cpp
index fb89df9f73f..689b3240da3 100644
--- a/intern/ghost/intern/GHOST_Context.cpp
+++ b/intern/ghost/intern/GHOST_Context.cpp
@@ -10,7 +10,7 @@
 #include "GHOST_Context.h"
 
 #ifdef _WIN32
-#  include   // only for symbolic constants, do not use API 
functions
+#  include 
 #  include 
 #
 #  ifndef ERROR_PROFILE_DOES_NOT_MATCH_DEVICE
diff --git a/intern/ghost/intern/GHOST_ContextD3D.cpp 
b/intern/ghost/intern/GHOST_ContextD3D.cpp
index ded76daa145..4fc05cf912c 100644
--- a/intern/ghost/intern/GHOST_ContextD3D.cpp
+++ b/intern/ghost/intern/GHOST_ContextD3D.cpp
@@ -10,8 +10,7 @@
 #include 
 #include 
 
-#include 
-#include 
+#include 
 
 #include "GHOST_ContextD3D.h"
 #include "GHOST_ContextWGL.h" /* For shared drawing */
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp 
b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 7417358e9ae..ac56ed45fcb 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -87,7 +87,7 @@ GHOST_TSuccess GHOST_ContextWGL::swapBuffers()
 
 GHOST_TSuccess GHOST_ContextWGL::setSwapInterval(int interval)
 {
-  if (WGLEW_EXT_swap_control)
+  if (epoxy_has_wgl_extension(m_hDC, "WGL_EXT_swap_control"))
 return WIN32_CHK(::wglSwapIntervalEXT(interval)) == TRUE ? GHOST_kSuccess 
: GHOST_kFailure;
   else
 return GHOST_kFailure;
@@ -95,7 +95,7 @@ GHOST_TSuccess GHOST_ContextWGL::setSwapInterval(int interval)
 
 GHOST_TSuccess GHOST_ContextWGL::getSwapInterval(int &intervalOut)
 {
-  if (WGLEW_EXT_swap_control) {
+  if (epoxy_has_wgl_extension(m_hDC, "WGL_EXT_swap_control")) {
 intervalOut = ::wglGetSwapIntervalEXT();
 return GHOST_kSuccess;
   }
@@ -266,7 +266,7 @@ static HWND clone_window(HWND hWnd, LPVOID lpParam)
   return hwndCloned;
 }
 
-void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
+void GHOST_ContextWGL::initContext(PIXELFORMATDESCRIPTOR &preferredPFD)
 {
   HWND dummyHWND = NULL;
 
@@ -319,12 +319,6 @@ void 
GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
   if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC)))
 goto finalize;
 
-  if (GLEW_CHK(glewInit()) != GLEW_OK) {
-fprintf(stderr, "Warning! Dummy GLEW/WGLEW failed to initialize 
properly.\n");
-  }
-
-  /* The following are not technically WGLEW, but they also require a context 
to work. */
-
 #ifndef NDEBUG
   free((void *)m_dummyRenderer);
   free((void *)m_dummyVendor);
@@ -493,11 +487,11 @@ int GHOST_ContextWGL::choose_pixel_format(bool 
stereoVisual, bool needAlpha)
   0 /* layer, visible, and damage masks (ignored) */
   };
 
-  initContextWGLEW(preferredPFD);
+  initContext(preferredPFD);
 
   int iPixelFormat = 0;
 
-  if (WGLEW_ARB_pixel_format)
+  if (epoxy_has_wgl_extension(m_hDC, "WGL_ARB_pixel_format"))
 iPixelFormat = choose_pixel_format_arb(stereoVisual, needAlpha);
 
   if (iPixelFormat == 0)
@@ -526,7 +520,7 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
   HDC prevHDC = ::wglGetCurrentDC();
   WIN32_CHK(GetLastError() == NO_ERROR);
 
-  if (!WGLEW_ARB_create_context || ::GetPixelFormat(m_hDC) == 0) {
+  if (!epoxy_has_wgl_extension(m_hDC, "WGL_ARB_create_context") || 
::GetPixelFormat(m_hDC) == 0) {
 const bool needAlpha = m_alphaBackground;
 int iPixelFormat;
 int lastPFD;
@@ -554,41 +548,24 @@ GHOST_TSuccess 
GHOST_ContextWGL::initializeDrawingContext()
 }
   }
 
-  if (WGLEW_ARB_create_context) {
+  if (epoxy_has_wgl_extension(m_hDC, "WGL_ARB_create_context")) {
 int profileBitCore = m_contextProfileMask & 
WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
 int profileBitCompat = m_contextProfileMask & 
WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
 
-#ifdef WITH_GLEW_ES
-int profileBitES = m_contextProfileMask & WGL_CONTEXT_ES_PROFILE_BIT_EXT;
-#endif
-
-if (!WGLEW_ARB_create_context_profile && profileBitCore)
+if (!epoxy_has_wgl_extension(m_hDC, "WGL_ARB_create_context_profile") && 
profileBitCore)
   fprintf(stderr, "Warning! OpenGL core profile not available.\n");
 
-if (!WGLEW_ARB_create_context_profile && profileBitCompat)
+if (!epoxy_has_wgl_extension(m_hDC, "WGL_ARB_create_context_profile") && 
profileBitCompat)
   fprintf(stderr, "Warning! OpenGL compatibility profile not 
available.\n");
 
-#ifdef WITH_GLEW_ES
-if (!WGLEW_EXT_create_context_es_profile && profileBit

[Bf-blender-cvs] [1f31269f30e] epoxy: move epoxy discovery to platform scripts

2022-07-01 Thread Brecht Van Lommel
Commit: 1f31269f30eddafe9917328480fcd7a100b01f17
Author: Brecht Van Lommel
Date:   Wed Jun 29 18:31:07 2022 +0100
Branches: epoxy
https://developer.blender.org/rB1f31269f30eddafe9917328480fcd7a100b01f17

move epoxy discovery to platform scripts

===

M   CMakeLists.txt
M   build_files/cmake/platform/platform_apple.cmake
M   build_files/cmake/platform/platform_unix.cmake
M   build_files/cmake/platform/platform_win32.cmake
M   intern/cycles/app/CMakeLists.txt
M   intern/cycles/blender/CMakeLists.txt
M   intern/cycles/cmake/external_libs.cmake
M   intern/cycles/device/hip/device_impl.cpp
M   intern/cycles/hydra/CMakeLists.txt
M   intern/ghost/CMakeLists.txt
M   intern/opencolorio/CMakeLists.txt
M   intern/opensubdiv/CMakeLists.txt
M   source/blender/gpu/CMakeLists.txt
M   source/blender/python/generic/CMakeLists.txt
M   source/blender/python/gpu/CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ac524619809..0619cc11211 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1320,12 +1320,6 @@ else()
   list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_CORE)
 endif()
 
-# link libepoxy
-set(EPOXY_ROOT_DIR ${LIBDIR}/libepoxy)
-find_package(LibEpoxy REQUIRED)
-list(APPEND BLENDER_GL_LIBRARIES ${LibEpoxy_LIBRARIES})
-include_directories(${LibEpoxy_INCLUDE_DIRS})
-
 #-
 # Configure Metal.
 if (WITH_METAL_BACKEND)
diff --git a/build_files/cmake/platform/platform_apple.cmake 
b/build_files/cmake/platform/platform_apple.cmake
index 32b10625590..dfe0ed8527d 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -223,6 +223,9 @@ if(WITH_SDL)
   endif()
 endif()
 
+set(EPOXY_ROOT_DIR ${LIBDIR}/libepoxy)
+find_package(LibEpoxy REQUIRED)
+
 set(PNG_ROOT ${LIBDIR}/png)
 find_package(PNG REQUIRED)
 
diff --git a/build_files/cmake/platform/platform_unix.cmake 
b/build_files/cmake/platform/platform_unix.cmake
index dff860d9876..18b38de3deb 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -95,6 +95,7 @@ find_package_wrapper(JPEG REQUIRED)
 find_package_wrapper(PNG REQUIRED)
 find_package_wrapper(ZLIB REQUIRED)
 find_package_wrapper(Zstd REQUIRED)
+find_package_wrapper(LibEpoxy REQUIRED)
 
 if(NOT WITH_SYSTEM_FREETYPE)
   # FreeType compiled with Brotli compression for woff2.
diff --git a/build_files/cmake/platform/platform_win32.cmake 
b/build_files/cmake/platform/platform_win32.cmake
index 7e272ea26b0..71d60e56213 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -323,6 +323,9 @@ if(NOT JPEG_FOUND)
   set(JPEG_LIBRARIES ${LIBDIR}/jpeg/lib/libjpeg.lib)
 endif()
 
+set(EPOXY_ROOT_DIR ${LIBDIR}/libepoxy)
+find_package(LibEpoxy REQUIRED)
+
 set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
 set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC3.lib)
 
diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt
index 4c9eb9a143c..fe8325f636e 100644
--- a/intern/cycles/app/CMakeLists.txt
+++ b/intern/cycles/app/CMakeLists.txt
@@ -44,8 +44,8 @@ endif()
 
 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
   add_definitions(${GL_DEFINITIONS})
-  list(APPEND INC_SYS ${SDL2_INCLUDE_DIRS})
-  list(APPEND LIB ${CYCLES_GL_LIBRARIES} ${SDL2_LIBRARIES})
+  list(APPEND INC_SYS ${LibEpoxy_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS})
+  list(APPEND LIB ${CYCLES_GL_LIBRARIES} ${LibEpoxy_LIBRARIES} 
${SDL2_LIBRARIES})
 endif()
 
 cycles_external_libraries_append(LIB)
diff --git a/intern/cycles/blender/CMakeLists.txt 
b/intern/cycles/blender/CMakeLists.txt
index a53b2528582..1dcbdf8f457 100644
--- a/intern/cycles/blender/CMakeLists.txt
+++ b/intern/cycles/blender/CMakeLists.txt
@@ -12,6 +12,7 @@ set(INC
 )
 
 set(INC_SYS
+  ${LibEpoxy_INCLUDE_DIRS}
   ${PYTHON_INCLUDE_DIRS}
 )
 
@@ -62,6 +63,7 @@ set(LIB
   cycles_subd
   cycles_util
 
+  ${LibEpoxy_LIBRARIES}
   ${PYTHON_LINKFLAGS}
   ${PYTHON_LIBRARIES}
 )
diff --git a/intern/cycles/cmake/external_libs.cmake 
b/intern/cycles/cmake/external_libs.cmake
index 497c9a5407c..c152f2b5e4c 100644
--- a/intern/cycles/cmake/external_libs.cmake
+++ b/intern/cycles/cmake/external_libs.cmake
@@ -504,6 +504,22 @@ if(CYCLES_STANDALONE_REPOSITORY)
   endif()
 endif()
 
+###
+# Libepoxy
+###
+
+if(CYCLES_STANDALONE_REPOSITORY)
+  if((WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI) OR
+ WITH_CYCLES_HYDRA_RENDER_DELEGATE)
+if(MSVC AND EXISTS ${_cycles_lib_dir})
+  set(LibEpoxy_LIBRARIES "${_cycles_lib_dir}/libepoxy/lib/epoxy.lib")
+  set(LibEpoxy_INCLUDE_DIR

[Bf-blender-cvs] [7df83470532] epoxy: add libepoxy source dependency

2022-07-01 Thread Christian Rauch
Commit: 7df8347053276da8238be596b541f0f0f0d168bf
Author: Christian Rauch
Date:   Tue Jun 28 02:01:11 2022 +0100
Branches: epoxy
https://developer.blender.org/rB7df8347053276da8238be596b541f0f0f0d168bf

add libepoxy source dependency

===

M   build_files/build_environment/CMakeLists.txt
M   build_files/build_environment/cmake/download.cmake
M   build_files/build_environment/cmake/harvest.cmake
A   build_files/build_environment/cmake/libepoxy.cmake
M   build_files/build_environment/cmake/versions.cmake

===

diff --git a/build_files/build_environment/CMakeLists.txt 
b/build_files/build_environment/CMakeLists.txt
index f4361adecc2..c06ff4e0127 100644
--- a/build_files/build_environment/CMakeLists.txt
+++ b/build_files/build_environment/CMakeLists.txt
@@ -52,6 +52,7 @@ include(cmake/imath.cmake)
 include(cmake/openexr.cmake)
 include(cmake/brotli.cmake)
 include(cmake/freetype.cmake)
+include(cmake/libepoxy.cmake)
 include(cmake/freeglut.cmake)
 include(cmake/alembic.cmake)
 include(cmake/opensubdiv.cmake)
diff --git a/build_files/build_environment/cmake/download.cmake 
b/build_files/build_environment/cmake/download.cmake
index c262cfb88a1..191686b0221 100644
--- a/build_files/build_environment/cmake/download.cmake
+++ b/build_files/build_environment/cmake/download.cmake
@@ -36,6 +36,7 @@ download_source(BLOSC)
 download_source(PTHREADS)
 download_source(OPENEXR)
 download_source(FREETYPE)
+download_source(LIBEPOXY)
 download_source(FREEGLUT)
 download_source(ALEMBIC)
 download_source(OPENSUBDIV)
diff --git a/build_files/build_environment/cmake/harvest.cmake 
b/build_files/build_environment/cmake/harvest.cmake
index c6d687528b3..cae4664456c 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -73,6 +73,8 @@ harvest(fftw3/lib fftw3/lib "*.a")
 harvest(flac/lib sndfile/lib "libFLAC.a")
 harvest(freetype/include freetype/include "*.h")
 harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
+harvest(libepoxy/include libepoxy/include "*.h")
+harvest(libepoxy/lib libepoxy/lib "*.a")
 harvest(gmp/include gmp/include "*.h")
 harvest(gmp/lib gmp/lib "*.a")
 harvest(jemalloc/include jemalloc/include "*.h")
diff --git a/build_files/build_environment/cmake/libepoxy.cmake 
b/build_files/build_environment/cmake/libepoxy.cmake
new file mode 100644
index 000..29ec9114049
--- /dev/null
+++ b/build_files/build_environment/cmake/libepoxy.cmake
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+ExternalProject_Add(external_libepoxy
+  URL file://${PACKAGE_DIR}/${LIBEPOXY_FILE}
+  DOWNLOAD_DIR ${DOWNLOAD_DIR}
+  URL_HASH ${LIBEPOXY_HASH_TYPE}=${LIBEPOXY_HASH}
+  PREFIX ${BUILD_DIR}/libepoxy
+  CONFIGURE_COMMAND meson setup --prefix ${LIBDIR}/libepoxy --default-library 
static --libdir lib . ../external_libepoxy -Dtests=false
+  BUILD_COMMAND ninja
+  INSTALL_COMMAND ninja install
+)
diff --git a/build_files/build_environment/cmake/versions.cmake 
b/build_files/build_environment/cmake/versions.cmake
index 40823cacbe5..7851a5ab186 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -80,6 +80,12 @@ set(FREETYPE_HASH bd4e3b007474319909a6b79d50908e85)
 set(FREETYPE_HASH_TYPE MD5)
 set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz)
 
+set(LIBEPOXY_VERSION 1.5.10)
+set(LIBEPOXY_URI 
https://github.com/anholt/libepoxy/archive/refs/tags/${LIBEPOXY_VERSION}.tar.gz)
+set(LIBEPOXY_HASH f0730aad115c952e77591fcc805b1dc1)
+set(LIBEPOXY_HASH_TYPE MD5)
+set(LIBEPOXY_FILE libepoxy-${LIBEPOXY_VERSION}.tar.gz)
+
 set(FREEGLUT_VERSION 3.0.0)
 set(FREEGLUT_URI 
http://prdownloads.sourceforge.net/freeglut/freeglut/${FREEGLUT_VERSION}/freeglut-${FREEGLUT_VERSION}.tar.gz)
 set(FREEGLUT_HASH 90c3ca4dd9d51cf32276bc5344ec9754)

___
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] [848f246070f] epoxy: handle missing GL_VENDOR

2022-07-01 Thread Christian Rauch
Commit: 848f246070f6345b92ae09a2a74ec9511c11031c
Author: Christian Rauch
Date:   Thu Jun 30 16:19:51 2022 +0100
Branches: epoxy
https://developer.blender.org/rB848f246070f6345b92ae09a2a74ec9511c11031c

handle missing GL_VENDOR

===

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

===

diff --git a/source/blender/gpu/intern/gpu_platform.cc 
b/source/blender/gpu/intern/gpu_platform.cc
index d108dd468a0..f8e2c0fe6fc 100644
--- a/source/blender/gpu/intern/gpu_platform.cc
+++ b/source/blender/gpu/intern/gpu_platform.cc
@@ -79,11 +79,15 @@ void GPUPlatformGlobal::init(eGPUDeviceType gpu_device,
   this->driver = driver_type;
   this->support_level = gpu_support_level;
 
-  this->vendor = BLI_strdup(vendor_str);
-  this->renderer = BLI_strdup(renderer_str);
-  this->version = BLI_strdup(version_str);
-  this->support_key = create_key(gpu_support_level, vendor_str, renderer_str, 
version_str);
-  this->gpu_name = create_gpu_name(vendor_str, renderer_str, version_str);
+  const char *vendor = vendor_str ? vendor_str : "UNKNOWN";
+  const char *renderer = renderer_str ? renderer_str : "UNKNOWN";
+  const char *version = version_str ? version_str : "UNKNOWN";
+
+  this->vendor = BLI_strdup(vendor);
+  this->renderer = BLI_strdup(renderer);
+  this->version = BLI_strdup(version);
+  this->support_key = create_key(gpu_support_level, vendor, renderer, version);
+  this->gpu_name = create_gpu_name(vendor, renderer, version);
   this->backend = backend;
 }
 
diff --git a/source/blender/gpu/opengl/gl_backend.cc 
b/source/blender/gpu/opengl/gl_backend.cc
index 498c2aa336b..6a1577fb907 100644
--- a/source/blender/gpu/opengl/gl_backend.cc
+++ b/source/blender/gpu/opengl/gl_backend.cc
@@ -51,7 +51,12 @@ void GLBackend::platform_init()
   os = GPU_OS_UNIX;
 #endif
 
-  if (strstr(vendor, "ATI") || strstr(vendor, "AMD")) {
+  if (!vendor) {
+printf("Warning: No OpenGL vendor detected.\n");
+device = GPU_DEVICE_UNKNOWN;
+driver = GPU_DRIVER_ANY;
+  }
+  else if (strstr(vendor, "ATI") || strstr(vendor, "AMD")) {
 device = GPU_DEVICE_ATI;
 driver = GPU_DRIVER_OFFICIAL;
   }

___
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] [09e38eaabae] epoxy: EGL: replace GLEW by libepoxy

2022-07-01 Thread Christian Rauch
Commit: 09e38eaabae7fe75bd08d924831cd5ef37bff480
Author: Christian Rauch
Date:   Fri Jun 24 23:47:36 2022 +0100
Branches: epoxy
https://developer.blender.org/rB09e38eaabae7fe75bd08d924831cd5ef37bff480

EGL: replace GLEW by libepoxy

===

M   intern/ghost/intern/GHOST_Context.cpp
M   intern/ghost/intern/GHOST_Context.h
M   intern/ghost/intern/GHOST_ContextEGL.cpp
M   intern/ghost/intern/GHOST_ContextEGL.h
M   intern/ghost/intern/GHOST_SystemX11.cpp
M   intern/ghost/intern/GHOST_WindowX11.cpp
M   source/blender/gpu/opengl/gl_backend.cc
M   source/blender/gpu/opengl/gl_batch.hh
M   source/blender/gpu/opengl/gl_context.cc
M   source/blender/gpu/opengl/gl_context.hh
M   source/blender/gpu/opengl/gl_debug.cc
M   source/blender/gpu/opengl/gl_debug.hh
M   source/blender/gpu/opengl/gl_framebuffer.hh
M   source/blender/gpu/opengl/gl_immediate.hh
M   source/blender/gpu/opengl/gl_index_buffer.hh
M   source/blender/gpu/opengl/gl_primitive.hh
M   source/blender/gpu/opengl/gl_query.hh
M   source/blender/gpu/opengl/gl_shader.cc
M   source/blender/gpu/opengl/gl_shader.hh
M   source/blender/gpu/opengl/gl_shader_interface.hh
M   source/blender/gpu/opengl/gl_state.hh
M   source/blender/gpu/opengl/gl_storage_buffer.hh
M   source/blender/gpu/opengl/gl_texture.hh
M   source/blender/gpu/opengl/gl_uniform_buffer.hh
M   source/blender/gpu/opengl/gl_vertex_array.hh
M   source/blender/gpu/opengl/gl_vertex_buffer.hh
M   source/blender/python/generic/bgl.c

===

diff --git a/intern/ghost/intern/GHOST_Context.cpp 
b/intern/ghost/intern/GHOST_Context.cpp
index f9aa80dc13d..fb89df9f73f 100644
--- a/intern/ghost/intern/GHOST_Context.cpp
+++ b/intern/ghost/intern/GHOST_Context.cpp
@@ -122,11 +122,6 @@ bool win32_chk(bool result, const char *file, int line, 
const char *text)
 
 #endif  // _WIN32
 
-void GHOST_Context::initContextGLEW()
-{
-  GLEW_CHK(glewInit());
-}
-
 void GHOST_Context::initClearGL()
 {
   glClearColor(0.294, 0.294, 0.294, 0.000);
diff --git a/intern/ghost/intern/GHOST_Context.h 
b/intern/ghost/intern/GHOST_Context.h
index d9c2cdce258..cf6aadd5cc5 100644
--- a/intern/ghost/intern/GHOST_Context.h
+++ b/intern/ghost/intern/GHOST_Context.h
@@ -11,7 +11,7 @@
 #include "GHOST_IContext.h"
 #include "GHOST_Types.h"
 
-#include "glew-mx.h"
+#include 
 
 #include   // for NULL
 
@@ -120,8 +120,6 @@ class GHOST_Context : public GHOST_IContext {
   }
 
  protected:
-  void initContextGLEW();
-
   bool m_stereoVisual;
 
   static void initClearGL();
diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp 
b/intern/ghost/intern/GHOST_ContextEGL.cpp
index 8c44dfe0158..c29e11ccb1d 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -151,15 +151,6 @@ static bool egl_chk(bool result,
 #  define EGL_CHK(x) egl_chk(x)
 #endif
 
-static inline bool bindAPI(EGLenum api)
-{
-  if (EGLEW_VERSION_1_2) {
-return (EGL_CHK(eglBindAPI(api)) == EGL_TRUE);
-  }
-
-  return false;
-}
-
 #ifdef WITH_GL_ANGLE
 HMODULE GHOST_ContextEGL::s_d3dcompiler = nullptr;
 #endif
@@ -256,7 +247,7 @@ GHOST_TSuccess GHOST_ContextEGL::swapBuffers()
 
 GHOST_TSuccess GHOST_ContextEGL::setSwapInterval(int interval)
 {
-  if (EGLEW_VERSION_1_1) {
+  if (epoxy_egl_version(m_display) >= 11) {
 if (EGL_CHK(::eglSwapInterval(m_display, interval))) {
   m_swap_interval = interval;
 
@@ -313,26 +304,13 @@ GHOST_TSuccess GHOST_ContextEGL::releaseDrawingContext()
   return GHOST_kFailure;
 }
 
-bool GHOST_ContextEGL::initContextEGLEW()
+inline bool GHOST_ContextEGL::bindAPI(EGLenum api)
 {
-  /* We have to manually get this function before we can call eglewInit, since
-   * it requires a display argument. glewInit() does the same, but we only want
-   * to initialize EGLEW here. */
-  eglGetDisplay = (PFNEGLGETDISPLAYPROC)eglGetProcAddress("eglGetDisplay");
-  if (eglGetDisplay == nullptr) {
-return false;
-  }
-
-  if (!EGL_CHK((m_display = ::eglGetDisplay(m_nativeDisplay)) != 
EGL_NO_DISPLAY)) {
-return false;
-  }
-
-  if (GLEW_CHK(eglewInit(m_display)) != GLEW_OK) {
-fprintf(stderr, "Warning! EGLEW failed to initialize properly.\n");
-return false;
+  if (epoxy_egl_version(m_display) >= 12) {
+return (EGL_CHK(eglBindAPI(api)) == EGL_TRUE);
   }
 
-  return true;
+  return false;
 }
 
 static const std::string &api_string(EGLenum api)
@@ -355,10 +333,6 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
   }
   m_stereoVisual = false; /* It doesn't matter what the Window wants. */
 
-  if (!initContextEGLEW()) {
-return GHOST_kFailure;
-  }
-
 #ifdef WITH_GL_ANGLE
   /* `d3dcompiler_XX.dll` needs to be loaded before ANGLE will work. */
   if (s_d3dcompiler == nullptr) {
@@ -380,6 +354,10 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()

[Bf-blender-cvs] [c7716f59771] epoxy: use CMake script for libepoxy

2022-07-01 Thread Christian Rauch
Commit: c7716f59771f421f8d77d34351e4e8fd5b2d4f7c
Author: Christian Rauch
Date:   Wed Jun 29 01:00:17 2022 +0100
Branches: epoxy
https://developer.blender.org/rBc7716f59771f421f8d77d34351e4e8fd5b2d4f7c

use CMake script for libepoxy

===

M   CMakeLists.txt
A   build_files/cmake/Modules/FindLibEpoxy.cmake

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88cbc43401d..ac524619809 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1321,9 +1321,10 @@ else()
 endif()
 
 # link libepoxy
-include(FindPkgConfig)
-pkg_check_modules(epoxy REQUIRED epoxy)
-list(APPEND BLENDER_GL_LIBRARIES ${epoxy_LIBRARIES})
+set(EPOXY_ROOT_DIR ${LIBDIR}/libepoxy)
+find_package(LibEpoxy REQUIRED)
+list(APPEND BLENDER_GL_LIBRARIES ${LibEpoxy_LIBRARIES})
+include_directories(${LibEpoxy_INCLUDE_DIRS})
 
 #-
 # Configure Metal.
diff --git a/build_files/cmake/Modules/FindLibEpoxy.cmake 
b/build_files/cmake/Modules/FindLibEpoxy.cmake
new file mode 100644
index 000..1da52f95f68
--- /dev/null
+++ b/build_files/cmake/Modules/FindLibEpoxy.cmake
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2022 Blender Foundation.
+
+# This module defines
+#  LibEpoxy_INCLUDE_DIRS, where to find epoxy/gl.h
+#  LibEpoxy_LIBRARY, where to find the epoxy library.
+#  LibEpoxy_ROOT_DIR, The base directory to search for libepoxy.
+# This can also be an environment variable.
+#  LibEpoxy_FOUND, If false, do not try to use libepoxy.
+
+IF(NOT EPOXY_ROOT_DIR AND NOT $ENV{EPOXY_ROOT_DIR} STREQUAL "")
+  SET(EPOXY_ROOT_DIR $ENV{EPOXY_ROOT_DIR})
+ENDIF()
+
+FIND_PATH(LibEpoxy_INCLUDE_DIR
+  NAMES
+epoxy/gl.h
+  HINTS
+${EPOXY_ROOT_DIR}
+  PATH_SUFFIXES
+include
+)
+
+FIND_LIBRARY(LibEpoxy_LIBRARY
+  NAMES
+epoxy
+  HINTS
+${EPOXY_ROOT_DIR}
+  PATH_SUFFIXES
+lib64 lib
+)
+
+# handle the QUIETLY and REQUIRED arguments and set LibEpoxy_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibEpoxy DEFAULT_MSG
+LibEpoxy_LIBRARY LibEpoxy_INCLUDE_DIR)
+
+IF(LibEpoxy_FOUND)
+  SET(LibEpoxy_INCLUDE_DIRS ${LibEpoxy_INCLUDE_DIR})
+  SET(LibEpoxy_LIBRARIES ${LibEpoxy_LIBRARY})
+ENDIF()
+
+MARK_AS_ADVANCED(
+  LibEpoxy_INCLUDE_DIR
+  LibEpoxy_LIBRARY
+)

___
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] [90b6fda84f2] epoxy: remove GLEW from build_environment

2022-07-01 Thread Christian Rauch
Commit: 90b6fda84f2dff94c1aab1be26e03598a650ef6d
Author: Christian Rauch
Date:   Sat Jun 25 01:32:39 2022 +0100
Branches: epoxy
https://developer.blender.org/rB90b6fda84f2dff94c1aab1be26e03598a650ef6d

remove GLEW from build_environment

===

M   build_files/build_environment/CMakeLists.txt
M   build_files/build_environment/cmake/download.cmake
D   build_files/build_environment/cmake/glew.cmake
M   build_files/build_environment/cmake/harvest.cmake
M   build_files/build_environment/cmake/versions.cmake
D   build_files/build_environment/patches/cmakelists_glew.txt

===

diff --git a/build_files/build_environment/CMakeLists.txt 
b/build_files/build_environment/CMakeLists.txt
index a9ff48b2a9b..f4361adecc2 100644
--- a/build_files/build_environment/CMakeLists.txt
+++ b/build_files/build_environment/CMakeLists.txt
@@ -53,7 +53,6 @@ include(cmake/openexr.cmake)
 include(cmake/brotli.cmake)
 include(cmake/freetype.cmake)
 include(cmake/freeglut.cmake)
-include(cmake/glew.cmake)
 include(cmake/alembic.cmake)
 include(cmake/opensubdiv.cmake)
 include(cmake/sdl.cmake)
diff --git a/build_files/build_environment/cmake/download.cmake 
b/build_files/build_environment/cmake/download.cmake
index b7150525a65..c262cfb88a1 100644
--- a/build_files/build_environment/cmake/download.cmake
+++ b/build_files/build_environment/cmake/download.cmake
@@ -36,7 +36,6 @@ download_source(BLOSC)
 download_source(PTHREADS)
 download_source(OPENEXR)
 download_source(FREETYPE)
-download_source(GLEW)
 download_source(FREEGLUT)
 download_source(ALEMBIC)
 download_source(OPENSUBDIV)
diff --git a/build_files/build_environment/cmake/glew.cmake 
b/build_files/build_environment/cmake/glew.cmake
deleted file mode 100644
index 0745ad01533..000
--- a/build_files/build_environment/cmake/glew.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-set(GLEW_EXTRA_ARGS
-  -DBUILD_UTILS=Off
-  -DBUILD_SHARED_LIBS=Off
-)
-
-ExternalProject_Add(external_glew
-  URL file://${PACKAGE_DIR}/${GLEW_FILE}
-  DOWNLOAD_DIR ${DOWNLOAD_DIR}
-  URL_HASH ${GLEW_HASH_TYPE}=${GLEW_HASH}
-  PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy 
${PATCH_DIR}/cmakelists_glew.txt 
${BUILD_DIR}/glew/src/external_glew/CMakeLists.txt
-  PREFIX ${BUILD_DIR}/glew
-  CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON 
-DCMAKE_INSTALL_PREFIX=${LIBDIR}/glew ${DEFAULT_CMAKE_FLAGS} ${GLEW_EXTRA_ARGS}
-  INSTALL_DIR ${LIBDIR}/glew
-)
diff --git a/build_files/build_environment/cmake/harvest.cmake 
b/build_files/build_environment/cmake/harvest.cmake
index 2865a5304d7..c6d687528b3 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -22,9 +22,6 @@ if(BUILD_MODE STREQUAL Release)
 # freeglut-> opengl
 ${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib 
${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ 
${HARVEST_TARGET}/opengl/include/ &&
-# glew-> opengl
-${CMAKE_COMMAND} -E copy ${LIBDIR}/glew/lib/libglew32.lib 
${HARVEST_TARGET}/opengl/lib/glew.lib &&
-${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/glew/include/ 
${HARVEST_TARGET}/opengl/include/ &&
 # tiff
 ${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiff.lib 
${HARVEST_TARGET}/tiff/lib/libtiff.lib &&
 ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ 
${HARVEST_TARGET}/tiff/include/
@@ -76,8 +73,6 @@ harvest(fftw3/lib fftw3/lib "*.a")
 harvest(flac/lib sndfile/lib "libFLAC.a")
 harvest(freetype/include freetype/include "*.h")
 harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
-harvest(glew/include glew/include "*.h")
-harvest(glew/lib glew/lib "*.a")
 harvest(gmp/include gmp/include "*.h")
 harvest(gmp/lib gmp/lib "*.a")
 harvest(jemalloc/include jemalloc/include "*.h")
diff --git a/build_files/build_environment/cmake/versions.cmake 
b/build_files/build_environment/cmake/versions.cmake
index 1a4ad291581..40823cacbe5 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -80,12 +80,6 @@ set(FREETYPE_HASH bd4e3b007474319909a6b79d50908e85)
 set(FREETYPE_HASH_TYPE MD5)
 set(FREETYPE_FILE freetype-${FREETYPE_VERSION}.tar.gz)
 
-set(GLEW_VERSION 1.13.0)
-set(GLEW_URI 
http://prdownloads.sourceforge.net/glew/glew/${GLEW_VERSION}/glew-${GLEW_VERSION}.tgz)
-set(GLEW_HASH 7cbada3166d2aadfc4169c4283701066)
-set(GLEW_HASH_TYPE MD5)
-set(GLEW_FILE glew-${GLEW_VERSION}.tgz)
-
 set(FREEGLUT_VERSION 3.0.0)
 set(FREEGLUT_URI 
http://prdownloads.sourceforge.net/freeglut/freeglut/${FREEGLUT_VERSION}/freeglut-${FREEGLUT_VERSION}.tar.gz)
 set(FREEGLUT_HASH 90c3ca4dd9d51cf32276bc5344ec9754)
diff --git a/build_files/build_environment/patches/cmakelists_glew.txt 
b/build_fi

[Bf-blender-cvs] [acd7b39249c] epoxy: remove glew-mx

2022-07-01 Thread Christian Rauch
Commit: acd7b39249cab76ba0ad234df3b80ad8648f88e8
Author: Christian Rauch
Date:   Fri Jun 24 22:10:37 2022 +0100
Branches: epoxy
https://developer.blender.org/rBacd7b39249cab76ba0ad234df3b80ad8648f88e8

remove glew-mx

===

M   CMakeLists.txt
M   intern/CMakeLists.txt
M   intern/cycles/blender/CMakeLists.txt
M   intern/cycles/cmake/external_libs.cmake
M   intern/cycles/device/CMakeLists.txt
M   intern/cycles/util/CMakeLists.txt
M   intern/ghost/CMakeLists.txt
M   intern/ghost/test/CMakeLists.txt
D   intern/glew-mx/CMakeLists.txt
D   intern/glew-mx/glew-mx.h
D   intern/glew-mx/intern/gl-deprecated.h
D   intern/glew-mx/intern/glew-mx.c
D   intern/glew-mx/intern/symbol-binding.h
M   intern/opencolorio/CMakeLists.txt
M   source/blender/blenfont/CMakeLists.txt
M   source/blender/blenkernel/CMakeLists.txt
M   source/blender/draw/CMakeLists.txt
M   source/blender/editors/animation/CMakeLists.txt
M   source/blender/editors/armature/CMakeLists.txt
M   source/blender/editors/curve/CMakeLists.txt
M   source/blender/editors/gizmo_library/CMakeLists.txt
M   source/blender/editors/gpencil/CMakeLists.txt
M   source/blender/editors/interface/CMakeLists.txt
M   source/blender/editors/mask/CMakeLists.txt
M   source/blender/editors/mesh/CMakeLists.txt
M   source/blender/editors/object/CMakeLists.txt
M   source/blender/editors/physics/CMakeLists.txt
M   source/blender/editors/render/CMakeLists.txt
M   source/blender/editors/screen/CMakeLists.txt
M   source/blender/editors/sculpt_paint/CMakeLists.txt
M   source/blender/editors/space_action/CMakeLists.txt
M   source/blender/editors/space_buttons/CMakeLists.txt
M   source/blender/editors/space_clip/CMakeLists.txt
M   source/blender/editors/space_console/CMakeLists.txt
M   source/blender/editors/space_file/CMakeLists.txt
M   source/blender/editors/space_graph/CMakeLists.txt
M   source/blender/editors/space_image/CMakeLists.txt
M   source/blender/editors/space_info/CMakeLists.txt
M   source/blender/editors/space_nla/CMakeLists.txt
M   source/blender/editors/space_node/CMakeLists.txt
M   source/blender/editors/space_outliner/CMakeLists.txt
M   source/blender/editors/space_script/CMakeLists.txt
M   source/blender/editors/space_sequencer/CMakeLists.txt
M   source/blender/editors/space_spreadsheet/CMakeLists.txt
M   source/blender/editors/space_statusbar/CMakeLists.txt
M   source/blender/editors/space_text/CMakeLists.txt
M   source/blender/editors/space_topbar/CMakeLists.txt
M   source/blender/editors/space_view3d/CMakeLists.txt
M   source/blender/editors/transform/CMakeLists.txt
M   source/blender/editors/util/CMakeLists.txt
M   source/blender/editors/uvedit/CMakeLists.txt
M   source/blender/gpu/CMakeLists.txt
M   source/blender/makesrna/intern/CMakeLists.txt
M   source/blender/nodes/CMakeLists.txt
M   source/blender/python/generic/CMakeLists.txt
M   source/blender/python/gpu/CMakeLists.txt
M   source/blender/windowmanager/CMakeLists.txt
M   source/creator/CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7bb7ad6c6d..0619cc11211 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1888,7 +1888,6 @@ if(WITH_BLENDER)
   # internal and external library information first, for test linking
   add_subdirectory(source)
 elseif(WITH_CYCLES_STANDALONE OR WITH_CYCLES_HYDRA_RENDER_DELEGATE)
-  add_subdirectory(intern/glew-mx)
   add_subdirectory(intern/guardedalloc)
   add_subdirectory(intern/libc_compat)
   add_subdirectory(intern/sky)
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index 2ff2fb39806..eb69a60c1ed 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -11,7 +11,6 @@ add_subdirectory(memutil)
 add_subdirectory(opencolorio)
 add_subdirectory(opensubdiv)
 add_subdirectory(mikktspace)
-add_subdirectory(glew-mx)
 add_subdirectory(eigen)
 add_subdirectory(sky)
 
diff --git a/intern/cycles/blender/CMakeLists.txt 
b/intern/cycles/blender/CMakeLists.txt
index d8f6cf3d86f..a53b2528582 100644
--- a/intern/cycles/blender/CMakeLists.txt
+++ b/intern/cycles/blender/CMakeLists.txt
@@ -3,7 +3,6 @@
 
 set(INC
   ..
-  ../../glew-mx
   ../../guardedalloc
   ../../mikktspace
   ../../../source/blender/makesdna
diff --git a/intern/cycles/cmake/external_libs.cmake 
b/intern/cycles/cmake/external_libs.cmake
index 51830250f2e..497c9a5407c 100644
--- a/intern/cycles/cmake/external_libs.cmake
+++ b/intern/cycles/cmake/external_libs.cmake
@@ -504,29 +504,6 @@ if(CYCLES_STANDALONE_REPOSITORY)
   endif()
 endif()
 
-###
-# GLEW
-###
-
-if(CYCLES_STANDALONE_REPOSITORY)

[Bf-blender-cvs] [dcd1aa1ff5e] epoxy: remove GPU_glew.h

2022-07-01 Thread Christian Rauch
Commit: dcd1aa1ff5e8d7dc62ed18e3fb602a33069636ec
Author: Christian Rauch
Date:   Fri Jun 24 22:25:02 2022 +0100
Branches: epoxy
https://developer.blender.org/rBdcd1aa1ff5e8d7dc62ed18e3fb602a33069636ec

remove GPU_glew.h

===

M   source/blender/gpu/CMakeLists.txt
D   source/blender/gpu/GPU_glew.h
D   source/blender/gpu/GPU_legacy_stubs.h
M   source/blender/gpu/tests/gpu_shader_test.cc

===

diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 0740428c43b..6dcf93b5fa3 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -87,12 +87,10 @@ set(SRC
   GPU_debug.h
   GPU_drawlist.h
   GPU_framebuffer.h
-  GPU_glew.h
   GPU_immediate.h
   GPU_immediate_util.h
   GPU_index_buffer.h
   GPU_init_exit.h
-  GPU_legacy_stubs.h
   GPU_material.h
   GPU_matrix.h
   GPU_platform.h
diff --git a/source/blender/gpu/GPU_glew.h b/source/blender/gpu/GPU_glew.h
deleted file mode 100644
index 38209a0eb17..000
--- a/source/blender/gpu/GPU_glew.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright 2012 Blender Foundation. All rights reserved. */
-
-/** \file
- * \ingroup gpu
- */
-
-#pragma once
-
-#if defined(WITH_OPENGL)
-#  include "glew-mx.h"
-#  ifndef WITH_LEGACY_OPENGL
-#include "GPU_legacy_stubs.h"
-#  endif
-#endif
diff --git a/source/blender/gpu/GPU_legacy_stubs.h 
b/source/blender/gpu/GPU_legacy_stubs.h
deleted file mode 100644
index 5970738a9b3..000
--- a/source/blender/gpu/GPU_legacy_stubs.h
+++ /dev/null
@@ -1,497 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright 2017 Blender Foundation. All rights reserved. */
-
-/** \file
- * \ingroup gpu
- *
- * This is to mark the transition to OpenGL core profile
- * The idea is to allow Blender 2.8 to be built with OpenGL 3.3 even if it 
means breaking things
- *
- * This file should be removed in the future
- */
-
-#pragma once
-
-#if defined(__GNUC__)
-#  pragma GCC diagnostic push
-#  pragma GCC diagnostic ignored "-Wunused-parameter"
-#  pragma GCC diagnostic ignored "-Wunused-function"
-#endif
-
-#include  /* for abort(). */
-
-#include "BLI_utildefines.h"
-
-/**
- * Empty function, use for break-point when a deprecated
- * OpenGL function is called.
- */
-static void gl_deprecated(void)
-{
-  BLI_assert(true);
-}
-
-#define _GL_BOOL BLI_INLINE GLboolean
-#define _GL_BOOL_RET \
-  { \
-gl_deprecated(); \
-return false; \
-  }
-
-#define _GL_ENUM BLI_INLINE GLenum
-#define _GL_ENUM_RET \
-  { \
-gl_deprecated(); \
-return 0; \
-  }
-
-#define _GL_INT BLI_INLINE GLint
-#define _GL_INT_RET \
-  { \
-gl_deprecated(); \
-return 0; \
-  }
-
-#define _GL_UINT BLI_INLINE GLuint
-#define _GL_UINT_RET \
-  { \
-gl_deprecated(); \
-return 0; \
-  }
-
-#define _GL_VOID BLI_INLINE void
-#define _GL_VOID_RET \
-  { \
-gl_deprecated(); \
-  }
-
-static bool disable_enable_check(GLenum cap)
-{
-  const bool is_deprecated = ELEM(cap,
-  GL_ALPHA_TEST,
-  GL_LINE_STIPPLE,
-  GL_POINT_SPRITE,
-  GL_TEXTURE_1D,
-  GL_TEXTURE_2D,
-  GL_TEXTURE_GEN_S,
-  GL_TEXTURE_GEN_T,
-  -1);
-
-  if (is_deprecated) {
-gl_deprecated();
-  }
-
-  return is_deprecated;
-}
-
-_GL_VOID USE_CAREFULLY_glDisable(GLenum cap)
-{
-  if (!disable_enable_check(cap)) {
-glDisable(cap);
-  }
-}
-#define glDisable USE_CAREFULLY_glDisable
-
-_GL_VOID USE_CAREFULLY_glEnable(GLenum cap)
-{
-  if (!disable_enable_check(cap)) {
-glEnable(cap);
-  }
-}
-#define glEnable USE_CAREFULLY_glEnable
-
-/**
- * Hand written cases
- */
-
-_GL_VOID DO_NOT_USE_glClientActiveTexture(GLenum texture) _GL_VOID_RET
-
-/**
- * List automatically generated from `gl-deprecated.h` and `glew.h`
- */
-
-/**
- * ENUM values
- */
-#define DO_NOT_USE_GL_CURRENT_FOG_COORDINATE 0
-#define DO_NOT_USE_GL_FOG_COORDINATE 0
-#define DO_NOT_USE_GL_FOG_COORDINATE_ARRAY 0
-#define DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0
-#define DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_POINTER 0
-#define DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_STRIDE 0
-#define DO_NOT_USE_GL_FOG_COORDINATE_ARRAY_TYPE 0
-#define DO_NOT_USE_GL_FOG_COORDINATE_SOURCE 0
-#define DO_NOT_USE_GL_POINT_SIZE_GRANULARITY 0
-#define DO_NOT_USE_GL_POINT_SIZE_RANGE 0
-#define DO_NOT_USE_GL_SOURCE0_ALPHA 0
-#define DO_NOT_USE_GL_SOURCE0_RGB 0
-#define DO_NOT_USE_GL_SOURCE1_ALPHA 0
-#define DO_NOT_USE_GL_SOURCE1_RGB 0
-#define DO_NOT_USE_GL_SOURCE2_ALPHA 0
-#define DO_NOT_USE_GL_SOURCE2_RGB 0
-
-/**
- * Functions
- */
-_GL_VOID DO_NOT_USE_glAccum(GLenum op, GLfloat value) _GL_VOID_RET _GL_VOID
-DO_NOT_US

[Bf-blender-cvs] [9e2317c5ac5] epoxy: SDL: replace GLEW by libepoxy

2022-07-01 Thread Christian Rauch
Commit: 9e2317c5ac51d9e6835922496932b49f3eefcb23
Author: Christian Rauch
Date:   Sat Jun 25 02:13:53 2022 +0100
Branches: epoxy
https://developer.blender.org/rB9e2317c5ac51d9e6835922496932b49f3eefcb23

SDL: replace GLEW by libepoxy

===

M   intern/ghost/intern/GHOST_ContextSDL.cpp
M   intern/ghost/intern/GHOST_WindowSDL.cpp

===

diff --git a/intern/ghost/intern/GHOST_ContextSDL.cpp 
b/intern/ghost/intern/GHOST_ContextSDL.cpp
index 5b02fe1c1e6..63b5927895d 100644
--- a/intern/ghost/intern/GHOST_ContextSDL.cpp
+++ b/intern/ghost/intern/GHOST_ContextSDL.cpp
@@ -138,8 +138,6 @@ GHOST_TSuccess GHOST_ContextSDL::initializeDrawingContext()
 
 success = (SDL_GL_MakeCurrent(m_window, m_context) < 0) ? GHOST_kFailure : 
GHOST_kSuccess;
 
-initContextGLEW();
-
 initClearGL();
 SDL_GL_SwapWindow(m_window);
 
diff --git a/intern/ghost/intern/GHOST_WindowSDL.cpp 
b/intern/ghost/intern/GHOST_WindowSDL.cpp
index 09192d989e4..59dc80cf7e6 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.cpp
+++ b/intern/ghost/intern/GHOST_WindowSDL.cpp
@@ -6,7 +6,6 @@
 
 #include "GHOST_WindowSDL.h"
 #include "SDL_mouse.h"
-#include "glew-mx.h"
 
 #include "GHOST_ContextSDL.h"

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


[Bf-blender-cvs] [fd138bd6227] epoxy: OpenXR: replace GLEW by libepoxy

2022-07-01 Thread Christian Rauch
Commit: fd138bd6227ab4f2b39f1d58df906f70df1c6b68
Author: Christian Rauch
Date:   Sat Jun 25 01:11:08 2022 +0100
Branches: epoxy
https://developer.blender.org/rBfd138bd6227ab4f2b39f1d58df906f70df1c6b68

OpenXR: replace GLEW by libepoxy

===

M   intern/ghost/intern/GHOST_Xr_openxr_includes.h

===

diff --git a/intern/ghost/intern/GHOST_Xr_openxr_includes.h 
b/intern/ghost/intern/GHOST_Xr_openxr_includes.h
index 9706f51c027..9f993ae45c2 100644
--- a/intern/ghost/intern/GHOST_Xr_openxr_includes.h
+++ b/intern/ghost/intern/GHOST_Xr_openxr_includes.h
@@ -29,11 +29,9 @@
 #endif
 #ifdef WITH_GHOST_X11
 #  ifdef WITH_GL_EGL
-/* TODO: Why do we have to create this typedef manually? */
-typedef void (*(*PFNEGLGETPROCADDRESSPROC)(const char *procname))(void);
-#include 
+#include 
 #  else
-#include 
+#include 
 #  endif
 #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] [5d54d85d5e3] epoxy: GLX: replace GLEW by libepoxy

2022-07-01 Thread Christian Rauch
Commit: 5d54d85d5e3bedbcf2f40355ec2f9823968af9f5
Author: Christian Rauch
Date:   Sat Jun 25 00:19:35 2022 +0100
Branches: epoxy
https://developer.blender.org/rB5d54d85d5e3bedbcf2f40355ec2f9823968af9f5

GLX: replace GLEW by libepoxy

===

M   intern/ghost/intern/GHOST_ContextGLX.cpp
M   intern/ghost/intern/GHOST_ContextGLX.h

===

diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp 
b/intern/ghost/intern/GHOST_ContextGLX.cpp
index b4a076e4598..ed1c874c236 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -95,11 +95,6 @@ GHOST_TSuccess GHOST_ContextGLX::releaseDrawingContext()
   return ::glXMakeCurrent(m_display, None, nullptr) ? GHOST_kSuccess : 
GHOST_kFailure;
 }
 
-void GHOST_ContextGLX::initContextGLXEW()
-{
-  initContextGLEW();
-}
-
 GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
 {
   GHOST_X11_ERROR_HANDLERS_OVERRIDE(handler_store);
@@ -278,18 +273,11 @@ GHOST_TSuccess 
GHOST_ContextGLX::initializeDrawingContext()
 
 glXMakeCurrent(m_display, m_window, m_context);
 
-/* Seems that this has to be called after #glXMakeCurrent,
- * which means we cannot use `glX` extensions until after we create a 
context. */
-initContextGLXEW();
-
 if (m_window) {
   initClearGL();
   ::glXSwapBuffers(m_display, m_window);
 }
 
-/* re initialize to get the extensions properly */
-initContextGLXEW();
-
 version = glGetString(GL_VERSION);
 
 if (!version || version[0] < '3' || ((version[0] == '3') && (version[2] < 
'3'))) {
@@ -318,7 +306,7 @@ GHOST_TSuccess GHOST_ContextGLX::releaseNativeHandles()
 
 GHOST_TSuccess GHOST_ContextGLX::setSwapInterval(int interval)
 {
-  if (!GLXEW_EXT_swap_control) {
+  if (!epoxy_has_glx_extension(m_display, DefaultScreen(m_display), 
"GLX_EXT_swap_control")) {
 ::glXSwapIntervalEXT(m_display, m_window, interval);
 return GHOST_kSuccess;
   }
@@ -327,7 +315,7 @@ GHOST_TSuccess GHOST_ContextGLX::setSwapInterval(int 
interval)
 
 GHOST_TSuccess GHOST_ContextGLX::getSwapInterval(int &intervalOut)
 {
-  if (GLXEW_EXT_swap_control) {
+  if (epoxy_has_glx_extension(m_display, DefaultScreen(m_display), 
"GLX_EXT_swap_control")) {
 unsigned int interval = 0;
 
 ::glXQueryDrawable(m_display, m_window, GLX_SWAP_INTERVAL_EXT, &interval);
diff --git a/intern/ghost/intern/GHOST_ContextGLX.h 
b/intern/ghost/intern/GHOST_ContextGLX.h
index c6184bbd3da..d526e6b1b32 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.h
+++ b/intern/ghost/intern/GHOST_ContextGLX.h
@@ -9,7 +9,7 @@
 
 #include "GHOST_Context.h"
 
-#include 
+#include 
 
 #ifndef GHOST_OPENGL_GLX_CONTEXT_FLAGS
 /* leave as convenience define for the future */
@@ -89,8 +89,6 @@ class GHOST_ContextGLX : public GHOST_Context {
   GHOST_TSuccess getSwapInterval(int &intervalOut);
 
  private:
-  void initContextGLXEW();
-
   Display *m_display;
   GLXFBConfig m_fbconfig;
   Window m_window;

___
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] [a484b71cd18] epoxy: link libepoxy

2022-07-01 Thread Christian Rauch
Commit: a484b71cd18b7347224ad0e88d0f8732cc03efb0
Author: Christian Rauch
Date:   Fri Jun 24 23:31:35 2022 +0100
Branches: epoxy
https://developer.blender.org/rBa484b71cd18b7347224ad0e88d0f8732cc03efb0

link libepoxy

===

M   CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0619cc11211..88cbc43401d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1320,6 +1320,11 @@ else()
   list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_CORE)
 endif()
 
+# link libepoxy
+include(FindPkgConfig)
+pkg_check_modules(epoxy REQUIRED epoxy)
+list(APPEND BLENDER_GL_LIBRARIES ${epoxy_LIBRARIES})
+
 #-
 # Configure Metal.
 if (WITH_METAL_BACKEND)

___
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] [8d40521d332] epoxy: remove GLEW

2022-07-01 Thread Christian Rauch
Commit: 8d40521d3323daae293b763715a2baa780238a13
Author: Christian Rauch
Date:   Fri Jun 24 22:01:11 2022 +0100
Branches: epoxy
https://developer.blender.org/rB8d40521d3323daae293b763715a2baa780238a13

remove GLEW

===

M   CMakeLists.txt
D   build_files/cmake/Modules/FindGLEW.cmake
M   extern/CMakeLists.txt
D   extern/glew-es/CMakeLists.txt
D   extern/glew-es/LICENSE.txt
D   extern/glew-es/README.blender
D   extern/glew-es/include/GL/eglew.h
D   extern/glew-es/include/GL/glesew.h
D   extern/glew-es/include/GL/glew.h
D   extern/glew-es/include/GL/glxew.h
D   extern/glew-es/include/GL/wglew.h
D   extern/glew-es/src/glew.c
D   extern/glew/CMakeLists.txt
D   extern/glew/LICENSE.txt
D   extern/glew/README.blender
D   extern/glew/include/GL/eglew.h
D   extern/glew/include/GL/glew.h
D   extern/glew/include/GL/glxew.h
D   extern/glew/include/GL/wglew.h
D   extern/glew/src/glew.c
M   release/license/THIRD-PARTY-LICENSES.txt
M   source/blender/freestyle/CMakeLists.txt

===

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2b8c56001b..a7bb7ad6c6d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -543,30 +543,18 @@ if(WITH_GHOST_WAYLAND)
 endif()
 
 if(UNIX AND NOT APPLE)
-  if(WITH_GL_EGL)
-# GLEW can only be built with either GLX or EGL support. Most binary 
distributions are
-# built with GLX support and we have no automated way to detect this. So 
always build
-# GLEW from source to be sure it has EGL support.
-set(WITH_SYSTEM_GLEW OFF)
-  else()
-option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the 
operating system" OFF)
-  endif()
-
   option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating 
system" ON)
 else()
-  # System GLEW and GLES not an option on other platforms.
-  set(WITH_SYSTEM_GLEW OFF)
+  # System GLES not an option on other platforms.
   set(WITH_SYSTEM_GLES OFF)
 endif()
 
 option(WITH_OPENGL  "When off limits visibility of the opengl 
headers to just bf_gpu and gawain (temporary option for development purposes)" 
ON)
-option(WITH_GLEW_ES "Switches to experimental copy of GLEW that 
has support for OpenGL ES. (temporary option for development purposes)" OFF)
 option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (through either 
EGL or the AGL/WGL/XGL 'es20' profile)"   OFF)
 option(WITH_GPU_SHADER_BUILDER  "Shader builder is a developer option enabling 
linting on GLSL during compilation"  OFF)
 
 mark_as_advanced(
   WITH_OPENGL
-  WITH_GLEW_ES
   WITH_GL_PROFILE_ES20
   WITH_GPU_SHADER_BUILDER
 )
@@ -589,11 +577,6 @@ if(WIN32)
   mark_as_advanced(WITH_GL_ANGLE)
 endif()
 
-if(WITH_GLEW_ES AND WITH_SYSTEM_GLEW)
-  message(WARNING Ignoring WITH_SYSTEM_GLEW and using WITH_GLEW_ES)
-  set(WITH_SYSTEM_GLEW OFF)
-endif()
-
 if(WIN32)
   getDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES)
   set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${})
@@ -1287,7 +1270,7 @@ if(WITH_GL_EGL)
   find_package(OpenGL REQUIRED EGL)
   list(APPEND BLENDER_GL_LIBRARIES OpenGL::EGL)
 
-  list(APPEND GL_DEFINITIONS -DWITH_GL_EGL -DGLEW_EGL -DGLEW_INC_EGL)
+  list(APPEND GL_DEFINITIONS -DWITH_GL_EGL)
 
   if(WITH_SYSTEM_GLES)
 if(NOT OPENGLES_EGL_LIBRARY)
@@ -1380,66 +1363,6 @@ if(WITH_OPENMP)
   )
 endif()
 
-#-
-# Configure GLEW
-
-if(WITH_SYSTEM_GLEW)
-  find_package(GLEW)
-
-  # Note: There is an assumption here that the system GLEW is not a static 
library.
-
-  if(NOT GLEW_FOUND)
-message(FATAL_ERROR "GLEW is required to build Blender. Install it or 
disable WITH_SYSTEM_GLEW.")
-  endif()
-
-  set(GLEW_INCLUDE_PATH "${GLEW_INCLUDE_DIR}")
-  set(BLENDER_GLEW_LIBRARIES ${GLEW_LIBRARY})
-else()
-  if(WITH_GLEW_ES)
-set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew-es/include")
-
-list(APPEND GL_DEFINITIONS -DGLEW_STATIC -DWITH_GLEW_ES)
-
-# These definitions remove APIs from glew.h, making GLEW smaller, and 
catching unguarded API usage
-if(WITH_GL_PROFILE_ES20)
-  list(APPEND GL_DEFINITIONS -DGLEW_ES_ONLY)
-else()
-  # No ES functions are needed
-  list(APPEND GL_DEFINITIONS -DGLEW_NO_ES)
-endif()
-
-if(WITH_GL_PROFILE_ES20)
-  if(WITH_GL_EGL)
-list(APPEND GL_DEFINITIONS -DGLEW_USE_LIB_ES20)
-  endif()
-
-  # ToDo: This is an experiment to eliminate ES 1 symbols,
-  # GLEW doesn't really properly provide this level of control
-  # (for example, without modification it eliminates too many symbols)
-  # so there are lots of modifications to GLEW to make this work,
-  # and no attempt to make it work beyond Blender at this point.
-  list(APPEND GL_DEFINITIONS -DGL_ES_VERSION_1

[Bf-blender-cvs] [ff10f508ed9] epoxy: more GLEW remove

2022-07-01 Thread Christian Rauch
Commit: ff10f508ed95b41998129ac35914c4cb959aa568
Author: Christian Rauch
Date:   Tue Jun 28 01:20:34 2022 +0100
Branches: epoxy
https://developer.blender.org/rBff10f508ed95b41998129ac35914c4cb959aa568

more GLEW remove

===

M   intern/cycles/app/CMakeLists.txt
M   intern/cycles/blender/CMakeLists.txt
M   intern/cycles/device/CMakeLists.txt
M   intern/cycles/hydra/CMakeLists.txt
M   intern/ghost/CMakeLists.txt
M   intern/ghost/test/CMakeLists.txt
M   intern/glew-mx/CMakeLists.txt
M   intern/opencolorio/CMakeLists.txt
M   intern/opensubdiv/CMakeLists.txt
M   source/blender/gpu/CMakeLists.txt
M   source/blender/python/generic/CMakeLists.txt
M   source/blender/python/gpu/CMakeLists.txt

===

diff --git a/intern/cycles/app/CMakeLists.txt b/intern/cycles/app/CMakeLists.txt
index 6aea962eab5..4c9eb9a143c 100644
--- a/intern/cycles/app/CMakeLists.txt
+++ b/intern/cycles/app/CMakeLists.txt
@@ -44,8 +44,8 @@ endif()
 
 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
   add_definitions(${GL_DEFINITIONS})
-  list(APPEND INC_SYS ${GLEW_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS})
-  list(APPEND LIB ${CYCLES_GL_LIBRARIES} ${CYCLES_GLEW_LIBRARIES} 
${SDL2_LIBRARIES})
+  list(APPEND INC_SYS ${SDL2_INCLUDE_DIRS})
+  list(APPEND LIB ${CYCLES_GL_LIBRARIES} ${SDL2_LIBRARIES})
 endif()
 
 cycles_external_libraries_append(LIB)
diff --git a/intern/cycles/blender/CMakeLists.txt 
b/intern/cycles/blender/CMakeLists.txt
index 4919b99cfe0..d8f6cf3d86f 100644
--- a/intern/cycles/blender/CMakeLists.txt
+++ b/intern/cycles/blender/CMakeLists.txt
@@ -14,7 +14,6 @@ set(INC
 
 set(INC_SYS
   ${PYTHON_INCLUDE_DIRS}
-  ${GLEW_INCLUDE_DIR}
 )
 
 set(SRC
diff --git a/intern/cycles/device/CMakeLists.txt 
b/intern/cycles/device/CMakeLists.txt
index 6418801c572..86ece4ccdd3 100644
--- a/intern/cycles/device/CMakeLists.txt
+++ b/intern/cycles/device/CMakeLists.txt
@@ -6,9 +6,7 @@ set(INC
   ../../glew-mx
 )
 
-set(INC_SYS
-  ${GLEW_INCLUDE_DIR}
-)
+set(INC_SYS )
 
 if(WITH_CYCLES_DEVICE_OPTIX OR WITH_CYCLES_DEVICE_CUDA)
   if(WITH_CUDA_DYNLOAD)
diff --git a/intern/cycles/hydra/CMakeLists.txt 
b/intern/cycles/hydra/CMakeLists.txt
index aa194fb936e..e7c2e0dafa9 100644
--- a/intern/cycles/hydra/CMakeLists.txt
+++ b/intern/cycles/hydra/CMakeLists.txt
@@ -10,14 +10,12 @@ set(INC
 )
 set(INC_SYS
   ${USD_INCLUDE_DIRS}
-  ${GLEW_INCLUDE_DIR}
 )
 
 set(LIB
   cycles_scene
   cycles_session
   cycles_graph
-  ${CYCLES_GLEW_LIBRARIES}
 )
 cycles_external_libraries_append(LIB)
 
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 6a11d00cbc4..02d9bb8db8e 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -8,9 +8,7 @@ set(INC
   ../../source/blender/makesdna
 )
 
-set(INC_SYS
-  ${GLEW_INCLUDE_PATH}
-)
+set(INC_SYS )
 
 set(SRC
   intern/GHOST_Buttons.cpp
@@ -69,7 +67,6 @@ set(SRC
 
 set(LIB
   bf_intern_glew_mx
-  ${GLEW_LIBRARY}
 )
 
 if(WITH_GHOST_DEBUG)
diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt
index 9cc406313c7..afebb8e7786 100644
--- a/intern/ghost/test/CMakeLists.txt
+++ b/intern/ghost/test/CMakeLists.txt
@@ -217,21 +217,12 @@ endif()
 
 if(UNIX AND NOT APPLE)
   find_package(X11 REQUIRED)
-  find_package(GLEW)
-
-  if(NOT GLEW_FOUND)
-message(FATAL_ERROR "GLEW is required to build blender, install it or 
disable WITH_SYSTEM_GLEW")
-  endif()
 
   set(PLATFORM_LINKLIBS
 ${X11_X11_LIB}
 ${X11_Xinput_LIB}
-${GLEW_LIBRARY}
 -lpthread
   )
-else()
-  # set(GLEW_LIBRARY "")  # unused
-  set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
 endif()
 
 string(APPEND CMAKE_C_FLAGS " ${PLATFORM_CFLAGS}")
diff --git a/intern/glew-mx/CMakeLists.txt b/intern/glew-mx/CMakeLists.txt
index 49e9762672f..ebfe8ad2f73 100644
--- a/intern/glew-mx/CMakeLists.txt
+++ b/intern/glew-mx/CMakeLists.txt
@@ -5,9 +5,7 @@ set(INC
   .
 )
 
-set(INC_SYS
-  ${GLEW_INCLUDE_PATH}
-)
+set(INC_SYS )
 
 set(SRC
   intern/glew-mx.c
diff --git a/intern/opencolorio/CMakeLists.txt 
b/intern/opencolorio/CMakeLists.txt
index be6ccc5c2c5..dd4297e6e28 100644
--- a/intern/opencolorio/CMakeLists.txt
+++ b/intern/opencolorio/CMakeLists.txt
@@ -37,7 +37,6 @@ if(WITH_OPENCOLORIO)
 
   list(APPEND INC_SYS
 ${OPENCOLORIO_INCLUDE_DIRS}
-${GLEW_INCLUDE_PATH}
   )
 
   list(APPEND SRC
diff --git a/intern/opensubdiv/CMakeLists.txt b/intern/opensubdiv/CMakeLists.txt
index bb3aa16a9fe..7d15936d0a0 100644
--- a/intern/opensubdiv/CMakeLists.txt
+++ b/intern/opensubdiv/CMakeLists.txt
@@ -29,7 +29,6 @@ if(WITH_OPENSUBDIV)
 
   list(APPEND INC_SYS
 ${OPENSUBDIV_INCLUDE_DIRS}
-${GLEW_INCLUDE_PATH}
   )
 
   list(APPEND SRC
@@ -100,7 +99,6 @@ if(WITH_OPENSUBDIV)
   OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_COMPUTE)
 
   add_definitions(${GL_DEFINITIONS})
-  add_definitions(-DOSD_USES_GLEW)
 
   if(WI

[Bf-blender-cvs] [41c10ac84ae] master: Cycles: fix support for multiple Intel GPUs

2022-07-01 Thread Xavier Hallade
Commit: 41c10ac84ae420274dd79227dc698c8be14d13dd
Author: Xavier Hallade
Date:   Fri Jul 1 10:36:00 2022 +0200
Branches: master
https://developer.blender.org/rB41c10ac84ae420274dd79227dc698c8be14d13dd

Cycles: fix support for multiple Intel GPUs

Identical Intel GPUs ended up with the same id.
Added PCI BDF to the id to make it unique.

===

M   intern/cycles/device/oneapi/device.cpp
M   intern/cycles/kernel/device/oneapi/kernel.cpp

===

diff --git a/intern/cycles/device/oneapi/device.cpp 
b/intern/cycles/device/oneapi/device.cpp
index f70425b32cf..8056c204188 100644
--- a/intern/cycles/device/oneapi/device.cpp
+++ b/intern/cycles/device/oneapi/device.cpp
@@ -89,6 +89,9 @@ bool device_oneapi_init()
   if (getenv("SYCL_DEVICE_FILTER") == nullptr) {
 _putenv_s("SYCL_DEVICE_FILTER", "host,level_zero");
   }
+  if (getenv("SYCL_ENABLE_PCI") == nullptr) {
+_putenv_s("SYCL_ENABLE_PCI", "1");
+  }
   if (getenv("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_FOR_IN_ORDER_QUEUE") == 
nullptr) {
 _putenv_s("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_FOR_IN_ORDER_QUEUE", "0");
   }
@@ -96,6 +99,7 @@ bool device_oneapi_init()
   setenv("SYCL_CACHE_PERSISTENT", "1", false);
   setenv("SYCL_CACHE_THRESHOLD", "0", false);
   setenv("SYCL_DEVICE_FILTER", "host,level_zero", false);
+  setenv("SYCL_ENABLE_PCI", "1", false);
   setenv("SYCL_PI_LEVEL_ZERO_USE_COPY_ENGINE_FOR_IN_ORDER_QUEUE", "0", false);
 #  endif
 
diff --git a/intern/cycles/kernel/device/oneapi/kernel.cpp 
b/intern/cycles/kernel/device/oneapi/kernel.cpp
index 2b915027bda..11a551e822e 100644
--- a/intern/cycles/kernel/device/oneapi/kernel.cpp
+++ b/intern/cycles/kernel/device/oneapi/kernel.cpp
@@ -862,6 +862,9 @@ void oneapi_iterate_devices(OneAPIDeviceIteratorCallback 
cb, void *user_ptr)
 device.get_platform().get_info();
 std::string name = device.get_info();
 std::string id = "ONEAPI_" + platform_name + "_" + name;
+if (device.has(sycl::aspect::ext_intel_pci_address)) {
+  id.append("_" + 
device.get_info());
+}
 (cb)(id.c_str(), name.c_str(), num, user_ptr);
 num++;
   }

___
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] [e7a21275c0f] master: IO: print import & export times of Alembic & USD

2022-07-01 Thread Aras Pranckevicius
Commit: e7a21275c0f1bfb0e8bbeda384e5b46131e48b93
Author: Aras Pranckevicius
Date:   Fri Jul 1 12:17:50 2022 +0300
Branches: master
https://developer.blender.org/rBe7a21275c0f1bfb0e8bbeda384e5b46131e48b93

IO: print import & export times of Alembic & USD

Many existing importers/exporters do log the time it takes to system
console (some others log more information too). In particular, OBJ
(C++ & python), STL (C++ & python), PLY, glTF2 all log the time it
takes. However, neither USD nor Alembic do. And also it's harder to
know the time it takes there from a profiler, since all the work
normally is done on a background job and is split between several
threads (so you can't just find some top-level function and see how
much time it took).

This change:

- Adds import/export time logging to USD & Alembic importer/exporter,
- In the time utility class (also used by OBJ & STL), improve the
  output formatting: 1) print only one decimal digit, 2) for long
  times, print seconds and also produce a hours:minutes:seconds form.

Reviewed By: Michael Kowalski, Kévin Dietrich
Differential Revision: https://developer.blender.org/D15170

===

M   source/blender/blenlib/intern/timeit.cc
M   source/blender/io/alembic/exporter/abc_export_capi.cc
M   source/blender/io/alembic/intern/alembic_capi.cc
M   source/blender/io/usd/intern/usd_capi_export.cc
M   source/blender/io/usd/intern/usd_capi_import.cc

===

diff --git a/source/blender/blenlib/intern/timeit.cc 
b/source/blender/blenlib/intern/timeit.cc
index f11f9c4ad94..7a8cf8da038 100644
--- a/source/blender/blenlib/intern/timeit.cc
+++ b/source/blender/blenlib/intern/timeit.cc
@@ -3,19 +3,29 @@
 #include "BLI_timeit.hh"
 
 #include 
+#include 
 
 namespace blender::timeit {
 
 void print_duration(Nanoseconds duration)
 {
-  if (duration < std::chrono::microseconds(100)) {
+  using namespace std::chrono;
+  if (duration < microseconds(100)) {
 std::cout << duration.count() << " ns";
   }
-  else if (duration < std::chrono::seconds(5)) {
-std::cout << duration.count() / 1.0e6 << " ms";
+  else if (duration < seconds(5)) {
+std::cout << std::fixed << std::setprecision(1) << duration.count() / 
1.0e6 << " ms";
+  }
+  else if (duration > seconds(90)) {
+/* Long durations: print seconds, and also H:m:s */
+const auto dur_hours = duration_cast(duration);
+const auto dur_mins = duration_cast(duration - dur_hours);
+const auto dur_sec = duration_cast(duration - dur_hours - 
dur_mins);
+std::cout << std::fixed << std::setprecision(1) << duration.count() / 
1.0e9 << " s ("
+  << dur_hours.count() << "H:" << dur_mins.count() << "m:" << 
dur_sec.count() << "s)";
   }
   else {
-std::cout << duration.count() / 1.0e9 << " s";
+std::cout << std::fixed << std::setprecision(1) << duration.count() / 
1.0e9 << " s";
   }
 }
 
diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc 
b/source/blender/io/alembic/exporter/abc_export_capi.cc
index 5554fb505a4..dfca89e2c6d 100644
--- a/source/blender/io/alembic/exporter/abc_export_capi.cc
+++ b/source/blender/io/alembic/exporter/abc_export_capi.cc
@@ -24,6 +24,7 @@
 #include "BLI_fileops.h"
 #include "BLI_path_util.h"
 #include "BLI_string.h"
+#include "BLI_timeit.hh"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -44,6 +45,7 @@ struct ExportJobData {
 
   bool was_canceled;
   bool export_ok;
+  blender::timeit::TimePoint start_time;
 };
 
 namespace blender::io::alembic {
@@ -59,6 +61,14 @@ static void build_depsgraph(Depsgraph *depsgraph, const bool 
visible_objects_onl
   }
 }
 
+static void report_job_duration(const ExportJobData *data)
+{
+  blender::timeit::Nanoseconds duration = blender::timeit::Clock::now() - 
data->start_time;
+  std::cout << "Alembic export of '" << data->filename << "' took ";
+  blender::timeit::print_duration(duration);
+  std::cout << '\n';
+}
+
 static void export_startjob(void *customdata,
 /* Cannot be const, this function implements 
wm_jobs_start_callback.
  * NOLINTNEXTLINE: 
readability-non-const-parameter. */
@@ -68,6 +78,7 @@ static void export_startjob(void *customdata,
 {
   ExportJobData *data = static_cast(customdata);
   data->was_canceled = false;
+  data->start_time = blender::timeit::Clock::now();
 
   G.is_rendering = true;
   WM_set_locked_interface(data->wm, true);
@@ -177,6 +188,7 @@ static void export_endjob(void *customdata)
 
   G.is_rendering = false;
   WM_set_locked_interface(data->wm, false);
+  report_job_duration(data);
 }
 
 }  // namespace blender::io::alembic
diff --git a/source/blender/io/alembic/intern/alembic_capi.cc 
b/source/blender/io/alembic/intern/alembic_capi.cc
index cd6750341a8..27df23b38c6 100644
--- a/source/blender/io/alembic/intern/alembic_capi.cc
+++ b/source/blender/io/alembic/intern/alembic_capi.cc
@@ -5

[Bf-blender-cvs] [5e4a8fa12e2] blender-v2.93-release: Py API Doc: refactor changelog generation script.

2022-07-01 Thread Bastien Montagne
Commit: 5e4a8fa12e2900ed35016cca40454280e0df9317
Author: Bastien Montagne
Date:   Wed Jun 15 15:36:19 2022 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB5e4a8fa12e2900ed35016cca40454280e0df9317

Py API Doc: refactor changelog generation script.

Main change is to make it use JSON format for its dump files, instead of
some Python code.

It also introduces an index for those API dump files, mapping a blender
version to the relevant file path.

This is then used to automatically the most recent (version-number wise)
previous API dump to compare against current one, when generating the
change log RST file.

Part of {T97663}.

===

M   doc/python_api/sphinx_changelog_gen.py

===

diff --git a/doc/python_api/sphinx_changelog_gen.py 
b/doc/python_api/sphinx_changelog_gen.py
index dc54de826ba..4fc50b5d5a5 100644
--- a/doc/python_api/sphinx_changelog_gen.py
+++ b/doc/python_api/sphinx_changelog_gen.py
@@ -19,59 +19,111 @@
 # 
 
 """
-Dump the python API into a text file so we can generate changelogs.
+---
 
-output from this tool should be added into "doc/python_api/rst/change_log.rst"
+Dump the python API into a JSON file, or generate changelogs from those JSON 
API dumps.
 
-# dump api blender_version.py in CWD
-blender --background --python doc/python_api/sphinx_changelog_gen.py -- --dump
+Typically, changelog output from this tool should be added into 
"doc/python_api/rst/change_log.rst"
 
-# create changelog
-blender --background --factory-startup --python 
doc/python_api/sphinx_changelog_gen.py -- \
---api_from blender_2_63_0.py \
---api_to   blender_2_64_0.py \
---api_out changes.rst
+API dump files are saved together with the generated API doc on the server, 
with a general index file.
+This way the changelog generation simply needs to re-download the previous 
version's dump for the diffing process.
+
+---
 
+# Dump api blender_version.json in CWD:
+blender --background  --factory-startup --python 
doc/python_api/sphinx_changelog_gen.py -- \
+--indexpath="path/to/api/docs/api_dump_index.json" \
+dump --filepath-out="path/to/api/docs//api_dump.json"
+
+# Create changelog:
+blender --background --factory-startup --python 
doc/python_api/sphinx_changelog_gen.py -- \
+--indexpath="path/to/api/docs/api_dump_index.json" \
+changelog --filepath-out doc/python_api/rst/change_log.rst
 
-# Api comparison can also run without blender
+# Api comparison can also run without blender,
+# will by default generate changeloig between the last two available versions 
listed in the index,
+# unless input files are provided explicitely:
 python doc/python_api/sphinx_changelog_gen.py -- \
---api_from blender_api_2_63_0.py \
---api_to   blender_api_2_64_0.py \
---api_out changes.rst
+--indexpath="path/to/api/docs/api_dump_index.json" \
+changelog --filepath-in-from blender_api_2_63_0.json \
+  --filepath-in-to   blender_api_2_64_0.json \
+  --filepath-out changes.rst
 
-# Save the latest API dump in this folder, renaming it with its revision.
-# This way the next person updating it doesn't need to build an old Blender 
only for that
+--
 
-"""
+API dump index format:
 
-# format
-'''
-{"module.name":
-{"parent.class":
-{"basic_type", "member_name":
-("Name", type, range, length, default, descr, f_args, f_arg_types, 
f_ret_types)}, ...
-}, ...
+{[version_main, version_sub]: "/api_dump.json", ...
 }
-'''
 
-api_names = "basic_type" "name", "type", "range", "length", "default", 
"descr", "f_args", "f_arg_types", "f_ret_types"
+API dump format:
+
+[
+[version_main, vserion_sub, version_path],
+{"module.name":
+{"parent.class":
+{"basic_type", "member_name":
+["Name", type, range, length, default, descr, f_args, 
f_arg_types, f_ret_types]}, ...
+}, ...
+}
+]
 
+"""
+
+import json
+import os
+
+
+api_names = "basic_type" "name", "type", "range", "length", "default", 
"descr", "f_args", "f_arg_types", "f_ret_types"
 API_BASIC_TYPE = 0
 API_F_ARGS = 7
 
 
-def api_dunp_fname():
-import bpy
-return "blender_api_%s.py" % "_".join([str(i) for i in bpy.app.version])
+def api_version():
+try:
+import bpy
+except:
+return None, None
+version = tuple(bpy.app.version[:2])
+version_key = "%d.%d" % (version[0], version[1])
+return version, version_key
+
+
+def api_version_previous_in_index(index, version):
+print("Searching for previous version to %s in %r" % (version, index))
+version_prev = (version[0], version[1])
+while True:
+version_prev = (version_prev[0], version_prev[1] - 1)
+if version_prev[1] < 0:
+version_prev = (version_prev[0] - 1, 99)
+if versio

[Bf-blender-cvs] [7ec5ef4e1e3] blender-v2.93-release: Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

2022-07-01 Thread Bastien Montagne
Commit: 7ec5ef4e1e3b71c87ebc6649ff9d10e07be9e725
Author: Bastien Montagne
Date:   Wed Jun 15 15:43:13 2022 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rB7ec5ef4e1e3b71c87ebc6649ff9d10e07be9e725

Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

Optionally use `sphinx_changelog_gen.py` to dump current version of the
API in a JSON file, and use closest previous one listed in given index
file to create a changelog RST page for Sphinx.

Part of {T97663}.

===

M   doc/python_api/sphinx_doc_gen.py

===

diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 107c233134e..db6b810762a 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -136,6 +136,26 @@ def handle_args():
  "(default=False)",
 required=False)
 
+parser.add_argument(
+"--api-changelog-generate",
+dest="changelog",
+default=False,
+action='store_true',
+help="Generate the API changelog RST file "
+"(default=False, requires `--api-dump-index-path` parameter)",
+required=False,
+)
+
+parser.add_argument(
+"--api-dump-index-path",
+dest="api_dump_index_path",
+metavar='FILE',
+default=None,
+help="Path to the API dump index JSON file "
+"(required when `--api-changelog-generate` is True)",
+required=False,
+)
+
 parser.add_argument("-o", "--output",
 dest="output_dir",
 type=str,
@@ -473,6 +493,26 @@ if ARGS.sphinx_build_pdf:
 sphinx_make_pdf_log = os.path.join(ARGS.output_dir, ".latex_make.log")
 SPHINX_MAKE_PDF_STDOUT = open(sphinx_make_pdf_log, "w", 
encoding="utf-8")
 
+
+# CHANGELOG 
GENERATION--
+
+def generate_changelog():
+import importlib.util
+spec = importlib.util.spec_from_file_location("sphinx_changelog_gen",
+  
os.path.abspath(os.path.join(SCRIPT_DIR, "sphinx_changelog_gen.py")))
+sphinx_changelog_gen = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(sphinx_changelog_gen)
+
+API_DUMP_INDEX_FILEPATH = ARGS.api_dump_index_path
+API_DUMP_ROOT = os.path.dirname(API_DUMP_INDEX_FILEPATH)
+API_DUMP_FILEPATH = os.path.abspath(os.path.join(API_DUMP_ROOT, 
BLENDER_VERSION_DOTS, "api_dump.json"))
+API_CHANGELOG_FILEPATH = os.path.abspath(os.path.join(SPHINX_IN_TMP, 
"change_log.rst"))
+
+sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, 
"dump", "--filepath-out", API_DUMP_FILEPATH))
+
+sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, 
"changelog", "--filepath-out", API_CHANGELOG_FILEPATH))
+
+
 # API 
DUMP--
 
 # lame, python won't give some access
@@ -2272,6 +2312,9 @@ def main():
 
 rna2sphinx(SPHINX_IN_TMP)
 
+if ARGS.changelog:
+generate_changelog()
+
 if ARGS.full_rebuild:
 # only for full updates
 shutil.rmtree(SPHINX_IN, True)

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


[Bf-blender-cvs] [4e23bfb043f] blender-v3.2-release: Py API Doc: refactor changelog generation script.

2022-07-01 Thread Bastien Montagne
Commit: 4e23bfb043f55f39c973370e0d40dd59e0d9439a
Author: Bastien Montagne
Date:   Wed Jun 15 15:36:19 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB4e23bfb043f55f39c973370e0d40dd59e0d9439a

Py API Doc: refactor changelog generation script.

Main change is to make it use JSON format for its dump files, instead of
some Python code.

It also introduces an index for those API dump files, mapping a blender
version to the relevant file path.

This is then used to automatically the most recent (version-number wise)
previous API dump to compare against current one, when generating the
change log RST file.

Part of {T97663}.

===

M   doc/python_api/sphinx_changelog_gen.py

===

diff --git a/doc/python_api/sphinx_changelog_gen.py 
b/doc/python_api/sphinx_changelog_gen.py
index 6c06178d603..ea0562f99bb 100644
--- a/doc/python_api/sphinx_changelog_gen.py
+++ b/doc/python_api/sphinx_changelog_gen.py
@@ -3,59 +3,111 @@
 # 
 
 """
-Dump the python API into a text file so we can generate changelogs.
+---
 
-output from this tool should be added into "doc/python_api/rst/change_log.rst"
+Dump the python API into a JSON file, or generate changelogs from those JSON 
API dumps.
 
-# dump api blender_version.py in CWD
-blender --background --python doc/python_api/sphinx_changelog_gen.py -- --dump
+Typically, changelog output from this tool should be added into 
"doc/python_api/rst/change_log.rst"
 
-# create changelog
-blender --background --factory-startup --python 
doc/python_api/sphinx_changelog_gen.py -- \
---api_from blender_2_63_0.py \
---api_to   blender_2_64_0.py \
---api_out changes.rst
+API dump files are saved together with the generated API doc on the server, 
with a general index file.
+This way the changelog generation simply needs to re-download the previous 
version's dump for the diffing process.
+
+---
 
+# Dump api blender_version.json in CWD:
+blender --background  --factory-startup --python 
doc/python_api/sphinx_changelog_gen.py -- \
+--indexpath="path/to/api/docs/api_dump_index.json" \
+dump --filepath-out="path/to/api/docs//api_dump.json"
+
+# Create changelog:
+blender --background --factory-startup --python 
doc/python_api/sphinx_changelog_gen.py -- \
+--indexpath="path/to/api/docs/api_dump_index.json" \
+changelog --filepath-out doc/python_api/rst/change_log.rst
 
-# Api comparison can also run without blender
+# Api comparison can also run without blender,
+# will by default generate changeloig between the last two available versions 
listed in the index,
+# unless input files are provided explicitely:
 python doc/python_api/sphinx_changelog_gen.py -- \
---api_from blender_api_2_63_0.py \
---api_to   blender_api_2_64_0.py \
---api_out changes.rst
+--indexpath="path/to/api/docs/api_dump_index.json" \
+changelog --filepath-in-from blender_api_2_63_0.json \
+  --filepath-in-to   blender_api_2_64_0.json \
+  --filepath-out changes.rst
 
-# Save the latest API dump in this folder, renaming it with its revision.
-# This way the next person updating it doesn't need to build an old Blender 
only for that
+--
 
-"""
+API dump index format:
 
-# format
-'''
-{"module.name":
-{"parent.class":
-{"basic_type", "member_name":
-("Name", type, range, length, default, descr, f_args, f_arg_types, 
f_ret_types)}, ...
-}, ...
+{[version_main, version_sub]: "/api_dump.json", ...
 }
-'''
 
-api_names = "basic_type" "name", "type", "range", "length", "default", 
"descr", "f_args", "f_arg_types", "f_ret_types"
+API dump format:
+
+[
+[version_main, vserion_sub, version_path],
+{"module.name":
+{"parent.class":
+{"basic_type", "member_name":
+["Name", type, range, length, default, descr, f_args, 
f_arg_types, f_ret_types]}, ...
+}, ...
+}
+]
 
+"""
+
+import json
+import os
+
+
+api_names = "basic_type" "name", "type", "range", "length", "default", 
"descr", "f_args", "f_arg_types", "f_ret_types"
 API_BASIC_TYPE = 0
 API_F_ARGS = 7
 
 
-def api_dunp_fname():
-import bpy
-return "blender_api_%s.py" % "_".join([str(i) for i in bpy.app.version])
+def api_version():
+try:
+import bpy
+except:
+return None, None
+version = tuple(bpy.app.version[:2])
+version_key = "%d.%d" % (version[0], version[1])
+return version, version_key
+
+
+def api_version_previous_in_index(index, version):
+print("Searching for previous version to %s in %r" % (version, index))
+version_prev = (version[0], version[1])
+while True:
+version_prev = (version_prev[0], version_prev[1] - 1)
+if version_prev[1] < 0:
+version_prev = (version_prev[0] - 1, 99)
+if version_p

[Bf-blender-cvs] [9bb9a54a2ae] blender-v3.2-release: Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

2022-07-01 Thread Bastien Montagne
Commit: 9bb9a54a2aec6787a833f08da66d9a117c059ce1
Author: Bastien Montagne
Date:   Wed Jun 15 15:43:13 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rB9bb9a54a2aec6787a833f08da66d9a117c059ce1

Py API Doc: add runtime changelog generation to `sphinx_doc_gen.py`.

Optionally use `sphinx_changelog_gen.py` to dump current version of the
API in a JSON file, and use closest previous one listed in given index
file to create a changelog RST page for Sphinx.

Part of {T97663}.

===

M   doc/python_api/sphinx_doc_gen.py

===

diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index d87d8b71ce5..684761f49c5 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -121,6 +121,26 @@ def handle_args():
  "(default=False)",
 required=False)
 
+parser.add_argument(
+"--api-changelog-generate",
+dest="changelog",
+default=False,
+action='store_true',
+help="Generate the API changelog RST file "
+"(default=False, requires `--api-dump-index-path` parameter)",
+required=False,
+)
+
+parser.add_argument(
+"--api-dump-index-path",
+dest="api_dump_index_path",
+metavar='FILE',
+default=None,
+help="Path to the API dump index JSON file "
+"(required when `--api-changelog-generate` is True)",
+required=False,
+)
+
 parser.add_argument("-o", "--output",
 dest="output_dir",
 type=str,
@@ -468,6 +488,26 @@ if ARGS.sphinx_build_pdf:
 sphinx_make_pdf_log = os.path.join(ARGS.output_dir, ".latex_make.log")
 SPHINX_MAKE_PDF_STDOUT = open(sphinx_make_pdf_log, "w", 
encoding="utf-8")
 
+
+# CHANGELOG 
GENERATION--
+
+def generate_changelog():
+import importlib.util
+spec = importlib.util.spec_from_file_location("sphinx_changelog_gen",
+  
os.path.abspath(os.path.join(SCRIPT_DIR, "sphinx_changelog_gen.py")))
+sphinx_changelog_gen = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(sphinx_changelog_gen)
+
+API_DUMP_INDEX_FILEPATH = ARGS.api_dump_index_path
+API_DUMP_ROOT = os.path.dirname(API_DUMP_INDEX_FILEPATH)
+API_DUMP_FILEPATH = os.path.abspath(os.path.join(API_DUMP_ROOT, 
BLENDER_VERSION_DOTS, "api_dump.json"))
+API_CHANGELOG_FILEPATH = os.path.abspath(os.path.join(SPHINX_IN_TMP, 
"change_log.rst"))
+
+sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, 
"dump", "--filepath-out", API_DUMP_FILEPATH))
+
+sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, 
"changelog", "--filepath-out", API_CHANGELOG_FILEPATH))
+
+
 # API 
DUMP--
 
 # lame, python won't give some access
@@ -2325,6 +2365,9 @@ def main():
 
 rna2sphinx(SPHINX_IN_TMP)
 
+if ARGS.changelog:
+generate_changelog()
+
 if ARGS.full_rebuild:
 # only for full updates
 shutil.rmtree(SPHINX_IN, True)

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


[Bf-blender-cvs] [4527dd1ce47] master: Metal: MTLMemoryManager implementation includes functions which manage allocation of MTLBuffer resources.

2022-07-01 Thread Jason Fielder
Commit: 4527dd1ce4784292cd3b8dd3764b9cd843020f9a
Author: Jason Fielder
Date:   Fri Jul 1 10:30:16 2022 +0200
Branches: master
https://developer.blender.org/rB4527dd1ce4784292cd3b8dd3764b9cd843020f9a

Metal: MTLMemoryManager implementation includes functions which manage 
allocation of MTLBuffer resources.

The memory manager includes both a GPUContext-local manager which allocates 
per-context resources such as Circular Scratch Buffers for temporary data such 
as uniform updates and resource staging, and a GPUContext-global memory manager 
which features a pooled memory allocator for efficient re-use of resources, to 
reduce CPU-overhead of frequent memory allocations.

These Memory Managers act as a simple interface for use by other Metal backend 
modules and to coordinate the lifetime of buffers, to ensure that GPU-resident 
resources are correctly tracked and freed when no longer in use.

Note: This also contains dependent DIFF changes from D15027, though these will 
be removed once D15027 lands.

Authored by Apple: Michael Parkin-White

Ref T96261

Reviewed By: fclem

Maniphest Tasks: T96261

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

===

M   source/blender/blenlib/BLI_math_base.h
M   source/blender/blenlib/intern/math_base_inline.c
M   source/blender/draw/engines/eevee/eevee_render.c
M   source/blender/draw/engines/workbench/workbench_render.c
M   source/blender/gpu/CMakeLists.txt
M   source/blender/gpu/intern/gpu_immediate_util.c
M   source/blender/gpu/metal/mtl_backend.mm
M   source/blender/gpu/metal/mtl_command_buffer.mm
M   source/blender/gpu/metal/mtl_common.hh
M   source/blender/gpu/metal/mtl_context.hh
M   source/blender/gpu/metal/mtl_context.mm
M   source/blender/gpu/metal/mtl_framebuffer.mm
A   source/blender/gpu/metal/mtl_memory.hh
A   source/blender/gpu/metal/mtl_memory.mm
M   source/blender/gpu/metal/mtl_state.hh
M   source/blender/gpu/metal/mtl_state.mm
M   source/blender/gpu/metal/mtl_texture.hh
M   source/blender/gpu/metal/mtl_texture.mm

===

diff --git a/source/blender/blenlib/BLI_math_base.h 
b/source/blender/blenlib/BLI_math_base.h
index f072a17f384..c0c4594ddc0 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -221,6 +221,19 @@ MINLINE unsigned int power_of_2_min_u(unsigned int x);
  * with integers, to avoid gradual darkening when rounding down.
  */
 MINLINE int divide_round_i(int a, int b);
+
+/**
+ * Integer division that returns the ceiling, instead of flooring like normal 
C division.
+ */
+MINLINE uint divide_ceil_u(uint a, uint b);
+MINLINE uint64_t divide_ceil_ul(uint64_t a, uint64_t b);
+
+/**
+ * Returns \a a if it is a multiple of \a b or the next multiple or \a b after 
\b a .
+ */
+MINLINE uint ceil_to_multiple_u(uint a, uint b);
+MINLINE uint64_t ceil_to_multiple_ul(uint64_t a, uint64_t b);
+
 /**
  * modulo that handles negative numbers, works the same as Python's.
  */
diff --git a/source/blender/blenlib/intern/math_base_inline.c 
b/source/blender/blenlib/intern/math_base_inline.c
index cb7659a7059..fb71e84c23e 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -370,6 +370,11 @@ MINLINE uint divide_ceil_u(uint a, uint b)
   return (a + b - 1) / b;
 }
 
+MINLINE uint64_t divide_ceil_ul(uint64_t a, uint64_t b)
+{
+  return (a + b - 1) / b;
+}
+
 /**
  * Returns \a a if it is a multiple of \a b or the next multiple or \a b after 
\b a .
  */
@@ -378,6 +383,11 @@ MINLINE uint ceil_to_multiple_u(uint a, uint b)
   return divide_ceil_u(a, b) * b;
 }
 
+MINLINE uint64_t ceil_to_multiple_ul(uint64_t a, uint64_t b)
+{
+  return divide_ceil_ul(a, b) * b;
+}
+
 MINLINE int mod_i(int i, int n)
 {
   return (i % n + n) % n;
diff --git a/source/blender/draw/engines/eevee/eevee_render.c 
b/source/blender/draw/engines/eevee/eevee_render.c
index bef19c589c2..82944f237ea 100644
--- a/source/blender/draw/engines/eevee/eevee_render.c
+++ b/source/blender/draw/engines/eevee/eevee_render.c
@@ -24,6 +24,7 @@
 #include "DEG_depsgraph_query.h"
 
 #include "GPU_capabilities.h"
+#include "GPU_context.h"
 #include "GPU_framebuffer.h"
 #include "GPU_state.h"
 
@@ -646,6 +647,10 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine 
*engine, RenderLayer *rl
 /* XXX Seems to fix TDR issue with NVidia drivers on linux. */
 GPU_finish();
 
+/* Perform render step between samples to allow
+ * flushing of freed GPUBackend resources. */
+GPU_render_step();
+
 RE_engine_update_progress(engine, (float)(render_samples++) / 
(float)tot_sample);
   }
 }
diff --git a/source/blender/draw/engines/workbench/workbench_render.c 
b/source/blender/draw/engines/workbench/workbench_render.c
index e5dcf6c5624..931f6a2dc92 100644
--- a/source/blender/draw/e

[Bf-blender-cvs] [3ffc5583411] master: Sculpt Curves: UI tweaks and shortcut

2022-07-01 Thread Dalai Felinto
Commit: 3ffc5583411ac6e1286586881bdbe1207a34b386
Author: Dalai Felinto
Date:   Fri Jul 1 10:20:07 2022 +0200
Branches: master
https://developer.blender.org/rB3ffc5583411ac6e1286586881bdbe1207a34b386

Sculpt Curves: UI tweaks and shortcut

* Minimum Distance -> Distance Mix
* Max Count -> Count Max
* Shift + A for selection grow

This follows better the names we have in geometry nodes in the Distribute Points
node when using the Poisson Disk method (Distance Min, Distance Max).

The shortcut for the selection grow is the same we use in mesh sculpt
for the Expand Mask operator (which behaves a bit similar).

===

M   release/scripts/presets/keyconfig/keymap_data/blender_default.py
M   release/scripts/startup/bl_ui/space_view3d.py

===

diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py 
b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index d12d68ee5a0..c0db6c5f523 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -5625,6 +5625,7 @@ def km_sculpt_curves(params):
 *_template_paint_radial_control("curves_sculpt"),
 *_template_items_select_actions(params, "sculpt_curves.select_all"),
 ("sculpt_curves.min_distance_edit", {"type": 'R', "value": 'PRESS', 
"shift": True}, {}),
+("sculpt_curves.select_grow", {"type": 'A', "value": 'PRESS', "shift": 
True}, {}),
 ])
 
 return keymap
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index c2342e8949a..5a38c4175a8 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -550,12 +550,12 @@ class _draw_tool_settings_context_mode:
 row = layout.row(align=True)
 row.prop(brush.curves_sculpt_settings, "density_mode", text="", 
expand=True)
 row = layout.row(align=True)
-row.prop(brush.curves_sculpt_settings, "minimum_distance")
+row.prop(brush.curves_sculpt_settings, "minimum_distance", 
text="Distance Min")
 row.operator_context = 'INVOKE_REGION_WIN'
 row.operator("sculpt_curves.min_distance_edit", text="", 
icon='DRIVER_DISTANCE')
 row = layout.row(align=True)
 row.enabled = brush.curves_sculpt_settings.density_mode != 'REMOVE'
-row.prop(brush.curves_sculpt_settings, "density_add_attempts", 
text="Max Count")
+row.prop(brush.curves_sculpt_settings, "density_add_attempts", 
text="Count Max")
 layout.popover("VIEW3D_PT_tools_brush_falloff")
 layout.popover("VIEW3D_PT_curves_sculpt_add_shape", text="Curve 
Shape")
 elif curves_tool == "SLIDE":

___
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] [0554537c3cb] master: Cleanup: add missing license headers in Cycles oneAPI implementation

2022-07-01 Thread Xavier Hallade
Commit: 0554537c3cb4d040cf9a01695ec3089ad0a8426b
Author: Xavier Hallade
Date:   Fri Jul 1 10:12:42 2022 +0200
Branches: master
https://developer.blender.org/rB0554537c3cb4d040cf9a01695ec3089ad0a8426b

Cleanup: add missing license headers in Cycles oneAPI implementation

===

M   intern/cycles/kernel/device/oneapi/dll_interface_template.h
M   intern/cycles/kernel/device/oneapi/kernel_templates.h

===

diff --git a/intern/cycles/kernel/device/oneapi/dll_interface_template.h 
b/intern/cycles/kernel/device/oneapi/dll_interface_template.h
index 22804490a70..662068c0fed 100644
--- a/intern/cycles/kernel/device/oneapi/dll_interface_template.h
+++ b/intern/cycles/kernel/device/oneapi/dll_interface_template.h
@@ -1,3 +1,6 @@
+/* SPDX-License-Identifier: Apache-2.0
+ * Copyright 2022 Intel Corporation */
+
 /* device_capabilities() returns a C string that must be free'd with 
oneapi_free(). */
 DLL_INTERFACE_CALL(oneapi_device_capabilities, char *)
 DLL_INTERFACE_CALL(oneapi_free, void, void *)
diff --git a/intern/cycles/kernel/device/oneapi/kernel_templates.h 
b/intern/cycles/kernel/device/oneapi/kernel_templates.h
index 41f9a9ba583..d8964d9b672 100644
--- a/intern/cycles/kernel/device/oneapi/kernel_templates.h
+++ b/intern/cycles/kernel/device/oneapi/kernel_templates.h
@@ -1,3 +1,6 @@
+/* SPDX-License-Identifier: Apache-2.0
+ * Copyright 2021-2022 Intel Corporation */
+
 #pragma once
 
 /* Some macro magic to generate templates for kernel arguments.

___
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] [bb8953ab498] master: GHOST/Wayland: map additional cursors from GHOST_TStandardCursor

2022-07-01 Thread Campbell Barton
Commit: bb8953ab49817a6ddaaef21ac0da3a2cdc81e23f
Author: Campbell Barton
Date:   Fri Jul 1 18:09:47 2022 +1000
Branches: master
https://developer.blender.org/rBbb8953ab49817a6ddaaef21ac0da3a2cdc81e23f

GHOST/Wayland: map additional cursors from GHOST_TStandardCursor

===

M   intern/ghost/intern/GHOST_SystemWayland.cpp

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index d00c8b34ed7..09784c67fda 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -669,7 +669,7 @@ static const std::unordered_map cursors = {
 {GHOST_kStandardCursorRightArrow, "right_ptr"},
 {GHOST_kStandardCursorLeftArrow, "left_ptr"},
 {GHOST_kStandardCursorInfo, ""},
-{GHOST_kStandardCursorDestroy, ""},
+{GHOST_kStandardCursorDestroy, "pirate"},
 {GHOST_kStandardCursorHelp, "question_arrow"},
 {GHOST_kStandardCursorWait, "watch"},
 {GHOST_kStandardCursorText, "xterm"},
@@ -677,21 +677,21 @@ static const std::unordered_map cursors = {
 {GHOST_kStandardCursorCrosshairA, ""},
 {GHOST_kStandardCursorCrosshairB, ""},
 {GHOST_kStandardCursorCrosshairC, ""},
-{GHOST_kStandardCursorPencil, ""},
+{GHOST_kStandardCursorPencil, "pencil"},
 {GHOST_kStandardCursorUpArrow, "sb_up_arrow"},
 {GHOST_kStandardCursorDownArrow, "sb_down_arrow"},
-{GHOST_kStandardCursorVerticalSplit, ""},
-{GHOST_kStandardCursorHorizontalSplit, ""},
+{GHOST_kStandardCursorVerticalSplit, "split_v"},
+{GHOST_kStandardCursorHorizontalSplit, "split_h"},
 {GHOST_kStandardCursorEraser, ""},
 {GHOST_kStandardCursorKnife, ""},
-{GHOST_kStandardCursorEyedropper, ""},
-{GHOST_kStandardCursorZoomIn, ""},
-{GHOST_kStandardCursorZoomOut, ""},
+{GHOST_kStandardCursorEyedropper, "color-picker"},
+{GHOST_kStandardCursorZoomIn, "zoom-in"},
+{GHOST_kStandardCursorZoomOut, "zoom-out"},
 {GHOST_kStandardCursorMove, "move"},
-{GHOST_kStandardCursorNSEWScroll, ""},
-{GHOST_kStandardCursorNSScroll, ""},
-{GHOST_kStandardCursorEWScroll, ""},
-{GHOST_kStandardCursorStop, ""},
+{GHOST_kStandardCursorNSEWScroll, "size_all"}, /* Not an exact match. */
+{GHOST_kStandardCursorNSScroll, "size_ver"},   /* Not an exact match. */
+{GHOST_kStandardCursorEWScroll, "size_hor"},   /* Not an exact match. */
+{GHOST_kStandardCursorStop, "not-allowed"},
 {GHOST_kStandardCursorUpDown, "sb_v_double_arrow"},
 {GHOST_kStandardCursorLeftRight, "sb_h_double_arrow"},
 {GHOST_kStandardCursorTopSide, "top_side"},

___
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] SVN commit: bf-blender [62964] trunk/lib/tests/compositor/distort/compositor_renders: Update compositor tests after fix for T99315

2022-07-01 Thread Sergey Sharybin
Revision: 62964
  https://developer.blender.org/rBL62964
Author:   sergey
Date: 2022-07-01 10:10:12 +0200 (Fri, 01 Jul 2022)
Log Message:
---
Update compositor tests after fix for T99315

Modified Paths:
--
trunk/lib/tests/compositor/distort/compositor_renders/node_corner_pin.png

trunk/lib/tests/compositor/distort/compositor_renders/node_plane_track_image.png

trunk/lib/tests/compositor/distort/compositor_renders/node_plane_track_motion_image.png

Modified: 
trunk/lib/tests/compositor/distort/compositor_renders/node_corner_pin.png
===
(Binary files differ)

Modified: 
trunk/lib/tests/compositor/distort/compositor_renders/node_plane_track_image.png
===
(Binary files differ)

Modified: 
trunk/lib/tests/compositor/distort/compositor_renders/node_plane_track_motion_image.png
===
(Binary files differ)

___
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] [ccbf9ee4826] master: Fix un-grab cursor positioning failing for Wayland

2022-07-01 Thread Campbell Barton
Commit: ccbf9ee48262c6078bcd10817f07c6e3f4bb9a25
Author: Campbell Barton
Date:   Fri Jul 1 18:00:30 2022 +1000
Branches: master
https://developer.blender.org/rBccbf9ee48262c6078bcd10817f07c6e3f4bb9a25

Fix un-grab cursor positioning failing for Wayland

UI elements such as sliders & color picker set an un-grab location
which GHOST/Wayland didn't implement.

===

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

===

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp 
b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 3a5e524782f..d00c8b34ed7 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -271,6 +271,8 @@ struct input_t {
 #ifdef USE_GNOME_CONFINE_HACK
   bool use_pointer_software_confine = false;
 #endif
+  /** The cursor location (in pixel-space) when hidden grab started 
(#GHOST_kGrabHide). */
+  wl_fixed_t grab_lock_xy[2] = {0, 0};
 
   struct cursor_t cursor;
 
@@ -3281,6 +3283,7 @@ static input_grab_state_t 
input_grab_state_from_mode(const GHOST_TGrabCursorMode
 
 GHOST_TSuccess GHOST_SystemWayland::setCursorGrab(const GHOST_TGrabCursorMode 
mode,
   const GHOST_TGrabCursorMode 
mode_current,
+  int32_t init_grab_xy[2],
   wl_surface *surface)
 {
   /* Ignore, if the required protocols are not supported. */
@@ -3370,6 +3373,20 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorGrab(const 
GHOST_TGrabCursorMode mo
 input->locked_pointer, xy_new[0], xy_new[1]);
 wl_surface_commit(surface);
   }
+  else if (mode_current == GHOST_kGrabHide) {
+if ((init_grab_xy[0] != input->grab_lock_xy[0]) ||
+(init_grab_xy[1] != input->grab_lock_xy[1])) {
+  GHOST_WindowWayland *win = 
GHOST_WindowWayland::from_surface_mut(surface);
+  const int scale = win->scale();
+  const wl_fixed_t xy_next[2] = {
+  wl_fixed_from_int(init_grab_xy[0]) / scale,
+  wl_fixed_from_int(init_grab_xy[1]) / scale,
+  };
+  zwp_locked_pointer_v1_set_cursor_position_hint(
+  input->locked_pointer, xy_next[0], xy_next[1]);
+  wl_surface_commit(surface);
+}
+  }
 #ifdef USE_GNOME_CONFINE_HACK
   else if (mode_current == GHOST_kGrabNormal) {
 if (was_software_confine) {
@@ -3410,6 +3427,16 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorGrab(const 
GHOST_TGrabCursorMode mo
 nullptr,
 ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
   }
+  if (mode == GHOST_kGrabHide) {
+/* Set the initial position to detect any changes when un-grabbing,
+ * otherwise the unlocked cursor defaults to un-locking in-place. */
+GHOST_WindowWayland *win = 
GHOST_WindowWayland::from_surface_mut(surface);
+const int scale = win->scale();
+init_grab_xy[0] = wl_fixed_to_int(scale * input->pointer.xy[0]);
+init_grab_xy[1] = wl_fixed_to_int(scale * input->pointer.xy[1]);
+input->grab_lock_xy[0] = init_grab_xy[0];
+input->grab_lock_xy[1] = init_grab_xy[1];
+  }
 }
 else if (grab_state_next.use_confine) {
   if (!grab_state_prev.use_confine) {
diff --git a/intern/ghost/intern/GHOST_SystemWayland.h 
b/intern/ghost/intern/GHOST_SystemWayland.h
index 7fe35146be0..4286aa9d183 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.h
+++ b/intern/ghost/intern/GHOST_SystemWayland.h
@@ -132,6 +132,7 @@ class GHOST_SystemWayland : public GHOST_System {
 
   GHOST_TSuccess setCursorGrab(const GHOST_TGrabCursorMode mode,
const GHOST_TGrabCursorMode mode_current,
+   int32_t init_grab_xy[2],
wl_surface *surface);
 
   /* WAYLAND direct-data access. */
diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp 
b/intern/ghost/intern/GHOST_WindowWayland.cpp
index 159cd808c0c..00d75d62c9f 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -484,7 +484,7 @@ 
GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
 
 GHOST_TSuccess GHOST_WindowWayland::setWindowCursorGrab(GHOST_TGrabCursorMode 
mode)
 {
-  return m_system->setCursorGrab(mode, m_cursorGrab, w->wl_surface);
+  return m_system->setCursorGrab(mode, m_cursorGrab, m_cursorGrabInitPos, 
w->wl_surface);
 }
 
 GHOST_TSuccess GHOST_WindowWayland::setWindowCursorShape(GHOST_TStandardCursor 
shape)

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

[Bf-blender-cvs] [eff62ea8aba] master: Geometry Nodes: remove warning in Points node

2022-07-01 Thread Jacques Lucke
Commit: eff62ea8abaccbaa8dab9c00e3780aaa873148d2
Author: Jacques Lucke
Date:   Fri Jul 1 10:04:35 2022 +0200
Branches: master
https://developer.blender.org/rBeff62ea8abaccbaa8dab9c00e3780aaa873148d2

Geometry Nodes: remove warning in Points node

Generating no points in some frames is a perfectly valid use case.

===

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

===

diff --git a/source/blender/nodes/geometry/nodes/node_geo_points.cc 
b/source/blender/nodes/geometry/nodes/node_geo_points.cc
index ced41c6c85c..da414960e1d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_points.cc
@@ -62,7 +62,6 @@ static void node_geo_exec(GeoNodeExecParams params)
 {
   const int count = params.extract_input("Count");
   if (count <= 0) {
-params.error_message_add(NodeWarningType::Warning, TIP_("Point count 
should be at least 1"));
 params.set_default_remaining_outputs();
 return;
   }

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


[Bf-blender-cvs] [5d57d9f8996] master: Cleanup: remove unused variable

2022-07-01 Thread Jacques Lucke
Commit: 5d57d9f899617fb04dd4f722599aa4b626ec70fe
Author: Jacques Lucke
Date:   Fri Jul 1 09:55:00 2022 +0200
Branches: master
https://developer.blender.org/rB5d57d9f899617fb04dd4f722599aa4b626ec70fe

Cleanup: remove unused variable

===

M   source/blender/editors/sculpt_paint/curves_sculpt_density.cc

===

diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc 
b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc
index 536c44ddd44..120a7802580 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc
@@ -416,9 +416,6 @@ void DensityAddOperation::on_stroke_extended(const bContext 
&C,
 
 class DensitySubtractOperation : public CurvesSculptStrokeOperation {
  private:
-  /** Only used when a 3D brush is used. */
-  CurvesBrush3D brush_3d_;
-
   friend struct DensitySubtractOperationExecutor;
 
  public:

___
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] [e4bf58e2852] master: Tracking: Image from Plane Marker operators

2022-07-01 Thread Sergey Sharybin
Commit: e4bf58e2852856e5c9d81ce04e6e9bb967795054
Author: Sergey Sharybin
Date:   Tue Jun 28 16:03:35 2022 +0200
Branches: master
https://developer.blender.org/rBe4bf58e2852856e5c9d81ce04e6e9bb967795054

Tracking: Image from Plane Marker operators

There are two operators added, which are available via a special
content menu next to the plane track image selector:

- New Image from Plane Marker
- Update Image from Plane Marker

The former one creates an image from pixels which the active plane
track marker "sees" at the current frame and sets it as the plane
track's image.

The latter one instead of creating the new image data-block updates
the image in-place.

This allows to create unwarped texture from a billboard from footage.
The intent is to allow this image to be touched up and re-projected
back to the footage with an updated content.

Available from a plane track image context menu, as well as from the
Track menu.

{F13243219}

The demo of the feature from Sebastian Koenig: 
https://www.youtube.com/watch?v=PDphO-w2SsA

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

===

M   release/scripts/startup/bl_ui/space_clip.py
M   source/blender/blenkernel/BKE_tracking.h
M   source/blender/blenkernel/intern/tracking.c
M   source/blender/editors/space_clip/clip_intern.h
M   source/blender/editors/space_clip/space_clip.c
M   source/blender/editors/space_clip/tracking_ops.c

===

diff --git a/release/scripts/startup/bl_ui/space_clip.py 
b/release/scripts/startup/bl_ui/space_clip.py
index a806e9e0c33..c337e8018e6 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -771,8 +771,10 @@ class CLIP_PT_plane_track(CLIP_PT_tracking_panel, Panel):
 
 layout.prop(active_track, "name")
 layout.prop(active_track, "use_auto_keying")
-layout.template_ID(
+row = layout.row()
+row.template_ID(
 active_track, "image", new="image.new", open="image.open")
+row.menu("CLIP_MT_plane_track_image_context_menu", 
icon='DOWNARROW_HLT', text="")
 
 row = layout.row()
 row.active = active_track.image is not None
@@ -1482,6 +1484,10 @@ class CLIP_MT_track(Menu):
 layout.operator("clip.detect_features")
 layout.operator("clip.create_plane_track")
 
+layout.separator()
+layout.operator("clip.new_image_from_plane_marker")
+layout.operator("clip.update_image_from_plane_marker")
+
 layout.separator()
 
 layout.operator(
@@ -1634,6 +1640,16 @@ class CLIP_MT_tracking_context_menu(Menu):
 draw_mask_context_menu(layout, context)
 
 
+class CLIP_MT_plane_track_image_context_menu(Menu):
+bl_label = "Plane Track Image Specials"
+
+def draw(self, _context):
+layout = self.layout
+
+layout.operator("clip.new_image_from_plane_marker")
+layout.operator("clip.update_image_from_plane_marker")
+
+
 class CLIP_PT_camera_presets(PresetPanel, Panel):
 """Predefined tracking camera intrinsics"""
 bl_label = "Camera Presets"
@@ -1935,6 +1951,7 @@ classes = (
 CLIP_MT_select,
 CLIP_MT_select_grouped,
 CLIP_MT_tracking_context_menu,
+CLIP_MT_plane_track_image_context_menu,
 CLIP_PT_camera_presets,
 CLIP_PT_track_color_presets,
 CLIP_PT_tracking_settings_presets,
diff --git a/source/blender/blenkernel/BKE_tracking.h 
b/source/blender/blenkernel/BKE_tracking.h
index 3f6d32e2f70..23b1f7c09bb 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -560,6 +560,11 @@ struct ImBuf *BKE_tracking_get_search_imbuf(struct ImBuf 
*ibuf,
 bool anchored,
 bool disable_channels);
 
+/* Create a new image buffer which consists of pixels which the plane marker 
"sees".
+ * The function will choose best image resolution based on the plane marker 
size. */
+struct ImBuf *BKE_tracking_get_plane_imbuf(const struct ImBuf *frame_ibuf,
+   const struct 
MovieTrackingPlaneMarker *plane_marker);
+
 /**
  * Zap channels from the imbuf that are disabled by the user. this can lead to
  * better tracks sometimes. however, instead of simply zeroing the channels
diff --git a/source/blender/blenkernel/intern/tracking.c 
b/source/blender/blenkernel/intern/tracking.c
index 8b462cba7ed..6abc40e89bc 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -2798,6 +2798,96 @@ ImBuf *BKE_tracking_get_search_imbuf(ImBuf *ibuf,
   return searchibuf;
 }
 
+BLI_INLINE int plane_marker_size_len_in_pixels(const float a[2],
+   const float b[2],
+   const int frame_width,
+ 

[Bf-blender-cvs] [c922b9e2c14] master: Fix image-from-imbuf resulting in invalid image configuration

2022-07-01 Thread Sergey Sharybin
Commit: c922b9e2c145b0c945fdb9d99f1209df3bf8bad0
Author: Sergey Sharybin
Date:   Thu Jun 30 15:17:30 2022 +0200
Branches: master
https://developer.blender.org/rBc922b9e2c145b0c945fdb9d99f1209df3bf8bad0

Fix image-from-imbuf resulting in invalid image configuration

The image which source is set to file is not expected to have empty
file path. If it happens it becomes very tricky to save the image on
exit using the standard quit dialog.

This change makes it so if the image buffer does not have file path
then the new image is set to the "generated" source and it behaves
as if the image was created like so and was fully painted on.

Additionally, mark image as dirty, so that quitting Blender after
such image was added will warn about possible data loss.

===

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

===

diff --git a/source/blender/blenkernel/intern/image.cc 
b/source/blender/blenkernel/intern/image.cc
index 0c4dc3c87f3..ed8652ca470 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -1174,18 +1174,35 @@ Image *BKE_image_add_generated(Main *bmain,
 
 Image *BKE_image_add_from_imbuf(Main *bmain, ImBuf *ibuf, const char *name)
 {
-  Image *ima;
-
   if (name == nullptr) {
 name = BLI_path_basename(ibuf->name);
   }
 
-  ima = image_alloc(bmain, name, IMA_SRC_FILE, IMA_TYPE_IMAGE);
+  /* When the image buffer has valid path create a new image with "file" 
source and copy the path
+   * from the image buffer.
+   * Otherwise create "generated" image, avoiding invalid configuration with 
an empty file path. */
+  const eImageSource source = ibuf->name[0] != '\0' ? IMA_SRC_FILE : 
IMA_SRC_GENERATED;
 
-  if (ima) {
+  Image *ima = image_alloc(bmain, name, source, IMA_TYPE_IMAGE);
+
+  if (!ima) {
+return nullptr;
+  }
+
+  if (source == IMA_SRC_FILE) {
 STRNCPY(ima->filepath, ibuf->name);
-image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
   }
+  else if (ibuf->rect_float) {
+/* For the consistency with manual image creation: when the image buffer 
is float reflect it in
+ * the generated flags. */
+ima->gen_flag |= IMA_GEN_FLOAT;
+  }
+
+  image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
+
+  /* Consider image dirty since its content can not be re-created unless the 
image is explicitly
+   * saved. */
+  BKE_image_mark_dirty(ima, ibuf);
 
   return ima;
 }

___
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] [72b9e07cf26] master: Add helper function to replace buffer of a single-frame image

2022-07-01 Thread Sergey Sharybin
Commit: 72b9e07cf26ddeb26ea8773004b951a7f1bff7c5
Author: Sergey Sharybin
Date:   Thu Jun 30 15:37:32 2022 +0200
Branches: master
https://developer.blender.org/rB72b9e07cf26ddeb26ea8773004b951a7f1bff7c5

Add helper function to replace buffer of a single-frame image

Very similar to BKE_image_add_from_imbuf with the exception that no
new image data-block is created, but instead the given one is modified.

===

M   source/blender/blenkernel/BKE_image.h
M   source/blender/blenkernel/intern/image.cc

===

diff --git a/source/blender/blenkernel/BKE_image.h 
b/source/blender/blenkernel/BKE_image.h
index 1f131568900..e54932fbc4e 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -194,6 +194,14 @@ struct Image *BKE_image_add_generated(struct Main *bmain,
  */
 struct Image *BKE_image_add_from_imbuf(struct Main *bmain, struct ImBuf *ibuf, 
const char *name);
 
+/**
+ * For a non-viewer single-buffer image (single frame file, or generated 
image) replace its image
+ * buffer with the given one.
+ * If an unsupported image type (multi-layer, image sequence, ...) the 
function will assert in the
+ * debug mode and will have an underfined behavior in the release mode.
+ */
+void BKE_image_replace_imbuf(struct Image *image, struct ImBuf *ibuf);
+
 /**
  * For reload, refresh, pack.
  */
diff --git a/source/blender/blenkernel/intern/image.cc 
b/source/blender/blenkernel/intern/image.cc
index b6294eb058c..92e98935e83 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -1216,23 +1216,37 @@ Image *BKE_image_add_from_imbuf(Main *bmain, ImBuf 
*ibuf, const char *name)
 return nullptr;
   }
 
-  if (source == IMA_SRC_FILE) {
-STRNCPY(ima->filepath, ibuf->name);
-  }
-  else if (ibuf->rect_float) {
-/* For the consistency with manual image creation: when the image buffer 
is float reflect it in
- * the generated flags. */
-ima->gen_flag |= IMA_GEN_FLOAT;
-  }
+  BKE_image_replace_imbuf(ima, ibuf);
+
+  return ima;
+}
+
+void BKE_image_replace_imbuf(Image *image, ImBuf *ibuf)
+{
+  BLI_assert(image->type == IMA_TYPE_IMAGE &&
+ ELEM(image->source, IMA_SRC_FILE, IMA_SRC_GENERATED));
+
+  BKE_image_free_buffers(image);
 
-  image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
-  image_colorspace_from_imbuf(ima, ibuf);
+  image_assign_ibuf(image, ibuf, IMA_NO_INDEX, 0);
+  image_colorspace_from_imbuf(image, ibuf);
+
+  /* Keep generated image type flags consistent with the image buffer. */
+  if (image->source == IMA_SRC_GENERATED) {
+if (ibuf->rect_float) {
+  image->gen_flag |= IMA_GEN_FLOAT;
+}
+else {
+  image->gen_flag &= ~IMA_GEN_FLOAT;
+}
+
+image->gen_x = ibuf->x;
+image->gen_y = ibuf->y;
+  }
 
   /* Consider image dirty since its content can not be re-created unless the 
image is explicitly
* saved. */
-  BKE_image_mark_dirty(ima, ibuf);
-
-  return ima;
+  BKE_image_mark_dirty(image, ibuf);
 }
 
 /** Pack image buffer to memory as PNG or EXR. */

___
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] [dfa5bd689e4] master: Fix possible wrong image color space when it is created from image buffer

2022-07-01 Thread Sergey Sharybin
Commit: dfa5bd689e470ad9b8fc7328927afdbe0159e0c1
Author: Sergey Sharybin
Date:   Thu Jun 30 15:31:12 2022 +0200
Branches: master
https://developer.blender.org/rBdfa5bd689e470ad9b8fc7328927afdbe0159e0c1

Fix possible wrong image color space when it is created from image buffer

From quick look it doesn't seem to be leading to real issues yet as the
image buffers are created with the default roles, but valid color space
is needed to be ensured for an upcoming development.

===

M   source/blender/blenkernel/intern/image.cc
M   source/blender/imbuf/IMB_colormanagement.h
M   source/blender/imbuf/intern/colormanagement.c

===

diff --git a/source/blender/blenkernel/intern/image.cc 
b/source/blender/blenkernel/intern/image.cc
index ed8652ca470..b6294eb058c 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -1172,6 +1172,33 @@ Image *BKE_image_add_generated(Main *bmain,
   return ima;
 }
 
+static void image_colorspace_from_imbuf(Image *image, const ImBuf *ibuf)
+{
+  const char *colorspace_name = NULL;
+
+  if (ibuf->rect_float) {
+if (ibuf->float_colorspace) {
+  colorspace_name = 
IMB_colormanagement_colorspace_get_name(ibuf->float_colorspace);
+}
+else {
+  colorspace_name = 
IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_FLOAT);
+}
+  }
+
+  if (ibuf->rect && !colorspace_name) {
+if (ibuf->rect_colorspace) {
+  colorspace_name = 
IMB_colormanagement_colorspace_get_name(ibuf->rect_colorspace);
+}
+else {
+  colorspace_name = 
IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_BYTE);
+}
+  }
+
+  if (colorspace_name) {
+STRNCPY(image->colorspace_settings.name, colorspace_name);
+  }
+}
+
 Image *BKE_image_add_from_imbuf(Main *bmain, ImBuf *ibuf, const char *name)
 {
   if (name == nullptr) {
@@ -1199,6 +1226,7 @@ Image *BKE_image_add_from_imbuf(Main *bmain, ImBuf *ibuf, 
const char *name)
   }
 
   image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
+  image_colorspace_from_imbuf(ima, ibuf);
 
   /* Consider image dirty since its content can not be re-created unless the 
image is explicitly
* saved. */
diff --git a/source/blender/imbuf/IMB_colormanagement.h 
b/source/blender/imbuf/IMB_colormanagement.h
index 2f0d2f9b449..0818dd653a1 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -341,6 +341,7 @@ const char *IMB_colormanagement_look_get_indexed_name(int 
index);
 
 int IMB_colormanagement_colorspace_get_named_index(const char *name);
 const char *IMB_colormanagement_colorspace_get_indexed_name(int index);
+const char *IMB_colormanagement_colorspace_get_name(const struct ColorSpace 
*colorspace);
 const char *IMB_colormanagement_view_get_default_name(const char 
*display_name);
 
 void IMB_colormanagement_colorspace_from_ibuf_ftype(
diff --git a/source/blender/imbuf/intern/colormanagement.c 
b/source/blender/imbuf/intern/colormanagement.c
index a58c2ba4c44..b95ec1cd92b 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -3174,6 +3174,11 @@ const char 
*IMB_colormanagement_colorspace_get_indexed_name(int index)
   return "";
 }
 
+const char *IMB_colormanagement_colorspace_get_name(const ColorSpace 
*colorspace)
+{
+  return colorspace->name;
+}
+
 void IMB_colormanagement_colorspace_from_ibuf_ftype(
 ColorManagedColorspaceSettings *colorspace_settings, ImBuf *ibuf)
 {

___
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] [b872ad037aa] master: Fix T99315: Unit plane track deform compositor node leads to unnecessary blur

2022-07-01 Thread Sergey Sharybin
Commit: b872ad037aaaffb6783cee9339ce4d876fc1ffca
Author: Sergey Sharybin
Date:   Fri Jul 1 09:40:52 2022 +0200
Branches: master
https://developer.blender.org/rBb872ad037aaaffb6783cee9339ce4d876fc1ffca

Fix T99315: Unit plane track deform compositor node leads to unnecessary blur

===

M   source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc

===

diff --git 
a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc 
b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc
index ddda02c5e80..9c19f55e04f 100644
--- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc
+++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc
@@ -43,6 +43,11 @@ BLI_INLINE void warp_coord(float x, float y, float 
matrix[3][3], float uv[2], fl
   uv[0] = vec[0] / vec[2];
   uv[1] = vec[1] / vec[2];
 
+  /* Offset so that pixel center corresponds to a (0.5, 0.5), which helps 
keeping transformed
+   * image sharp. */
+  uv[0] += 0.5f;
+  uv[1] += 0.5f;
+
   deriv[0][0] = (matrix[0][0] - matrix[0][2] * uv[0]) / vec[2];
   deriv[1][0] = (matrix[0][1] - matrix[0][2] * uv[1]) / vec[2];
   deriv[0][1] = (matrix[1][0] - matrix[1][2] * uv[0]) / vec[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] [16264aebe6e] master: Fix sequencer transform test failing.

2022-07-01 Thread Richard Antalik
Commit: 16264aebe6e022f9fbb95851d8806681ae5726a3
Author: Richard Antalik
Date:   Fri Jul 1 08:59:03 2022 +0200
Branches: master
https://developer.blender.org/rB16264aebe6e022f9fbb95851d8806681ae5726a3

Fix sequencer transform test failing.

Issue was caused by using function `SEQ_render_give_stripelem` to obtain
first `StripElem`, but this function now takes retiming into account.

Since first element was meant to be obtained, point to it directly by
using `seq->strip->stripdata`.

===

M   source/blender/blenloader/intern/versioning_290.c

===

diff --git a/source/blender/blenloader/intern/versioning_290.c 
b/source/blender/blenloader/intern/versioning_290.c
index 47786f55871..de652b40590 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -160,7 +160,7 @@ static void seq_convert_transform_crop(const Scene *scene,
   const uint32_t use_transform_flag = (1 << 16);
   const uint32_t use_crop_flag = (1 << 17);
 
-  const StripElem *s_elem = SEQ_render_give_stripelem(scene, seq, seq->start);
+  const StripElem *s_elem = seq->strip->stripdata;
   if (s_elem != NULL) {
 image_size_x = s_elem->orig_width;
 image_size_y = s_elem->orig_height;
@@ -285,7 +285,7 @@ static void seq_convert_transform_crop_2(const Scene *scene,
  Sequence *seq,
  const eSpaceSeq_Proxy_RenderSize 
render_size)
 {
-  const StripElem *s_elem = SEQ_render_give_stripelem(scene, seq, seq->start);
+  const StripElem *s_elem = seq->strip->stripdata;
   if (s_elem == NULL) {
 return;
   }

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


[Bf-blender-cvs] [f06af897231] temp-T95933-object-mode-curve-selection: Fix pushing thickness when curve doens't have a thickness.

2022-07-01 Thread Jeroen Bakker
Commit: f06af89723138796ca7e17037da2cdc6ce00dd09
Author: Jeroen Bakker
Date:   Fri Jul 1 08:49:37 2022 +0200
Branches: temp-T95933-object-mode-curve-selection
https://developer.blender.org/rBf06af89723138796ca7e17037da2cdc6ce00dd09

Fix pushing thickness when curve doens't have a thickness.

===

M   
source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
M   source/blender/draw/intern/shaders/common_hair_lib.glsl

===

diff --git 
a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
 
b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
index 2cd05353984..6b57cb27169 100644
--- 
a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
+++ 
b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
@@ -31,29 +31,31 @@ void main()
 {
   bool is_persp = (ProjectionMatrix[3][3] == 0.0);
   float time, thick_time, thickness;
-  vec3 world_pos, tan, binor;
-  hair_get_pos_tan_binor_time(is_persp,
-  ModelMatrixInverse,
-  ViewMatrixInverse[3].xyz,
-  ViewMatrixInverse[2].xyz,
-  world_pos,
-  tan,
-  binor,
-  time,
-  thickness,
-  thick_time);
+  vec3 center_world_pos, world_pos, tan, binor;
+
+  hair_get_pos_tan_binor_time_ex(is_persp,
+ ModelMatrixInverse,
+ ViewMatrixInverse[3].xyz,
+ ViewMatrixInverse[2].xyz,
+ center_world_pos,
+ world_pos,
+ tan,
+ binor,
+ time,
+ thickness,
+ thick_time);
 
   vec4 pos_ndc = point_world_to_ndc(world_pos);
 
-#if 0
-  /* TODO: make screen size aware. */
   if (hairThicknessRes > 1) {
-vec3 orig_pos;
-orig_pos = world_pos + binor * -thick_time;
-vec4 orig_pos_ndc = point_world_to_ndc(orig_pos);
+if (thick_time == 0.0) {
+  float thick_time = ((gl_VertexID % hairThicknessRes) == 0 ? -1.0 : 1.0) 
* 0.0001;
+  world_pos = center_world_pos + binor * thick_time;
+}
 vec3 pos_view = point_world_to_view(world_pos);
-vec3 orig_pos_view = point_world_to_view(orig_pos);
+vec3 orig_pos_view = point_world_to_view(center_world_pos);
 vec3 d = pos_view - orig_pos_view;
+/* TODO: make screen size aware. */
 float distance = length(d.xy);
 if (distance < 0.0001) {
   distance = 0.0001;
@@ -61,12 +63,11 @@ void main()
 pos_view = orig_pos_view + distance * normalize(d);
 pos_ndc = point_view_to_ndc(pos_view);
   }
-#endif
 
   gl_Position = pos_ndc;
 
 #ifdef USE_GEOM
-  vert.pos = point_world_to_view(world_pos);
+  vert.pos = point_world_to_view(world_pos);  // TODO: use pos_view...
 #endif
 
   /* Small bias to always be on top of the geom. */
diff --git a/source/blender/draw/intern/shaders/common_hair_lib.glsl 
b/source/blender/draw/intern/shaders/common_hair_lib.glsl
index d6bde2ac2ec..097a1af0fea 100644
--- a/source/blender/draw/intern/shaders/common_hair_lib.glsl
+++ b/source/blender/draw/intern/shaders/common_hair_lib.glsl
@@ -164,41 +164,42 @@ float hair_shaperadius(float shape, float root, float 
tip, float time)
 in float dummy;
 #  endif
 
-void hair_get_pos_tan_binor_time(bool is_persp,
- mat4 invmodel_mat,
- vec3 camera_pos,
- vec3 camera_z,
- out vec3 wpos,
- out vec3 wtan,
- out vec3 wbinor,
- out float time,
- out float thickness,
- out float thick_time)
+void hair_get_pos_tan_binor_time_ex(bool is_persp,
+mat4 invmodel_mat,
+vec3 camera_pos,
+vec3 camera_z,
+out vec3 orig_wpos,
+out vec3 wpos,
+out vec3 wtan,
+out vec3 wbinor,
+out float time,
+out float thickness,
+out float thick_time)
 {
   int id = hair_get_base_id();
   vec4 data = texelFetch(hairPointBuffer, id);
-  wpos = data.point_position;
+  orig_wpos = data.p

[Bf-blender-cvs] [ce5e1c84df8] temp-T95933-object-mode-curve-selection: Set a minimum radius for curve rendering. (WIP)

2022-07-01 Thread Jeroen Bakker
Commit: ce5e1c84df8b6f844fab40374edec2ea1eb2fcec
Author: Jeroen Bakker
Date:   Tue Jun 28 16:03:56 2022 +0200
Branches: temp-T95933-object-mode-curve-selection
https://developer.blender.org/rBce5e1c84df8b6f844fab40374edec2ea1eb2fcec

Set a minimum radius for curve rendering. (WIP)

===

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

===

diff --git 
a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
 
b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
index 179b89dd5c3..2cd05353984 100644
--- 
a/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
+++ 
b/source/blender/draw/engines/overlay/shaders/overlay_outline_prepass_curves_vert.glsl
@@ -45,7 +45,8 @@ void main()
 
   vec4 pos_ndc = point_world_to_ndc(world_pos);
 
-#if 1
+#if 0
+  /* TODO: make screen size aware. */
   if (hairThicknessRes > 1) {
 vec3 orig_pos;
 orig_pos = world_pos + binor * -thick_time;

___
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] [3583392fc29] temp-T95933-object-mode-curve-selection: Don't show outlines in sculpt curve mode.

2022-07-01 Thread Jeroen Bakker
Commit: 3583392fc29cf354bd26449b3d14f3c8896236b5
Author: Jeroen Bakker
Date:   Fri Jul 1 08:58:23 2022 +0200
Branches: temp-T95933-object-mode-curve-selection
https://developer.blender.org/rB3583392fc29cf354bd26449b3d14f3c8896236b5

Don't show outlines in sculpt curve mode.

===

M   source/blender/draw/engines/overlay/overlay_engine.c

===

diff --git a/source/blender/draw/engines/overlay/overlay_engine.c 
b/source/blender/draw/engines/overlay/overlay_engine.c
index f8c28394b16..d4d6737e439 100644
--- a/source/blender/draw/engines/overlay/overlay_engine.c
+++ b/source/blender/draw/engines/overlay/overlay_engine.c
@@ -308,6 +308,8 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
  (pd->ctx_mode == CTX_MODE_PARTICLE);
   const bool in_paint_mode = (ob == draw_ctx->obact) &&
  (draw_ctx->object_mode & OB_MODE_ALL_PAINT);
+  const bool in_sculpt_curve_mode = (ob == draw_ctx->obact) &&
+(draw_ctx->object_mode & 
OB_MODE_SCULPT_CURVES);
   const bool in_sculpt_mode = (ob == draw_ctx->obact) && (ob->sculpt != NULL) 
&&
   (ob->sculpt->mode_type == OB_MODE_SCULPT);
   const bool has_surface = ELEM(ob->type,
@@ -329,8 +331,8 @@ static void OVERLAY_cache_populate(void *vedata, Object *ob)
   const bool draw_bones = (pd->overlay.flag & V3D_OVERLAY_HIDE_BONES) == 0;
   const bool draw_wires = draw_surface && has_surface &&
   (pd->wireframe_mode || !pd->hide_overlays);
-  const bool draw_outlines = !in_edit_mode && !in_paint_mode && renderable && 
has_surface &&
- !instance_parent_in_edit_mode &&
+  const bool draw_outlines = !in_edit_mode && !in_paint_mode && 
!in_sculpt_curve_mode &&
+ renderable && has_surface && 
!instance_parent_in_edit_mode &&
  (pd->v3d_flag & V3D_SELECT_OUTLINE) &&
  (ob->base_flag & BASE_SELECTED);
   const bool draw_bone_selection = (ob->type == OB_MESH) && 
pd->armature.do_pose_fade_geom &&

___
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