diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-01-25 11:34:35 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-01-25 11:34:35 +0300 |
commit | 699dac822a330f5cfc5225989c03196ce48a080d (patch) | |
tree | e73cc2710a5338d1fd44b7b386960d72aa9f6e5f | |
parent | 43a4948e6d08fb1c03197d261cddc2dcff0ba0f0 (diff) | |
parent | 1b1693d43f125e8b542bc298dcc6e5360c2a4d11 (diff) |
Merge branch 'master' into temp-T94185-id-remapper-ui
87 files changed, 546 insertions, 383 deletions
diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake index cc811cef06f..7abde5e5fc3 100644 --- a/build_files/build_environment/cmake/versions.cmake +++ b/build_files/build_environment/cmake/versions.cmake @@ -506,4 +506,3 @@ set(BROTLI_URI https://github.com/google/brotli/archive/refs/tags/${BROTLI_VERSI set(BROTLI_HASH f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46) set(BROTLI_HASH_TYPE SHA256) set(BROTLI_FILE brotli-${BROTLI_VERSION}.tar.gz) - diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index b6da737af71..5aace62211c 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -100,7 +100,13 @@ find_package_wrapper(JPEG REQUIRED) find_package_wrapper(PNG REQUIRED) find_package_wrapper(ZLIB REQUIRED) find_package_wrapper(Zstd REQUIRED) + +# FreeType compiled with Brotli compression for woff2. find_package_wrapper(Freetype REQUIRED) +list(APPEND FREETYPE_LIBRARIES + ${LIBDIR}/brotli/lib/libbrotlidec-static.a + ${LIBDIR}/brotli/lib/libbrotlicommon-static.a +) if(WITH_PYTHON) # No way to set py35, remove for now. diff --git a/intern/cycles/blender/output_driver.cpp b/intern/cycles/blender/output_driver.cpp index d5cc0c60bae..f35b48493cb 100644 --- a/intern/cycles/blender/output_driver.cpp +++ b/intern/cycles/blender/output_driver.cpp @@ -51,8 +51,6 @@ bool BlenderOutputDriver::read_render_tile(const Tile &tile) BL::RenderLayer b_rlay = *b_single_rlay; - vector<float> pixels(static_cast<size_t>(tile.size.x) * tile.size.y * 4); - /* Copy each pass. * TODO:copy only the required ones for better performance? */ for (BL::RenderPass &b_pass : b_rlay.passes) { diff --git a/intern/cycles/integrator/path_trace.cpp b/intern/cycles/integrator/path_trace.cpp index 0b55d1078a8..fd697836f52 100644 --- a/intern/cycles/integrator/path_trace.cpp +++ b/intern/cycles/integrator/path_trace.cpp @@ -820,8 +820,15 @@ void PathTrace::tile_buffer_read() return; } + /* Read buffers back from device. */ + tbb::parallel_for_each(path_trace_works_, [&](unique_ptr<PathTraceWork> &path_trace_work) { + path_trace_work->copy_render_buffers_from_device(); + }); + + /* Read (subset of) passes from output driver. */ PathTraceTile tile(*this); if (output_driver_->read_render_tile(tile)) { + /* Copy buffers to device again. */ tbb::parallel_for_each(path_trace_works_, [](unique_ptr<PathTraceWork> &path_trace_work) { path_trace_work->copy_render_buffers_to_device(); }); diff --git a/intern/cycles/kernel/geom/point.h b/intern/cycles/kernel/geom/point.h index 52a1e77d71a..23764d49095 100644 --- a/intern/cycles/kernel/geom/point.h +++ b/intern/cycles/kernel/geom/point.h @@ -81,7 +81,7 @@ ccl_device float3 point_attribute_float3(KernelGlobals kg, # endif if (desc.element == ATTR_ELEMENT_VERTEX) { - return float4_to_float3(kernel_tex_fetch(__attributes_float4, desc.offset + sd->prim)); + return kernel_tex_fetch(__attributes_float3, desc.offset + sd->prim); } else { return make_float3(0.0f, 0.0f, 0.0f); diff --git a/release/scripts/addons b/release/scripts/addons -Subproject 6afec05c3286cdea58ab269fb8dd1f5de011de4 +Subproject 67f1fbca1482d9d9362a4001332e785c3fd5d23 diff --git a/source/blender/blenkernel/BKE_blendfile_link_append.h b/source/blender/blenkernel/BKE_blendfile_link_append.h index e55a2d15dcc..983c93223a1 100644 --- a/source/blender/blenkernel/BKE_blendfile_link_append.h +++ b/source/blender/blenkernel/BKE_blendfile_link_append.h @@ -30,8 +30,8 @@ struct LibraryLink_Params; struct Main; struct ReportList; struct Scene; -struct ViewLayer; struct View3D; +struct ViewLayer; typedef struct BlendfileLinkAppendContext BlendfileLinkAppendContext; typedef struct BlendfileLinkAppendContextItem BlendfileLinkAppendContextItem; diff --git a/source/blender/blenkernel/BKE_curve_to_mesh.hh b/source/blender/blenkernel/BKE_curve_to_mesh.hh index cf5c8b87ede..10649e8703f 100644 --- a/source/blender/blenkernel/BKE_curve_to_mesh.hh +++ b/source/blender/blenkernel/BKE_curve_to_mesh.hh @@ -16,8 +16,8 @@ #pragma once -struct Mesh; struct CurveEval; +struct Mesh; /** \file * \ingroup bke diff --git a/source/blender/blenkernel/BKE_duplilist.h b/source/blender/blenkernel/BKE_duplilist.h index 5eff84b8c9e..303a83d921f 100644 --- a/source/blender/blenkernel/BKE_duplilist.h +++ b/source/blender/blenkernel/BKE_duplilist.h @@ -27,11 +27,11 @@ extern "C" { #endif struct Depsgraph; +struct ID; struct ListBase; struct Object; struct ParticleSystem; struct Scene; -struct ID; /* ---------------------------------------------------- */ /* Dupli-Geometry */ diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h index f83675fbb7e..df50f773a46 100644 --- a/source/blender/blenkernel/BKE_idtype.h +++ b/source/blender/blenkernel/BKE_idtype.h @@ -31,11 +31,11 @@ extern "C" { #endif +struct BPathForeachPathData; struct BlendDataReader; struct BlendExpander; struct BlendLibReader; struct BlendWriter; -struct BPathForeachPathData; struct ID; struct LibraryForeachIDData; struct Main; diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h index 1d905ad85b1..ebd35cad965 100644 --- a/source/blender/blenkernel/BKE_lib_id.h +++ b/source/blender/blenkernel/BKE_lib_id.h @@ -383,6 +383,16 @@ enum { }; /** + * Helper to decide whether given `id` can be directly made local, or needs to be copied. + * `r_force_local` and `r_force_copy` cannot be true together. But both can be false, in case no + * action should be performed. + * + * \note low-level helper to de-duplicate logic between `BKE_lib_id_make_local_generic` and the + * specific corner-cases implementations needed for objects and brushes. + */ +void BKE_lib_id_make_local_generic_action_define( + struct Main *bmain, struct ID *id, int flags, bool *r_force_local, bool *r_force_copy); +/** * Generic 'make local' function, works for most of data-block types. */ void BKE_lib_id_make_local_generic(struct Main *bmain, struct ID *id, int flags); diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 2f9034f6438..cd6d58f563a 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1179,30 +1179,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, i #define SH_NODE_VECTOR_ROTATE 708 #define SH_NODE_CURVE_FLOAT 709 -/* API */ - -struct bNodeTreeExec *ntreeShaderBeginExecTree(struct bNodeTree *ntree); -void ntreeShaderEndExecTree(struct bNodeTreeExec *exec); -/** - Find an output node of the shader tree. - * - * \note it will only return output which is NOT in the group, which isn't how - * render engines works but it's how the GPU shader compilation works. This we - * can change in the future and make it a generic function, but for now it stays - * private here. - */ -struct bNode *ntreeShaderOutputNode(struct bNodeTree *ntree, int target); -/** - * This one needs to work on a local tree. - * - * TODO: This is *not* part of `blenkernel`, it's defined under "source/blender/nodes/". - * This declaration should be moved out of BKE. - */ -void ntreeGPUMaterialNodes(struct bNodeTree *localtree, - struct GPUMaterial *mat, - bool *has_surface_output, - bool *has_volume_output); - /** \} */ /* -------------------------------------------------------------------- */ @@ -1352,75 +1328,6 @@ void ntreeGPUMaterialNodes(struct bNodeTree *localtree, #define CMP_DEFAULT_SMAA_CONTRAST_LIMIT 0.2f #define CMP_DEFAULT_SMAA_CORNER_ROUNDING 0.25f -/* API */ -void ntreeCompositExecTree(struct Scene *scene, - struct bNodeTree *ntree, - struct RenderData *rd, - int rendering, - int do_previews, - const struct ColorManagedViewSettings *view_settings, - const struct ColorManagedDisplaySettings *display_settings, - const char *view_name); - -/** - * Called from render pipeline, to tag render input and output. - * need to do all scenes, to prevent errors when you re-render 1 scene. - */ -void ntreeCompositTagRender(struct Scene *scene); -/** - * Update the outputs of the render layer nodes. - * Since the outputs depend on the render engine, this part is a bit complex: - * - #ntreeCompositUpdateRLayers is called and loops over all render layer nodes. - * - Each render layer node calls the update function of the - * render engine that's used for its scene. - * - The render engine calls RE_engine_register_pass for each pass. - * - #RE_engine_register_pass calls #node_cmp_rlayers_register_pass. - * - * TODO: This is *not* part of `blenkernel`, it's defined under "source/blender/nodes/". - * This declaration should be moved out of BKE. - */ -void ntreeCompositUpdateRLayers(struct bNodeTree *ntree); -void ntreeCompositClearTags(struct bNodeTree *ntree); - -struct bNodeSocket *ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree, - struct bNode *node, - const char *name, - struct ImageFormatData *im_format); -int ntreeCompositOutputFileRemoveActiveSocket(struct bNodeTree *ntree, struct bNode *node); -void ntreeCompositOutputFileSetPath(struct bNode *node, - struct bNodeSocket *sock, - const char *name); -void ntreeCompositOutputFileSetLayer(struct bNode *node, - struct bNodeSocket *sock, - const char *name); -/* needed in do_versions */ -void ntreeCompositOutputFileUniquePath(struct ListBase *list, - struct bNodeSocket *sock, - const char defname[], - char delim); -void ntreeCompositOutputFileUniqueLayer(struct ListBase *list, - struct bNodeSocket *sock, - const char defname[], - char delim); - -void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *ntree, bNode *node); -void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *ntree, bNode *node); - -void ntreeCompositCryptomatteSyncFromAdd(const Scene *scene, bNode *node); -void ntreeCompositCryptomatteSyncFromRemove(bNode *node); -bNodeSocket *ntreeCompositCryptomatteAddSocket(bNodeTree *ntree, bNode *node); -int ntreeCompositCryptomatteRemoveSocket(bNodeTree *ntree, bNode *node); -void ntreeCompositCryptomatteLayerPrefix(const Scene *scene, - const bNode *node, - char *r_prefix, - size_t prefix_len); -/** - * Update the runtime layer names with the crypto-matte layer names of the references render layer - * or image. - */ -void ntreeCompositCryptomatteUpdateLayerNames(const Scene *scene, bNode *node); -struct CryptomatteSession *ntreeCompositCryptomatteSession(const Scene *scene, bNode *node); - /** \} */ /* -------------------------------------------------------------------- */ @@ -1457,24 +1364,6 @@ struct TexResult; #define TEX_NODE_PROC 500 #define TEX_NODE_PROC_MAX 600 -/* API */ -void ntreeTexCheckCyclics(struct bNodeTree *ntree); - -struct bNodeTreeExec *ntreeTexBeginExecTree(struct bNodeTree *ntree); -void ntreeTexEndExecTree(struct bNodeTreeExec *exec); -int ntreeTexExecTree(struct bNodeTree *ntree, - struct TexResult *target, - const float co[3], - float dxt[3], - float dyt[3], - int osatex, - short thread, - const struct Tex *tex, - short which_output, - int cfra, - int preview, - struct MTex *mtex); - /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/blenkernel/BKE_node_tree_update.h b/source/blender/blenkernel/BKE_node_tree_update.h index f77bd83a8ef..443ceafb073 100644 --- a/source/blender/blenkernel/BKE_node_tree_update.h +++ b/source/blender/blenkernel/BKE_node_tree_update.h @@ -20,12 +20,12 @@ * \ingroup bke */ +struct ID; +struct Main; struct bNode; +struct bNodeLink; struct bNodeSocket; struct bNodeTree; -struct bNodeLink; -struct Main; -struct ID; #ifdef __cplusplus extern "C" { diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 89e794cd2fc..4019c4d62c4 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -617,10 +617,6 @@ typedef struct SculptSession { float init_pivot_rot[4]; float init_pivot_scale[3]; - float prev_pivot_pos[3]; - float prev_pivot_rot[4]; - float prev_pivot_scale[3]; - union { struct { struct SculptVertexPaintGeomMap gmap; diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h index 510d6773f6d..ea816812344 100644 --- a/source/blender/blenkernel/BKE_shrinkwrap.h +++ b/source/blender/blenkernel/BKE_shrinkwrap.h @@ -47,8 +47,8 @@ struct MDeformVert; struct Mesh; struct ModifierEvalContext; struct Object; -struct ShrinkwrapModifierData; struct ShrinkwrapGpencilModifierData; +struct ShrinkwrapModifierData; struct SpaceTransform; /* Information about boundary edges in the mesh. */ diff --git a/source/blender/blenkernel/BKE_subdiv_eval.h b/source/blender/blenkernel/BKE_subdiv_eval.h index 2eb64ae795d..23bcdcce276 100644 --- a/source/blender/blenkernel/BKE_subdiv_eval.h +++ b/source/blender/blenkernel/BKE_subdiv_eval.h @@ -30,8 +30,8 @@ extern "C" { #endif struct Mesh; -struct Subdiv; struct OpenSubdiv_EvaluatorCache; +struct Subdiv; typedef enum eSubdivEvaluatorType { SUBDIV_EVALUATOR_TYPE_CPU, diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 153a65d67db..c86d4658cc9 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -149,16 +149,9 @@ static void brush_make_local(Main *bmain, ID *id, const int flags) Brush *brush = (Brush *)id; const bool lib_local = (flags & LIB_ID_MAKELOCAL_FULL_LIBRARY) != 0; - bool force_local = (flags & LIB_ID_MAKELOCAL_FORCE_LOCAL) != 0; - bool force_copy = (flags & LIB_ID_MAKELOCAL_FORCE_COPY) != 0; - BLI_assert(force_copy == false || force_copy != force_local); - bool is_local = false, is_lib = false; - - /* - only lib users: do nothing (unless force_local is set) - * - only local users: set flag - * - mixed: make copy - */ + bool force_local, force_copy; + BKE_lib_id_make_local_generic_action_define(bmain, id, flags, &force_local, &force_copy); if (brush->clone.image) { /* Special case: ima always local immediately. Clone image should only have one user anyway. */ @@ -171,18 +164,6 @@ static void brush_make_local(Main *bmain, ID *id, const int flags) BLI_assert(brush->clone.image->id.lib == NULL && brush->clone.image->id.newid == NULL); } - if (!force_local && !force_copy) { - BKE_library_ID_test_usages(bmain, brush, &is_local, &is_lib); - if (lib_local || is_local) { - if (!is_lib) { - force_local = true; - } - else { - force_copy = true; - } - } - } - if (force_local) { BKE_lib_id_clear_library_data(bmain, &brush->id, flags); BKE_lib_id_expand_local(bmain, &brush->id, flags); diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index 692e27731c5..26b0b72cd63 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -454,38 +454,57 @@ static void lib_id_copy_ensure_local(Main *bmain, const ID *old_id, ID *new_id, } } -void BKE_lib_id_make_local_generic(Main *bmain, ID *id, const int flags) +void BKE_lib_id_make_local_generic_action_define( + struct Main *bmain, struct ID *id, int flags, bool *r_force_local, bool *r_force_copy) { - if (!ID_IS_LINKED(id)) { - return; - } - - const bool lib_local = (flags & LIB_ID_MAKELOCAL_FULL_LIBRARY) != 0; bool force_local = (flags & LIB_ID_MAKELOCAL_FORCE_LOCAL) != 0; bool force_copy = (flags & LIB_ID_MAKELOCAL_FORCE_COPY) != 0; BLI_assert(force_copy == false || force_copy != force_local); + if (force_local || force_copy) { + /* Already set by caller code, nothig to do here. */ + *r_force_local = force_local; + *r_force_copy = force_copy; + return; + } + + const bool lib_local = (flags & LIB_ID_MAKELOCAL_FULL_LIBRARY) != 0; bool is_local = false, is_lib = false; - /* - only lib users: do nothing (unless force_local is set) - * - only local users: set flag + /* - no user (neither lib nor local): make local (happens e.g. with UI-used only data). + * - only lib users: do nothing (unless force_local is set) + * - only local users: make local * - mixed: make copy * In case we make a whole lib's content local, * we always want to localize, and we skip remapping (done later). */ - if (!force_copy && !force_local) { - BKE_library_ID_test_usages(bmain, id, &is_local, &is_lib); - if (lib_local || is_local) { - if (!is_lib) { - force_local = true; - } - else { - force_copy = true; - } + BKE_library_ID_test_usages(bmain, id, &is_local, &is_lib); + if (!lib_local && !is_local && !is_lib) { + force_local = true; + } + else if (lib_local || is_local) { + if (!is_lib) { + force_local = true; + } + else { + force_copy = true; } } + *r_force_local = force_local; + *r_force_copy = force_copy; +} + +void BKE_lib_id_make_local_generic(Main *bmain, ID *id, const int flags) +{ + if (!ID_IS_LINKED(id)) { + return; + } + + bool force_local, force_copy; + BKE_lib_id_make_local_generic_action_define(bmain, id, flags, &force_local, &force_copy); + if (force_local) { BKE_lib_id_clear_library_data(bmain, id, flags); BKE_lib_id_expand_local(bmain, id, flags); @@ -516,6 +535,7 @@ void BKE_lib_id_make_local_generic(Main *bmain, ID *id, const int flags) } } + const bool lib_local = (flags & LIB_ID_MAKELOCAL_FULL_LIBRARY) != 0; if (!lib_local) { BKE_libblock_remap(bmain, id, id_new, ID_REMAP_SKIP_INDIRECT_USAGE); } diff --git a/source/blender/blenkernel/intern/node_tree_update.cc b/source/blender/blenkernel/intern/node_tree_update.cc index be9777281cb..0555707b64c 100644 --- a/source/blender/blenkernel/intern/node_tree_update.cc +++ b/source/blender/blenkernel/intern/node_tree_update.cc @@ -34,6 +34,7 @@ #include "NOD_node_declaration.hh" #include "NOD_node_tree_ref.hh" +#include "NOD_texture.h" #include "DEG_depsgraph_query.h" diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index 5045851d7f9..d510c9b06dc 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -333,30 +333,9 @@ static void object_make_local(Main *bmain, ID *id, const int flags) Object *ob = (Object *)id; const bool lib_local = (flags & LIB_ID_MAKELOCAL_FULL_LIBRARY) != 0; const bool clear_proxy = (flags & LIB_ID_MAKELOCAL_OBJECT_NO_PROXY_CLEARING) == 0; - bool force_local = (flags & LIB_ID_MAKELOCAL_FORCE_LOCAL) != 0; - bool force_copy = (flags & LIB_ID_MAKELOCAL_FORCE_COPY) != 0; - BLI_assert(force_copy == false || force_copy != force_local); - bool is_local = false, is_lib = false; - - /* - only lib users: do nothing (unless force_local is set) - * - only local users: set flag - * - mixed: make copy - * In case we make a whole lib's content local, - * we always want to localize, and we skip remapping (done later). - */ - - if (!force_local && !force_copy) { - BKE_library_ID_test_usages(bmain, ob, &is_local, &is_lib); - if (lib_local || is_local) { - if (!is_lib) { - force_local = true; - } - else { - force_copy = true; - } - } - } + bool force_local, force_copy; + BKE_lib_id_make_local_generic_action_define(bmain, id, flags, &force_local, &force_copy); if (force_local) { BKE_lib_id_clear_library_data(bmain, &ob->id, flags); diff --git a/source/blender/blenkernel/intern/subdiv_modifier.c b/source/blender/blenkernel/intern/subdiv_modifier.c index 65809782f8f..525c4837bc4 100644 --- a/source/blender/blenkernel/intern/subdiv_modifier.c +++ b/source/blender/blenkernel/intern/subdiv_modifier.c @@ -92,7 +92,7 @@ bool BKE_subsurf_modifier_can_do_gpu_subdiv_ex(const Scene *scene, return false; } - if (!GPU_compute_shader_support()) { + if (!(GPU_compute_shader_support() && GPU_shader_storage_buffer_objects_support())) { return false; } diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index ee9247e6e60..37d5d732a70 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -67,6 +67,8 @@ #include "BKE_scene.h" #include "BKE_texture.h" +#include "NOD_texture.h" + #include "RE_texture.h" #include "BLO_read_write.h" diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 90c6760019a..e9446f36c83 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -252,9 +252,9 @@ set(SRC BLI_math_solvers.h BLI_math_statistics.h BLI_math_time.h - BLI_math_vector.h - BLI_math_vec_types.hh BLI_math_vec_mpq_types.hh + BLI_math_vec_types.hh + BLI_math_vector.h BLI_memarena.h BLI_memblock.h BLI_memiter.h diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 8a22fd07c24..c34b8f735e5 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -78,6 +78,7 @@ #include "IMB_imbuf.h" /* for proxy / time-code versioning stuff. */ #include "NOD_common.h" +#include "NOD_composite.h" #include "NOD_texture.h" #include "BLO_readfile.h" diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index f1a2e678b2e..1f18405cdf9 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -42,6 +42,8 @@ #include "BKE_main.h" #include "BKE_node.h" +#include "NOD_shader.h" + #include "MEM_guardedalloc.h" #include "IMB_colormanagement.h" diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index d5d8154d7ee..b9b365a3175 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -38,8 +38,8 @@ set(INC ../render/intern ../../../extern/clew/include ../../../intern/atomic - ../../../intern/guardedalloc ../../../intern/clog + ../../../intern/guardedalloc # dna_type_offsets.h ${CMAKE_CURRENT_BINARY_DIR}/../makesdna/intern @@ -140,6 +140,8 @@ set(SRC nodes/COM_OutputFileNode.h nodes/COM_RenderLayersNode.cc nodes/COM_RenderLayersNode.h + nodes/COM_SceneTimeNode.cc + nodes/COM_SceneTimeNode.h nodes/COM_SwitchNode.cc nodes/COM_SwitchNode.h nodes/COM_SwitchViewNode.cc @@ -150,8 +152,6 @@ set(SRC nodes/COM_TimeNode.h nodes/COM_ValueNode.cc nodes/COM_ValueNode.h - nodes/COM_SceneTimeNode.cc - nodes/COM_SceneTimeNode.h # output nodes nodes/COM_CompositorNode.cc @@ -573,10 +573,10 @@ set(SRC operations/COM_IDMaskOperation.cc operations/COM_IDMaskOperation.h - operations/COM_DotproductOperation.cc - operations/COM_DotproductOperation.h operations/COM_ConvertColorSpaceOperation.cc operations/COM_ConvertColorSpaceOperation.h + operations/COM_DotproductOperation.cc + operations/COM_DotproductOperation.h # Matte operation operations/COM_BoxMaskOperation.cc diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cc b/source/blender/compositor/nodes/COM_CryptomatteNode.cc index 605dc1dc84d..c360e519cf8 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.cc +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cc @@ -16,9 +16,12 @@ * Copyright 2018, Blender Foundation. */ -#include "COM_CryptomatteNode.h" #include "BKE_node.h" + +#include "NOD_composite.h" + #include "COM_ConvertOperation.h" +#include "COM_CryptomatteNode.h" #include "COM_MultilayerImageOperation.h" #include "COM_RenderLayersProg.h" #include "COM_SetAlphaMultiplyOperation.h" diff --git a/source/blender/compositor/operations/COM_TextureOperation.cc b/source/blender/compositor/operations/COM_TextureOperation.cc index f5d47478a8d..a4990993d73 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cc +++ b/source/blender/compositor/operations/COM_TextureOperation.cc @@ -22,6 +22,8 @@ #include "BKE_image.h" #include "BKE_node.h" +#include "NOD_texture.h" + namespace blender::compositor { TextureBaseOperation::TextureBaseOperation() diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 787e3799029..d699c799e40 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -71,8 +71,8 @@ struct Scene; struct Simulation; struct Speaker; struct Tex; -struct ViewLayer; struct VFont; +struct ViewLayer; struct World; struct bAction; struct bArmature; diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index 8dd7e3d7dbf..f0e2e2bafd1 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -212,8 +212,8 @@ set(SRC intern/draw_manager_profiling.h intern/draw_manager_testing.h intern/draw_manager_text.h - intern/draw_shader_shared.h intern/draw_shader.h + intern/draw_shader_shared.h intern/draw_subdivision.h intern/draw_texture_pool.h intern/draw_view.h diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc index 37bc9435c76..2f0c5cca3d6 100644 --- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc +++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc @@ -573,6 +573,9 @@ void draw_subdiv_cache_free(DRWSubdivCache *cache) GPU_VERTBUF_DISCARD_SAFE(cache->subdiv_vertex_face_adjacency); cache->resolution = 0; cache->num_subdiv_loops = 0; + cache->num_subdiv_edges = 0; + cache->num_subdiv_verts = 0; + cache->num_subdiv_triangles = 0; cache->num_coarse_poly = 0; cache->num_subdiv_quads = 0; draw_subdiv_free_edit_mode_cache(cache); @@ -749,9 +752,10 @@ static bool draw_subdiv_topology_info_cb(const SubdivForeachContext *foreach_con cache->subdiv_loop_poly_index = static_cast<int *>( MEM_mallocN(cache->num_subdiv_loops * sizeof(int), "subdiv_loop_poly_index")); + const int num_coarse_vertices = ctx->coarse_mesh->totvert; cache->point_indices = static_cast<int *>( - MEM_mallocN(cache->num_subdiv_verts * sizeof(int), "point_indices")); - for (int i = 0; i < num_vertices; i++) { + MEM_mallocN(num_coarse_vertices * sizeof(int), "point_indices")); + for (int i = 0; i < num_coarse_vertices; i++) { cache->point_indices[i] = -1; } @@ -976,6 +980,7 @@ static bool draw_subdiv_build_cache(DRWSubdivCache *cache, } DRWCacheBuildingContext cache_building_context; + memset(&cache_building_context, 0, sizeof(DRWCacheBuildingContext)); cache_building_context.coarse_mesh = mesh_eval; cache_building_context.settings = &to_mesh_settings; cache_building_context.cache = cache; diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h index 6c3e0773a15..fdb7cfba580 100644 --- a/source/blender/draw/intern/draw_common.h +++ b/source/blender/draw/intern/draw_common.h @@ -24,12 +24,12 @@ struct DRWShadingGroup; struct FluidModifierData; +struct GPUMaterial; struct ModifierData; struct Object; struct ParticleSystem; struct RegionView3D; struct ViewLayer; -struct GPUMaterial; #define UBO_FIRST_COLOR colorWire #define UBO_LAST_COLOR colorUVShadow diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c index 0abb00a71a9..bf37ea45dda 100644 --- a/source/blender/draw/intern/draw_hair.c +++ b/source/blender/draw/intern/draw_hair.c @@ -54,7 +54,7 @@ BLI_INLINE eParticleRefineShaderType drw_hair_shader_type_get(void) { #ifdef USE_COMPUTE_SHADERS - if (GPU_compute_shader_support()) { + if (GPU_compute_shader_support() && GPU_shader_storage_buffer_objects_support()) { return PART_REFINE_SHADER_COMPUTE; } #endif diff --git a/source/blender/draw/intern/draw_view_data.h b/source/blender/draw/intern/draw_view_data.h index 494c28cc067..b37e48c11e8 100644 --- a/source/blender/draw/intern/draw_view_data.h +++ b/source/blender/draw/intern/draw_view_data.h @@ -31,9 +31,9 @@ extern "C" { #endif -struct GPUViewport; -struct DrawEngineType; struct DRWRegisteredDrawEngine; +struct DrawEngineType; +struct GPUViewport; /* NOTE these structs are only here for reading the actual lists from the engine. * The actual length of them is stored in a ViewportEngineData_Info. diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc index 3ea3e67a8da..c3f89ab96ee 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc @@ -157,7 +157,7 @@ static void extract_points_finish(const MeshRenderData *UNUSED(mr), } static void extract_points_init_subdiv(const DRWSubdivCache *subdiv_cache, - const MeshRenderData *UNUSED(mr), + const MeshRenderData *mr, struct MeshBatchCache *UNUSED(cache), void *UNUSED(buffer), void *data) @@ -165,9 +165,9 @@ static void extract_points_init_subdiv(const DRWSubdivCache *subdiv_cache, GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(data); /* Copy the points as the data upload will free them. */ elb->data = (uint *)MEM_dupallocN(subdiv_cache->point_indices); - elb->index_len = subdiv_cache->num_subdiv_verts; + elb->index_len = mr->vert_len; elb->index_min = 0; - elb->index_max = subdiv_cache->num_subdiv_loops - 1; + elb->index_max = subdiv_cache->num_subdiv_loops + mr->loop_loose_len; elb->prim_type = GPU_PRIM_POINTS; } @@ -184,9 +184,6 @@ static void extract_points_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache, GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(data); - elb->data = static_cast<uint32_t *>( - MEM_reallocN(elb->data, sizeof(uint) * (subdiv_cache->num_subdiv_loops + loop_loose_len))); - const Mesh *coarse_mesh = subdiv_cache->mesh; const MEdge *coarse_edges = coarse_mesh->medge; @@ -195,22 +192,18 @@ static void extract_points_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache, for (int i = 0; i < loose_geom->edge_len; i++) { const MEdge *loose_edge = &coarse_edges[loose_geom->edges[i]]; if (elb->data[loose_edge->v1] == -1u) { - elb->data[loose_edge->v1] = offset; + GPU_indexbuf_set_point_vert(elb, loose_edge->v1, offset); } if (elb->data[loose_edge->v2] == -1u) { - elb->data[loose_edge->v2] = offset + 1; + GPU_indexbuf_set_point_vert(elb, loose_edge->v2, offset + 1); } - elb->index_max += 2; - elb->index_len += 2; offset += 2; } for (int i = 0; i < loose_geom->vert_len; i++) { if (elb->data[loose_geom->verts[i]] == -1u) { - elb->data[loose_geom->verts[i]] = offset; + GPU_indexbuf_set_point_vert(elb, loose_geom->verts[i], offset); } - elb->index_max += 1; - elb->index_len += 1; offset += 1; } } diff --git a/source/blender/editors/asset/ED_asset_catalog.h b/source/blender/editors/asset/ED_asset_catalog.h index be99de01173..acb0b67d9c0 100644 --- a/source/blender/editors/asset/ED_asset_catalog.h +++ b/source/blender/editors/asset/ED_asset_catalog.h @@ -28,8 +28,8 @@ extern "C" { #endif -struct Main; struct AssetLibrary; +struct Main; void ED_asset_catalogs_save_from_main_path(struct AssetLibrary *library, const struct Main *bmain); diff --git a/source/blender/editors/asset/ED_asset_mark_clear.h b/source/blender/editors/asset/ED_asset_mark_clear.h index 512a1d94535..8f10e769c52 100644 --- a/source/blender/editors/asset/ED_asset_mark_clear.h +++ b/source/blender/editors/asset/ED_asset_mark_clear.h @@ -25,8 +25,8 @@ extern "C" { #endif struct ID; -struct bContext; struct Main; +struct bContext; /** * Mark the datablock as asset. diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index c5e8c2ee096..3c1b8e4ecc1 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -38,10 +38,10 @@ struct Main; struct ReportList; struct Scene; struct SpaceImage; +struct View2D; struct bContext; struct wmOperator; struct wmWindowManager; -struct View2D; /* image_draw.c */ float ED_space_image_zoom_level(const struct View2D *v2d, int grid_dimension); diff --git a/source/blender/editors/include/UI_interface.hh b/source/blender/editors/include/UI_interface.hh index a52b4ebd338..8d1ca54b7a1 100644 --- a/source/blender/editors/include/UI_interface.hh +++ b/source/blender/editors/include/UI_interface.hh @@ -31,8 +31,8 @@ namespace blender::nodes::geometry_nodes_eval_log { struct GeometryAttributeInfo; } -struct uiBlock; struct StructRNA; +struct uiBlock; struct uiSearchItems; namespace blender::ui { diff --git a/source/blender/editors/include/UI_tree_view.hh b/source/blender/editors/include/UI_tree_view.hh index 8208f8daf5d..8dee88defb3 100644 --- a/source/blender/editors/include/UI_tree_view.hh +++ b/source/blender/editors/include/UI_tree_view.hh @@ -40,8 +40,8 @@ struct uiBlock; struct uiBut; struct uiButTreeRow; struct uiLayout; -struct wmEvent; struct wmDrag; +struct wmEvent; namespace blender::ui { diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c index 52730096b2f..05840175fab 100644 --- a/source/blender/editors/interface/interface_eyedropper_color.c +++ b/source/blender/editors/interface/interface_eyedropper_color.c @@ -42,6 +42,8 @@ #include "BKE_node.h" #include "BKE_screen.h" +#include "NOD_composite.h" + #include "RNA_access.h" #include "UI_interface.h" diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index 31dca83a3ab..1f867c6f1f7 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -28,6 +28,7 @@ set(INC ../../imbuf ../../makesdna ../../makesrna + ../../nodes ../../render ../../sequencer ../../windowmanager diff --git a/source/blender/editors/render/render_internal.cc b/source/blender/editors/render/render_internal.cc index 1d0de322271..a156b9234dc 100644 --- a/source/blender/editors/render/render_internal.cc +++ b/source/blender/editors/render/render_internal.cc @@ -56,6 +56,8 @@ #include "BKE_scene.h" #include "BKE_screen.h" +#include "NOD_composite.h" + #include "DEG_depsgraph.h" #include "WM_api.h" diff --git a/source/blender/editors/render/render_shading.cc b/source/blender/editors/render/render_shading.cc index 992bba420c1..19ab6841e22 100644 --- a/source/blender/editors/render/render_shading.cc +++ b/source/blender/editors/render/render_shading.cc @@ -64,6 +64,8 @@ #include "BKE_workspace.h" #include "BKE_world.h" +#include "NOD_composite.h" + #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" diff --git a/source/blender/editors/render/render_update.cc b/source/blender/editors/render/render_update.cc index b2958efde9b..b1e8e3927ef 100644 --- a/source/blender/editors/render/render_update.cc +++ b/source/blender/editors/render/render_update.cc @@ -49,6 +49,8 @@ #include "BKE_paint.h" #include "BKE_scene.h" +#include "NOD_composite.h" + #include "RE_engine.h" #include "RE_pipeline.h" diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 5c8d7a9e9b6..b15b6784d34 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -27,6 +27,7 @@ set(INC ../../gpu ../../imbuf ../../makesdna + ../../nodes ../../makesrna ../../render ../../windowmanager diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 265746e27cd..4010b87a2ed 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -47,6 +47,8 @@ #include "BKE_object.h" #include "BKE_paint.h" +#include "NOD_texture.h" + #include "WM_api.h" #include "wm_cursors.h" diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index dc2eaacca0c..a912bb5cf3b 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -56,6 +56,8 @@ #include "BKE_paint.h" #include "BKE_undo_system.h" +#include "NOD_texture.h" + #include "DEG_depsgraph.h" #include "UI_interface.h" diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index df323baa2a9..75d4237d157 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -32,6 +32,7 @@ #include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_rect.h" +#include "BLI_string.h" #include "BLI_task.h" #include "DNA_brush_types.h" @@ -43,9 +44,11 @@ #include "RNA_access.h" #include "BKE_brush.h" +#include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_deform.h" #include "BKE_layer.h" +#include "BKE_lib_id.h" #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_mesh_mapping.h" @@ -1470,14 +1473,48 @@ struct WPaintData { bool precomputed_weight_ready; }; +static void smooth_brush_toggle_on(const bContext *C, Paint *paint, StrokeCache *cache) +{ + Scene *scene = CTX_data_scene(C); + Brush *brush = paint->brush; + int cur_brush_size = BKE_brush_size_get(scene, brush); + + BLI_strncpy( + cache->saved_active_brush_name, brush->id.name + 2, sizeof(cache->saved_active_brush_name)); + + /* Switch to the blur (smooth) brush. */ + brush = BKE_paint_toolslots_brush_get(paint, WPAINT_TOOL_BLUR); + if (brush) { + BKE_paint_brush_set(paint, brush); + cache->saved_smooth_size = BKE_brush_size_get(scene, brush); + BKE_brush_size_set(scene, brush, cur_brush_size); + BKE_curvemapping_init(brush->curve); + } +} + +static void smooth_brush_toggle_off(const bContext *C, Paint *paint, StrokeCache *cache) +{ + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + Brush *brush = BKE_paint_brush(paint); + /* The current brush should match with what we have stored in the cache. */ + BLI_assert(brush == cache->brush); + + /* Try to switch back to the saved/previous brush. */ + BKE_brush_size_set(scene, brush, cache->saved_smooth_size); + brush = (Brush *)BKE_libblock_find_name(bmain, ID_BR, cache->saved_active_brush_name); + if (brush) { + BKE_paint_brush_set(paint, brush); + } +} + /* Initialize the stroke cache invariants from operator properties */ static void vwpaint_update_cache_invariants( - bContext *C, const VPaint *vp, SculptSession *ss, wmOperator *op, const float mouse[2]) + bContext *C, VPaint *vp, SculptSession *ss, wmOperator *op, const float mouse[2]) { StrokeCache *cache; Scene *scene = CTX_data_scene(C); UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings; - const Brush *brush = vp->paint.brush; ViewContext *vc = paint_stroke_view_context(op->customdata); Object *ob = CTX_data_active_object(C); float mat[3][3]; @@ -1513,7 +1550,12 @@ static void vwpaint_update_cache_invariants( ups->draw_inverted = false; } + if (cache->alt_smooth) { + smooth_brush_toggle_on(C, &vp->paint, cache); + } + copy_v2_v2(cache->mouse, cache->initial_mouse); + Brush *brush = vp->paint.brush; /* Truly temporary data that isn't stored in properties */ cache->vc = vc; cache->brush = brush; @@ -1715,15 +1757,15 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo wpd->mirror.lock = tmpflags; } - if (ELEM(vp->paint.brush->weightpaint_tool, WPAINT_TOOL_SMEAR, WPAINT_TOOL_BLUR)) { - wpd->precomputed_weight = MEM_mallocN(sizeof(float) * me->totvert, __func__); - } - /* If not previously created, create vertex/weight paint mode session data */ vertex_paint_init_stroke(depsgraph, ob); vwpaint_update_cache_invariants(C, vp, ss, op, mouse); vertex_paint_init_session_data(ts, ob); + if (ELEM(vp->paint.brush->weightpaint_tool, WPAINT_TOOL_SMEAR, WPAINT_TOOL_BLUR)) { + wpd->precomputed_weight = MEM_mallocN(sizeof(float) * me->totvert, __func__); + } + if (ob->sculpt->mode.wpaint.dvert_prev != NULL) { MDeformVert *dv = ob->sculpt->mode.wpaint.dvert_prev; for (int i = 0; i < me->totvert; i++, dv++) { @@ -2395,7 +2437,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P wpi.vgroup_validmap = wpd->vgroup_validmap; wpi.vgroup_locked = wpd->vgroup_locked; wpi.vgroup_unlocked = wpd->vgroup_unlocked; - wpi.do_flip = RNA_boolean_get(itemptr, "pen_flip"); + wpi.do_flip = RNA_boolean_get(itemptr, "pen_flip") || ss->cache->invert; wpi.do_multipaint = wpd->do_multipaint; wpi.do_auto_normalize = ((ts->auto_normalize != 0) && (wpi.vgroup_validmap != NULL) && (wpi.do_multipaint || wpi.vgroup_validmap[wpi.active.index])); @@ -2480,6 +2522,14 @@ static void wpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) MEM_freeN(wpd); } + SculptSession *ss = ob->sculpt; + + if (ss->cache->alt_smooth) { + ToolSettings *ts = CTX_data_tool_settings(C); + VPaint *vp = ts->wpaint; + smooth_brush_toggle_off(C, &vp->paint, ss->cache); + } + /* and particles too */ if (ob->particlesystem.first) { ParticleSystem *psys; @@ -3433,6 +3483,14 @@ static void vpaint_stroke_done(const bContext *C, struct PaintStroke *stroke) MEM_freeN(vpd->smear.color_curr); } + SculptSession *ss = ob->sculpt; + + if (ss->cache->alt_smooth) { + ToolSettings *ts = CTX_data_tool_settings(C); + VPaint *vp = ts->vpaint; + smooth_brush_toggle_off(C, &vp->paint, ss->cache); + } + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); MEM_freeN(vpd); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 5ac13ebdd93..2725fc1eae4 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -73,6 +73,8 @@ #include "BKE_subdiv_ccg.h" #include "BKE_subsurf.h" +#include "NOD_texture.h" + #include "DEG_depsgraph.h" #include "IMB_colormanagement.h" @@ -4028,13 +4030,71 @@ static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss) } } +static void smooth_brush_toggle_on(const bContext *C, Paint *paint, StrokeCache *cache) +{ + Scene *scene = CTX_data_scene(C); + Brush *brush = paint->brush; + + if (brush->sculpt_tool == SCULPT_TOOL_MASK) { + cache->saved_mask_brush_tool = brush->mask_tool; + brush->mask_tool = BRUSH_MASK_SMOOTH; + } + else if (ELEM(brush->sculpt_tool, + SCULPT_TOOL_SLIDE_RELAX, + SCULPT_TOOL_DRAW_FACE_SETS, + SCULPT_TOOL_PAINT, + SCULPT_TOOL_SMEAR)) { + /* Do nothing, this tool has its own smooth mode. */ + } + else { + int cur_brush_size = BKE_brush_size_get(scene, brush); + + BLI_strncpy(cache->saved_active_brush_name, + brush->id.name + 2, + sizeof(cache->saved_active_brush_name)); + + /* Switch to the smooth brush. */ + brush = BKE_paint_toolslots_brush_get(paint, SCULPT_TOOL_SMOOTH); + if (brush) { + BKE_paint_brush_set(paint, brush); + cache->saved_smooth_size = BKE_brush_size_get(scene, brush); + BKE_brush_size_set(scene, brush, cur_brush_size); + BKE_curvemapping_init(brush->curve); + } + } +} + +static void smooth_brush_toggle_off(const bContext *C, Paint *paint, StrokeCache *cache) +{ + Main *bmain = CTX_data_main(C); + Scene *scene = CTX_data_scene(C); + Brush *brush = BKE_paint_brush(paint); + + if (brush->sculpt_tool == SCULPT_TOOL_MASK) { + brush->mask_tool = cache->saved_mask_brush_tool; + } + else if (ELEM(brush->sculpt_tool, + SCULPT_TOOL_SLIDE_RELAX, + SCULPT_TOOL_DRAW_FACE_SETS, + SCULPT_TOOL_PAINT, + SCULPT_TOOL_SMEAR)) { + /* Do nothing. */ + } + else { + /* Try to switch back to the saved/previous brush. */ + BKE_brush_size_set(scene, brush, cache->saved_smooth_size); + brush = (Brush *)BKE_libblock_find_name(bmain, ID_BR, cache->saved_active_brush_name); + if (brush) { + BKE_paint_brush_set(paint, brush); + } + } +} + /* Initialize the stroke cache invariants from operator properties. */ static void sculpt_update_cache_invariants( bContext *C, Sculpt *sd, SculptSession *ss, wmOperator *op, const float mouse[2]) { StrokeCache *cache = MEM_callocN(sizeof(StrokeCache), "stroke cache"); - Main *bmain = CTX_data_main(C); - Scene *scene = CTX_data_scene(C); UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings; Brush *brush = BKE_paint_brush(&sd->paint); ViewContext *vc = paint_stroke_view_context(op->customdata); @@ -4099,35 +4159,9 @@ static void sculpt_update_cache_invariants( /* Alt-Smooth. */ if (cache->alt_smooth) { - if (brush->sculpt_tool == SCULPT_TOOL_MASK) { - cache->saved_mask_brush_tool = brush->mask_tool; - brush->mask_tool = BRUSH_MASK_SMOOTH; - } - else if (ELEM(brush->sculpt_tool, - SCULPT_TOOL_SLIDE_RELAX, - SCULPT_TOOL_DRAW_FACE_SETS, - SCULPT_TOOL_PAINT, - SCULPT_TOOL_SMEAR)) { - /* Do nothing, this tool has its own smooth mode. */ - } - else { - Paint *p = &sd->paint; - Brush *br; - int size = BKE_brush_size_get(scene, brush); - - BLI_strncpy(cache->saved_active_brush_name, - brush->id.name + 2, - sizeof(cache->saved_active_brush_name)); - - br = (Brush *)BKE_libblock_find_name(bmain, ID_BR, "Smooth"); - if (br) { - BKE_paint_brush_set(p, br); - brush = br; - cache->saved_smooth_size = BKE_brush_size_get(scene, brush); - BKE_brush_size_set(scene, brush, size); - BKE_curvemapping_init(brush->curve); - } - } + smooth_brush_toggle_on(C, &sd->paint, cache); + /* Refresh the brush pointer in case we switched brush in the toggle function. */ + brush = BKE_paint_brush(&sd->paint); } copy_v2_v2(cache->mouse, cache->initial_mouse); @@ -4135,9 +4169,7 @@ static void sculpt_update_cache_invariants( copy_v2_v2(ups->tex_mouse, cache->initial_mouse); /* Truly temporary data that isn't stored in properties. */ - cache->vc = vc; - cache->brush = brush; /* Cache projection matrix. */ @@ -5255,9 +5287,7 @@ static void sculpt_brush_exit_tex(Sculpt *sd) static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(stroke)) { - Main *bmain = CTX_data_main(C); Object *ob = CTX_data_active_object(C); - Scene *scene = CTX_data_scene(C); SculptSession *ss = ob->sculpt; Sculpt *sd = CTX_data_tool_settings(C)->sculpt; @@ -5275,23 +5305,9 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str /* Alt-Smooth. */ if (ss->cache->alt_smooth) { - if (brush->sculpt_tool == SCULPT_TOOL_MASK) { - brush->mask_tool = ss->cache->saved_mask_brush_tool; - } - else if (ELEM(brush->sculpt_tool, - SCULPT_TOOL_SLIDE_RELAX, - SCULPT_TOOL_DRAW_FACE_SETS, - SCULPT_TOOL_PAINT, - SCULPT_TOOL_SMEAR)) { - /* Do nothing. */ - } - else { - BKE_brush_size_set(scene, brush, ss->cache->saved_smooth_size); - brush = (Brush *)BKE_libblock_find_name(bmain, ID_BR, ss->cache->saved_active_brush_name); - if (brush) { - BKE_paint_brush_set(&sd->paint, brush); - } - } + smooth_brush_toggle_off(C, &sd->paint, ss->cache); + /* Refresh the brush pointer in case we switched brush in the toggle function. */ + brush = BKE_paint_brush(&sd->paint); } if (SCULPT_is_automasking_enabled(sd, ss, brush)) { diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index f84380b4f64..8de9fa3763b 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -376,14 +376,6 @@ typedef enum SculptFilterOrientation { SCULPT_FILTER_ORIENTATION_VIEW = 2, } SculptFilterOrientation; -/* Defines how transform tools are going to apply its displacement. */ -typedef enum SculptTransformDisplacementMode { - /* Displaces the elements from their original coordinates. */ - SCULPT_TRANSFORM_DISPLACEMENT_ORIGINAL = 0, - /* Displaces the elements incrementally from their previous position. */ - SCULPT_TRANSFORM_DISPLACEMENT_INCREMENTAL = 1, -} SculptTransformDisplacementMode; - #define SCULPT_CLAY_STABILIZER_LEN 10 typedef struct AutomaskingSettings { @@ -452,9 +444,6 @@ typedef struct FilterCache { int active_face_set; - /* Transform. */ - SculptTransformDisplacementMode transform_displacement_mode; - /* Auto-masking. */ AutomaskingCache *automasking; } FilterCache; diff --git a/source/blender/editors/sculpt_paint/sculpt_transform.c b/source/blender/editors/sculpt_paint/sculpt_transform.c index bfbe545d1ef..b91e05f226e 100644 --- a/source/blender/editors/sculpt_paint/sculpt_transform.c +++ b/source/blender/editors/sculpt_paint/sculpt_transform.c @@ -70,10 +70,6 @@ void ED_sculpt_init_transform(struct bContext *C, Object *ob) copy_v4_v4(ss->init_pivot_rot, ss->pivot_rot); copy_v3_v3(ss->init_pivot_scale, ss->pivot_scale); - copy_v3_v3(ss->prev_pivot_pos, ss->pivot_pos); - copy_v4_v4(ss->prev_pivot_rot, ss->pivot_rot); - copy_v3_v3(ss->prev_pivot_scale, ss->pivot_scale); - SCULPT_undo_push_begin(ob, "Transform"); BKE_sculpt_update_object_for_edit(depsgraph, ob, false, false, false); @@ -81,13 +77,10 @@ void ED_sculpt_init_transform(struct bContext *C, Object *ob) SCULPT_vertex_random_access_ensure(ss); SCULPT_filter_cache_init(C, ob, sd, SCULPT_UNDO_COORDS); - - ss->filter_cache->transform_displacement_mode = SCULPT_TRANSFORM_DISPLACEMENT_ORIGINAL; } static void sculpt_transform_matrices_init(SculptSession *ss, const char symm, - const SculptTransformDisplacementMode t_mode, float r_transform_mats[8][4][4]) { @@ -96,18 +89,9 @@ static void sculpt_transform_matrices_init(SculptSession *ss, transform_mat[4][4]; float start_pivot_pos[3], start_pivot_rot[4], start_pivot_scale[3]; - switch (t_mode) { - case SCULPT_TRANSFORM_DISPLACEMENT_ORIGINAL: - copy_v3_v3(start_pivot_pos, ss->init_pivot_pos); - copy_v4_v4(start_pivot_rot, ss->init_pivot_rot); - copy_v3_v3(start_pivot_scale, ss->init_pivot_scale); - break; - case SCULPT_TRANSFORM_DISPLACEMENT_INCREMENTAL: - copy_v3_v3(start_pivot_pos, ss->prev_pivot_pos); - copy_v4_v4(start_pivot_rot, ss->prev_pivot_rot); - copy_v3_v3(start_pivot_scale, ss->prev_pivot_scale); - break; - } + copy_v3_v3(start_pivot_pos, ss->init_pivot_pos); + copy_v4_v4(start_pivot_rot, ss->init_pivot_rot); + copy_v3_v3(start_pivot_scale, ss->init_pivot_scale); for (int i = 0; i < PAINT_SYMM_AREAS; i++) { ePaintSymmetryAreas v_symm = i; @@ -167,25 +151,15 @@ static void sculpt_transform_task_cb(void *__restrict userdata, BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) { SCULPT_orig_vert_data_update(&orig_data, &vd); float transformed_co[3], orig_co[3], disp[3]; - float *start_co; float fade = vd.mask ? *vd.mask : 0.0f; copy_v3_v3(orig_co, orig_data.co); char symm_area = SCULPT_get_vertex_symm_area(orig_co); - switch (ss->filter_cache->transform_displacement_mode) { - case SCULPT_TRANSFORM_DISPLACEMENT_ORIGINAL: - start_co = orig_co; - break; - case SCULPT_TRANSFORM_DISPLACEMENT_INCREMENTAL: - start_co = vd.co; - break; - } - - copy_v3_v3(transformed_co, start_co); + copy_v3_v3(transformed_co, orig_co); mul_m4_v3(data->transform_mats[(int)symm_area], transformed_co); - sub_v3_v3v3(disp, transformed_co, start_co); + sub_v3_v3v3(disp, transformed_co, orig_co); mul_v3_fl(disp, 1.0f - fade); - add_v3_v3v3(vd.co, start_co, disp); + add_v3_v3v3(vd.co, orig_co, disp); if (vd.mvert) { vd.mvert->flag |= ME_VERT_PBVH_UPDATE; @@ -207,8 +181,7 @@ static void sculpt_transform_all_vertices(Sculpt *sd, Object *ob) .nodes = ss->filter_cache->nodes, }; - sculpt_transform_matrices_init( - ss, symm, ss->filter_cache->transform_displacement_mode, data.transform_mats); + sculpt_transform_matrices_init(ss, symm, data.transform_mats); /* Regular transform applies all symmetry passes at once as it is split by symmetry areas * (each vertex can only be transformed once by the transform matrix of its area). */ @@ -229,10 +202,6 @@ void ED_sculpt_update_modal_transform(struct bContext *C, Object *ob) sculpt_transform_all_vertices(sd, ob); - copy_v3_v3(ss->prev_pivot_pos, ss->pivot_pos); - copy_v4_v4(ss->prev_pivot_rot, ss->pivot_rot); - copy_v3_v3(ss->prev_pivot_scale, ss->pivot_scale); - if (ss->deform_modifiers_active || ss->shapekey_active) { SCULPT_flush_stroke_deform(sd, ob, true); } diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index 4334beea196..bd55e6f78ab 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -34,11 +34,11 @@ extern "C" { struct ARegion; struct ARegionType; struct AssetLibrary; -struct FileSelectParams; struct FileAssetSelectParams; +struct FileSelectParams; struct SpaceFile; -struct uiLayout; struct View2D; +struct uiLayout; /* file_draw.c */ diff --git a/source/blender/editors/space_node/node_context_path.cc b/source/blender/editors/space_node/node_context_path.cc index 2f3855fd654..cab7cbf10be 100644 --- a/source/blender/editors/space_node/node_context_path.cc +++ b/source/blender/editors/space_node/node_context_path.cc @@ -45,11 +45,11 @@ #include "node_intern.hh" -struct Mesh; struct Curve; struct Light; -struct World; struct Material; +struct Mesh; +struct World; namespace blender::ed::space_node { diff --git a/source/blender/editors/space_node/node_select.cc b/source/blender/editors/space_node/node_select.cc index 46b9bd3de53..2751a53e8af 100644 --- a/source/blender/editors/space_node/node_select.cc +++ b/source/blender/editors/space_node/node_select.cc @@ -1310,4 +1310,4 @@ void NODE_OT_find_node(wmOperatorType *ot) /** \} */ -} +} // namespace blender::ed::space_node diff --git a/source/blender/editors/space_outliner/tree/tree_display.hh b/source/blender/editors/space_outliner/tree/tree_display.hh index 8005b7d17dd..68f0f9c562d 100644 --- a/source/blender/editors/space_outliner/tree/tree_display.hh +++ b/source/blender/editors/space_outliner/tree/tree_display.hh @@ -38,8 +38,8 @@ struct ID; struct LayerCollection; -struct ListBase; struct Library; +struct ListBase; struct Main; struct Scene; struct Sequence; diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 8f7ab2ea881..7143a1fa1ca 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -33,13 +33,13 @@ struct ARegionType; struct Depsgraph; struct Main; struct Scene; -struct Sequence; struct SeqCollection; +struct Sequence; struct SpaceSeq; struct StripElem; +struct View2D; struct bContext; struct rctf; -struct View2D; struct wmOperator; #define OVERLAP_ALPHA 180 diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh b/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh index 64672b919cd..df23a27aa22 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh +++ b/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh @@ -36,8 +36,8 @@ struct SpaceSpreadsheet_Runtime { } }; -struct bContext; struct ARegionType; +struct bContext; void spreadsheet_operatortypes(); void spreadsheet_update_context_path(const bContext *C); diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index 55f2bfd37db..e00522f0f88 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -1650,7 +1650,7 @@ void createTransEditVerts(TransInfo *t) else if (prop_mode || BM_elem_flag_test(eve, BM_ELEM_SELECT)) { float *bweight = (cd_vert_bweight_offset != -1) ? BM_ELEM_CD_GET_VOID_P(eve, cd_vert_bweight_offset) : - (cd_vert_crease_offset != -1) ? + (cd_vert_crease_offset != -1) ? BM_ELEM_CD_GET_VOID_P(eve, cd_vert_crease_offset) : NULL; diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index bb7e9e8b26f..4bb66b78dd0 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -404,40 +404,40 @@ set(SHADER_CREATE_INFOS #../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 +../draw/intern/shaders/draw_view_info.hh shaders/infos/gpu_clip_planes_info.hh -shaders/infos/gpu_srgb_to_framebuffer_space_info.hh -shaders/infos/gpu_shader_3D_image_modulate_alpha_info.hh +shaders/infos/gpu_shader_2D_area_borders_info.hh shaders/infos/gpu_shader_2D_checker_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_color_info.hh -shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh +shaders/infos/gpu_shader_2D_image_info.hh +shaders/infos/gpu_shader_2D_image_multi_rect_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_rect_color_info.hh -shaders/infos/gpu_shader_text_info.hh -shaders/infos/gpu_shader_keyframe_shape_info.hh -shaders/infos/gpu_shader_3D_flat_color_info.hh -shaders/infos/gpu_shader_3D_uniform_color_info.hh -shaders/infos/gpu_shader_3D_smooth_color_info.hh -shaders/infos/gpu_shader_3D_depth_only_info.hh -shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh +shaders/infos/gpu_shader_2D_image_shuffle_color_info.hh +shaders/infos/gpu_shader_2D_nodelink_info.hh shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_aa_info.hh shaders/infos/gpu_shader_2D_point_uniform_size_uniform_color_outline_aa_info.hh -shaders/infos/gpu_shader_2D_area_borders_info.hh -shaders/infos/gpu_shader_2D_image_multi_rect_color_info.hh -shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh +shaders/infos/gpu_shader_2D_point_varying_size_varying_color_info.hh +shaders/infos/gpu_shader_2D_smooth_color_info.hh +shaders/infos/gpu_shader_2D_uniform_color_info.hh +shaders/infos/gpu_shader_3D_depth_only_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_3D_point_info.hh -shaders/infos/gpu_shader_2D_nodelink_info.hh +shaders/infos/gpu_shader_3D_smooth_color_info.hh +shaders/infos/gpu_shader_3D_uniform_color_info.hh shaders/infos/gpu_shader_gpencil_stroke_info.hh +shaders/infos/gpu_shader_instance_varying_color_varying_size_info.hh +shaders/infos/gpu_shader_keyframe_shape_info.hh shaders/infos/gpu_shader_simple_lighting_info.hh +shaders/infos/gpu_shader_text_info.hh +shaders/infos/gpu_srgb_to_framebuffer_space_info.hh ) set(SHADER_CREATE_INFOS_CONTENT "") diff --git a/source/blender/gpu/GPU_viewport.h b/source/blender/gpu/GPU_viewport.h index c4948d68298..917b87efeaa 100644 --- a/source/blender/gpu/GPU_viewport.h +++ b/source/blender/gpu/GPU_viewport.h @@ -40,10 +40,10 @@ extern "C" { typedef struct GHash GHash; typedef struct GPUViewport GPUViewport; -struct GPUFrameBuffer; +struct DRWData; struct DefaultFramebufferList; struct DefaultTextureList; -struct DRWData; +struct GPUFrameBuffer; GPUViewport *GPU_viewport_create(void); GPUViewport *GPU_viewport_stereo_create(void); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 6451086f5fc..11c61e4cf72 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -44,6 +44,8 @@ #include "BKE_node.h" #include "BKE_scene.h" +#include "NOD_shader.h" + #include "GPU_material.h" #include "GPU_shader.h" #include "GPU_texture.h" diff --git a/source/blender/gpu/intern/gpu_shader_create_info.cc b/source/blender/gpu/intern/gpu_shader_create_info.cc index de0b7a0be6d..b8ae6bc3868 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.cc +++ b/source/blender/gpu/intern/gpu_shader_create_info.cc @@ -72,6 +72,8 @@ void ShaderCreateInfo::finalize() pass_resources_.extend(info.pass_resources_); typedef_sources_.extend(info.typedef_sources_); + validate(info); + if (info.local_group_size_[0] != 0) { BLI_assert(local_group_size_[0] == 0); for (int i = 0; i < 3; i++) { @@ -100,6 +102,67 @@ void ShaderCreateInfo::finalize() } } +void ShaderCreateInfo::validate(const ShaderCreateInfo &other_info) +{ + { + /* Check same bindpoints usage in OGL. */ + Set<int> images, samplers, ubos, ssbos; + + auto register_resource = [&](const Resource &res) -> bool { + switch (res.bind_type) { + case Resource::BindType::UNIFORM_BUFFER: + return images.add(res.slot); + case Resource::BindType::STORAGE_BUFFER: + return samplers.add(res.slot); + case Resource::BindType::SAMPLER: + return ubos.add(res.slot); + case Resource::BindType::IMAGE: + return ssbos.add(res.slot); + default: + return false; + } + }; + + auto print_error_msg = [&](const Resource &res) { + std::cerr << name_ << ": Validation failed : Overlapping "; + + switch (res.bind_type) { + case Resource::BindType::UNIFORM_BUFFER: + std::cerr << "Uniform Buffer " << res.uniformbuf.name; + break; + case Resource::BindType::STORAGE_BUFFER: + std::cerr << "Storage Buffer " << res.storagebuf.name; + break; + case Resource::BindType::SAMPLER: + std::cerr << "Sampler " << res.sampler.name; + break; + case Resource::BindType::IMAGE: + std::cerr << "Image " << res.image.name; + break; + default: + std::cerr << "Unknown Type"; + break; + } + std::cerr << " (" << res.slot << ") while merging " << other_info.name_ << std::endl; + }; + + for (auto &res : batch_resources_) { + if (register_resource(res) == false) { + print_error_msg(res); + } + } + + for (auto &res : pass_resources_) { + if (register_resource(res) == false) { + print_error_msg(res); + } + } + } + { + /* TODO(fclem) Push constant validation. */ + } +} + } // namespace blender::gpu::shader using namespace blender::gpu::shader; diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index a1ebdb0ec51..c7b3ac5ca37 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -597,6 +597,9 @@ struct ShaderCreateInfo { /* WARNING: Recursive. */ void finalize(); + /** Error detection that some backend compilers do not complain about. */ + void validate(const ShaderCreateInfo &other_info); + /** \} */ }; diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index 1a445ebd7eb..c32123bc15e 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -240,6 +240,7 @@ static void detect_workarounds() GLContext::unused_fb_slot_workaround = true; /* Turn off extensions. */ GCaps.shader_image_load_store_support = false; + GCaps.shader_storage_buffer_objects_support = false; GLContext::base_instance_support = false; GLContext::clear_texture_support = false; GLContext::copy_image_support = false; @@ -419,6 +420,12 @@ static void detect_workarounds() strstr(renderer, "HD Graphics 4000")) { GLContext::generate_mipmap_workaround = true; } + + /* Buggy interface query functions cause crashes when handling SSBOs (T93680) */ + if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_ANY, GPU_DRIVER_ANY) && + (strstr(renderer, "HD Graphics 4400")|| strstr(renderer, "HD Graphics 4600"))) { + GCaps.shader_storage_buffer_objects_support = false; + } } // namespace blender::gpu /** Internal capabilities. */ diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc index 2211c2fbb7c..772d0888823 100644 --- a/source/blender/gpu/opengl/gl_shader_interface.cc +++ b/source/blender/gpu/opengl/gl_shader_interface.cc @@ -364,6 +364,9 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI name_buffer_ = (char *)MEM_mallocN(info.interface_names_size_, "name_buffer"); uint32_t name_buffer_offset = 0; + /* Necessary to make #glUniform works. TODO(fclem) Remove. */ + glUseProgram(program); + /* Attributes */ for (const ShaderCreateInfo::VertIn &attr : info.vertex_inputs_) { copy_input_name(input, attr.name, name_buffer_, name_buffer_offset); @@ -382,7 +385,7 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI if (res.bind_type == ShaderCreateInfo::Resource::BindType::UNIFORM_BUFFER) { copy_input_name(input, res.uniformbuf.name, name_buffer_, name_buffer_offset); if (true || !GLContext::explicit_location_support) { - input->location = glGetUniformBlockIndex(program, res.uniformbuf.name.c_str()); + input->location = glGetUniformBlockIndex(program, name_buffer_ + input->name_offset); glUniformBlockBinding(program, input->location, res.slot); } input->binding = res.slot; @@ -421,7 +424,7 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI copy_input_name(input, uni.name, name_buffer_, name_buffer_offset); /* Until we make use of explicit uniform location. */ if (true || !GLContext::explicit_location_support) { - input->location = glGetUniformLocation(program, uni.name.c_str()); + input->location = glGetUniformLocation(program, name_buffer_ + input->name_offset); } input->binding = -1; input++; diff --git a/source/blender/makesdna/DNA_brush_enums.h b/source/blender/makesdna/DNA_brush_enums.h index 72b2db89cef..68e50c5b29d 100644 --- a/source/blender/makesdna/DNA_brush_enums.h +++ b/source/blender/makesdna/DNA_brush_enums.h @@ -532,6 +532,9 @@ typedef enum eBrushImagePaintTool { PAINT_TOOL_MASK = 5, } eBrushImagePaintTool; +/* The enums here should be kept in sync with the weight paint tool. + * This is because #smooth_brush_toggle_on and #smooth_brush_toggle_off + * assumes that the Blur blursh has the same enum value. */ typedef enum eBrushVertexPaintTool { VPAINT_TOOL_DRAW = 0, VPAINT_TOOL_BLUR = 1, @@ -539,6 +542,7 @@ typedef enum eBrushVertexPaintTool { VPAINT_TOOL_SMEAR = 3, } eBrushVertexPaintTool; +/* See #eBrushVertexPaintTool when changing this definition. */ typedef enum eBrushWeightPaintTool { WPAINT_TOOL_DRAW = 0, WPAINT_TOOL_BLUR = 1, diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index cc2f7ce615a..13f332f83fd 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -38,6 +38,7 @@ struct ID; struct Image; struct ListBase; struct Material; +struct PreviewImage; struct Tex; struct bGPdata; struct bNodeInstanceHash; @@ -46,7 +47,6 @@ struct bNodePreview; struct bNodeTreeExec; struct bNodeType; struct uiBlock; -struct PreviewImage; #define NODE_MAXSTR 64 diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index af2e21a90bb..4e12f135242 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -68,7 +68,7 @@ typedef struct SpaceProperties_Runtime SpaceProperties_Runtime; #ifdef __cplusplus namespace blender::ed::space_node { struct SpaceNode_Runtime; -} // namespace blender::nodes +} // namespace blender::ed::space_node using SpaceNode_Runtime = blender::ed::space_node::SpaceNode_Runtime; #else typedef struct SpaceNode_Runtime SpaceNode_Runtime; diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 7d2697c8770..1c04805be8b 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -243,7 +243,7 @@ static int rna_Image_gl_touch( BKE_image_tag_time(image); - if (image->gputexture[TEXTARGET_2D][0] == NULL) { + if (image->gputexture[TEXTARGET_2D][0][IMA_TEXTURE_RESOLUTION_FULL] == NULL) { error = rna_Image_gl_load(image, reports, frame, layer_index, pass_index); } diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index ab4cbc429ce..b02a5c8dc1e 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -53,6 +53,8 @@ # include "BKE_node.h" # include "BKE_scene.h" +# include "NOD_composite.h" + # include "BLI_listbase.h" # include "DEG_depsgraph_build.h" diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 4192a9975be..117b9dbd983 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -631,6 +631,7 @@ static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_no_bo # include "NOD_geometry.h" # include "NOD_shader.h" # include "NOD_socket.h" +# include "NOD_texture.h" # include "RE_engine.h" # include "RE_pipeline.h" diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 31b2e2f7023..7f9890e492d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -655,6 +655,8 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = { # include "BKE_screen.h" # include "BKE_unit.h" +# include "NOD_composite.h" + # include "ED_image.h" # include "ED_info.h" # include "ED_keyframing.h" diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 05c1a645823..ec9b67deeac 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1861,6 +1861,9 @@ static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, SpaceText *st = (SpaceText *)(ptr->data); st->text = value.data; + if (st->text != NULL) { + id_us_ensure_real((ID *)st->text); + } ScrArea *area = rna_area_from_space(ptr); if (area) { diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h index c80d0bcdd1e..82faccc2c2d 100644 --- a/source/blender/nodes/NOD_composite.h +++ b/source/blender/nodes/NOD_composite.h @@ -152,6 +152,75 @@ const char *node_cmp_rlayers_sock_to_pass(int sock_index); void register_node_type_cmp_custom_group(bNodeType *ntype); +void ntreeCompositExecTree(struct Scene *scene, + struct bNodeTree *ntree, + struct RenderData *rd, + int rendering, + int do_previews, + const struct ColorManagedViewSettings *view_settings, + const struct ColorManagedDisplaySettings *display_settings, + const char *view_name); + +/** + * Called from render pipeline, to tag render input and output. + * need to do all scenes, to prevent errors when you re-render 1 scene. + */ +void ntreeCompositTagRender(struct Scene *scene); + +/** + * Update the outputs of the render layer nodes. + * Since the outputs depend on the render engine, this part is a bit complex: + * - #ntreeCompositUpdateRLayers is called and loops over all render layer nodes. + * - Each render layer node calls the update function of the + * render engine that's used for its scene. + * - The render engine calls RE_engine_register_pass for each pass. + * - #RE_engine_register_pass calls #node_cmp_rlayers_register_pass. + */ +void ntreeCompositUpdateRLayers(struct bNodeTree *ntree); + +void ntreeCompositClearTags(struct bNodeTree *ntree); + +struct bNodeSocket *ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree, + struct bNode *node, + const char *name, + struct ImageFormatData *im_format); + +int ntreeCompositOutputFileRemoveActiveSocket(struct bNodeTree *ntree, struct bNode *node); +void ntreeCompositOutputFileSetPath(struct bNode *node, + struct bNodeSocket *sock, + const char *name); +void ntreeCompositOutputFileSetLayer(struct bNode *node, + struct bNodeSocket *sock, + const char *name); +/* needed in do_versions */ +void ntreeCompositOutputFileUniquePath(struct ListBase *list, + struct bNodeSocket *sock, + const char defname[], + char delim); +void ntreeCompositOutputFileUniqueLayer(struct ListBase *list, + struct bNodeSocket *sock, + const char defname[], + char delim); + +void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *ntree, bNode *node); +void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *ntree, bNode *node); + +void ntreeCompositCryptomatteSyncFromAdd(const Scene *scene, bNode *node); +void ntreeCompositCryptomatteSyncFromRemove(bNode *node); +bNodeSocket *ntreeCompositCryptomatteAddSocket(bNodeTree *ntree, bNode *node); +int ntreeCompositCryptomatteRemoveSocket(bNodeTree *ntree, bNode *node); +void ntreeCompositCryptomatteLayerPrefix(const Scene *scene, + const bNode *node, + char *r_prefix, + size_t prefix_len); + +/** + * Update the runtime layer names with the crypto-matte layer names of the references render layer + * or image. + */ +void ntreeCompositCryptomatteUpdateLayerNames(const Scene *scene, bNode *node); +struct CryptomatteSession *ntreeCompositCryptomatteSession(const Scene *scene, bNode *node); + #ifdef __cplusplus } #endif diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h index 76c174201e8..65720fc119b 100644 --- a/source/blender/nodes/NOD_shader.h +++ b/source/blender/nodes/NOD_shader.h @@ -143,6 +143,28 @@ void register_node_type_sh_tex_white_noise(void); void register_node_type_sh_custom_group(bNodeType *ntype); +struct bNodeTreeExec *ntreeShaderBeginExecTree(struct bNodeTree *ntree); +void ntreeShaderEndExecTree(struct bNodeTreeExec *exec); + + +/** + * Find an output node of the shader tree. + * + * \note it will only return output which is NOT in the group, which isn't how + * render engines works but it's how the GPU shader compilation works. This we + * can change in the future and make it a generic function, but for now it stays + * private here. + */ +struct bNode *ntreeShaderOutputNode(struct bNodeTree *ntree, int target); + +/** + * This one needs to work on a local tree. + */ +void ntreeGPUMaterialNodes(struct bNodeTree *localtree, + struct GPUMaterial *mat, + bool *has_surface_output, + bool *has_volume_output); + #ifdef __cplusplus } #endif diff --git a/source/blender/nodes/NOD_texture.h b/source/blender/nodes/NOD_texture.h index af59fefd925..c08bc814915 100644 --- a/source/blender/nodes/NOD_texture.h +++ b/source/blender/nodes/NOD_texture.h @@ -74,6 +74,22 @@ void register_node_type_tex_proc_noise(void); void register_node_type_tex_proc_stucci(void); void register_node_type_tex_proc_distnoise(void); +void ntreeTexCheckCyclics(struct bNodeTree *ntree); +struct bNodeTreeExec *ntreeTexBeginExecTree(struct bNodeTree *ntree); +void ntreeTexEndExecTree(struct bNodeTreeExec *exec); +int ntreeTexExecTree(struct bNodeTree *ntree, + struct TexResult *target, + const float co[3], + float dxt[3], + float dyt[3], + int osatex, + short thread, + const struct Tex *tex, + short which_output, + int cfra, + int preview, + struct MTex *mtex); + #ifdef __cplusplus } #endif diff --git a/source/blender/nodes/composite/CMakeLists.txt b/source/blender/nodes/composite/CMakeLists.txt index aceca617fb4..8d2b2befd1a 100644 --- a/source/blender/nodes/composite/CMakeLists.txt +++ b/source/blender/nodes/composite/CMakeLists.txt @@ -54,9 +54,9 @@ set(SRC nodes/node_composite_color_spill.cc nodes/node_composite_colorbalance.cc nodes/node_composite_colorcorrection.cc - nodes/node_composite_convert_color_space.cc nodes/node_composite_common.cc nodes/node_composite_composite.cc + nodes/node_composite_convert_color_space.cc nodes/node_composite_cornerpin.cc nodes/node_composite_crop.cc nodes/node_composite_cryptomatte.cc @@ -105,6 +105,7 @@ set(SRC nodes/node_composite_rgb.cc nodes/node_composite_rotate.cc nodes/node_composite_scale.cc + nodes/node_composite_scene_time.cc nodes/node_composite_sepcomb_hsva.cc nodes/node_composite_sepcomb_rgba.cc nodes/node_composite_sepcomb_ycca.cc @@ -125,7 +126,6 @@ set(SRC nodes/node_composite_vec_blur.cc nodes/node_composite_viewer.cc nodes/node_composite_zcombine.cc - nodes/node_composite_scene_time.cc node_composite_tree.cc node_composite_util.cc diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc b/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc index fbf6b521fd8..b1144b58c37 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_curve_handles.cc @@ -22,7 +22,11 @@ namespace blender::nodes::node_geo_input_curve_handles_cc { static void node_declare(NodeDeclarationBuilder &b) { - b.add_input<decl::Bool>(N_("Relative")).default_value(false).supports_field(); + b.add_input<decl::Bool>(N_("Relative")) + .default_value(false) + .supports_field() + .description(N_("Output the handle positions relative to the corresponding control point " + "instead of in the local space of the geometry")); b.add_output<decl::Vector>(N_("Left")).field_source(); b.add_output<decl::Vector>(N_("Right")).field_source(); } diff --git a/source/blender/render/RE_bake.h b/source/blender/render/RE_bake.h index d61c0a8bf90..d3025bf4198 100644 --- a/source/blender/render/RE_bake.h +++ b/source/blender/render/RE_bake.h @@ -25,9 +25,9 @@ struct Depsgraph; struct ImBuf; +struct MLoopUV; struct Mesh; struct Render; -struct MLoopUV; #ifdef __cplusplus extern "C" { diff --git a/source/blender/render/RE_texture_margin.h b/source/blender/render/RE_texture_margin.h index 3fb151bbedd..8d1a6c45809 100644 --- a/source/blender/render/RE_texture_margin.h +++ b/source/blender/render/RE_texture_margin.h @@ -26,11 +26,11 @@ extern "C" { #endif -struct Mesh; +struct DerivedMesh; struct IMBuf; -struct MLoopUV; struct ImBuf; -struct DerivedMesh; +struct MLoopUV; +struct Mesh; /** * Generate a margin around the textures uv islands by copying pixels from the adjacent polygon. diff --git a/source/blender/render/intern/pipeline.c b/source/blender/render/intern/pipeline.c index 721abe45932..739202564af 100644 --- a/source/blender/render/intern/pipeline.c +++ b/source/blender/render/intern/pipeline.c @@ -73,6 +73,8 @@ #include "BKE_sound.h" #include "BKE_writeavi.h" /* <------ should be replaced once with generic movie module */ +#include "NOD_composite.h" + #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_debug.h" diff --git a/source/blender/render/intern/texture_procedural.c b/source/blender/render/intern/texture_procedural.c index f563cb9f84a..c894d8d9f48 100644 --- a/source/blender/render/intern/texture_procedural.c +++ b/source/blender/render/intern/texture_procedural.c @@ -43,15 +43,15 @@ #include "IMB_colormanagement.h" #include "IMB_imbuf_types.h" -#include "BKE_image.h" -#include "BKE_node.h" - #include "BKE_colorband.h" +#include "BKE_image.h" #include "BKE_material.h" +#include "BKE_node.h" #include "BKE_scene.h" - #include "BKE_texture.h" +#include "NOD_texture.h" + #include "MEM_guardedalloc.h" #include "render_types.h" diff --git a/source/blender/sequencer/SEQ_utils.h b/source/blender/sequencer/SEQ_utils.h index a209857d1f9..515c47f53fd 100644 --- a/source/blender/sequencer/SEQ_utils.h +++ b/source/blender/sequencer/SEQ_utils.h @@ -32,9 +32,9 @@ extern "C" { struct ListBase; struct Mask; struct Scene; +struct SeqRenderData; struct Sequence; struct StripElem; -struct SeqRenderData; /** * Sort strips in provided seqbase. Effect strips are trailing the list and they are sorted by diff --git a/source/blender/sequencer/intern/utils.h b/source/blender/sequencer/intern/utils.h index 512647ed2e2..b5aa66804c6 100644 --- a/source/blender/sequencer/intern/utils.h +++ b/source/blender/sequencer/intern/utils.h @@ -27,8 +27,8 @@ extern "C" { #endif -struct Scene; struct ListBase; +struct Scene; bool sequencer_seq_generates_image(struct Sequence *seq); void seq_open_anim_file(struct Scene *scene, struct Sequence *seq, bool openfile); diff --git a/source/creator/blender_launcher_win32.c b/source/creator/blender_launcher_win32.c index 86b0f4f3b97..f19438ad907 100644 --- a/source/creator/blender_launcher_win32.c +++ b/source/creator/blender_launcher_win32.c @@ -79,7 +79,26 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine BOOL success = CreateProcess( path, buffer, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &siStartInfo, &procInfo); + DWORD returnValue = success ? 0 : -1; + if (success) { + /* If blender-launcher is called with background command line flag, + * wait for the blender process to exit and return its return value. */ + BOOL background = FALSE; + int argc = 0; + LPWSTR *argv = CommandLineToArgvW(pCmdLine, &argc); + for (int i = 0; i < argc; i++) { + if ((wcscmp(argv[i], L"-b") == 0) || (wcscmp(argv[i], L"--background") == 0)) { + background = TRUE; + break; + } + } + + if (background) { + WaitForSingleObject(procInfo.hProcess, INFINITE); + GetExitCodeProcess(procInfo.hProcess, &returnValue); + } + /* Handles in PROCESS_INFORMATION must be closed with CloseHandle when they are no longer * needed - MSDN. Closing the handles will NOT terminate the thread/process that we just * started. */ @@ -88,5 +107,5 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine } free(buffer); - return success ? 0 : -1; + return returnValue; } diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index f3136d6c649..062dc5517db 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -772,6 +772,7 @@ set(geo_node_tests geometry mesh_primitives mesh + mesh/extrude points utilities vector |