[Bf-blender-cvs] [937aa8e1142] master: Cleanup: Use new socket builder API
Commit: 937aa8e1142300e0ba82f6f9b9ddb9908be54b9c Author: Aaron Carlisle Date: Fri Jan 7 23:52:19 2022 -0500 Branches: master https://developer.blender.org/rB937aa8e1142300e0ba82f6f9b9ddb9908be54b9c Cleanup: Use new socket builder API === M source/blender/nodes/shader/nodes/node_shader_attribute.cc M source/blender/nodes/shader/nodes/node_shader_background.cc M source/blender/nodes/shader/nodes/node_shader_bevel.cc M source/blender/nodes/shader/nodes/node_shader_brightness.cc M source/blender/nodes/shader/nodes/node_shader_fresnel.cc M source/blender/nodes/shader/nodes/node_shader_hair_info.cc M source/blender/nodes/shader/nodes/node_shader_light_path.cc M source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc M source/blender/nodes/shader/nodes/node_shader_squeeze.cc M source/blender/nodes/shader/nodes/node_shader_vector_transform.cc === diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.cc b/source/blender/nodes/shader/nodes/node_shader_attribute.cc index 3e9c57df7cf..8cf48306641 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.cc +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.cc @@ -21,15 +21,13 @@ namespace blender::nodes::node_shader_attribute_cc { -/* OUTPUT */ - -static bNodeSocketTemplate sh_node_attribute_out[] = { -{SOCK_RGBA, N_("Color")}, -{SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, -{SOCK_FLOAT, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, -{SOCK_FLOAT, N_("Alpha"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, -{-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_output(N_("Color")); + b.add_output(N_("Vector")); + b.add_output(N_("Fac")); + b.add_output(N_("Alpha")); +} static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node) { @@ -75,7 +73,6 @@ static int node_shader_gpu_attribute(GPUMaterial *mat, GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr); - /* for each output. */ int i; LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, i) { node_shader_gpu_bump_tex_coord(mat, node, &out[i].link); @@ -94,7 +91,7 @@ void register_node_type_sh_attribute() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_attribute_out); + ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_shader_init_attribute); node_type_storage( &ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_background.cc b/source/blender/nodes/shader/nodes/node_shader_background.cc index 39858e36fd1..3b9e71cf842 100644 --- a/source/blender/nodes/shader/nodes/node_shader_background.cc +++ b/source/blender/nodes/shader/nodes/node_shader_background.cc @@ -21,18 +21,12 @@ namespace blender::nodes::node_shader_background_cc { -/* OUTPUT */ - -static bNodeSocketTemplate sh_node_background_in[] = { -{SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, -{SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 100.0f}, -{-1, ""}, -}; - -static bNodeSocketTemplate sh_node_background_out[] = { -{SOCK_SHADER, N_("Background")}, -{-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input(N_("Strength")).default_value(1.0f).min(0.0f).max(100.0f); + b.add_output(N_("Background")); +} static int node_shader_gpu_background(GPUMaterial *mat, bNode *node, @@ -53,8 +47,7 @@ void register_node_type_sh_background() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_background_in, file_ns::sh_node_background_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_background); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_bevel.cc b/source/blender/nodes/shader/nodes/node_shader_bevel.cc index a3063358556..aa38eea273c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bevel.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bevel.cc @@ -21,18 +21,12 @@ namespace blender::nodes::node_shader_bevel_cc { -/* OUTPUT */ - -static bNodeSocketTemplate sh_node_bevel_in[] = { -{SOCK_FLOAT, N_("Radius"), 0.05f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, -{SOCK_VECTOR, N_("Normal"), 0.
[Bf-blender-cvs] [90e5ce6ab51] master: Cleanup: Loop through socket listbase instead of array
Commit: 90e5ce6ab513e733dddecddb65ed4f303c5589f7 Author: Aaron Carlisle Date: Fri Jan 7 23:38:35 2022 -0500 Branches: master https://developer.blender.org/rB90e5ce6ab513e733dddecddb65ed4f303c5589f7 Cleanup: Loop through socket listbase instead of array The socket arrays will be removed when using the new socket builder. So instead we have to loop through the node outputs list. === M source/blender/nodes/shader/nodes/node_shader_attribute.cc M source/blender/nodes/shader/nodes/node_shader_tex_coord.cc === diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.cc b/source/blender/nodes/shader/nodes/node_shader_attribute.cc index 780d0a72ef8..3e9c57df7cf 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.cc +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.cc @@ -76,7 +76,8 @@ static int node_shader_gpu_attribute(GPUMaterial *mat, GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr); /* for each output. */ - for (int i = 0; sh_node_attribute_out[i].type != -1; i++) { + int i; + LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, i) { node_shader_gpu_bump_tex_coord(mat, node, &out[i].link); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc index 9372d29456d..723458b7321 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc @@ -63,8 +63,8 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat, GPU_stack_link( mat, node, "node_tex_coord", in, out, viewpos, worldnor, inv_obmat, texcofacs, orco, mtface); - /* for each output. */ - for (int i = 0; sh_node_tex_coord_out[i].type != -1; i++) { + int i; + LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, i) { node_shader_gpu_bump_tex_coord(mat, node, &out[i].link); /* Normalize some vectors after dFdx/dFdy offsets. * This is the case for interpolated, non linear functions. ___ 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] [11885cd2829] soc-2021-curves: Extra comment during merge
Commit: 11885cd282911511af8698ecf9383e4029e0d55d Author: Dilith Jayakody Date: Sat Jan 8 07:18:44 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rB11885cd282911511af8698ecf9383e4029e0d55d Extra comment during merge === M source/blender/editors/sculpt_paint/sculpt.c === diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index a590cf93f44..02886643cb4 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1331,8 +1331,6 @@ static void sculpt_rake_data_update(struct SculptRakeData *srd, const float co[3 /** \} */ -/** \} */ - /* */ /** \name Sculpt Dynamic Topology * \{ */ ___ 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] [85f2a51e6ac] soc-2021-curves: Cleanup
Commit: 85f2a51e6ac9630c11dee792b6199361a6aa4ae9 Author: Dilith Jayakody Date: Fri Jan 7 22:47:25 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rB85f2a51e6ac9630c11dee792b6199361a6aa4ae9 Cleanup === M source/blender/editors/curve/editcurve_pen.c === diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c index 1436dc5f3f3..54fe032a43d 100644 --- a/source/blender/editors/curve/editcurve_pen.c +++ b/source/blender/editors/curve/editcurve_pen.c @@ -46,8 +46,8 @@ #include "float.h" -#define FOREACH_SELECTED_BEZT_BEGIN(bezt, editnurb) \ - LISTBASE_FOREACH (Nurb *, nu, editnurb) { \ +#define FOREACH_SELECTED_BEZT_BEGIN(bezt, nurbs) \ + LISTBASE_FOREACH (Nurb *, nu, nurbs) { \ if (nu->type == CU_BEZIER) { \ for (int i = 0; i < nu->pntsu; i++) { \ BezTriple *bezt = nu->bezt + i; \ @@ -168,14 +168,14 @@ static bool worldspace_to_screenspace_int(const float pos_3d[3], return check; } -static void get_displacement_to_avg_selected_point(const ListBase *editnurb, +static void get_displacement_to_avg_selected_point(const ListBase *nurbs, float change[2], const wmEvent *event, const ViewContext *vc) { float total[3] = {0.0f, 0.0f, 0.0f}; int count = 0; - FOREACH_SELECTED_BEZT_BEGIN(bezt, editnurb) + FOREACH_SELECTED_BEZT_BEGIN(bezt, nurbs) add_v3_v3(total, bezt->vec[1]); count++; FOREACH_SELECTED_BEZT_END @@ -192,12 +192,12 @@ static void get_displacement_to_avg_selected_point(const ListBase *editnurb, /* Move the handle of the newly added #BezTriple to mouse. */ static void move_new_bezt_handles_to_mouse(const wmEvent *event, const ViewContext *vc, - ListBase *editnurb) + ListBase *nurbs) { float change[2]; - get_displacement_to_avg_selected_point(editnurb, change, event, vc); + get_displacement_to_avg_selected_point(nurbs, change, event, vc); - FOREACH_SELECTED_BEZT_BEGIN(bezt, editnurb) + FOREACH_SELECTED_BEZT_BEGIN(bezt, nurbs) if (bezt->h1 == HD_VECT && bezt->h2 == HD_VECT) { bezt->h1 = HD_ALIGN; bezt->h2 = HD_ALIGN; @@ -339,7 +339,7 @@ static void move_bp_to_location(BPoint *bp, const float mval[2], const ViewConte } /* Move all selected points by an amount equivalent to the distance moved by mouse. */ -static void move_all_selected_points(ListBase *editnurb, +static void move_all_selected_points(ListBase *nurbs, const bool move_entire, const bool link_handles, const wmEvent *event, @@ -349,7 +349,7 @@ static void move_all_selected_points(ListBase *editnurb, sub_v2_v2v2_int(change_int, event->xy, event->prev_xy); float change[2] = {(float)change_int[0], (float)change_int[1]}; - LISTBASE_FOREACH (Nurb *, nu, editnurb) { + LISTBASE_FOREACH (Nurb *, nu, nurbs) { if (nu->type == CU_BEZIER) { for (int i = 0; i < nu->pntsu; i++) { BezTriple *bezt = nu->bezt + i; @@ -402,9 +402,9 @@ static void move_all_selected_points(ListBase *editnurb, } } -static void select_all_next_handles(ListBase *editnurb) +static void select_all_next_handles(ListBase *nurbs) { - FOREACH_SELECTED_BEZT_BEGIN(bezt, editnurb) + FOREACH_SELECTED_BEZT_BEGIN(bezt, nurbs) const bool invert = (nu->bezt + nu->pntsu - 1 == bezt && !(nu->flagu & CU_NURB_CYCLIC)) || (nu->bezt == bezt && (nu->flagu & CU_NURB_CYCLIC)); @@ -920,7 +920,7 @@ static void get_selected_points( { /* In nu and (bezt or bp) selected are written if there's 1 sel. */ /* If more points selected in 1 spline: return only nu, bezt and bp are 0. */ - ListBase *editnurb = &cu->editnurb->nurbs; + ListBase *nurbs = &cu->editnurb->nurbs; BezTriple *bezt1; BPoint *bp1; int a; @@ -929,7 +929,7 @@ static void get_selected_points( *r_bezt = NULL; *r_bp = NULL; - LISTBASE_FOREACH (Nurb *, nu1, editnurb) { + LISTBASE_FOREACH (Nurb *, nu1, nurbs) { if (nu1->type == CU_BEZIER) { bezt1 = nu1->bezt; a = nu1->pntsu; @@ -1178,9 +1178,9 @@ static void move_segment(MoveSegmentData *seg_data, const wmEvent *event, ViewCo } /* Toggle between `free` and `align` handles of the given `BezTriple` */ -static void toggle_bezt_free_align_handles(ListBase *editnurb) +static void toggle_bezt_free_align_handles(ListBase *nurbs) { - FOREACH_SELECTED_BEZT_BEGIN(bezt, editnurb) + FOREACH_SELECTED_BEZT_BEGIN(bezt, nurbs) if (bezt->h1 != HD_FREE || bezt->h2 != HD_FREE) { bezt->h1 = bezt->h2 = HD_FREE; } @@ -1242,
[Bf-blender-cvs] [91a70ee848e] soc-2021-curves: Support for `move_entire` of multiple points
Commit: 91a70ee848e65b96fbee8ec9242ebde459bbcac4 Author: Dilith Jayakody Date: Thu Jan 6 22:08:49 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rB91a70ee848e65b96fbee8ec9242ebde459bbcac4 Support for `move_entire` of multiple points === M source/blender/editors/curve/editcurve_pen.c === diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c index 1874c595b83..14ca2ea62a9 100644 --- a/source/blender/editors/curve/editcurve_pen.c +++ b/source/blender/editors/curve/editcurve_pen.c @@ -190,9 +190,9 @@ static void get_displacement_to_avg_selected_point(const ListBase *editnurb, } /* Move the handle of the newly added #BezTriple to mouse. */ -static void move_bezt_handles_to_mouse(const wmEvent *event, - const ViewContext *vc, - ListBase *editnurb) +static void move_new_bezt_handles_to_mouse(const wmEvent *event, + const ViewContext *vc, + ListBase *editnurb) { float change[2]; get_displacement_to_avg_selected_point(editnurb, change, event, vc); @@ -267,13 +267,35 @@ static void remove_handle_movement_constraints(BezTriple *bezt, const bool f1, c } } +static void move_bezt_handle_or_vertex_to_location_int(BezTriple *bezt, + const int mval[2], + const short cp_index, + const ViewContext *vc) +{ + float location[3]; + screenspace_to_worldspace_int(mval, bezt->vec[cp_index], vc, location); + if (cp_index == 1) { +move_bezt_to_location(bezt, location); + } + else { +copy_v3_v3(bezt->vec[cp_index], location); +if (bezt->h1 == HD_ALIGN && bezt->h2 == HD_ALIGN) { + float handle_vec[3]; + sub_v3_v3v3(handle_vec, bezt->vec[1], location); + const short other_handle = cp_index == 2 ? 0 : 2; + normalize_v3_length(handle_vec, len_v3v3(bezt->vec[1], bezt->vec[other_handle])); + add_v3_v3v3(bezt->vec[other_handle], bezt->vec[1], handle_vec); +} + } +} + static void move_bezt_handle_or_vertex_to_location(BezTriple *bezt, - const int mval[2], + const float mval[2], const short cp_index, const ViewContext *vc) { float location[3]; - screenspace_to_worldspace_int(mval, bezt->vec[cp_index], vc, location); + screenspace_to_worldspace(mval, bezt->vec[cp_index], vc, location); if (cp_index == 1) { move_bezt_to_location(bezt, location); } @@ -295,23 +317,23 @@ static void move_selected_bezt_to_location(BezTriple *bezt, const int mval[2]) { if (BEZT_ISSEL_IDX(bezt, 1)) { -move_bezt_handle_or_vertex_to_location(bezt, mval, 1, vc); +move_bezt_handle_or_vertex_to_location_int(bezt, mval, 1, vc); } else { remove_handle_movement_constraints(bezt, BEZT_ISSEL_IDX(bezt, 0), BEZT_ISSEL_IDX(bezt, 2)); if (BEZT_ISSEL_IDX(bezt, 0)) { - move_bezt_handle_or_vertex_to_location(bezt, mval, 0, vc); + move_bezt_handle_or_vertex_to_location_int(bezt, mval, 0, vc); } else { - move_bezt_handle_or_vertex_to_location(bezt, mval, 2, vc); + move_bezt_handle_or_vertex_to_location_int(bezt, mval, 2, vc); } } } -static void move_bp_to_location(BPoint *bp, const int mval[2], const ViewContext *vc) +static void move_bp_to_location(BPoint *bp, const float mval[2], const ViewContext *vc) { float location[3]; - screenspace_to_worldspace_int(mval, bp->vec, vc, location); + screenspace_to_worldspace(mval, bp->vec, vc, location); copy_v3_v3(bp->vec, location); } @@ -323,25 +345,27 @@ static void move_all_selected_points(ListBase *editnurb, const wmEvent *event, const ViewContext *vc) { - int change[2]; - sub_v2_v2v2_int(change, event->xy, event->prev_xy); + int change_int[2]; + sub_v2_v2v2_int(change_int, event->xy, event->prev_xy); + float change[2] = {(float)change_int[0], (float)change_int[1]}; + LISTBASE_FOREACH (Nurb *, nu, editnurb) { if (nu->type == CU_BEZIER) { for (int i = 0; i < nu->pntsu; i++) { BezTriple *bezt = nu->bezt + i; if (BEZT_ISSEL_IDX(bezt, 1) || (move_entire && BEZT_ISSEL_ANY(bezt))) { - int pos[2], dst[2]; - worldspace_to_screenspace_int(bezt->vec[1], vc, pos); - add_v2_v2v2_int(dst, pos, change); + float pos[2], dst[2]; + worldspace_to_screenspace(bezt->vec
[Bf-blender-cvs] [cb537a49000] soc-2021-curves: Move handles of all extruded points
Commit: cb537a49000357f621dd7e825981ba443f86eff6 Author: Dilith Jayakody Date: Thu Jan 6 07:41:35 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rBcb537a49000357f621dd7e825981ba443f86eff6 Move handles of all extruded points === M source/blender/editors/curve/editcurve_pen.c === diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c index 384613cfc6e..8557da53816 100644 --- a/source/blender/editors/curve/editcurve_pen.c +++ b/source/blender/editors/curve/editcurve_pen.c @@ -46,6 +46,19 @@ #include "float.h" +#define FOREACH_SELECTED_BEZT_BEGIN(bezt, editnurb) \ + LISTBASE_FOREACH (Nurb *, nu, editnurb) { \ +if (nu->type == CU_BEZIER) { \ + for (int i = 0; i < nu->pntsu; i++) { \ +BezTriple *bezt = nu->bezt + i; \ +if (BEZT_ISSEL_ANY(bezt)) { + +#define FOREACH_SELECTED_BEZT_END \ + } \ + } \ + } \ + } + /* Data structure to keep track of details about the cut location */ typedef struct CutData { /* Index of the last #BezTriple or BPoint before the cut. */ @@ -108,13 +121,26 @@ static const EnumPropertyItem prop_extra_key_types[] = { {0, NULL, 0, NULL, NULL}, }; -static void screenspace_to_worldspace(const int pos_2d[2], +static void screenspace_to_worldspace_int(const int pos_2d[2], + const float depth[3], + const ViewContext *vc, + float r_pos_3d[3]) +{ + mul_v3_m4v3(r_pos_3d, vc->obedit->obmat, depth); + ED_view3d_win_to_3d_int(vc->v3d, vc->region, r_pos_3d, pos_2d, r_pos_3d); + + float imat[4][4]; + invert_m4_m4(imat, vc->obedit->obmat); + mul_m4_v3(imat, r_pos_3d); +} + +static void screenspace_to_worldspace(const float pos_2d[2], const float depth[3], const ViewContext *vc, float r_pos_3d[3]) { mul_v3_m4v3(r_pos_3d, vc->obedit->obmat, depth); - ED_view3d_win_to_3d_int(vc->v3d, vc->region, r_pos_3d, pos_2d, r_pos_3d); + ED_view3d_win_to_3d(vc->v3d, vc->region, r_pos_3d, pos_2d, r_pos_3d); float imat[4][4]; invert_m4_m4(imat, vc->obedit->obmat); @@ -142,26 +168,58 @@ static bool worldspace_to_screenspace_int(const float pos_3d[3], return check; } +static void get_displacement_to_avg_selected_point(const ListBase *editnurb, + float change[2], + const wmEvent *event, + const ViewContext *vc) +{ + float total[3] = {0.0f, 0.0f, 0.0f}; + int count = 0; + FOREACH_SELECTED_BEZT_BEGIN(bezt, editnurb) + add_v3_v3(total, bezt->vec[1]); + count++; + FOREACH_SELECTED_BEZT_END + + if (count) { +mul_v3_fl(total, 1.0f / count); +worldspace_to_screenspace(total, vc, change); +float mval[2] = {(float)(event->mval[0]), (float)(event->mval[1])}; +negate_v2(change); +add_v2_v2(change, mval); + } +} + /* Move the handle of the newly added #BezTriple to mouse. */ -static void move_bezt_handles_to_mouse(BezTriple *bezt, - const bool is_end_point, - const wmEvent *event, - const ViewContext *vc) +static void move_bezt_handles_to_mouse(const wmEvent *event, + const ViewContext *vc, + ListBase *editnurb) { + float change[2]; + get_displacement_to_avg_selected_point(editnurb, change, event, vc); + + FOREACH_SELECTED_BEZT_BEGIN(bezt, editnurb) if (bezt->h1 == HD_VECT && bezt->h2 == HD_VECT) { bezt->h1 = HD_ALIGN; bezt->h2 = HD_ALIGN; } + const bool is_endpoint = (nu->bezt + nu->pntsu - 1 == bezt && !(nu->flagu & CU_NURB_CYCLIC)) || + (nu->bezt == bezt && (nu->flagu & CU_NURB_CYCLIC)); + + float bezt_loc[2]; + worldspace_to_screenspace(bezt->vec[1], vc, bezt_loc); + add_v2_v2(bezt_loc, change); + float location[3]; - screenspace_to_worldspace(event->mval, bezt->vec[1], vc, location); + screenspace_to_worldspace(bezt_loc, bezt->vec[1], vc, location); /* If the new point is the last point of the curve, move the second handle to the mouse. */ - if (is_end_point) { + if (is_endpoint) { + copy_v3_v3(bezt->vec[2], location); if (bezt->h2 != HD_FREE) { - mul_v3_fl(location, -1.0f); + negate_v3(location); madd_v3_v3v3fl(bezt->vec[0], location, bezt->vec[1], 2.0f); } } @@ -169,10 +227,11 @@ static void move_bezt_handles_to_mouse(BezTriple *bezt, copy_v3_v3(bezt->vec[0], location); if (bezt->h1 != HD_FREE) { - mul_v3_fl(location, -1.0f); + ne
[Bf-blender-cvs] [48ebc11dce8] soc-2021-curves: Removed unused curve pen modal map
Commit: 48ebc11dce878f8ec26d0818184a32cb376c190f Author: Dilith Jayakody Date: Sat Jan 8 07:28:06 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rB48ebc11dce878f8ec26d0818184a32cb376c190f Removed unused curve pen modal map === M release/scripts/addons M release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py === diff --git a/release/scripts/addons b/release/scripts/addons index 3fc46407617..6afec05c328 16 --- a/release/scripts/addons +++ b/release/scripts/addons @@ -1 +1 @@ -Subproject commit 3fc46407617b25343d75b8ba749baf9634a1e946 +Subproject commit 6afec05c3286cdea58ab269fb8dd1f5de011de4e diff --git a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py index 552dca63e70..c3bc0f429c1 100644 --- a/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py +++ b/release/scripts/modules/bl_keymap_utils/keymap_hierarchy.py @@ -116,7 +116,6 @@ _km_hierarchy = [ ('Paint Stroke Modal', 'EMPTY', 'WINDOW', []), ('Sculpt Expand Modal', 'EMPTY', 'WINDOW', []), ('Paint Curve', 'EMPTY', 'WINDOW', []), -('Curve Pen Modal Map', 'EMPTY', 'WINDOW', []), ('Object Non-modal', 'EMPTY', 'WINDOW', []), # mode change ___ 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] [ca6802b435d] soc-2021-curves: Added additional key-bindings
Commit: ca6802b435d03de443453d54c87653fe3405175e Author: Dilith Jayakody Date: Fri Jan 7 23:56:06 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rBca6802b435d03de443453d54c87653fe3405175e Added additional key-bindings === M release/scripts/presets/keyconfig/keymap_data/blender_default.py M source/blender/editors/curve/editcurve_pen.c === diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index dcc463c6dc1..010ab44f85d 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -7001,6 +7001,7 @@ def km_3d_view_tool_edit_curve_pen(params): ("free_toggle", "Shift"), ("adj_handle", "Ctrl"), ("move_entire", "Alt"), + ("link_handles", "Ctrl-Shift") ]}), ("curve.pen", {"type": params.tool_mouse, "value": 'PRESS', "ctrl": True}, {"properties": [("delete_point", True),]}), diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c index 54fe032a43d..86d7f6197ab 100644 --- a/source/blender/editors/curve/editcurve_pen.c +++ b/source/blender/editors/curve/editcurve_pen.c @@ -112,12 +112,23 @@ typedef struct CurvePenData { } CurvePenData; /* Enum to choose between shortcuts for the extra functionalities. */ -typedef enum eExtra_key { NONE = 0, SHIFT = 1, CTRL = 2, ALT = 3 } eExtra_key; +typedef enum eExtra_key { + NONE = 0, + SHIFT = 1, + CTRL = 2, + ALT = 3, + CTRL_SHIFT = 4, + CTRL_ALT = 5, + SHIFT_ALT = 6 +} eExtra_key; static const EnumPropertyItem prop_extra_key_types[] = { {NONE, "None", 0, "None", ""}, {SHIFT, "Shift", 0, "Shift", ""}, {CTRL, "Ctrl", 0, "Ctrl", ""}, {ALT, "Alt", 0, "Alt", ""}, +{CTRL_SHIFT, "Ctrl-Shift", 0, "Ctrl-Shift", ""}, +{CTRL_ALT, "Ctrl-Alt", 0, "Ctrl-Alt", ""}, +{SHIFT_ALT, "Shift-Alt", 0, "Shift-Alt", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -1104,8 +1115,12 @@ static bool is_spline_nearby(ViewContext *vc, struct wmOperator *op, const wmEve static bool is_extra_key_pressed(const wmEvent *event, int key) { - return (key == SHIFT && event->shift) || (key == CTRL && event->ctrl) || - (key == ALT && event->alt); + return (key == SHIFT && event->shift && !event->ctrl && !event->alt) || + (key == CTRL && !event->shift && event->ctrl && !event->alt) || + (key == ALT && !event->shift && !event->ctrl && event->alt) || + (key == CTRL_SHIFT && event->shift && event->ctrl && !event->alt) || + (key == CTRL_ALT && !event->shift && event->ctrl && event->alt) || + (key == SHIFT_ALT && event->shift && !event->ctrl && event->alt); } /* Move segment to mouse pointer. */ @@ -1377,14 +1392,6 @@ static void toggle_vector_auto(BezTriple *bezt, short bezt_idx, CurvePenData *cp } } -static bool is_event_key_equal_to_extra_key(const int event_key, const int extra_key) -{ - return ((event_key == EVT_LEFTSHIFTKEY || event_key == EVT_RIGHTSHIFTKEY) && - extra_key == SHIFT) || - ((event_key == EVT_LEFTCTRLKEY || event_key == EVT_RIGHTCTRLKEY) && extra_key == CTRL) || - ((event_key == EVT_LEFTALTKEY || event_key == EVT_RIGHTALTKEY) && extra_key == ALT); -} - static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); @@ -1428,7 +1435,7 @@ static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event) const int move_entire = RNA_enum_get(op->ptr, "move_entire"); const int link_handles = RNA_enum_get(op->ptr, "link_handles"); - if (!cpd->free_toggle_pressed && is_event_key_equal_to_extra_key(event->type, free_toggle)) { + if (!cpd->free_toggle_pressed && is_extra_key_pressed(event, free_toggle)) { toggle_bezt_free_align_handles(nurbs); cpd->dragging = 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] [a7be3add5bd] soc-2021-curves: Merge branch 'master' into soc-2021-curves
Commit: a7be3add5bdfcf4f7dad2ad8ad875bbdcae8de16 Author: Dilith Jayakody Date: Sat Jan 8 07:20:00 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rBa7be3add5bdfcf4f7dad2ad8ad875bbdcae8de16 Merge branch 'master' into soc-2021-curves === === ___ 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] [315766e202d] soc-2021-curves: Merge branch 'master' into soc-2021-curves
Commit: 315766e202dcbc3a6bb10e8a8250f48958812e87 Author: Dilith Jayakody Date: Fri Jan 7 23:58:36 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rB315766e202dcbc3a6bb10e8a8250f48958812e87 Merge branch 'master' into soc-2021-curves === === ___ 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] [4bd7f7d6e65] soc-2021-curves: Fixed bug with selection while moving
Commit: 4bd7f7d6e652f6b020bd49dded17d8a963f8830f Author: Dilith Jayakody Date: Fri Jan 7 08:40:11 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rB4bd7f7d6e652f6b020bd49dded17d8a963f8830f Fixed bug with selection while moving === M source/blender/editors/curve/editcurve_pen.c === diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c index 14ca2ea62a9..1436dc5f3f3 100644 --- a/source/blender/editors/curve/editcurve_pen.c +++ b/source/blender/editors/curve/editcurve_pen.c @@ -1468,12 +1468,6 @@ static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event) if (move_point) { short bezt_idx; float mval[2] = {(float)event->mval[0], (float)event->mval[1]}; -get_closest_vertex_to_point_in_nurbs( -&cu->editnurb->nurbs, &nu, &bezt, &bp, &bezt_idx, mval, sel_dist_mul, &vc); -if (bezt && !BEZT_ISSEL_IDX(bezt, bezt_idx)) { - ED_curve_editnurb_select_pick_thresholded( - C, event->mval, sel_dist_mul, false, false, false); -} move_all_selected_points( &cu->editnurb->nurbs, move_entire_pressed, link_handles_pressed, event, &vc); cpd->acted = true; @@ -1492,17 +1486,24 @@ static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event) cpd->bezt = bezt; cpd->bp = bp; - if (select_point || move_point || select_multi) { -if (move_point && (!nu || bezt || bp)) { - cpd->found_point = ED_curve_editnurb_select_pick_thresholded( - C, event->mval, sel_dist_mul, false, false, false); - cpd->selection_made = true; + Nurb *nu1; + BezTriple *bezt1; + BPoint *bp1; + short bezt_idx = 0; + cpd->found_point = get_closest_vertex_to_point_in_nurbs( + &(cu->editnurb->nurbs), &nu1, &bezt1, &bp1, &bezt_idx, mval_fl, sel_dist_mul, &vc); + + if (move_point && nu1 && + (bezt || (bezt1 && !BEZT_ISSEL_IDX(bezt1, bezt_idx)) || (bp1 && !(bp1->f1 & SELECT { +ED_curve_deselect_all(cu->editnurb); +if (bezt1) { + BEZT_SEL_IDX(bezt1, bezt_idx); } -else { - short bezt_idx = 0; - cpd->found_point = get_closest_vertex_to_point_in_nurbs( - &(cu->editnurb->nurbs), &nu, &bezt, &bp, &bezt_idx, mval_fl, sel_dist_mul, &vc); +else if (bp1) { + bp1->f1 |= SELECT; } + +cpd->selection_made = true; } if (!cpd->found_point) { if (is_spline_nearby(&vc, op, event)) { ___ 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] [f5cb8da8163] soc-2021-curves: Check if bezt exists before moving adjacent handles
Commit: f5cb8da816395c4361482e670e0aa95aeb8fb04d Author: Dilith Jayakody Date: Wed Jan 5 19:41:53 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rBf5cb8da816395c4361482e670e0aa95aeb8fb04d Check if bezt exists before moving adjacent handles === M source/blender/editors/curve/editcurve_pen.c === diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c index c988de11ce4..384613cfc6e 100644 --- a/source/blender/editors/curve/editcurve_pen.c +++ b/source/blender/editors/curve/editcurve_pen.c @@ -1144,6 +1144,10 @@ static void move_adjacent_handle(ViewContext *vc, const wmEvent *event) BPoint *bp; get_selected_points(vc->obedit->data, vc->v3d, &nu, &bezt, &bp); + if (!bezt) { +return; + } + /* Get the adjacent `BezTriple` */ BezTriple *adj_bezt = BKE_nurb_bezt_get_prev(nu, bezt); int cp_index = 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] [5247a110a57] soc-2021-curves: Fixed bug - handles don't recalculate
Commit: 5247a110a5795146cec38dc57269fe2e96014595 Author: Dilith Jayakody Date: Wed Jan 5 13:00:00 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rB5247a110a5795146cec38dc57269fe2e96014595 Fixed bug - handles don't recalculate === M release/datafiles/locale A release/scripts/addons M source/blender/editors/curve/editcurve_pen.c === diff --git a/release/datafiles/locale b/release/datafiles/locale index 6ac775c595a..94d7306b5d0 16 --- a/release/datafiles/locale +++ b/release/datafiles/locale @@ -1 +1 @@ -Subproject commit 6ac775c595a2dd40684cd6421d24f1f064fe3a6f +Subproject commit 94d7306b5d0f2b2932d7c8cfdeaf75cfbbe104d6 diff --git a/release/scripts/addons b/release/scripts/addons new file mode 16 index 000..3fc46407617 --- /dev/null +++ b/release/scripts/addons @@ -0,0 +1 @@ +Subproject commit 3fc46407617b25343d75b8ba749baf9634a1e946 diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c index a04568fe05f..c988de11ce4 100644 --- a/source/blender/editors/curve/editcurve_pen.c +++ b/source/blender/editors/curve/editcurve_pen.c @@ -314,6 +314,10 @@ static void move_all_selected_points(ListBase *editnurb, } } } + +if (nu && nu->type == CU_BEZIER) { + BKE_nurb_handles_calc(nu); +} } } ___ 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] [86965750d31] soc-2021-curves: Fixed bezt select bug
Commit: 86965750d31110daed65941a0a41f5fda1e81e9a Author: Dilith Jayakody Date: Thu Jan 6 08:18:27 2022 +0530 Branches: soc-2021-curves https://developer.blender.org/rB86965750d31110daed65941a0a41f5fda1e81e9a Fixed bezt select bug === M source/blender/editors/curve/editcurve_pen.c === diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c index 8557da53816..1874c595b83 100644 --- a/source/blender/editors/curve/editcurve_pen.c +++ b/source/blender/editors/curve/editcurve_pen.c @@ -298,7 +298,7 @@ static void move_selected_bezt_to_location(BezTriple *bezt, move_bezt_handle_or_vertex_to_location(bezt, mval, 1, vc); } else { -remove_handle_movement_constraints(bezt, bezt->f1, bezt->f3); +remove_handle_movement_constraints(bezt, BEZT_ISSEL_IDX(bezt, 0), BEZT_ISSEL_IDX(bezt, 2)); if (BEZT_ISSEL_IDX(bezt, 0)) { move_bezt_handle_or_vertex_to_location(bezt, mval, 0, vc); } @@ -336,7 +336,8 @@ static void move_all_selected_points(ListBase *editnurb, move_bezt_handle_or_vertex_to_location(bezt, dst, 1, vc); } else { - remove_handle_movement_constraints(bezt, bezt->f1, bezt->f3); + remove_handle_movement_constraints( + bezt, BEZT_ISSEL_IDX(bezt, 0), BEZT_ISSEL_IDX(bezt, 2)); if (BEZT_ISSEL_IDX(bezt, 0)) { int pos[2], dst[2]; worldspace_to_screenspace_int(bezt->vec[0], vc, pos); @@ -361,11 +362,12 @@ static void move_all_selected_points(ListBase *editnurb, } } } + BKE_nurb_handles_calc(nu); } else { for (int i = 0; i < nu->pntsu; i++) { BPoint *bp = nu->bp + i; -if (bp->f1) { +if (bp->f1 & SELECT) { int pos[2], dst[2]; worldspace_to_screenspace_int(bp->vec, vc, pos); add_v2_v2v2_int(dst, pos, change); @@ -373,10 +375,6 @@ static void move_all_selected_points(ListBase *editnurb, } } } - -if (nu && nu->type == CU_BEZIER) { - BKE_nurb_handles_calc(nu); -} } } @@ -387,12 +385,14 @@ static void select_all_next_handles(ListBase *editnurb) (nu->bezt == bezt && (nu->flagu & CU_NURB_CYCLIC)); if (invert) { -bezt->f3 = SELECT; -bezt->f1 = bezt->f2 = ~SELECT; +BEZT_DESEL_IDX(bezt, 0); +BEZT_DESEL_IDX(bezt, 1); +BEZT_SEL_IDX(bezt, 2); } else { -bezt->f1 = SELECT; -bezt->f2 = bezt->f3 = ~SELECT; +BEZT_SEL_IDX(bezt, 0); +BEZT_DESEL_IDX(bezt, 1); +BEZT_DESEL_IDX(bezt, 2); } FOREACH_SELECTED_BEZT_END } @@ -973,7 +973,7 @@ static void extrude_point_from_selected_vertex(const ViewContext *vc, BEZT_DESEL_ALL(nu1->bezt + i); } else { -(nu1->bp + i)->f1 = ~SELECT; +(nu1->bp + i)->f1 &= ~SELECT; } } } @@ -1317,11 +1317,11 @@ static void toggle_select_bezt(BezTriple *bezt, const short bezt_idx) static void toggle_select_bp(BPoint *bp) { - if (bp->f1 == SELECT) { -bp->f1 = ~SELECT; + if (bp->f1 & SELECT) { +bp->f1 &= ~SELECT; } else { -bp->f1 = SELECT; +bp->f1 |= SELECT; } } ___ 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] [741ed5fcd2e] master: Fix Cycles compile error after last own commit
Commit: 741ed5fcd2e2ede686f2a024181cb6b769745cdb Author: Julian Eisel Date: Sat Jan 8 00:25:59 2022 +0100 Branches: master https://developer.blender.org/rB741ed5fcd2e2ede686f2a024181cb6b769745cdb Fix Cycles compile error after last own commit We can't include `BLI_utildefines.h` in `RNA_types.h` since Cycles includes that, but duplicates some of the util defines. So you'd have duplicated definitions. === M source/blender/editors/space_node/node_add.cc M source/blender/makesrna/RNA_types.h === diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 09652be3226..be29c125e5a 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -524,7 +524,7 @@ void NODE_OT_add_object(wmOperatorType *ot) "Session UUID of the data-block to assign", INT32_MIN, INT32_MAX); - RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); + RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); } /** \} */ @@ -631,7 +631,7 @@ void NODE_OT_add_texture(wmOperatorType *ot) "Session UUID of the data-block to assign", INT32_MIN, INT32_MAX); - RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); + RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); } /** \} */ @@ -743,7 +743,7 @@ void NODE_OT_add_collection(wmOperatorType *ot) "Session UUID of the data-block to assign", INT32_MIN, INT32_MAX); - RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); + RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); } /** \} */ @@ -949,7 +949,7 @@ void NODE_OT_add_mask(wmOperatorType *ot) "Session UUID of the data-block to assign", INT32_MIN, INT32_MAX); - RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); + RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); } /** \} */ diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 8a143a9f6ea..2d499dd113f 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -23,7 +23,6 @@ #define __RNA_TYPES_H__ #include "../blenlib/BLI_sys_types.h" -#include "BLI_utildefines.h" #ifdef __cplusplus extern "C" { @@ -315,7 +314,6 @@ typedef enum PropertyFlag { */ PROP_NO_DEG_UPDATE = (1 << 30), } PropertyFlag; -ENUM_OPERATORS(PropertyFlag, PROP_TEXTEDIT_UPDATE); /** * Flags related to comparing and overriding RNA properties. ___ 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] [34e84d0ee8a] master: Cleanup: Remove unused code from BKE_node.h
Commit: 34e84d0ee8a238d1ce46dc06e30c2c56693285dd Author: Hans Goudey Date: Fri Jan 7 16:16:34 2022 -0600 Branches: master https://developer.blender.org/rB34e84d0ee8a238d1ce46dc06e30c2c56693285dd Cleanup: Remove unused code from BKE_node.h Remove a variety of unused functions, declarations without definitions, incorrect comments, and defines that have been commented for years === M source/blender/blenkernel/BKE_node.h M source/blender/blenkernel/intern/node.cc M source/blender/nodes/shader/node_shader_tree.cc === diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 7a875f88fa8..ed1b1397219 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -357,22 +357,11 @@ typedef struct bNodeType { #define NODE_CLASS_OP_VECTOR 4 #define NODE_CLASS_OP_FILTER 5 #define NODE_CLASS_GROUP 6 -// #define NODE_CLASS_FILE 7 #define NODE_CLASS_CONVERTER 8 #define NODE_CLASS_MATTE 9 #define NODE_CLASS_DISTORT 10 -// #define NODE_CLASS_OP_DYNAMIC11 /* deprecated */ #define NODE_CLASS_PATTERN 12 #define NODE_CLASS_TEXTURE 13 -// #define NODE_CLASS_EXECUTION 14 -// #define NODE_CLASS_GETDATA 15 -// #define NODE_CLASS_SETDATA 16 -// #define NODE_CLASS_MATH 17 -// #define NODE_CLASS_MATH_VECTOR 18 -// #define NODE_CLASS_MATH_ROTATION 19 -// #define NODE_CLASS_PARTICLES 25 -// #define NODE_CLASS_TRANSFORM 30 -// #define NODE_CLASS_COMBINE 31 #define NODE_CLASS_SCRIPT 32 #define NODE_CLASS_INTERFACE 33 #define NODE_CLASS_SHADER 40 @@ -499,7 +488,6 @@ struct bNodeTree *ntreeFromID(struct ID *id); void ntreeFreeLocalNode(struct bNodeTree *ntree, struct bNode *node); void ntreeFreeLocalTree(struct bNodeTree *ntree); struct bNode *ntreeFindType(const struct bNodeTree *ntree, int type); -bool ntreeHasType(const struct bNodeTree *ntree, int type); bool ntreeHasTree(const struct bNodeTree *ntree, const struct bNodeTree *lookup); void ntreeUpdateAllNew(struct Main *main); void ntreeUpdateAllUsers(struct Main *main, struct ID *id); @@ -634,13 +622,6 @@ struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree, const char *idname, const char *identifier, const char *name); -struct bNodeSocket *nodeInsertSocket(struct bNodeTree *ntree, - struct bNode *node, - eNodeSocketInOut in_out, - const char *idname, - struct bNodeSocket *next_sock, - const char *identifier, - const char *name); struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree, struct bNode *node, eNodeSocketInOut in_out, @@ -648,14 +629,6 @@ struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree, int subtype, const char *identifier, const char *name); -struct bNodeSocket *nodeInsertStaticSocket(struct bNodeTree *ntree, - struct bNode *node, - eNodeSocketInOut in_out, - int type, - int subtype, - struct bNodeSocket *next_sock, - const char *identifier, - const char *name); void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock); void nodeRemoveSocketEx(struct bNodeTree *ntree, struct bNode *node, @@ -709,8 +682,6 @@ bNode *node_copy(bNodeTree *dst_tree, const bNode &src_node, int flag, bool uniq #endif -bNode *BKE_node_copy(bNodeTree *dst_tree, const bNode *src_node, int flag, bool unique_name); - /** * Also used via RNA API, so we check for proper input output direction. */ @@ -941,7 +912,6 @@ bNodePreview *BKE_node_preview_verify( bNodePreview *BKE_node_preview_copy(struct bNodePreview *preview); void BKE_node_preview_free(struct bNodePreview *preview); void BKE_node_preview_init_tree(struct bNodeTree *ntree, int xsize, int ysize); -void BKE_node_preview_free_tree(struct bNodeTree *ntree); void BKE_node_preview_remove_unused(struct bNodeTree *ntree); void BKE_node_preview_clear(struct bNodePreview *preview); void BKE_node_preview_clear_tree(struct bNodeTree *ntree); @@ -1110,11 +1080,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree,
[Bf-blender-cvs] [3e11c7016ee] master: RNA: Support bitwise operators for property flags in C++
Commit: 3e11c7016ee60491ed8c310e615cb1e2a3f6168a Author: Julian Eisel Date: Fri Jan 7 22:50:55 2022 +0100 Branches: master https://developer.blender.org/rB3e11c7016ee60491ed8c310e615cb1e2a3f6168a RNA: Support bitwise operators for property flags in C++ Needed for the following commit. === M source/blender/makesrna/RNA_types.h === diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 2d499dd113f..8a143a9f6ea 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -23,6 +23,7 @@ #define __RNA_TYPES_H__ #include "../blenlib/BLI_sys_types.h" +#include "BLI_utildefines.h" #ifdef __cplusplus extern "C" { @@ -314,6 +315,7 @@ typedef enum PropertyFlag { */ PROP_NO_DEG_UPDATE = (1 << 30), } PropertyFlag; +ENUM_OPERATORS(PropertyFlag, PROP_TEXTEDIT_UPDATE); /** * Flags related to comparing and overriding RNA properties. ___ 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] [09d6846839e] master: Fix Adjust Last Operation panel showing session UUID number button
Commit: 09d6846839e8e8140b80619171c7a2613bb3dbb5 Author: Julian Eisel Date: Fri Jan 7 22:55:45 2022 +0100 Branches: master https://developer.blender.org/rB09d6846839e8e8140b80619171c7a2613bb3dbb5 Fix Adjust Last Operation panel showing session UUID number button This is implementation specific data that should never be exposed to regular users. Also make sure this data is not saved to presets. === M source/blender/editors/object/object_add.c M source/blender/editors/space_node/node_add.cc === diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 9354171a1e4..b9943d13b19 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1742,15 +1742,16 @@ void OBJECT_OT_collection_instance_add(wmOperatorType *ot) ot->prop = prop; ED_object_add_generic_props(ot, false); - RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the collection to add", - INT32_MIN, - INT32_MAX); + prop = RNA_def_int(ot->srna, + "session_uuid", + 0, + INT32_MIN, + INT32_MAX, + "Session UUID", + "Session UUID of the collection to add", + INT32_MIN, + INT32_MAX); + RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); object_add_drop_xy_props(ot); } diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 0aa9cd5511a..09652be3226 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -499,6 +499,8 @@ static bool node_add_object_poll(bContext *C) void NODE_OT_add_object(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Add Node Object"; ot->description = "Add an object info node to the current node editor"; @@ -513,15 +515,16 @@ void NODE_OT_add_object(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; RNA_def_string(ot->srna, "name", "Object", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); - RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the data-block to assign", - INT32_MIN, - INT32_MAX); + prop = RNA_def_int(ot->srna, + "session_uuid", + 0, + INT32_MIN, + INT32_MAX, + "Session UUID", + "Session UUID of the data-block to assign", + INT32_MIN, + INT32_MAX); + RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); } /** \} */ @@ -602,6 +605,8 @@ static bool node_add_texture_poll(bContext *C) void NODE_OT_add_texture(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Add Node Texture"; ot->description = "Add a texture to the current node editor"; @@ -617,15 +622,16 @@ void NODE_OT_add_texture(wmOperatorType *ot) RNA_def_string( ot->srna, "name", "Texture", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); - RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the data-block to assign", - INT32_MIN, - INT32_MAX); + prop = RNA_def_int(ot->srna, + "session_uuid", + 0, + INT32_MIN, + INT32_MAX, + "Session UUID", + "Session UUID of the data-block to assign", + INT32_MIN, + INT32_MAX); + RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); } /** \} */ @@ -711,6 +717,8 @@ static bool node_add_collection_poll(bContext *C) void NODE_OT_add_collection(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Add Node Collection"; ot->description = "Add an collection info node to the current node editor"; @@ -726,15 +734,16 @@ void NODE_OT_add_collection(wmOperatorType *ot) RNA_def_string( ot->srna, "name", "Collection", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); - RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the data-block to assign", - INT32_MIN, -
[Bf-blender-cvs] [c8aedd75d7b] sculpt-dev: Sculpt-dev: New normal automasking modes
Commit: c8aedd75d7b549bd2e4073a548efa34360be6614 Author: Joseph Eagar Date: Fri Jan 7 12:03:40 2022 -0800 Branches: sculpt-dev https://developer.blender.org/rBc8aedd75d7b549bd2e4073a548efa34360be6614 Sculpt-dev: New normal automasking modes Two new automasking modes: "Brush Normal" and "View Normal." Brush Normal compares vertex normals to the initial sculpt normal, while View Normal of course compares with the view vector. Each of these modes have an angular limit and a falloff. There's also an "original normal" option, which needs a better name; "original normal" is actually already taken, but "automasking original normal" is a lot of characters. Not sure what to do here. === M release/scripts/startup/bl_ui/properties_paint_common.py M release/scripts/startup/bl_ui/space_toolsystem_common.py M release/scripts/startup/bl_ui/space_toolsystem_toolbar.py M release/scripts/startup/bl_ui/space_view3d_toolbar.py M source/blender/blenkernel/intern/brush_channel_define.h M source/blender/blenkernel/intern/brush_engine_presets.c M source/blender/draw/intern/draw_cache_impl_mesh.c M source/blender/editors/sculpt_paint/sculpt.c M source/blender/editors/sculpt_paint/sculpt_automasking.c M source/blender/editors/sculpt_paint/sculpt_intern.h M source/blender/makesdna/DNA_brush_enums.h M source/blender/makesdna/DNA_sculpt_brush_types.h M source/blender/makesrna/intern/rna_brush_engine.c === diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index 9364aafb4ed..c6bad232953 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -2105,11 +2105,51 @@ def brush_settings_advanced(layout, context, brush, popover=False): context, brush, "automasking_boundary_edges_propagation_steps") -UnifiedPaintPanel.channel_unified(layout.column(), + +flags = UnifiedPaintPanel.get_channel_value(context, brush, "automasking") + +if "CONCAVITY" in flags: +UnifiedPaintPanel.channel_unified(layout.column(), +context, +brush, +"concave_mask_factor", +slider=True) + +enable_orig_normal = False + +if "BRUSH_NORMAL" in flags: +UnifiedPaintPanel.channel_unified(layout.column(), +context, +brush, +"normal_mask_limit", +slider=True) +UnifiedPaintPanel.channel_unified(layout.column(), +context, +brush, +"normal_mask_falloff", +slider=True) +enable_orig_normal = True + +if "VIEW_NORMAL" in flags: +UnifiedPaintPanel.channel_unified(layout.column(), +context, +brush, +"view_normal_mask_limit", +slider=True) +UnifiedPaintPanel.channel_unified(layout.column(), +context, +brush, +"view_normal_mask_falloff", +slider=True) +enable_orig_normal = True + +sub = layout.row() +sub.enabled = enable_orig_normdal + +UnifiedPaintPanel.channel_unified(sub, context, brush, -"concave_mask_factor", -slider=True) +"automasking_use_original_normal") """ col = layout.column(heading="Auto-Masking", align=True) diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index c4dabb5b5bc..f63beee3f03 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -120,6 +120,8 @@ ToolDef = namedtuple( "draw_cursor", # Various options, see: `bpy.types.WorkSpaceTool.setup` options argument. "options", +#get_enabled(ctx, idname) whether tool should be grayed out +"get_enabled" ) ) del namedtuple @@ -143,6 +145,7 @@ def from_dict(kw_args): "operator": None, "draw_settings": None, "draw_cursor": None, +"get_enabled": None } kw.update(kw_args) @@ -725,9 +728,14 @@ class ToolSelectPanelHelper: icon_value = ToolSelectPanelHelper._icon_value_from_icon_handle(item.icon) sub = ui_gen.send(False) +sub2 = sub + +if item.get_enabled is not None: +sub2 = sub.row(align=False) +sub2.enabled = item.get_enabled(context, item.idname) if use_menu: -sub.operator_menu_hold( +
[Bf-blender-cvs] [5ba5678e004] master: Cleanup: Use forward declaration of struct in header
Commit: 5ba5678e0041c960a50ee05a1bf28d6c7b396162 Author: Hans Goudey Date: Fri Jan 7 12:42:04 2022 -0600 Branches: master https://developer.blender.org/rB5ba5678e0041c960a50ee05a1bf28d6c7b396162 Cleanup: Use forward declaration of struct in header This meant that BKE_mesh.h couldn't be used without the DNA headers first. === M source/blender/blenkernel/BKE_mesh.h === diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index dc9d0e9452a..5f3fcb535b2 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -951,7 +951,7 @@ void BKE_mesh_calc_edges_tessface(struct Mesh *mesh); /* In DerivedMesh.cc */ void BKE_mesh_wrapper_deferred_finalize(struct Mesh *me_eval, -const CustomData_MeshMasks *cd_mask_finalize); +const struct CustomData_MeshMasks *cd_mask_finalize); /* Depsgraph evaluation */ ___ 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] [6437be3a1b4] temp-sculpt-colors: Merge branch 'master' into temp-sculpt-colors
Commit: 6437be3a1b4c813ba576d793f8e2f34cadc1ea7d Author: Joseph Eagar Date: Fri Jan 7 07:57:34 2022 -0800 Branches: temp-sculpt-colors https://developer.blender.org/rB6437be3a1b4c813ba576d793f8e2f34cadc1ea7d Merge branch 'master' into temp-sculpt-colors === === diff --cc release/scripts/addons index c60fef38175,c08568cc376..6afec05c328 --- a/release/scripts/addons +++ b/release/scripts/addons @@@ -1,1 -1,1 +1,1 @@@ - Subproject commit c60fef38175ad989ee0c45e924cb27e1417c8667 -Subproject commit c08568cc376d2e4298710c4172fb0c74f0611de1 ++Subproject commit 6afec05c3286cdea58ab269fb8dd1f5de011de4e diff --cc source/blender/blenkernel/BKE_attribute.h index 68d5c7948a3,db8f3759bf8..7b4ca0c0a55 --- a/source/blender/blenkernel/BKE_attribute.h +++ b/source/blender/blenkernel/BKE_attribute.h @@@ -63,14 -54,8 +63,10 @@@ typedef enum bool BKE_id_attributes_supported(struct ID *id); +/* list_mask restricts unique name check to certain customdata types, + if in doubt just pass CD_MASK_PROP_ALL */ - struct CustomDataLayer *BKE_id_attribute_new(struct ID *id, - const char *name, - const int type, - const AttributeDomain domain, - const CustomDataMask list_mask, - struct ReportList *reports); + struct CustomDataLayer *BKE_id_attribute_new( + struct ID *id, const char *name, int type, AttributeDomain domain, struct ReportList *reports); bool BKE_id_attribute_remove(struct ID *id, struct CustomDataLayer *layer, struct ReportList *reports); diff --cc source/blender/blenkernel/BKE_data_transfer.h index cfb567cc226,42cf2256e8c..9d06da94809 --- a/source/blender/blenkernel/BKE_data_transfer.h +++ b/source/blender/blenkernel/BKE_data_transfer.h @@@ -71,21 -69,16 +71,21 @@@ void BKE_object_data_transfer_dttypes_t * Check what can do each layer type * (if it is actually handled by transfer-data, if it supports advanced mixing. */ - bool BKE_object_data_transfer_get_dttypes_capacity(const int dtdata_types, + bool BKE_object_data_transfer_get_dttypes_capacity(int dtdata_types, bool *r_advanced_mixing, bool *r_threshold); - int BKE_object_data_transfer_get_dttypes_item_types(const int dtdata_types); + int BKE_object_data_transfer_get_dttypes_item_types(int dtdata_types); - int BKE_object_data_transfer_dttype_to_cdtype(const int dtdata_type); - int BKE_object_data_transfer_dttype_to_srcdst_index(const int dtdata_type); + int BKE_object_data_transfer_dttype_to_cdtype(int dtdata_type); + int BKE_object_data_transfer_dttype_to_srcdst_index(int dtdata_type); #define DT_DATATYPE_IS_VERT(_dt) \ - ELEM(_dt, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_SKIN, DT_TYPE_BWEIGHT_VERT) + ELEM(_dt, \ + DT_TYPE_MDEFORMVERT, \ + DT_TYPE_SHAPEKEY, \ + DT_TYPE_SKIN, \ + DT_TYPE_BWEIGHT_VERT, \ + DT_TYPE_PROPCOL) #define DT_DATATYPE_IS_EDGE(_dt) \ ELEM(_dt, \ DT_TYPE_CREASE, \ diff --cc source/blender/blenloader/intern/versioning_300.c index 4b00332ea82,152684db8f1..7bfc04d1696 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@@ -44,8 -44,9 +44,10 @@@ #include "DNA_lineart_types.h" #include "DNA_listBase.h" #include "DNA_material_types.h" +#include "DNA_mesh_types.h" #include "DNA_modifier_types.h" + #include "DNA_screen_types.h" + #include "DNA_space_types.h" #include "DNA_text_types.h" #include "DNA_workspace_types.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] [def061207ea] temp-sculpt-colors: Fix merge error
Commit: def061207eaf96a0bf0bd45a7854ea4269580e6f Author: Joseph Eagar Date: Fri Jan 7 10:12:12 2022 -0800 Branches: temp-sculpt-colors https://developer.blender.org/rBdef061207eaf96a0bf0bd45a7854ea4269580e6f Fix merge error === M source/blender/blenkernel/BKE_attribute.h === diff --git a/source/blender/blenkernel/BKE_attribute.h b/source/blender/blenkernel/BKE_attribute.h index 7b4ca0c0a55..80d14fc31cd 100644 --- a/source/blender/blenkernel/BKE_attribute.h +++ b/source/blender/blenkernel/BKE_attribute.h @@ -65,8 +65,12 @@ bool BKE_id_attributes_supported(struct ID *id); /* list_mask restricts unique name check to certain customdata types, if in doubt just pass CD_MASK_PROP_ALL */ -struct CustomDataLayer *BKE_id_attribute_new( -struct ID *id, const char *name, int type, AttributeDomain domain, struct ReportList *reports); +struct CustomDataLayer *BKE_id_attribute_new(struct ID *id, + const char *name, + int type, + AttributeDomain domain, + const CustomDataMask list_mask, + struct ReportList *reports); bool BKE_id_attribute_remove(struct ID *id, struct CustomDataLayer *layer, struct ReportList *reports); ___ 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] [ae28d90578b] master: Fix T93350: Cycles renders shows black during rendering huge resolutions
Commit: ae28d90578be516bf81f3532846c29f9985f1085 Author: Brecht Van Lommel Date: Thu Jan 6 16:41:44 2022 +0100 Branches: master https://developer.blender.org/rBae28d90578be516bf81f3532846c29f9985f1085 Fix T93350: Cycles renders shows black during rendering huge resolutions The root of the issue is caused by Cycles ignoring OpenGL limitation on the maximum resolution of textures: Cycles was allocating texture of the final render resolution. It was exceeding limitation on certain GPUs and driver. The idea is simple: use multiple textures for the display, each of which will fit into OpenGL limitations. There is some code which allows the display driver to know when to start the new tile. Also added some code to allow force graphics interop to be re-created. The latter one ended up not used in the final version of the patch, but it might be helpful for other drivers implementation. The tile size is limited to 8K now as it is the safest size for textures on many GPUs and OpenGL drivers. This is an updated fix with a workaround for freezing with the NVIDIA driver on Linux. Differential Revision: https://developer.blender.org/D13385 === M intern/cycles/blender/addon/properties.py M intern/cycles/blender/display_driver.cpp M intern/cycles/blender/display_driver.h M intern/cycles/device/cuda/graphics_interop.cpp M intern/cycles/integrator/path_trace.cpp M intern/cycles/integrator/path_trace.h M intern/cycles/integrator/path_trace_display.cpp M intern/cycles/integrator/path_trace_display.h M intern/cycles/integrator/path_trace_work.cpp M intern/cycles/integrator/path_trace_work_gpu.cpp M intern/cycles/session/display_driver.h M intern/cycles/session/session.cpp M intern/cycles/session/tile.cpp M intern/cycles/session/tile.h === diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index a7deae2c05d..f669adb9f37 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -802,7 +802,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): name="Tile Size", default=2048, description="", -min=8, max=16384, +min=8, max=8192, ) # Various fine-tuning debug flags diff --git a/intern/cycles/blender/display_driver.cpp b/intern/cycles/blender/display_driver.cpp index abf421983b3..7524a3adf37 100644 --- a/intern/cycles/blender/display_driver.cpp +++ b/intern/cycles/blender/display_driver.cpp @@ -272,12 +272,300 @@ uint BlenderDisplaySpaceShader::get_shader_program() return shader_program_; } +/* + * DrawTile. + */ + +/* Higher level representation of a texture from the graphics library. */ +class GLTexture { + public: + /* Global counter for all allocated OpenGL textures used by instances of this class. */ + static inline std::atomic num_used = 0; + + GLTexture() = default; + + ~GLTexture() + { +assert(gl_id == 0); + } + + GLTexture(const GLTexture &other) = delete; + GLTexture &operator=(GLTexture &other) = delete; + + GLTexture(GLTexture &&other) noexcept + : gl_id(other.gl_id), width(other.width), height(other.height) + { +other.reset(); + } + + GLTexture &operator=(GLTexture &&other) + { +if (this == &other) { + return *this; +} + +gl_id = other.gl_id; +width = other.width; +height = other.height; + +other.reset(); + +return *this; + } + + bool gl_resources_ensure() + { +if (gl_id) { + return true; +} + +/* Create texture. */ +glGenTextures(1, &gl_id); +if (!gl_id) { + LOG(ERROR) << "Error creating texture."; + return false; +} + +/* Configure the texture. */ +glActiveTexture(GL_TEXTURE0); +glBindTexture(GL_TEXTURE_2D, gl_id); + +glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); +glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + +/* Clamp to edge so that precision issues when zoomed out (which forces linear interpolation) + * does not cause unwanted repetition. */ +glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); +glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + +glBindTexture(GL_TEXTURE_2D, 0); + +++num_used; + +return true; + } + + void gl_resources_destroy() + { +if (!gl_id) { + return; +} + +glDeleteTextures(1, &gl_id); + +reset(); + +--num_used; + } + + /* OpenGL resource IDs of the texture. + * + * NOTE: Allocated on the render engine's context. */ + uint gl_id = 0; + + /* Dimensions of the texture in pixels. */ + int width = 0; + int height = 0; + + protected: + void reset() + { +gl_id = 0; +width = 0; +
[Bf-blender-cvs] [34d553671da] master: Fix wrong shadow terminator geometry offset with deformation motion blur
Commit: 34d553671daeb5f38d8bbc69ebbdee0f93421000 Author: Olivier Maury Date: Fri Jan 7 17:15:37 2022 +0100 Branches: master https://developer.blender.org/rB34d553671daeb5f38d8bbc69ebbdee0f93421000 Fix wrong shadow terminator geometry offset with deformation motion blur Differential Revision: https://developer.blender.org/D13759 === M intern/cycles/kernel/geom/motion_triangle.h M intern/cycles/kernel/light/sample.h === diff --git a/intern/cycles/kernel/geom/motion_triangle.h b/intern/cycles/kernel/geom/motion_triangle.h index 62b7b630c89..bd62325eaf2 100644 --- a/intern/cycles/kernel/geom/motion_triangle.h +++ b/intern/cycles/kernel/geom/motion_triangle.h @@ -116,6 +116,52 @@ ccl_device_inline void motion_triangle_vertices( verts[2] = (1.0f - t) * verts[2] + t * next_verts[2]; } +ccl_device_inline void motion_triangle_vertices_and_normals( +KernelGlobals kg, int object, int prim, float time, float3 verts[3], float3 normals[3]) +{ + /* get motion info */ + int numsteps, numverts; + object_motion_info(kg, object, &numsteps, &numverts, NULL); + + /* Figure out which steps we need to fetch and their interpolation factor. */ + int maxstep = numsteps * 2; + int step = min((int)(time * maxstep), maxstep - 1); + float t = time * maxstep - step; + + /* Find attribute. */ + int offset = intersection_find_attribute(kg, object, ATTR_STD_MOTION_VERTEX_POSITION); + kernel_assert(offset != ATTR_STD_NOT_FOUND); + + /* Fetch vertex coordinates. */ + float3 next_verts[3]; + uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim); + + motion_triangle_verts_for_step(kg, tri_vindex, offset, numverts, numsteps, step, verts); + motion_triangle_verts_for_step(kg, tri_vindex, offset, numverts, numsteps, step + 1, next_verts); + + /* Interpolate between steps. */ + verts[0] = (1.0f - t) * verts[0] + t * next_verts[0]; + verts[1] = (1.0f - t) * verts[1] + t * next_verts[1]; + verts[2] = (1.0f - t) * verts[2] + t * next_verts[2]; + + /* Compute smooth normal. */ + + /* Find attribute. */ + offset = intersection_find_attribute(kg, object, ATTR_STD_MOTION_VERTEX_NORMAL); + kernel_assert(offset != ATTR_STD_NOT_FOUND); + + /* Fetch vertex coordinates. */ + float3 next_normals[3]; + motion_triangle_normals_for_step(kg, tri_vindex, offset, numverts, numsteps, step, normals); + motion_triangle_normals_for_step( + kg, tri_vindex, offset, numverts, numsteps, step + 1, next_normals); + + /* Interpolate between steps. */ + normals[0] = (1.0f - t) * normals[0] + t * next_normals[0]; + normals[1] = (1.0f - t) * normals[1] + t * next_normals[1]; + normals[2] = (1.0f - t) * normals[2] + t * next_normals[2]; +} + ccl_device_inline float3 motion_triangle_smooth_normal( KernelGlobals kg, float3 Ng, int object, int prim, float u, float v, float time) { diff --git a/intern/cycles/kernel/light/sample.h b/intern/cycles/kernel/light/sample.h index 5a4b7c0a302..7dbc783b1bb 100644 --- a/intern/cycles/kernel/light/sample.h +++ b/intern/cycles/kernel/light/sample.h @@ -141,7 +141,14 @@ ccl_device_inline float3 shadow_ray_smooth_surface_offset( KernelGlobals kg, ccl_private const ShaderData *ccl_restrict sd, float3 Ng) { float3 V[3], N[3]; - triangle_vertices_and_normals(kg, sd->prim, V, N); + + if (sd->type == PRIMITIVE_MOTION_TRIANGLE) { +motion_triangle_vertices_and_normals(kg, sd->object, sd->prim, sd->time, V, N); + } + else { +kernel_assert(sd->type == PRIMITIVE_TRIANGLE); +triangle_vertices_and_normals(kg, sd->prim, V, N); + } const float u = sd->u, v = sd->v; const float w = 1 - u - v; ___ 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] [1152caad325] master: Fix: connecting hair fails on meshes with no generative modifiers
Commit: 1152caad3254d0d11d06fd01e55784f51d2a9b9a Author: Aleksi Juvani Date: Fri Jan 7 17:45:06 2022 +0100 Branches: master https://developer.blender.org/rB1152caad3254d0d11d06fd01e55784f51d2a9b9a Fix: connecting hair fails on meshes with no generative modifiers Fixes a bug introduced in rB5dedb39d447b. `mesh_original` is not set if the mesh has no generative modifiers, in which case we can use `mesh_final`, which would seem to be consistent with the rest of the particle code. An alternative approach would be to make sure that `mesh_original` is always set in `deformVerts`. Differential Revision: https://developer.blender.org/D13754 === M source/blender/editors/physics/particle_object.c === diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 4f571fa6353..896a37c3984 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -746,7 +746,7 @@ static bool remap_hair_emitter(Depsgraph *depsgraph, const bool use_dm_final_indices = (target_psys->part->use_modifier_stack && !target_psmd->mesh_final->runtime.deformed_only); - if (use_dm_final_indices) { + if (use_dm_final_indices || !target_psmd->mesh_original) { mesh = target_psmd->mesh_final; } 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] [ee0928d4be6] master: Fix wrong shadow terminator geometry offset for instances
Commit: ee0928d4be6e1f502eb7208f821d8e049795dadd Author: Olivier Maury Date: Fri Jan 7 17:07:08 2022 +0100 Branches: master https://developer.blender.org/rBee0928d4be6e1f502eb7208f821d8e049795dadd Fix wrong shadow terminator geometry offset for instances Must take into account SD_OBJECT_TRANSFORM_APPLIED to determine if the normal was already in world space. Differential Revision: https://developer.blender.org/D13639 === M intern/cycles/kernel/light/sample.h === diff --git a/intern/cycles/kernel/light/sample.h b/intern/cycles/kernel/light/sample.h index b6662c7f6b3..5a4b7c0a302 100644 --- a/intern/cycles/kernel/light/sample.h +++ b/intern/cycles/kernel/light/sample.h @@ -148,7 +148,9 @@ ccl_device_inline float3 shadow_ray_smooth_surface_offset( float3 P = V[0] * u + V[1] * v + V[2] * w; /* Local space */ float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without normalization */ - object_normal_transform(kg, sd, &n); /* Normal x scale, world space */ + if (!(sd->object_flag & SD_OBJECT_TRANSFORM_APPLIED)) { +object_normal_transform(kg, sd, &n); /* Normal x scale, world space */ + } /* Parabolic approximation */ float a = dot(N[2] - N[0], V[0] - V[2]); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [efe3d60a2c8] master: Cycles: Fix Metal build
Commit: efe3d60a2c8306aefd41bc304548da35b67c252c Author: Michael Jones Date: Fri Jan 7 15:28:43 2022 + Branches: master https://developer.blender.org/rBefe3d60a2c8306aefd41bc304548da35b67c252c Cycles: Fix Metal build This patch fixes a couple of new Metal kernel compilation errors: 1) a kernel parameter count overflow, and 2) missing address space qualifiers. Reviewed By: brecht Differential Revision: https://developer.blender.org/D13763 === M intern/cycles/kernel/device/gpu/kernel.h M intern/cycles/kernel/device/metal/compat.h === diff --git a/intern/cycles/kernel/device/gpu/kernel.h b/intern/cycles/kernel/device/gpu/kernel.h index 027b2a7a8c7..00c727b48cb 100644 --- a/intern/cycles/kernel/device/gpu/kernel.h +++ b/intern/cycles/kernel/device/gpu/kernel.h @@ -821,8 +821,8 @@ ccl_gpu_kernel(GPU_KERNEL_BLOCK_NUM_THREADS, GPU_KERNEL_MAX_REGISTERS) if (guiding_pass_flow != PASS_UNUSED) { kernel_assert(render_pass_motion != PASS_UNUSED); -const float *motion_in = buffer + render_pass_motion; -float *flow_out = guiding_pixel + guiding_pass_flow; +ccl_global const float *motion_in = buffer + render_pass_motion; +ccl_global float *flow_out = guiding_pixel + guiding_pass_flow; flow_out[0] = -motion_in[0] * pixel_scale; flow_out[1] = -motion_in[1] * pixel_scale; diff --git a/intern/cycles/kernel/device/metal/compat.h b/intern/cycles/kernel/device/metal/compat.h index a51afc37fc0..1222b68f0ee 100644 --- a/intern/cycles/kernel/device/metal/compat.h +++ b/intern/cycles/kernel/device/metal/compat.h @@ -98,8 +98,12 @@ using namespace metal::raytracing; #define FN14(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14) p1; p2; p3; p4; p5; p6; p7; p8; p9; p10; p11; p12; p13; p14; #define FN15(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) p1; p2; p3; p4; p5; p6; p7; p8; p9; p10; p11; p12; p13; p14; p15; #define FN16(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16) p1; p2; p3; p4; p5; p6; p7; p8; p9; p10; p11; p12; p13; p14; p15; p16; -#define GET_LAST_ARG(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, ...) p16 -#define PARAMS_MAKER(...) GET_LAST_ARG(__VA_ARGS__, FN16, FN15, FN14, FN13, FN12, FN11, FN10, FN9, FN8, FN7, FN6, FN5, FN4, FN3, FN2, FN1, FN0) +#define FN17(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17) p1; p2; p3; p4; p5; p6; p7; p8; p9; p10; p11; p12; p13; p14; p15; p16; p17; +#define FN18(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18) p1; p2; p3; p4; p5; p6; p7; p8; p9; p10; p11; p12; p13; p14; p15; p16; p17; p18; +#define FN19(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19) p1; p2; p3; p4; p5; p6; p7; p8; p9; p10; p11; p12; p13; p14; p15; p16; p17; p18; p19; +#define FN20(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20) p1; p2; p3; p4; p5; p6; p7; p8; p9; p10; p11; p12; p13; p14; p15; p16; p17; p18; p19; p20; +#define GET_LAST_ARG(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, ...) p20 +#define PARAMS_MAKER(...) GET_LAST_ARG(__VA_ARGS__, FN20, FN19, FN18, FN17, FN16, FN15, FN14, FN13, FN12, FN11, FN10, FN9, FN8, FN7, FN6, FN5, FN4, FN3, FN2, FN1, FN0) /* Generate a struct containing the entry-point parameters and a "run" * method which can access them implicitly via this-> */ ___ 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] [3067efe54ed] temp-sculpt-colors: temp-sculpt-colors: Various fixes
Commit: 3067efe54eda52ccd679041aa657ca21c76f49fb Author: Joseph Eagar Date: Fri Jan 7 07:51:59 2022 -0800 Branches: temp-sculpt-colors https://developer.blender.org/rB3067efe54eda52ccd679041aa657ca21c76f49fb temp-sculpt-colors: Various fixes * Fixed byte color layers not rendering in EEVEE * Fixed byte color layers not showing up in ui list for vertex color shading node. * Rewrote vcol extractor for non-BMesh case to be less messy. === M source/blender/blenkernel/intern/attribute.c M source/blender/draw/intern/draw_cache_impl_mesh.c M source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc M source/blender/editors/geometry/geometry_attributes.c M source/blender/editors/space_node/drawnode.cc M source/blender/gpu/intern/gpu_codegen.c M source/blender/makesrna/intern/rna_attribute.c M source/blender/makesrna/intern/rna_internal.h === diff --git a/source/blender/blenkernel/intern/attribute.c b/source/blender/blenkernel/intern/attribute.c index 67aff869751..f89e678f3e0 100644 --- a/source/blender/blenkernel/intern/attribute.c +++ b/source/blender/blenkernel/intern/attribute.c @@ -495,6 +495,10 @@ CustomDataLayer *BKE_id_attributes_active_color_get(ID *id) return NULL; } + if (!ref->name[0]) { +return NULL; + } + DomainInfo info[ATTR_DOMAIN_NUM]; get_domains(id, info); @@ -561,6 +565,10 @@ CustomDataLayer *BKE_id_attributes_render_color_get(ID *id) return NULL; } + if (!ref->name[0]) { +return NULL; + } + DomainInfo info[ATTR_DOMAIN_NUM]; get_domains(id, info); diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 6981c771173..8bde4e081d6 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -574,12 +574,34 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Mesh *me, if (layer == -1) { layer = CustomData_get_named_layer(cd_vdata, CD_PROP_COLOR, name); - type = CD_PROP_COLOR; + if (layer != -1) { +type = CD_PROP_COLOR; +domain = ATTR_DOMAIN_POINT; + } +} + +if (layer == -1) { + layer = CustomData_get_named_layer(cd_ldata, CD_PROP_COLOR, name); + if (layer != -1) { +type = CD_PROP_COLOR; +domain = ATTR_DOMAIN_CORNER; + } +} + +if (layer == -1) { + layer = CustomData_get_named_layer(cd_vdata, CD_MLOOPCOL, name); + if (layer != -1) { +type = CD_MLOOPCOL; +domain = ATTR_DOMAIN_POINT; + } } if (layer == -1) { layer = CustomData_get_named_layer(cd_ldata, CD_MLOOPCOL, name); - type = CD_MCOL; + if (layer != -1) { +type = CD_MLOOPCOL; +domain = ATTR_DOMAIN_CORNER; + } } #if 0 /* Tangents are always from UV's - this will never happen. */ @@ -656,7 +678,10 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Mesh *me, break; } - case CD_MCOL: + /* note that attr->type will always be CD_PROP_COLOR event for + CD_MLOOPCOL layers, see node_shader_gpu_vertex_color in + node_shader_vertex_color.cc + */ case CD_MLOOPCOL: case CD_PROP_COLOR: { const AttributeRef *render = &me->attr_color_render; @@ -667,15 +692,28 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Mesh *me, if (layer == -1 && name[0] != '\0') { layer = CustomData_get_named_layer_index(cd_ldata, type, name); + domain = layer != -1 ? ATTR_DOMAIN_CORNER : domain; - if (layer != -1) { -domain = ATTR_DOMAIN_CORNER; - } - else { + if (layer == -1) { layer = CustomData_get_named_layer_index(cd_vdata, type, name); +domain = layer != -1 ? ATTR_DOMAIN_POINT : domain; + } + + if (layer == -1) { +layer = CustomData_get_named_layer_index(cd_ldata, CD_MLOOPCOL, name); + +if (layer != -1) { + domain = ATTR_DOMAIN_CORNER; + type = CD_MLOOPCOL; +} + } + + if (layer == -1) { +layer = CustomData_get_named_layer_index(cd_vdata, CD_MLOOPCOL, name); if (layer != -1) { domain = ATTR_DOMAIN_POINT; + type = CD_MLOOPCOL; } } diff --git a/source/blender/draw/intern/mesh_extract
[Bf-blender-cvs] [c7161379c24] asset-greasepencil: Merge branch 'master' into asset-greasepencil
Commit: c7161379c24bdc4846a04cc5e65b8034a8d814aa Author: Antonio Vazquez Date: Fri Jan 7 16:05:22 2022 +0100 Branches: asset-greasepencil https://developer.blender.org/rBc7161379c24bdc4846a04cc5e65b8034a8d814aa Merge branch 'master' into asset-greasepencil === === ___ 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] [375c872799d] tmp-gpu-shader-descriptor-2: EditUVs faces, edges and facedots.
Commit: 375c872799d6e7f0c74d702b9bcdba5c462a065b Author: Jeroen Bakker Date: Fri Jan 7 15:47:31 2022 +0100 Branches: tmp-gpu-shader-descriptor-2 https://developer.blender.org/rB375c872799d6e7f0c74d702b9bcdba5c462a065b EditUVs faces, edges and facedots. === M source/blender/gpu/CMakeLists.txt M source/blender/gpu/shaders/infos/gpu_interface_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_uv_edges_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_uv_facedots_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_uv_faces_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_uv_faces_stretch_info.hh M source/blender/gpu/shaders/infos/gpu_shader_todo_info.hh === diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 23b915b3c19..7b433da3f55 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -443,6 +443,10 @@ shaders/infos/gpu_shader_3D_depth_only_info.hh #shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh #shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh shaders/infos/gpu_shader_2D_point_fixed_size_uniform_color_info.hh +shaders/infos/gpu_shader_2D_uv_faces_stretch_info.hh +shaders/infos/gpu_shader_2D_uv_faces_info.hh +shaders/infos/gpu_shader_2D_uv_facedots_info.hh +shaders/infos/gpu_shader_2D_uv_edges_info.hh #shaders/infos/gpu_shader_todo_info.hh ) diff --git a/source/blender/gpu/shaders/infos/gpu_interface_info.hh b/source/blender/gpu/shaders/infos/gpu_interface_info.hh index 61d8e1b9c24..97ead4098d8 100644 --- a/source/blender/gpu/shaders/infos/gpu_interface_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_interface_info.hh @@ -3,5 +3,6 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_INTERFACE_INFO(flat_color_iface, "").flat(Type::VEC4, "finalColor"); +GPU_SHADER_INTERFACE_INFO(no_perspective_color_iface, "").no_perspective(Type::VEC4, "finalColor"); GPU_SHADER_INTERFACE_INFO(smooth_color_iface, "").smooth(Type::VEC4, "finalColor"); GPU_SHADER_INTERFACE_INFO(smooth_tex_coord_interp_iface, "").smooth(Type::VEC2, "texCoord_interp"); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_uv_edges_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_uv_edges_info.hh new file mode 100644 index 000..36bf454f3dd --- /dev/null +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_uv_edges_info.hh @@ -0,0 +1,42 @@ +#include "gpu_interface_info.hh" +#include "gpu_shader_create_info.hh" + +GPU_SHADER_INTERFACE_INFO(flat_edituvs_edges_iface, "") +.flat(Type::VEC4, "finalColor") +.no_perspective(Type::VEC2, "stipple_pos") +.flat(Type::VEC2, "stipple_start"); +GPU_SHADER_INTERFACE_INFO(no_perspective_edituvs_edges_iface, "") +.no_perspective(Type::VEC4, "finalColor") +.no_perspective(Type::VEC2, "stipple_pos") +.flat(Type::VEC2, "stipple_start"); + +GPU_SHADER_CREATE_INFO(gpu_shader_2D_uv_edges) +.vertex_in(0, Type::VEC2, "pos") +.vertex_in(1, Type::INT, "flag") +.vertex_out(flat_edituvs_edges_iface) +.fragment_out(0, Type::VEC4, "fragColor") +.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix") +.push_constant(16, Type::VEC4, "edgeColor") +.push_constant(20, Type::VEC4, "selectColor") +.push_constant(24, Type::FLOAT, "dashWidth") + +.vertex_source("gpu_shader_2D_edituvs_edges_vert.glsl") +.fragment_source("gpu_shader_2D_edituvs_edges_frag.glsl") +.additional_info("gpu_srgb_to_framebuffer_space") +.do_static_compilation(true); + +GPU_SHADER_CREATE_INFO(gpu_shader_2D_uv_edges_smooth) +.vertex_in(0, Type::VEC2, "pos") +.vertex_in(1, Type::INT, "flag") +.vertex_out(no_perspective_edituvs_edges_iface) +.fragment_out(0, Type::VEC4, "fragColor") +.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix") +.push_constant(16, Type::VEC4, "edgeColor") +.push_constant(20, Type::VEC4, "selectColor") +.push_constant(24, Type::FLOAT, "dashWidth") + +.vertex_source("gpu_shader_2D_edituvs_edges_vert.glsl") +.fragment_source("gpu_shader_2D_edituvs_edges_frag.glsl") +.define("SMOOTH_COLOR") +.additional_info("gpu_srgb_to_framebuffer_space") +.do_static_compilation(true); diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_uv_facedots_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_uv_facedots_info.hh new file mode 100644 index 000..4c85f5543c0 --- /dev/null +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_uv_facedots_info.hh @@ -0,0 +1,14 @@ +#include "gpu_interface_info.hh" +#include "gpu_shader_create_info.hh" + +GPU_SHADER_CREATE_INFO(gpu_shader_2D_uv_facedots) +.vertex_in(0, Type::VEC2, "pos") +.vertex_in(1, Type::INT, "flag") +.vertex_out(smooth_color_iface) +.fragment_out(0, Type ::VEC4, "fragColor") +.push_constant(0, Type:
[Bf-blender-cvs] [b7ea6e9d0ef] master: LibOverrides: small refactor of resync main public function.
Commit: b7ea6e9d0ef910fe668d0fa3454ac94400471804 Author: Bastien Montagne Date: Fri Jan 7 15:25:25 2022 +0100 Branches: master https://developer.blender.org/rBb7ea6e9d0ef910fe668d0fa3454ac94400471804 LibOverrides: small refactor of resync main public function. Simplify signature of `BKE_lib_override_library_resync` and make it a shallow wrapper around new internal `lib_override_library_resync` that can then be easily extended for other internal needs. Not functional changes expected here. === M source/blender/blenkernel/BKE_lib_override.h M source/blender/blenkernel/intern/lib_override.c M source/blender/editors/space_outliner/outliner_tools.c === diff --git a/source/blender/blenkernel/BKE_lib_override.h b/source/blender/blenkernel/BKE_lib_override.h index afffa98fe3d..16156824f8e 100644 --- a/source/blender/blenkernel/BKE_lib_override.h +++ b/source/blender/blenkernel/BKE_lib_override.h @@ -164,9 +164,9 @@ void BKE_lib_override_library_main_proxy_convert(struct Main *bmain, * Advanced 'smart' function to resync, re-create fully functional overrides up-to-date with linked * data, from an existing override hierarchy. * - * \param id_root: The root liboverride ID to resync from. * \param view_layer: the active view layer to search instantiated collections in, can be NULL (in *which case \a scene's master collection children hierarchy is used instead). + * \param id_root: The root liboverride ID to resync from. * \return true if override was successfully resynced. */ bool BKE_lib_override_library_resync(struct Main *bmain, @@ -175,7 +175,6 @@ bool BKE_lib_override_library_resync(struct Main *bmain, struct ID *id_root, struct Collection *override_resync_residual_storage, bool do_hierarchy_enforce, - bool do_post_process, struct BlendFileReadReport *reports); /** * Detect and handle required resync of overrides data, when relations between reference linked IDs diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 6fe57a0257c..38ce8ea88b9 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -376,7 +376,6 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain, * existing linked IDs usages. */ if (success) { for (todo_id_iter = todo_ids.first; todo_id_iter != NULL; todo_id_iter = todo_id_iter->next) { - ID *other_id; reference_id = todo_id_iter->data; ID *local_id = reference_id->newid; @@ -394,6 +393,7 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain, * remapped to use newly created overriding IDs, if needed. */ ID *id; FOREACH_MAIN_ID_BEGIN (bmain, id) { +ID *other_id; /* In case we created new overrides as 'no main', they are not accessible directly in this * loop, but we can get to them through their reference's `newid` pointer. */ if (do_no_main && id->lib == reference_id->lib && id->newid != NULL) { @@ -1121,14 +1121,14 @@ void BKE_lib_override_library_main_proxy_convert(Main *bmain, BlendFileReadRepor } } -bool BKE_lib_override_library_resync(Main *bmain, - Scene *scene, - ViewLayer *view_layer, - ID *id_root, - Collection *override_resync_residual_storage, - const bool do_hierarchy_enforce, - const bool do_post_process, - BlendFileReadReport *reports) +static bool lib_override_library_resync(Main *bmain, +Scene *scene, +ViewLayer *view_layer, +ID *id_root, +Collection *override_resync_residual_storage, +const bool do_hierarchy_enforce, +const bool do_post_process, +BlendFileReadReport *reports) { BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_root)); @@ -1499,6 +1499,26 @@ bool BKE_lib_override_library_resync(Main *bmain, return success; } +bool BKE_lib_override_library_resync(Main *bmain, + Scene *scene, + ViewLayer *view_layer, + ID *id_root, + Collection *override_resync_residual_storage, +
[Bf-blender-cvs] [960ce1e628d] tmp-gpu-shader-descriptor-2: Added stubs for all missing shaders.
Commit: 960ce1e628dc9c97014a40c319896ee0b7d9bb7d Author: Jeroen Bakker Date: Fri Jan 7 14:59:37 2022 +0100 Branches: tmp-gpu-shader-descriptor-2 https://developer.blender.org/rB960ce1e628dc9c97014a40c319896ee0b7d9bb7d Added stubs for all missing shaders. === M source/blender/gpu/CMakeLists.txt A source/blender/gpu/shaders/infos/gpu_shader_todo_info.hh === diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index ce9f6032255..23b915b3c19 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -443,8 +443,7 @@ shaders/infos/gpu_shader_3D_depth_only_info.hh #shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh #shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh shaders/infos/gpu_shader_2D_point_fixed_size_uniform_color_info.hh - - +#shaders/infos/gpu_shader_todo_info.hh ) set(SHADER_CREATE_INFOS_CONTENT "") diff --git a/source/blender/gpu/shaders/infos/gpu_shader_todo_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_todo_info.hh new file mode 100644 index 000..3b36c5bd680 --- /dev/null +++ b/source/blender/gpu/shaders/infos/gpu_shader_todo_info.hh @@ -0,0 +1,324 @@ +#include "gpu_shader_create_info.hh" + +GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_varying_size_varying_color) +.vertex_source("gpu_shader_2D_point_varying_size_varying_color_vert.glsl") +.fragment_source("gpu_shader_point_varying_color_frag.glsl") +.do_static_compilation(true); + +GPU_SHADER_CREATE_INFO(gpu_shader_2d_point_uniform_size_uniform_color_aa) +.vertex_source("gpu_shader_2D_point_uniform_size_aa_vert.glsl") +.fragment_source("gpu_shader_point_uniform_color_aa_frag.glsl") +.do_static_compilation(true); +/* +[GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA] = +{ +.name = "GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA", +.vert = datatoc_gpu_shader_2D_point_uniform_size_aa_vert_glsl, +.frag = datatoc_gpu_shader_point_uniform_color_aa_frag_glsl, +}, +*/ +GPU_SHADER_CREATE_INFO(gpu_shader_2d_point_uniform_size_uniform_color_outline_aa) +.vertex_source("gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl") +.fragment_source("gpu_shader_point_uniform_color_outline_aa_frag.glsl") +.do_static_compilation(true); +/* +[GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA] = +{ +.name = "GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA", +.vert = datatoc_gpu_shader_2D_point_uniform_size_outline_aa_vert_glsl, +.frag = datatoc_gpu_shader_point_uniform_color_outline_aa_frag_glsl, +}, +*/ +GPU_SHADER_CREATE_INFO(gpu_shader_2d_point_uniform_size_varying_color_outline_aa) + .vertex_source("gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert.glsl") +.fragment_source("gpu_shader_point_varying_color_outline_aa_frag.glsl") +.do_static_compilation(true); +/* +[GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA] = +{ +.name = "GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA", +.vert = datatoc_gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert_glsl, +.frag = datatoc_gpu_shader_point_varying_color_outline_aa_frag_glsl, +}, +*/ +GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_fixed_size_uniform_color) +.vertex_source("gpu_shader_3D_vert.glsl") +.fragment_source("gpu_shader_point_uniform_color_frag.glsl") +.do_static_compilation(true); +/* +[GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR] = +{ +.name = "GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR", +.vert = datatoc_gpu_shader_3D_vert_glsl, +.frag = datatoc_gpu_shader_point_uniform_color_frag_glsl, +}, +*/ +GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_fixed_size_varying_color) +.vertex_source("gpu_shader_3D_point_fixed_size_varying_color_vert.glsl") +.fragment_source("gpu_shader_point_varying_color_frag.glsl") +.do_static_compilation(true); +/* +[GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR] = +{ +.name = "GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR", +.vert = datatoc_gpu_shader_3D_point_fixed_size_varying_color_vert_glsl, +.frag = datatoc_gpu_shader_point_varying_color_frag_glsl, +}, +*/ +GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_varying_size_uniform_color) +.vertex_source("gpu_shader_3D_point_varying_size_vert.glsl") +.fragment_source("gpu_shader_point_uniform_color_frag.glsl") +.do_static_compilation(true); +/* +[GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR] = +{ +.name = "GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR", +.vert = datatoc_gpu_shader_3D_point_varying_size_vert_glsl, +.frag = datatoc_gpu_shader_point_uniform_color_frag_gl
[Bf-blender-cvs] [5560f324471] master: Fix T94078: Wrong Bound Box calculated for curves
Commit: 5560f3244717221600506866bf1c79d370e0045e Author: Germano Cavalcante Date: Tue Jan 4 11:29:15 2022 -0300 Branches: master https://developer.blender.org/rB5560f3244717221600506866bf1c79d370e0045e Fix T94078: Wrong Bound Box calculated for curves `DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN` creates temporary objects that correspond to duplicates or instances. These temporary objects can share same pointers with the original object as in the case of Bounding Box. Bound Box of temporary objects is marked dirty in `BKE_object_replace_data_on_shallow_copy` since `ob->data` is different. This causes the original Bounding Box, calculated for the evaluated geometry, to be lost. The solution in this commit is to change the boundbox reference of the temporary objects, so the boundbox of the non-temporary object (with the data curve) is not marked dirty. Differential Revision: https://developer.blender.org/D13581 === M source/blender/depsgraph/intern/depsgraph_query_iter.cc M source/blender/draw/intern/draw_manager.c === diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc index c84adbcde00..0b219dcbf5e 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc @@ -76,14 +76,8 @@ void deg_invalidate_iterator_work_data(DEGObjectIterData *data) #endif } -void verify_id_properties_freed(DEGObjectIterData *data) +void ensure_id_properties_freed(const Object *dupli_object, Object *temp_dupli_object) { - if (data->dupli_object_current == nullptr) { -/* We didn't enter duplication yet, so we can't have any dangling pointers. */ -return; - } - const Object *dupli_object = data->dupli_object_current->ob; - Object *temp_dupli_object = &data->temp_dupli_object; if (temp_dupli_object->id.properties == nullptr) { /* No ID properties in temp data-block -- no leak is possible. */ return; @@ -97,6 +91,35 @@ void verify_id_properties_freed(DEGObjectIterData *data) temp_dupli_object->id.properties = nullptr; } +void ensure_boundbox_freed(const Object *dupli_object, Object *temp_dupli_object) +{ + if (temp_dupli_object->runtime.bb == nullptr) { +/* No Bounding Box in temp data-block -- no leak is possible. */ +return; + } + if (temp_dupli_object->runtime.bb == dupli_object->runtime.bb) { +/* Temp copy of object did not modify Bounding Box. */ +return; + } + /* Free memory which is owned by temporary storage which is about to get overwritten. */ + MEM_freeN(temp_dupli_object->runtime.bb); + temp_dupli_object->runtime.bb = nullptr; +} + +void free_owned_memory(DEGObjectIterData *data) +{ + if (data->dupli_object_current == nullptr) { +/* We didn't enter duplication yet, so we can't have any dangling pointers. */ +return; + } + + const Object *dupli_object = data->dupli_object_current->ob; + Object *temp_dupli_object = &data->temp_dupli_object; + + ensure_id_properties_freed(dupli_object, temp_dupli_object); + ensure_boundbox_freed(dupli_object, temp_dupli_object); +} + bool deg_object_hide_original(eEvaluationMode eval_mode, Object *ob, DupliObject *dob) { /* Automatic hiding if this object is being instanced on verts/faces/frames @@ -153,7 +176,7 @@ bool deg_iterator_duplis_step(DEGObjectIterData *data) continue; } -verify_id_properties_freed(data); +free_owned_memory(data); data->dupli_object_current = dob; @@ -169,6 +192,8 @@ bool deg_iterator_duplis_step(DEGObjectIterData *data) copy_v4_v4(temp_dupli_object->color, dupli_parent->color); temp_dupli_object->runtime.select_id = dupli_parent->runtime.select_id; if (dob->ob->data != dob->ob_data) { + /* Do not modify the original boundbox. */ + temp_dupli_object->runtime.bb = nullptr; BKE_object_replace_data_on_shallow_copy(temp_dupli_object, dob->ob_data); } @@ -192,7 +217,7 @@ bool deg_iterator_duplis_step(DEGObjectIterData *data) return true; } - verify_id_properties_freed(data); + free_owned_memory(data); free_object_duplilist(data->dupli_list); data->dupli_parent = nullptr; data->dupli_list = nullptr; diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 94950a1ff94..86ed08c5b0f 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -757,8 +757,11 @@ static void duplidata_key_free(void *key) } else { Object temp_object = *dupli_key->ob; +/* Do not modify the original boundbox. */ +temp_object.runtime.bb = NULL; BKE_object_replace_data_on_shallow_copy(&temp_object, dupli_key->ob_data); drw_batch_cache_generate_requested(&temp_object); +MEM_SAFE_FREE(temp_object.runtime.bb); }
[Bf-blender-cvs] [a54cc2acd2f] tmp-gpu-shader-descriptor-2: Added #ifndefs in all builtin shaders.
Commit: a54cc2acd2f43d91cc1dbbaf1fbdc5397d235760 Author: Jeroen Bakker Date: Fri Jan 7 14:29:35 2022 +0100 Branches: tmp-gpu-shader-descriptor-2 https://developer.blender.org/rBa54cc2acd2f43d91cc1dbbaf1fbdc5397d235760 Added #ifndefs in all builtin shaders. === M source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl M source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl M source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_image_multi_rect_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_nodelink_frag.glsl M source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_aa_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_point_varying_size_varying_color_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl M source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_widget_shadow_frag.glsl M source/blender/gpu/shaders/gpu_shader_2D_widget_shadow_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_clipped_uniform_color_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_normal_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_passthrough_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_point_fixed_size_varying_color_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_aa_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_varying_color_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_polyline_geom.glsl M source/blender/gpu/shaders/gpu_shader_cfg_world_clip_lib.glsl M source/blender/gpu/shaders/gpu_shader_colorspace_lib.glsl M source/blender/gpu/shaders/gpu_shader_common_obinfos_lib.glsl M source/blender/gpu/shaders/gpu_shader_flat_color_alpha_test_0_frag.glsl M source/blender/gpu/shaders/gpu_shader_flat_id_frag.glsl M source/blender/gpu/shaders/gpu_shader_geometry.glsl M source/blender/gpu/shaders/gpu_shader_gpencil_stroke_frag.glsl M source/blender/gpu/shaders/gpu_shader_gpencil_stroke_geom.glsl M source/blender/gpu/shaders/gpu_shader_gpencil_stroke_vert.glsl M source/blender/gpu/shaders/gpu_shader_image_varying_color_frag.glsl M source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl M source/blender/gpu/shaders/gpu_shader_point_uniform_color_aa_frag.glsl M source/blender/gpu/shaders/gpu_shader_point_uniform_color_outline_aa_frag.glsl M source/blender/gpu/shaders/gpu_shader_point_varying_color_frag.glsl M source/blender/gpu/shaders/gpu_shader_point_varying_color_outline_aa_frag.glsl M source/blender/gpu/shaders/gpu_shader_point_varying_color_varying_outline_aa_frag.glsl M source/blender/gpu/shaders/gpu_shader_simple_lighting_frag.glsl === diff --git a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl index 56da7a7ff74..4ebcb9c397f 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl @@ -1,9 +1,11 @@ +#ifndef USE_GPU_SHADER_CREATE_INFO uniform vec4 color; uniform float scale; in vec2 uv; out vec4 fragColor; +#endif void main() { diff --git a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl index d20ddcd27c0..c6f01d68eee 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_vert.glsl @@ -1,4 +1,4 @@ - +#ifndef USE_GPU_SHADER_CREATE_INFO uniform mat4 ModelViewProjectionMatrix; uniform vec4 rect; @@ -8,6 +8,7 @@ uniform float scale; in vec2 pos; out vec2 uv; +#endif void main() { diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl b/source/blender/gpu/shaders/gpu_shade
[Bf-blender-cvs] [6e605978bf9] tmp-gpu-shader-descriptor-2: Migrated shaders.
Commit: 6e605978bf922211c4dfcf92c4814fc7d9a6be44 Author: Jeroen Bakker Date: Fri Jan 7 14:11:04 2022 +0100 Branches: tmp-gpu-shader-descriptor-2 https://developer.blender.org/rB6e605978bf922211c4dfcf92c4814fc7d9a6be44 Migrated shaders. === M source/blender/gpu/CMakeLists.txt M source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl M source/blender/gpu/shaders/gpu_shader_2D_image_rect_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl M source/blender/gpu/shaders/gpu_shader_2D_line_dashed_uniform_color_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_line_dashed_uniform_color_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_polyline_frag.glsl M source/blender/gpu/shaders/gpu_shader_3D_polyline_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_smooth_color_frag.glsl M source/blender/gpu/shaders/gpu_shader_3D_smooth_color_vert.glsl M source/blender/gpu/shaders/gpu_shader_3D_vert.glsl M source/blender/gpu/shaders/gpu_shader_point_uniform_color_frag.glsl M source/blender/gpu/shaders/infos/gpu_interface_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_image_rect_color_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_point_fixed_size_uniform_color_info.hh M source/blender/gpu/shaders/infos/gpu_shader_2D_smooth_color_info.hh A source/blender/gpu/shaders/infos/gpu_shader_3D_depth_only_info.hh A source/blender/gpu/shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh A source/blender/gpu/shaders/infos/gpu_shader_3D_polyline_info.hh A source/blender/gpu/shaders/infos/gpu_shader_3D_smooth_color_info.hh A source/blender/gpu/shaders/infos/gpu_shader_3D_uniform_color_info.hh === diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index fe631e30d35..ce9f6032255 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -418,7 +418,7 @@ set(SHADER_CREATE_INFOS shaders/infos/gpu_clip_planes_info.hh shaders/infos/gpu_srgb_to_framebuffer_space_info.hh -#shaders/infos/gpu_shader_3D_flat_color_info.hh !Disabled due to failing compilation. +#shaders/infos/gpu_shader_3D_flat_color_info.hh !Disabled due to world_clipping shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh #shaders/infos/gpu_shader_simple_lighting_info.hh !TODO shaders/infos/gpu_shader_2D_checker_info.hh @@ -432,8 +432,19 @@ shaders/infos/gpu_shader_2D_image_info.hh shaders/infos/gpu_shader_2D_image_color_info.hh shaders/infos/gpu_shader_2D_image_desaturate_info.hh shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh +shaders/infos/gpu_shader_2D_image_rect_color_info.hh shaders/infos/gpu_shader_text_info.hh shaders/infos/gpu_shader_keyframe_shape_info.hh +#shaders/infos/gpu_shader_2D_image_multi_rect_color_info.hh !TODO +#shaders/infos/gpu_shader_3D_uniform_color_info.hh !Disabled due to world clipping +shaders/infos/gpu_shader_3D_smooth_color_info.hh +shaders/infos/gpu_shader_3D_depth_only_info.hh +#shaders/infos/gpu_shader_3D_polyline_info.hh !TODO +#shaders/infos/gpu_shader_2D_line_dashed_uniform_color_info.hh +#shaders/infos/gpu_shader_3D_line_dashed_uniform_color_info.hh +shaders/infos/gpu_shader_2D_point_fixed_size_uniform_color_info.hh + + ) set(SHADER_CREATE_INFOS_CONTENT "") diff --git a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl index 5a36b414229..56da7a7ff74 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_area_borders_frag.glsl @@ -1,4 +1,3 @@ - uniform vec4 color; uniform float scale; diff --git a/source/blender/gpu/shaders/gpu_shader_2D_image_rect_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_image_rect_vert.glsl index ab9c30505c2..d9a5aeeef46 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_image_rect_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_image_rect_vert.glsl @@ -3,11 +3,13 @@ * does not need any vertex input (producing less call to immBegin/End) */ +#ifndef USE_GPU_SHADER_CREATE_INFO uniform mat4 ModelViewProjectionMatrix; uniform vec4 rect_icon; uniform vec4 rect_geom; out vec2 texCoord_interp; +#endif void main() { diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl index 43f259671fa..af9a24d1280 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl @@ -6,6 +6,8 @@ * Dashed is performed in screen space. */ +#ifndef USE_GPU_SHADER_CREATE_INFO + unifor
[Bf-blender-cvs] [17ffc6c140c] soc-2021-simulation-display: Cleanup: remove unnecessary print statements
Commit: 17ffc6c140c01c652eb6e43d91aebc4f84225874 Author: Your Name Date: Fri Jan 7 18:20:16 2022 +0530 Branches: soc-2021-simulation-display https://developer.blender.org/rB17ffc6c140c01c652eb6e43d91aebc4f84225874 Cleanup: remove unnecessary print statements === M source/blender/blenkernel/intern/rigidbody.c === diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 559f26e2c65..d52dcfc9888 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -2532,9 +2532,9 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime const float interp_step = 1.0f / rbw->substeps_per_frame; float cur_interp_val = interp_step; -printf("woo\n"); + GHash *norm_forces_magnitudes = BLI_ghash_ptr_new(__func__); -printf("woo1\n"); + /* Set all contact forces and their locations to zero. (for drawing debug info) */ for (int i = 0; i < rbw->numbodies; i++) { Object *ob = rbw->objects[i]; @@ -2547,10 +2547,10 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime if((ob->rigidbody_object->display_force_types & RB_SIM_NORMAL) || (ob->rigidbody_object->display_force_types & RB_SIM_FRICTION) || (ob->rigidbody_object->sim_display_options & RB_SIM_COLLISIONS)) { - printf("woo2\n"); + float *arr = MEM_callocN(sizeof(float) * 3 ,__func__); BLI_ghash_insert(norm_forces_magnitudes, ob, arr); - printf("w003\n"); + } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [5085c622ea8] master: Cleanup: Remove unused numapi library
Commit: 5085c622ea883c77c723f6f6e2ca656f88d1999e Author: Sergey Sharybin Date: Fri Jan 7 12:03:49 2022 +0100 Branches: master https://developer.blender.org/rB5085c622ea883c77c723f6f6e2ca656f88d1999e Cleanup: Remove unused numapi library === M intern/CMakeLists.txt D intern/numaapi/AUTHORS D intern/numaapi/CMakeLists.txt D intern/numaapi/LICENSE D intern/numaapi/README D intern/numaapi/README.blender D intern/numaapi/include/numaapi.h D intern/numaapi/source/build_config.h D intern/numaapi/source/numaapi.c D intern/numaapi/source/numaapi_linux.c D intern/numaapi/source/numaapi_stub.c D intern/numaapi/source/numaapi_win32.c === diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt index dbd939e64b7..0a61cef7cc8 100644 --- a/intern/CMakeLists.txt +++ b/intern/CMakeLists.txt @@ -25,7 +25,6 @@ add_subdirectory(ghost) add_subdirectory(guardedalloc) add_subdirectory(libmv) add_subdirectory(memutil) -add_subdirectory(numaapi) add_subdirectory(opencolorio) add_subdirectory(opensubdiv) add_subdirectory(mikktspace) diff --git a/intern/numaapi/AUTHORS b/intern/numaapi/AUTHORS deleted file mode 100644 index a824c03d9ff..000 --- a/intern/numaapi/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Sergey Sharybin diff --git a/intern/numaapi/CMakeLists.txt b/intern/numaapi/CMakeLists.txt deleted file mode 100644 index e65ae15ae47..000 --- a/intern/numaapi/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# * BEGIN GPL LICENSE BLOCK * -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# * END GPL LICENSE BLOCK * - -set(INC - include -) - -set(INC_SYS - -) - -set(SRC - source/numaapi.c - source/numaapi_linux.c - source/numaapi_stub.c - source/numaapi_win32.c - - include/numaapi.h - source/build_config.h -) - -set(LIB -) - -add_definitions(-DWITH_DYNLOAD) - -blender_add_lib(bf_intern_numaapi "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/intern/numaapi/LICENSE b/intern/numaapi/LICENSE deleted file mode 100644 index 3562d7ac274..000 --- a/intern/numaapi/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2016 libnumaapi authors. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. diff --git a/intern/numaapi/README b/intern/numaapi/README deleted file mode 100644 index a510ff12548..000 --- a/intern/numaapi/README +++ /dev/null @@ -1,7 +0,0 @@ -LibNumaAPI is aimed to provide one common cross-platform API for all -possible platforms, so cross-platform applications might not worry -about implementation details. - -LICENSE - -LibNumaAPI library is released under the MIT license. diff --git a/intern/numaapi/README.blender b/intern/numaapi/README.blender deleted file mode 100644 index a7f43445169..000 --- a/intern/numaapi/README.blender +++ /dev/null @@ -1,5 +0,0 @@ -Project: LibNumaAPI -URL: https://github.com/Nazg-Gul/libNumaAPI -License: MIT -Upstream version: 1c1ae7bc78e -Local modifications: None diff --git a/intern/numaapi/include/numaapi.h b/intern/numaapi/include/numaapi.h deleted file mode 100644 index 11e916019ef..000 --- a/intern/numaapi/include/numaapi.h +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2016, libn
[Bf-blender-cvs] [312aa67cc73] master: Remove dead numaapi code in blenlib
Commit: 312aa67cc73c97f11e34be24623231f98fcdaa35 Author: Sergey Sharybin Date: Fri Jan 7 12:01:11 2022 +0100 Branches: master https://developer.blender.org/rB312aa67cc73c97f11e34be24623231f98fcdaa35 Remove dead numaapi code in blenlib It it rather an old experiment now which didn't pay off. The initial idea was to have main and jobs threads on fast nodes of TR2 processors. This didn't really work reliably because in Blender we need to be able to create nested threads without their affinity set. This is not how some of OS are creating nested threads, and we don't always have access to child threads to reset their affinity. So overall complexity of the initial idea implementation became too much compared to the performance gain. === M source/blender/blenlib/BLI_threads.h M source/blender/blenlib/CMakeLists.txt M source/blender/blenlib/intern/threads.cc M source/blender/windowmanager/intern/wm_jobs.c M source/creator/creator.c === diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h index c7aae6d7972..60ed5f0544a 100644 --- a/source/blender/blenlib/BLI_threads.h +++ b/source/blender/blenlib/BLI_threads.h @@ -210,13 +210,6 @@ void BLI_thread_queue_nowait(ThreadQueue *queue); # define BLI_thread_local_set(name, value) name = value #endif /* defined(__APPLE__) */ -/* Special functions to help performance on crazy NUMA setups. */ - -/* Make sure process/thread is using NUMA node with fast memory access. */ - -void BLI_thread_put_process_on_fast_node(void); -void BLI_thread_put_thread_on_fast_node(void); - #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 0db0d9a67b3..3958fd8e2d2 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -25,7 +25,6 @@ set(INC ../../../intern/atomic ../../../intern/eigen ../../../intern/guardedalloc - ../../../intern/numaapi/include ../../../extern/wcwidth ../../../extern/json/include ) @@ -334,7 +333,6 @@ set(SRC set(LIB bf_intern_eigen bf_intern_guardedalloc - bf_intern_numaapi extern_wcwidth ${ZLIB_LIBRARIES} diff --git a/source/blender/blenlib/intern/threads.cc b/source/blender/blenlib/intern/threads.cc index 3589c952409..f131a464650 100644 --- a/source/blender/blenlib/intern/threads.cc +++ b/source/blender/blenlib/intern/threads.cc @@ -52,7 +52,6 @@ #endif #include "atomic_ops.h" -#include "numaapi.h" #if defined(__APPLE__) && defined(_OPENMP) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2) && \ !defined(__clang__) @@ -125,7 +124,6 @@ static pthread_mutex_t _colormanage_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _fftw_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _view3d_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_t mainid; -static bool is_numa_available = false; static unsigned int thread_levels = 0; /* threads can be invoked inside threads */ static int num_threads_override = 0; @@ -143,9 +141,6 @@ struct ThreadSlot { void BLI_threadapi_init() { mainid = pthread_self(); - if (numaAPI_Initialize() == NUMAAPI_SUCCESS) { -is_numa_available = true; - } } void BLI_threadapi_exit() @@ -807,110 +802,3 @@ void BLI_thread_queue_wait_finish(ThreadQueue *queue) pthread_mutex_unlock(&queue->mutex); } - -/* Special functions to help performance on crazy NUMA setups. */ - -#if 0 /* UNUSED */ -static bool check_is_threadripper2_alike_topology(){ - /* NOTE: We hope operating system does not support CPU hot-swap to - * a different brand. And that SMP of different types is also not - * encouraged by the system. */ - static bool is_initialized = false; - static bool is_threadripper2 = false; - if (is_initialized) { -return is_threadripper2; - } - is_initialized = true; - char *cpu_brand = BLI_cpu_brand_string(); - if (cpu_brand == nullptr) { -return false; - } - if (strstr(cpu_brand, "Threadripper")) { -/* NOTE: We consider all Thread-rippers having similar topology to - * the second one. This is because we are trying to utilize NUMA node - * 0 as much as possible. This node does exist on earlier versions of - * thread-ripper and setting affinity to it should not have negative - * effect. - * This allows us to avoid per-model check, making the code more - * reliable for the CPUs which are not yet released. - */ -if (strstr(cpu_brand, "2990WX") || strstr(cpu_brand, "2950X")) { - is_threadripper2 = true; -} - } - /* NOTE: While all dies of EPYC has memory controller, only two f them - * has access to a lower-indexed DDR slots. Those dies are same as on - * Threadripper2 with the memory controller. - * Now, it is rather likely that reasonable amount of users don't max - * up th
[Bf-blender-cvs] [ed52de948cc] master: LibOverride: Add tag to libraries that had to be recursively resynced.
Commit: ed52de948ccddf297e010dbf79dfadfcd164dae9 Author: Bastien Montagne Date: Fri Jan 7 12:07:37 2022 +0100 Branches: master https://developer.blender.org/rBed52de948ccddf297e010dbf79dfadfcd164dae9 LibOverride: Add tag to libraries that had to be recursively resynced. Request from studio, to help identify quickly libs that need update. NOTE: Currently only outputing INFO log in console, display of this info in the outliner will come in a separate commit. === M source/blender/blenkernel/intern/lib_override.c M source/blender/makesdna/DNA_ID.h M source/blender/makesrna/intern/rna_access_compare_override.c === diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 011b7a4924d..6fe57a0257c 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -1733,6 +1733,10 @@ static void lib_override_library_main_resync_on_library_indirect_level( continue; } +if (ID_IS_LINKED(id)) { + id->lib->tag |= LIBRARY_TAG_RESYNC_REQUIRED; +} + /* We cannot resync a scene that is currently active. */ if (id == &scene->id) { id->tag &= ~LIB_TAG_LIB_OVERRIDE_NEED_RESYNC; @@ -1889,6 +1893,16 @@ void BKE_lib_override_library_main_resync(Main *bmain, if (BKE_collection_is_empty(override_resync_residual_storage)) { BKE_collection_delete(bmain, override_resync_residual_storage, true); } + + LISTBASE_FOREACH (Library *, library, &bmain->libraries) { +if (library->tag & LIBRARY_TAG_RESYNC_REQUIRED) { + CLOG_INFO(&LOG, +2, +"library '%s' contains some linked overrides that required recursive resync, " +"consider updating it", +library->filepath); +} + } } void BKE_lib_override_library_delete(Main *bmain, ID *id_root) diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 9fdf7be04e2..a70befc155b 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -445,12 +445,21 @@ typedef struct Library { struct PackedFile *packedfile; + ushort tag; + char _pad_0[6]; + /* Temp data needed by read/write code, and liboverride recursive resync. */ int temp_index; /** See BLENDER_FILE_VERSION, BLENDER_FILE_SUBVERSION, needed for do_versions. */ short versionfile, subversionfile; } Library; +/* Library.tag */ +enum eLibrary_Tag { + /* Automatic recursive resync was needed when linking/loading data from that library. */ + LIBRARY_TAG_RESYNC_REQUIRED = 1 << 0, +}; + /** * A weak library/ID reference for local data that has been appended, to allow re-using that local * data instead of creating a new copy of it in future appends. diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c index e59938d7ea3..950eccdb552 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.c +++ b/source/blender/makesrna/intern/rna_access_compare_override.c @@ -1127,6 +1127,9 @@ static void rna_property_override_check_resync(Main *bmain, * self-references updated to itself, instead of still pointing to its linked source. */ (id_dst->lib == id_src->lib && id_dst != id_owner_dst))) { id_owner_dst->tag |= LIB_TAG_LIB_OVERRIDE_NEED_RESYNC; +if (ID_IS_LINKED(id_owner_src)) { + id_owner_src->lib->tag |= LIBRARY_TAG_RESYNC_REQUIRED; +} CLOG_INFO(&LOG, 3, "Local override %s detected as needing resync", id_owner_dst->name); } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a5a947190ae] tmp-gpu-shader-descriptor-2: Migrated shaders.
Commit: a5a947190aeef9e7c668aef21d27687ee2f99f61 Author: Jeroen Bakker Date: Fri Jan 7 12:05:59 2022 +0100 Branches: tmp-gpu-shader-descriptor-2 https://developer.blender.org/rBa5a947190aeef9e7c668aef21d27687ee2f99f61 Migrated shaders. === M source/blender/gpu/CMakeLists.txt M source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl M source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl M source/blender/gpu/shaders/gpu_shader_2D_smooth_color_vert.glsl M source/blender/gpu/shaders/gpu_shader_diag_stripes_frag.glsl M source/blender/gpu/shaders/gpu_shader_image_color_frag.glsl M source/blender/gpu/shaders/gpu_shader_image_desaturate_frag.glsl M source/blender/gpu/shaders/gpu_shader_image_frag.glsl M source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl M source/blender/gpu/shaders/gpu_shader_image_overlays_stereo_merge_frag.glsl M source/blender/gpu/shaders/gpu_shader_image_shuffle_color_frag.glsl M source/blender/gpu/shaders/gpu_shader_uniform_color_frag.glsl A source/blender/gpu/shaders/infos/gpu_interface_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_diag_stripes_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_flat_color_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_image_color_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_image_desaturate_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_image_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_smooth_color_info.hh A source/blender/gpu/shaders/infos/gpu_shader_2D_uniform_color_info.hh M source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh M source/blender/gpu/shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh === diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 1b535408226..fe631e30d35 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -418,10 +418,20 @@ set(SHADER_CREATE_INFOS shaders/infos/gpu_clip_planes_info.hh shaders/infos/gpu_srgb_to_framebuffer_space_info.hh -#shaders/infos/gpu_shader_3D_flat_color_info.hh +#shaders/infos/gpu_shader_3D_flat_color_info.hh !Disabled due to failing compilation. shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh +#shaders/infos/gpu_shader_simple_lighting_info.hh !TODO shaders/infos/gpu_shader_2D_checker_info.hh -#shaders/infos/gpu_shader_simple_lighting_info.hh +shaders/infos/gpu_shader_2D_diag_stripes_info.hh +shaders/infos/gpu_shader_2D_uniform_color_info.hh +shaders/infos/gpu_shader_2D_flat_color_info.hh +shaders/infos/gpu_shader_2D_smooth_color_info.hh +shaders/infos/gpu_shader_2D_image_overlays_merge_info.hh +shaders/infos/gpu_shader_2D_image_overlays_stereo_merge_info.hh +shaders/infos/gpu_shader_2D_image_info.hh +shaders/infos/gpu_shader_2D_image_color_info.hh +shaders/infos/gpu_shader_2D_image_desaturate_info.hh +shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh shaders/infos/gpu_shader_text_info.hh shaders/infos/gpu_shader_keyframe_shape_info.hh ) diff --git a/source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl index df2507c0dc9..494ef8d888e 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_flat_color_vert.glsl @@ -1,10 +1,11 @@ - +#ifndef USE_GPU_SHADER_CREATE_INFO uniform mat4 ModelViewProjectionMatrix; in vec2 pos; in vec4 color; flat out vec4 finalColor; +#endif void main() { diff --git a/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl index cdb066c9c52..0b5e3759dfb 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_image_vert.glsl @@ -1,10 +1,11 @@ - +#ifndef USE_GPU_SHADER_CREATE_INFO uniform mat4 ModelViewProjectionMatrix; /* Keep in sync with intern/opencolorio/gpu_shader_display_transform_vertex.glsl */ in vec2 texCoord; in vec2 pos; out vec2 texCoord_interp; +#endif void main() { diff --git a/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl index 1333c00682c..4d887a37807 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_smooth_color_frag.glsl @@ -1,6 +1,7 @@ -
[Bf-blender-cvs] [2ff9688677d] tmp-gpu-shader-descriptor-2: Migrated GPU_SHADER_KEYFRAME_SHAPE.
Commit: 2ff9688677dd5c5c153220bd8e91bda5f5f4d9bd Author: Jeroen Bakker Date: Fri Jan 7 09:30:50 2022 +0100 Branches: tmp-gpu-shader-descriptor-2 https://developer.blender.org/rB2ff9688677dd5c5c153220bd8e91bda5f5f4d9bd Migrated GPU_SHADER_KEYFRAME_SHAPE. === M source/blender/gpu/CMakeLists.txt M source/blender/gpu/shaders/gpu_shader_keyframe_shape_frag.glsl M source/blender/gpu/shaders/gpu_shader_keyframe_shape_vert.glsl A source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh === diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 8c54ee3f04f..92045abda93 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -410,14 +410,18 @@ list(APPEND SRC ${glsl_source_list_file}) list(APPEND INC ${CMAKE_CURRENT_BINARY_DIR}) set(SHADER_CREATE_INFOS -../draw/engines/workbench/shaders/workbench_effect_cavity_info.hh -../draw/engines/workbench/shaders/workbench_prepass_info.hh +#../draw/engines/workbench/shaders/workbench_effect_cavity_info.hh +#../draw/engines/workbench/shaders/workbench_prepass_info.hh ../draw/intern/shaders/draw_fullscreen_info.hh ../draw/intern/shaders/draw_view_info.hh ../draw/intern/shaders/draw_object_infos_info.hh -shaders/infos/gpu_shader_3D_flat_color_info.hh -shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh + shaders/infos/gpu_clip_planes_info.hh +shaders/infos/gpu_srgb_to_framebuffer_space_info.hh +#shaders/infos/gpu_shader_3D_flat_color_info.hh +shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh +shaders/infos/gpu_shader_text_info.hh +shaders/infos/gpu_shader_keyframe_shape_info.hh ) set(SHADER_CREATE_INFOS_CONTENT "") diff --git a/source/blender/gpu/shaders/gpu_shader_keyframe_shape_frag.glsl b/source/blender/gpu/shaders/gpu_shader_keyframe_shape_frag.glsl index a3b61dca8b4..2a2eaab7340 100644 --- a/source/blender/gpu/shaders/gpu_shader_keyframe_shape_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_keyframe_shape_frag.glsl @@ -11,6 +11,7 @@ #define GPU_KEYFRAME_SHAPE_SQUARE \ (GPU_KEYFRAME_SHAPE_CLIPPED_VERTICAL | GPU_KEYFRAME_SHAPE_CLIPPED_HORIZONTAL) +#ifndef USE_GPU_SHADER_CREATE_INFO flat in vec4 radii; flat in vec4 thresholds; @@ -20,6 +21,7 @@ flat in vec4 finalOutlineColor; flat in int finalFlags; out vec4 fragColor; +#endif const float diagonal_scale = sqrt(0.5); diff --git a/source/blender/gpu/shaders/gpu_shader_keyframe_shape_vert.glsl b/source/blender/gpu/shaders/gpu_shader_keyframe_shape_vert.glsl index 18e8b76ba23..4ef3ff1a8d0 100644 --- a/source/blender/gpu/shaders/gpu_shader_keyframe_shape_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_keyframe_shape_vert.glsl @@ -11,15 +11,16 @@ #define GPU_KEYFRAME_SHAPE_SQUARE \ (GPU_KEYFRAME_SHAPE_CLIPPED_VERTICAL | GPU_KEYFRAME_SHAPE_CLIPPED_HORIZONTAL) -uniform mat4 ModelViewProjectionMatrix; -uniform vec2 ViewportSize = vec2(-1, -1); -uniform float outline_scale = 1.0; - const float line_falloff = 1.0; const float circle_scale = sqrt(2.0 / 3.1416); const float square_scale = sqrt(0.5); const float diagonal_scale = sqrt(0.5); +#ifndef USE_GPU_SHADER_CREATE_INFO +uniform mat4 ModelViewProjectionMatrix; +uniform vec2 ViewportSize = vec2(-1, -1); +uniform float outline_scale = 1.0; + in vec2 pos; in float size; in vec4 color; @@ -33,6 +34,7 @@ flat out int finalFlags; flat out vec4 radii; flat out vec4 thresholds; +#endif bool test(int bit) { diff --git a/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh new file mode 100644 index 000..7b4d3ec9e10 --- /dev/null +++ b/source/blender/gpu/shaders/infos/gpu_shader_keyframe_shape_info.hh @@ -0,0 +1,23 @@ +#include "gpu_shader_create_info.hh" + +GPU_SHADER_INTERFACE_INFO(keyframe_shape_iface, "") +.flat(Type::VEC4, "finalColor") +.flat(Type::VEC4, "finalOutlineColor") +.flat(Type::VEC4, "radii") +.flat(Type::VEC4, "thresholds") +.flat(Type::INT, "finalFlags"); + +GPU_SHADER_CREATE_INFO(gpu_shader_keyframe_shape) +.vertex_in(0, Type::VEC4, "color") +.vertex_in(1, Type::VEC4, "outlineColor") +.vertex_in(2, Type::VEC2, "pos") +.vertex_in(3, Type::FLOAT, "size") +.vertex_in(4, Type ::INT, "flags") +.vertex_out(keyframe_shape_iface) +.fragment_out(0, Type::VEC4, "fragColor") +.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix") +.push_constant(16, Type::VEC2, "ViewportSize") +.push_constant(24, Type::FLOAT, "outline_scale") +.vertex_source("gpu_shader_keyframe_shape_vert.glsl") +.fragment_source("gpu_shader_keyframe_shape_frag.glsl") +.do_static_compilation(true); \ No newline at end of file ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, su
[Bf-blender-cvs] [c9589296171] tmp-gpu-shader-descriptor-2: Migrate GPU_SHADER_2D_CHECKER.
Commit: c958929617170dcb19775420734afd9c51957112 Author: Jeroen Bakker Date: Fri Jan 7 11:00:32 2022 +0100 Branches: tmp-gpu-shader-descriptor-2 https://developer.blender.org/rBc958929617170dcb19775420734afd9c51957112 Migrate GPU_SHADER_2D_CHECKER. === M source/blender/gpu/CMakeLists.txt M source/blender/gpu/shaders/gpu_shader_2D_vert.glsl M source/blender/gpu/shaders/gpu_shader_checker_frag.glsl A source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh === diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 92045abda93..1b535408226 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -420,6 +420,8 @@ shaders/infos/gpu_clip_planes_info.hh shaders/infos/gpu_srgb_to_framebuffer_space_info.hh #shaders/infos/gpu_shader_3D_flat_color_info.hh shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh +shaders/infos/gpu_shader_2D_checker_info.hh +#shaders/infos/gpu_shader_simple_lighting_info.hh shaders/infos/gpu_shader_text_info.hh shaders/infos/gpu_shader_keyframe_shape_info.hh ) diff --git a/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl index de6547715f3..698f20ae1f9 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_vert.glsl @@ -1,11 +1,13 @@ +#ifndef USE_GPU_SHADER_CREATE_INFO uniform mat4 ModelViewProjectionMatrix; -#ifdef UV_POS +# ifdef UV_POS in vec2 u; -# define pos u -#else +#define pos u +# else in vec2 pos; +# endif #endif void main() diff --git a/source/blender/gpu/shaders/gpu_shader_checker_frag.glsl b/source/blender/gpu/shaders/gpu_shader_checker_frag.glsl index 156b6cb75ab..9065da0275a 100644 --- a/source/blender/gpu/shaders/gpu_shader_checker_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_checker_frag.glsl @@ -1,9 +1,10 @@ - +#ifndef USE_GPU_SHADER_CREATE_INFO uniform vec4 color1; uniform vec4 color2; uniform int size; out vec4 fragColor; +#endif void main() { diff --git a/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh new file mode 100644 index 000..044ef7283ac --- /dev/null +++ b/source/blender/gpu/shaders/infos/gpu_shader_2D_checker_info.hh @@ -0,0 +1,13 @@ + +#include "gpu_shader_create_info.hh" + +GPU_SHADER_CREATE_INFO(gpu_shader_2D_checker) +.vertex_in(0, Type::VEC2, "pos") +.fragment_out(0, Type::VEC4, "fragColor") +.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix") +.push_constant(16, Type::VEC4, "color1") +.push_constant(20, Type::VEC4, "color2") +.push_constant(24, Type::INT, "size") +.vertex_source("gpu_shader_2D_vert.glsl") +.fragment_source("gpu_shader_checker_frag.glsl") +.do_static_compilation(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] [aa2ef3db7ab] tmp-gpu-shader-descriptor-2: Fix compilation issues GPU_SHADER_3D_FLAT_COLOR.
Commit: aa2ef3db7abbe3e0c4a706fdfe4dbdad490a3c05 Author: Jeroen Bakker Date: Fri Jan 7 09:30:05 2022 +0100 Branches: tmp-gpu-shader-descriptor-2 https://developer.blender.org/rBaa2ef3db7abbe3e0c4a706fdfe4dbdad490a3c05 Fix compilation issues GPU_SHADER_3D_FLAT_COLOR. === M source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl M source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl M source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh === diff --git a/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl index 5b6a890ccc8..192d26fe436 100644 --- a/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_3D_flat_color_vert.glsl @@ -1,17 +1,18 @@ - +#ifndef USE_GPU_SHADER_CREATE_INFO uniform mat4 ModelViewProjectionMatrix; -#ifdef USE_WORLD_CLIP_PLANES +# ifdef USE_WORLD_CLIP_PLANES uniform mat4 ModelMatrix; -#endif +# endif in vec3 pos; -#if defined(USE_COLOR_U32) +# if defined(USE_COLOR_U32) in uint color; -#else +# else in vec4 color; -#endif +# endif flat out vec4 finalColor; +#endif void main() { diff --git a/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl index 99d8b6ab685..1675de3d567 100644 --- a/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_flat_color_frag.glsl @@ -1,6 +1,7 @@ - +#ifndef USE_GPU_SHADER_CREATE_INFO flat in vec4 finalColor; out vec4 fragColor; +#endif void main() { diff --git a/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh index c22e89227ac..a16e9f215a5 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_3D_flat_color_info.hh @@ -5,12 +5,14 @@ GPU_SHADER_INTERFACE_INFO(flat_color_iface, "").flat(Type::VEC4, "finalColor"); GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color) .vertex_in(0, Type::VEC3, "pos") -.vertex_in(1, Type::VEC4, "col") +.vertex_in(1, Type::VEC4, "color") .vertex_out(flat_color_iface) .fragment_out(0, Type::VEC4, "fragColor") +.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix") .push_constant(1, Type::BOOL, "srgbTarget") .vertex_source("gpu_shader_3D_flat_color_vert.glsl") .fragment_source("gpu_shader_flat_color_frag.glsl") +.additional_info("gpu_srgb_to_framebuffer_space") .do_static_compilation(true); GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color_clipped) ___ 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] [2cc6b249c38] master: Cycles: Remove usage of libnumaapi
Commit: 2cc6b249c382981cee15d69db8440e2ba3dd6453 Author: Sergey Sharybin Date: Fri Jan 7 11:46:31 2022 +0100 Branches: master https://developer.blender.org/rB2cc6b249c382981cee15d69db8440e2ba3dd6453 Cycles: Remove usage of libnumaapi No need for it now since all the threading queries and scheduling is done via TBB. Should be no functional changes as all the removed code is supposed to be unused. === M intern/cycles/cmake/macros.cmake M intern/cycles/util/CMakeLists.txt M intern/cycles/util/system.cpp M intern/cycles/util/system.h M intern/cycles/util/thread.cpp M intern/cycles/util/thread.h === diff --git a/intern/cycles/cmake/macros.cmake b/intern/cycles/cmake/macros.cmake index 957b702fd3a..044058a25a8 100644 --- a/intern/cycles/cmake/macros.cmake +++ b/intern/cycles/cmake/macros.cmake @@ -168,12 +168,6 @@ macro(cycles_target_link_libraries target) target_link_libraries(${target} extern_hipew) endif() - if(CYCLES_STANDALONE_REPOSITORY) -target_link_libraries(${target} extern_numaapi) - else() -target_link_libraries(${target} bf_intern_numaapi) - endif() - if(UNIX AND NOT APPLE) if(CYCLES_STANDALONE_REPOSITORY) target_link_libraries(${target} extern_libc_compat) diff --git a/intern/cycles/util/CMakeLists.txt b/intern/cycles/util/CMakeLists.txt index b68646a44d5..a26934c0ace 100644 --- a/intern/cycles/util/CMakeLists.txt +++ b/intern/cycles/util/CMakeLists.txt @@ -53,16 +53,6 @@ if(WITH_CYCLES_STANDALONE) endif() endif() -if(CYCLES_STANDALONE_REPOSITORY) - list(APPEND INC_SYS -../../third_party/numaapi/include - ) -else() - list(APPEND INC_SYS -../../numaapi/include - ) -endif() - set(SRC_HEADERS algorithm.h aligned_malloc.h diff --git a/intern/cycles/util/system.cpp b/intern/cycles/util/system.cpp index f12e15e756f..61ad552fa89 100644 --- a/intern/cycles/util/system.cpp +++ b/intern/cycles/util/system.cpp @@ -20,9 +20,8 @@ #include "util/string.h" #include "util/types.h" -#include - #include + OIIO_NAMESPACE_USING #ifdef _WIN32 @@ -41,83 +40,6 @@ OIIO_NAMESPACE_USING CCL_NAMESPACE_BEGIN -bool system_cpu_ensure_initialized() -{ - static bool is_initialized = false; - static bool result = false; - if (is_initialized) { -return result; - } - is_initialized = true; - const NUMAAPI_Result numa_result = numaAPI_Initialize(); - result = (numa_result == NUMAAPI_SUCCESS); - return result; -} - -/* Fallback solution, which doesn't use NUMA/CPU groups. */ -static int system_cpu_thread_count_fallback() -{ -#ifdef _WIN32 - SYSTEM_INFO info; - GetSystemInfo(&info); - return info.dwNumberOfProcessors; -#elif defined(__APPLE__) - int count; - size_t len = sizeof(count); - int mib[2] = {CTL_HW, HW_NCPU}; - sysctl(mib, 2, &count, &len, NULL, 0); - return count; -#else - return sysconf(_SC_NPROCESSORS_ONLN); -#endif -} - -int system_cpu_thread_count() -{ - const int num_nodes = system_cpu_num_numa_nodes(); - int num_threads = 0; - for (int node = 0; node < num_nodes; ++node) { -if (!system_cpu_is_numa_node_available(node)) { - continue; -} -num_threads += system_cpu_num_numa_node_processors(node); - } - return num_threads; -} - -int system_cpu_num_numa_nodes() -{ - if (!system_cpu_ensure_initialized()) { -/* Fallback to a single node with all the threads. */ -return 1; - } - return numaAPI_GetNumNodes(); -} - -bool system_cpu_is_numa_node_available(int node) -{ - if (!system_cpu_ensure_initialized()) { -return true; - } - return numaAPI_IsNodeAvailable(node); -} - -int system_cpu_num_numa_node_processors(int node) -{ - if (!system_cpu_ensure_initialized()) { -return system_cpu_thread_count_fallback(); - } - return numaAPI_GetNumNodeProcessors(node); -} - -bool system_cpu_run_thread_on_node(int node) -{ - if (!system_cpu_ensure_initialized()) { -return true; - } - return numaAPI_RunThreadOnNode(node); -} - int system_console_width() { int columns = 0; @@ -137,14 +59,6 @@ int system_console_width() return (columns > 0) ? columns : 80; } -int system_cpu_num_active_group_processors() -{ - if (!system_cpu_ensure_initialized()) { -return system_cpu_thread_count_fallback(); - } - return numaAPI_GetNumCurrentNodesProcessors(); -} - /* Equivalent of Windows __cpuid for x86 processors on other platforms. */ #if (!defined(_WIN32) || defined(FREE_WINDOWS)) && (defined(__x86_64__) || defined(__i386__)) static void __cpuid(int data[4], int selector) diff --git a/intern/cycles/util/system.h b/intern/cycles/util/system.h index 425c7255cbe..d26c324be0a 100644 --- a/intern/cycles/util/system.h +++ b/intern/cycles/util/system.h @@ -22,36 +22,9 @@ CCL_NAMESPACE_BEGIN -/* Make sure CPU groups / NUMA API is initialized. */ -bool system_cpu_ensure_initialized(); - -/* Get total number of threads in a
[Bf-blender-cvs] [361702f2395] master: Fix T94310: Blender doesn't support with 128 threads well in Win11
Commit: 361702f239528803260ba966d4174b8601e90a53 Author: Jagannadhan Ravi Date: Fri Jan 7 11:31:02 2022 +0100 Branches: master https://developer.blender.org/rB361702f239528803260ba966d4174b8601e90a53 Fix T94310: Blender doesn't support with 128 threads well in Win11 Query TBB for the maximum allowed concurrency, which is free from a bug in own concurrency detection code. One thing to keep in mind is that now Cycles is limited by the number of threads in the TBB areana from which Session is created. This isn't a problem for Blender since we do not limit arena on Blender side. Could be something to watch out for in other Cycles integrations. Differential Revision: https://developer.blender.org/D13658 === M intern/cycles/device/device.cpp M intern/cycles/util/task.cpp === diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index 2b067d57158..d3de6c54a17 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -37,6 +37,7 @@ #include "util/math.h" #include "util/string.h" #include "util/system.h" +#include "util/task.h" #include "util/time.h" #include "util/types.h" #include "util/vector.h" @@ -333,7 +334,7 @@ DeviceInfo Device::get_multi_device(const vector &subdevices, /* Ensure CPU device does not slow down GPU. */ if (device.type == DEVICE_CPU && subdevices.size() > 1) { if (background) { -int orig_cpu_threads = (threads) ? threads : system_cpu_thread_count(); +int orig_cpu_threads = (threads) ? threads : TaskScheduler::num_threads(); int cpu_threads = max(orig_cpu_threads - (subdevices.size() - 1), 0); VLOG(1) << "CPU render threads reduced from " << orig_cpu_threads << " to " << cpu_threads diff --git a/intern/cycles/util/task.cpp b/intern/cycles/util/task.cpp index ce61bf8d6c4..eeccbaf1c44 100644 --- a/intern/cycles/util/task.cpp +++ b/intern/cycles/util/task.cpp @@ -89,7 +89,7 @@ void TaskScheduler::init(int num_threads) active_num_threads = num_threads; } else { -active_num_threads = system_cpu_thread_count(); +active_num_threads = tbb::this_task_arena::max_concurrency(); } } ___ 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] [bef2412ca25] master: Fix T86952: Buffer overflow reading specific DDS images
Commit: bef2412ca253a9d3d63fc713e03997104d350f50 Author: Sergey Sharybin Date: Thu Jan 6 16:08:40 2022 +0100 Branches: master https://developer.blender.org/rBbef2412ca253a9d3d63fc713e03997104d350f50 Fix T86952: Buffer overflow reading specific DDS images Add a data boundary check in the flipping code. This code now also communicates the number of mipmap levels it processed with an intent to avoid GPU texture from using more levels than there are in the DDS data. Differential Revision: https://developer.blender.org/D13755 === M source/blender/imbuf/intern/dds/FlipDXT.cpp M source/blender/imbuf/intern/dds/FlipDXT.h M source/blender/imbuf/intern/dds/dds_api.cpp === diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp index 359d6f30cdc..6686d56e9d1 100644 --- a/source/blender/imbuf/intern/dds/FlipDXT.cpp +++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp @@ -168,9 +168,16 @@ static void FlipDXT5BlockHalf(uint8_t *block) FlipDXT1BlockHalf(block + 8); } -int FlipDXTCImage( -unsigned int width, unsigned int height, unsigned int levels, int fourcc, uint8_t *data) +int FlipDXTCImage(unsigned int width, + unsigned int height, + unsigned int levels, + int fourcc, + uint8_t *data, + int data_size, + unsigned int *r_num_valid_levels) { + *r_num_valid_levels = 0; + /* Must have valid dimensions. */ if (width == 0 || height == 0) { return 0; @@ -204,14 +211,25 @@ int FlipDXTCImage( return 0; } + *r_num_valid_levels = levels; + unsigned int mip_width = width; unsigned int mip_height = height; + const uint8_t *data_end = data + data_size; + for (unsigned int i = 0; i < levels; i++) { unsigned int blocks_per_row = (mip_width + 3) / 4; unsigned int blocks_per_col = (mip_height + 3) / 4; unsigned int blocks = blocks_per_row * blocks_per_col; +if (data + block_bytes * blocks > data_end) { + /* Stop flipping when running out of data to be modified, avoiding possible buffer overrun + * on a malformed files. */ + *r_num_valid_levels = i; + break; +} + if (mip_height == 1) { /* no flip to do, and we're done. */ break; diff --git a/source/blender/imbuf/intern/dds/FlipDXT.h b/source/blender/imbuf/intern/dds/FlipDXT.h index b4f71e4eca7..f9d3ce6112e 100644 --- a/source/blender/imbuf/intern/dds/FlipDXT.h +++ b/source/blender/imbuf/intern/dds/FlipDXT.h @@ -23,5 +23,10 @@ * * Use to flip vertically to fit OpenGL convention. */ -int FlipDXTCImage( -unsigned int width, unsigned int height, unsigned int levels, int fourcc, uint8_t *data); +int FlipDXTCImage(unsigned int width, + unsigned int height, + unsigned int levels, + int fourcc, + uint8_t *data, + int data_size, + unsigned int *r_num_valid_levels); diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 1729a9a64f8..f576209ff62 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -186,8 +186,13 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, /* flip compressed texture */ if (ibuf->dds_data.data) { -FlipDXTCImage( -dds.width(), dds.height(), dds.mipmapCount(), dds.fourCC(), ibuf->dds_data.data); +FlipDXTCImage(dds.width(), + dds.height(), + ibuf->dds_data.nummipmaps, + dds.fourCC(), + ibuf->dds_data.data, + ibuf->dds_data.size, + &ibuf->dds_data.nummipmaps); } } 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