[Bf-blender-cvs] [d5b72fb06cd] master: Nodes: Declare shader nodes in individual file namespace
Aaron Carlisle
noreply at git.blender.org
Mon Dec 27 22:23:32 CET 2021
Commit: d5b72fb06cd0405c4627d22711ab02804093400c
Author: Aaron Carlisle
Date: Mon Dec 27 16:21:31 2021 -0500
Branches: master
https://developer.blender.org/rBd5b72fb06cd0405c4627d22711ab02804093400c
Nodes: Declare shader nodes in individual file namespace
To be used in the future to support unity builds
===================================================================
M source/blender/nodes/shader/nodes/node_shader_clamp.cc
M source/blender/nodes/shader/nodes/node_shader_curves.cc
M source/blender/nodes/shader/nodes/node_shader_map_range.cc
M source/blender/nodes/shader/nodes/node_shader_math.cc
M source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc
M source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc
M source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc
M source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc
M source/blender/nodes/shader/nodes/node_shader_tex_brick.cc
M source/blender/nodes/shader/nodes/node_shader_tex_checker.cc
M source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc
M source/blender/nodes/shader/nodes/node_shader_tex_image.cc
M source/blender/nodes/shader/nodes/node_shader_tex_magic.cc
M source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc
M source/blender/nodes/shader/nodes/node_shader_tex_noise.cc
M source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc
M source/blender/nodes/shader/nodes/node_shader_tex_wave.cc
M source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc
M source/blender/nodes/shader/nodes/node_shader_value.cc
M source/blender/nodes/shader/nodes/node_shader_vector_math.cc
M source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc
===================================================================
diff --git a/source/blender/nodes/shader/nodes/node_shader_clamp.cc b/source/blender/nodes/shader/nodes/node_shader_clamp.cc
index 6c3457151e5..172bd333259 100644
--- a/source/blender/nodes/shader/nodes/node_shader_clamp.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_clamp.cc
@@ -23,7 +23,7 @@
#include "node_shader_util.h"
-namespace blender::nodes {
+namespace blender::nodes::node_shader_clamp_cc {
static void sh_node_clamp_declare(NodeDeclarationBuilder &b)
{
@@ -34,8 +34,6 @@ static void sh_node_clamp_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("Result"));
};
-} // namespace blender::nodes
-
static void node_shader_init_clamp(bNodeTree *UNUSED(ntree), bNode *node)
{
node->custom1 = NODE_CLAMP_MINMAX; /* clamp type */
@@ -75,15 +73,19 @@ static void sh_node_clamp_build_multi_function(blender::nodes::NodeMultiFunction
}
}
+} // namespace blender::nodes::node_shader_clamp_cc
+
void register_node_type_sh_clamp()
{
+ namespace file_ns = blender::nodes::node_shader_clamp_cc;
+
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_CLAMP, "Clamp", NODE_CLASS_CONVERTER, 0);
- ntype.declare = blender::nodes::sh_node_clamp_declare;
- node_type_init(&ntype, node_shader_init_clamp);
- node_type_gpu(&ntype, gpu_shader_clamp);
- ntype.build_multi_function = sh_node_clamp_build_multi_function;
+ ntype.declare = file_ns::sh_node_clamp_declare;
+ node_type_init(&ntype, file_ns::node_shader_init_clamp);
+ node_type_gpu(&ntype, file_ns::gpu_shader_clamp);
+ ntype.build_multi_function = file_ns::sh_node_clamp_build_multi_function;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.cc b/source/blender/nodes/shader/nodes/node_shader_curves.cc
index 09bbf3d851c..45c1fbdfc8a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.cc
@@ -23,7 +23,7 @@
#include "node_shader_util.h"
-namespace blender::nodes {
+namespace blender::nodes::node_shader_curves_cc {
static void sh_node_curve_vec_declare(NodeDeclarationBuilder &b)
{
@@ -33,8 +33,6 @@ static void sh_node_curve_vec_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Vector>(N_("Vector"));
};
-} // namespace blender::nodes
-
static void node_shader_exec_curve_vec(void *UNUSED(data),
int UNUSED(thread),
bNode *node,
@@ -152,25 +150,29 @@ static void sh_node_curve_vec_build_multi_function(
builder.construct_and_set_matching_fn<CurveVecFunction>(*cumap);
}
+} // namespace blender::nodes::node_shader_curves_cc
+
void register_node_type_sh_curve_vec()
{
+ namespace file_ns = blender::nodes::node_shader_curves_cc;
+
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0);
- ntype.declare = blender::nodes::sh_node_curve_vec_declare;
- node_type_init(&ntype, node_shader_init_curve_vec);
+ ntype.declare = file_ns::sh_node_curve_vec_declare;
+ node_type_init(&ntype, file_ns::node_shader_init_curve_vec);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
- node_type_exec(&ntype, node_initexec_curves, nullptr, node_shader_exec_curve_vec);
- node_type_gpu(&ntype, gpu_shader_curve_vec);
- ntype.build_multi_function = sh_node_curve_vec_build_multi_function;
+ node_type_exec(&ntype, node_initexec_curves, nullptr, file_ns::node_shader_exec_curve_vec);
+ node_type_gpu(&ntype, file_ns::gpu_shader_curve_vec);
+ ntype.build_multi_function = file_ns::sh_node_curve_vec_build_multi_function;
nodeRegisterType(&ntype);
}
/* **************** CURVE RGB ******************** */
-namespace blender::nodes {
+namespace blender::nodes::node_shader_curves_cc {
static void sh_node_curve_rgb_declare(NodeDeclarationBuilder &b)
{
@@ -180,8 +182,6 @@ static void sh_node_curve_rgb_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Color>(N_("Color"));
};
-} // namespace blender::nodes
-
static void node_shader_exec_curve_rgb(void *UNUSED(data),
int UNUSED(thread),
bNode *node,
@@ -329,25 +329,29 @@ static void sh_node_curve_rgb_build_multi_function(
builder.construct_and_set_matching_fn<CurveRGBFunction>(*cumap);
}
+} // namespace blender::nodes::node_shader_curves_cc
+
void register_node_type_sh_curve_rgb()
{
+ namespace file_ns = blender::nodes::node_shader_curves_cc;
+
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, 0);
- ntype.declare = blender::nodes::sh_node_curve_rgb_declare;
- node_type_init(&ntype, node_shader_init_curve_rgb);
+ ntype.declare = file_ns::sh_node_curve_rgb_declare;
+ node_type_init(&ntype, file_ns::node_shader_init_curve_rgb);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
- node_type_exec(&ntype, node_initexec_curves, nullptr, node_shader_exec_curve_rgb);
- node_type_gpu(&ntype, gpu_shader_curve_rgb);
- ntype.build_multi_function = sh_node_curve_rgb_build_multi_function;
+ node_type_exec(&ntype, node_initexec_curves, nullptr, file_ns::node_shader_exec_curve_rgb);
+ node_type_gpu(&ntype, file_ns::gpu_shader_curve_rgb);
+ ntype.build_multi_function = file_ns::sh_node_curve_rgb_build_multi_function;
nodeRegisterType(&ntype);
}
/* **************** CURVE FLOAT ******************** */
-namespace blender::nodes {
+namespace blender::nodes::node_shader_curves_cc {
static void sh_node_curve_float_declare(NodeDeclarationBuilder &b)
{
@@ -361,8 +365,6 @@ static void sh_node_curve_float_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("Value"));
};
-} // namespace blender::nodes
-
static void node_shader_exec_curve_float(void *UNUSED(data),
int UNUSED(thread),
bNode *node,
@@ -473,18 +475,22 @@ static void sh_node_curve_float_build_multi_function(
builder.construct_and_set_matching_fn<CurveFloatFunction>(*cumap);
}
+} // namespace blender::nodes::node_shader_curves_cc
+
void register_node_type_sh_curve_float()
{
+ namespace file_ns = blender::nodes::node_shader_curves_cc;
+
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_CURVE_FLOAT, "Float Curve", NODE_CLASS_CONVERTER, 0);
- ntype.declare = blender::nodes::sh_node_curve_float_declare;
- node_type_init(&ntype, node_shader_init_curve_float);
+ ntype.declare = file_ns::sh_node_curve_float_declare;
+ node_type_init(&ntype, file_ns::node_shader_init_curve_float);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
- node_type_exec(&ntype, node_initexec_curves, nullptr, node_shader_exec_curve_float);
- node_type_gpu(&ntype, gpu_shader_curve_float);
- ntype.build_multi_function = sh_node_curve_float_build_multi_function;
+ node_type_exec(&ntype, node_initexec_curves, nullptr, file_ns::node_shader_exec_curve_float);
+ node_type_gpu(&ntype, file_ns::gpu_shader_curve_float);
+ ntype.build_multi_function = file_ns::sh_node_curve_float_build_multi_function;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_map_range.cc b/source/blender/nodes/shader/nodes/node_shader_map_range.cc
index d0eab8d9727..cfad7b6b887 100644
--- a/source/blender/nodes/shader/nodes/node_shader_map_range.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_map_range.cc
@@ -31,7 +31,7 @@
NODE_STORAGE_FUNCS(NodeMapRange)
-namespace blender::nodes {
+namespace blender::nodes::node_shader_map_range_cc {
static void sh_node_map_range_declare(NodeDeclarationBuilder &b)
{
@@ -149,8 +149,6 @@ static void node_map_range_gather_link_searches(GatherLinkSearchOpParams ¶ms
}
}
-} // namespace blender::nodes
-
static const char *gpu_shader_get_name(int mode, bool use_vector)
{
if (use_vector) {
@@ -205,8 +203,6 @@ static int gpu_shader_map_range(GPUMaterial *mat,
return ret;
}
-namespace blender::nodes {
-
static inline float clamp_range(const float value, const float min, const float max)
{
return (min > max) ? std::clamp(value, max, min) : std::clamp(value, min, max);
@@ -644,20 +640,22 @@ static void sh_node_map_range_build_multi_function(
}
}
-} // namespace blender::nodes
+} // namespace blender::nodes::node_shader_map_range_cc
void register_node_type_sh_map_range()
{
+ namespace file_ns = blender::nodes::node_shader_map_range_cc;
+
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_MAP_RANGE, "Map Range", NODE_CLASS_CONVERTER, 0);
- ntype.declare = blender::nodes::sh_node_map_range_declare;
- node_type_init(&ntype, blender::nodes::node_shader_init_map_range);
+ ntype.declare = file_ns::sh_node_map_range_declare;
+ node_type_init(&ntype, file_ns::node_shader_init_map_range);
node_type_storage(
&ntype, "NodeMapRange", node_free_standard_storage, node_copy_standard_storage);
- node_type_update(&ntype, blender::nodes::node_shader_update_map_range);
- node_type_gpu(&ntype, gpu_shader_map_range);
- ntype.build_multi_function = blender::nodes::sh_node_map_range_build_multi_function;
- ntype.gather_link_search_ops = blender::nodes::node_map_range_gather_link_searches;
+ node_type_update(&ntype, file_ns::node_shader_update_map_range);
+ node_type_gpu(&ntype, file_ns::gpu_shader_map_range);
+ ntype.build_multi_function = file_ns::sh_node_map_range_build_multi_function;
+ ntype.gather_link_search_ops = file_ns::node_map_range_gather_link_searches;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc b/source/blender/nodes/shader/nodes/node_shader_math.cc
index da237be273f..e683d55edc8 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_math.cc
@@ -28,7 +28,7 @@
/* **************** SCALAR MATH ******************** */
-namesp
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list