Cleanup: Remove unused node_type_exec for shader node

From what I can tell these are left over from Blender Internal render.

Test still pass locally, also tested a couple eevee scenes.

Reviewed By: JacquesLucke, brecht

Differential Revision: https://developer.blender.org/D13732
This commit is contained in:
Aaron Carlisle
2022-01-05 11:52:30 -05:00
parent 8cd6d0fe68
commit a0edee712a
19 changed files with 1 additions and 482 deletions

View File

@@ -67,7 +67,7 @@ void sh_fn_node_type_base(bNodeType *ntype, int type, const char *name, short nc
/* ****** */
void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
static void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
{
const float *from = ns->vec;

View File

@@ -83,18 +83,11 @@ void sh_fn_node_type_base(struct bNodeType *ntype, int type, const char *name, s
/* ********* exec data struct, remains internal *********** */
struct ShaderCallData {
/* Empty for now, may be reused if we convert shader to texture nodes. */
int dummy;
};
struct XYZ_to_RGB /* Transposed #imbuf_xyz_to_rgb, passed as 3x vec3. */
{
float r[3], g[3], b[3];
};
void nodestack_get_vec(float *in, short type_in, bNodeStack *ns);
void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, struct bNodeStack *ns);
void node_data_from_gpu_stack(struct bNodeStack *ns, struct GPUNodeStack *gs);
void node_shader_gpu_bump_tex_coord(struct GPUMaterial *mat,

View File

@@ -37,25 +37,6 @@ static void sh_node_valtorgb_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("Alpha"));
};
static void node_shader_exec_valtorgb(void *UNUSED(data),
int UNUSED(thread),
bNode *node,
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
/* stack order in: fac */
/* stack order out: col, alpha */
if (node->storage) {
float fac;
nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
BKE_colorband_evaluate((ColorBand *)node->storage, fac, out[0]->vec);
out[1]->vec[0] = out[0]->vec[3];
}
}
static void node_shader_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node)
{
node->storage = BKE_colorband_add(true);
@@ -181,7 +162,6 @@ void register_node_type_sh_valtorgb()
node_type_init(&ntype, file_ns::node_shader_init_valtorgb);
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_valtorgb);
node_type_gpu(&ntype, file_ns::gpu_shader_valtorgb);
ntype.build_multi_function = file_ns::sh_node_valtorgb_build_multi_function;

View File

@@ -35,127 +35,8 @@
#include "RNA_access.h"
static void copy_stack(bNodeStack *to, bNodeStack *from)
{
if (to != from) {
copy_v4_v4(to->vec, from->vec);
to->data = from->data;
to->datatype = from->datatype;
/* tag as copy to prevent freeing */
to->is_copy = 1;
}
}
static void move_stack(bNodeStack *to, bNodeStack *from)
{
if (to != from) {
copy_v4_v4(to->vec, from->vec);
to->data = from->data;
to->datatype = from->datatype;
to->is_copy = from->is_copy;
from->data = nullptr;
from->is_copy = 0;
}
}
/**** GROUP ****/
static void *group_initexec(bNodeExecContext *context, bNode *node, bNodeInstanceKey key)
{
bNodeTree *ngroup = (bNodeTree *)node->id;
bNodeTreeExec *exec;
if (!ngroup) {
return nullptr;
}
/* initialize the internal node tree execution */
exec = ntreeShaderBeginExecTree_internal(context, ngroup, key);
return exec;
}
static void group_freeexec(void *nodedata)
{
bNodeTreeExec *gexec = (bNodeTreeExec *)nodedata;
if (gexec) {
ntreeShaderEndExecTree_internal(gexec);
}
}
/* Copy inputs to the internal stack.
*/
static void group_copy_inputs(bNode *gnode, bNodeStack **in, bNodeStack *gstack)
{
bNodeTree *ngroup = (bNodeTree *)gnode->id;
LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) {
if (node->type == NODE_GROUP_INPUT) {
int a;
LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, a) {
bNodeStack *ns = node_get_socket_stack(gstack, sock);
if (ns) {
copy_stack(ns, in[a]);
}
}
}
}
}
/* Copy internal results to the external outputs.
*/
static void group_move_outputs(bNode *gnode, bNodeStack **out, bNodeStack *gstack)
{
bNodeTree *ngroup = (bNodeTree *)gnode->id;
LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) {
if (node->type == NODE_GROUP_OUTPUT && (node->flag & NODE_DO_OUTPUT)) {
int a;
LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->inputs, a) {
bNodeStack *ns = node_get_socket_stack(gstack, sock);
if (ns) {
move_stack(out[a], ns);
}
}
break; /* only one active output node */
}
}
}
static void group_execute(void *data,
int thread,
struct bNode *node,
bNodeExecData *execdata,
struct bNodeStack **in,
struct bNodeStack **out)
{
bNodeTreeExec *exec = static_cast<bNodeTreeExec *>(execdata->data);
if (!exec) {
return;
}
/* XXX same behavior as trunk: all nodes inside group are executed.
* it's stupid, but just makes it work. compo redesign will do this better.
*/
{
LISTBASE_FOREACH (bNode *, inode, &exec->nodetree->nodes) {
inode->need_exec = 1;
}
}
bNodeThreadStack *nts = ntreeGetThreadStack(exec, thread);
group_copy_inputs(node, in, nts->stack);
ntreeExecThreadNodes(exec, nts, data, thread);
group_move_outputs(node, out, nts->stack);
ntreeReleaseThreadStack(nts);
}
static void group_gpu_copy_inputs(bNode *gnode, GPUNodeStack *in, bNodeStack *gstack)
{
bNodeTree *ngroup = (bNodeTree *)gnode->id;
@@ -231,7 +112,6 @@ void register_node_type_sh_group()
node_type_size(&ntype, 140, 60, 400);
ntype.labelfunc = node_group_label;
node_type_group_update(&ntype, node_group_update);
node_type_exec(&ntype, group_initexec, group_freeexec, group_execute);
node_type_gpu(&ntype, gpu_group_execute);
nodeRegisterType(&ntype);
@@ -247,6 +127,5 @@ void register_node_type_sh_custom_group(bNodeType *ntype)
ntype->insert_link = node_insert_link_default;
}
node_type_exec(ntype, group_initexec, group_freeexec, group_execute);
node_type_gpu(ntype, gpu_group_execute);
}

View File

@@ -33,21 +33,6 @@ static void sh_node_curve_vec_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Vector>(N_("Vector"));
};
static void node_shader_exec_curve_vec(void *UNUSED(data),
int UNUSED(thread),
bNode *node,
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float vec[3];
/* stack order input: vec */
/* stack order output: vec */
nodestack_get_vec(vec, SOCK_VECTOR, in[1]);
BKE_curvemapping_evaluate3F((CurveMapping *)node->storage, out[0]->vec, vec);
}
static void node_shader_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node)
{
node->storage = BKE_curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
@@ -163,7 +148,6 @@ void register_node_type_sh_curve_vec()
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, 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;
@@ -182,26 +166,6 @@ static void sh_node_curve_rgb_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Color>(N_("Color"));
};
static void node_shader_exec_curve_rgb(void *UNUSED(data),
int UNUSED(thread),
bNode *node,
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float vec[3];
float fac;
/* stack order input: vec */
/* stack order output: vec */
nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
nodestack_get_vec(vec, SOCK_VECTOR, in[1]);
BKE_curvemapping_evaluateRGBF((CurveMapping *)node->storage, out[0]->vec, vec);
if (fac != 1.0f) {
interp_v3_v3v3(out[0]->vec, vec, out[0]->vec, fac);
}
}
static void node_shader_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node)
{
node->storage = BKE_curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
@@ -342,7 +306,6 @@ void register_node_type_sh_curve_rgb()
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, 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;
@@ -365,24 +328,6 @@ static void sh_node_curve_float_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("Value"));
};
static void node_shader_exec_curve_float(void *UNUSED(data),
int UNUSED(thread),
bNode *node,
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float value;
float fac;
nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
nodestack_get_vec(&value, SOCK_FLOAT, in[1]);
out[0]->vec[0] = BKE_curvemapping_evaluateF((CurveMapping *)node->storage, 0, value);
if (fac != 1.0f) {
out[0]->vec[0] = (1.0f - fac) * value + fac * out[0]->vec[0];
}
}
static void node_shader_init_curve_float(bNodeTree *UNUSED(ntree), bNode *node)
{
node->storage = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
@@ -488,7 +433,6 @@ void register_node_type_sh_curve_float()
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, 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;

View File

@@ -50,15 +50,6 @@ static int node_shader_gpu_fresnel(GPUMaterial *mat,
return GPU_stack_link(mat, node, "node_fresnel", in, out, GPU_builtin(GPU_VIEW_POSITION));
}
static void node_shader_exec_fresnel(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **UNUSED(in),
bNodeStack **UNUSED(out))
{
}
} // namespace blender::nodes::node_shader_fresnel_cc
/* node type definition */
@@ -71,7 +62,6 @@ void register_node_type_sh_fresnel()
sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT);
node_type_socket_templates(&ntype, file_ns::sh_node_fresnel_in, file_ns::sh_node_fresnel_out);
node_type_gpu(&ntype, file_ns::node_shader_gpu_fresnel);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_fresnel);
nodeRegisterType(&ntype);
}

View File

@@ -34,23 +34,6 @@ static bNodeSocketTemplate sh_node_gamma_out[] = {
{-1, ""},
};
static void node_shader_exec_gamma(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float col[3];
float gamma;
nodestack_get_vec(col, SOCK_VECTOR, in[0]);
nodestack_get_vec(&gamma, SOCK_FLOAT, in[1]);
out[0]->vec[0] = col[0] > 0.0f ? powf(col[0], gamma) : col[0];
out[0]->vec[1] = col[1] > 0.0f ? powf(col[1], gamma) : col[1];
out[0]->vec[2] = col[2] > 0.0f ? powf(col[2], gamma) : col[2];
}
static int node_shader_gpu_gamma(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -70,7 +53,6 @@ void register_node_type_sh_gamma()
sh_node_type_base(&ntype, SH_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR);
node_type_socket_templates(&ntype, file_ns::sh_node_gamma_in, file_ns::sh_node_gamma_out);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_gamma);
node_type_gpu(&ntype, file_ns::node_shader_gpu_gamma);
nodeRegisterType(&ntype);

View File

@@ -39,45 +39,6 @@ static bNodeSocketTemplate sh_node_hue_sat_out[] = {
{-1, ""},
};
/* NOTE: it would be possible to use CMP version for both nodes. */
static void do_hue_sat_fac(
bNode *UNUSED(node), float *out, float hue, float sat, float val, const float in[4], float fac)
{
if (fac != 0.0f && (hue != 0.5f || sat != 1.0f || val != 1.0f)) {
float col[3], hsv[3], mfac = 1.0f - fac;
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv + 1, hsv + 2);
hsv[0] = fmodf(hsv[0] + hue + 0.5f, 1.0f);
hsv[1] = clamp_f(hsv[1] * sat, 0.0f, 1.0f);
hsv[2] *= val;
hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col + 1, col + 2);
out[0] = mfac * in[0] + fac * col[0];
out[1] = mfac * in[1] + fac * col[1];
out[2] = mfac * in[2] + fac * col[2];
}
else {
copy_v4_v4(out, in);
}
}
static void node_shader_exec_hue_sat(void *UNUSED(data),
int UNUSED(thread),
bNode *node,
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float hue, sat, val, fac;
float col[4];
nodestack_get_vec(&hue, SOCK_FLOAT, in[0]);
nodestack_get_vec(&sat, SOCK_FLOAT, in[1]);
nodestack_get_vec(&val, SOCK_FLOAT, in[2]);
nodestack_get_vec(&fac, SOCK_FLOAT, in[3]);
nodestack_get_vec(col, SOCK_RGBA, in[4]);
do_hue_sat_fac(node, out[0]->vec, hue, sat, val, col, fac);
}
static int gpu_shader_hue_sat(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -98,7 +59,6 @@ void register_node_type_sh_hue_sat()
sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR);
node_type_socket_templates(&ntype, file_ns::sh_node_hue_sat_in, file_ns::sh_node_hue_sat_out);
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_hue_sat);
node_type_gpu(&ntype, file_ns::gpu_shader_hue_sat);
nodeRegisterType(&ntype);

View File

@@ -33,31 +33,6 @@ static bNodeSocketTemplate sh_node_invert_in[] = {
static bNodeSocketTemplate sh_node_invert_out[] = {{SOCK_RGBA, N_("Color")}, {-1, ""}};
static void node_shader_exec_invert(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float col[3], icol[3], fac;
nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
nodestack_get_vec(col, SOCK_VECTOR, in[1]);
icol[0] = 1.0f - col[0];
icol[1] = 1.0f - col[1];
icol[2] = 1.0f - col[2];
/* if fac, blend result against original input */
if (fac < 1.0f) {
interp_v3_v3v3(out[0]->vec, col, icol, fac);
}
else {
copy_v3_v3(out[0]->vec, icol);
}
}
static int gpu_shader_invert(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -77,7 +52,6 @@ void register_node_type_sh_invert()
sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR);
node_type_socket_templates(&ntype, file_ns::sh_node_invert_in, file_ns::sh_node_invert_out);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_invert);
node_type_gpu(&ntype, file_ns::gpu_shader_invert);
nodeRegisterType(&ntype);

View File

@@ -52,15 +52,6 @@ static int node_shader_gpu_layer_weight(GPUMaterial *mat,
return GPU_stack_link(mat, node, "node_layer_weight", in, out, GPU_builtin(GPU_VIEW_POSITION));
}
static void node_shader_exec_layer_weight(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **UNUSED(in),
bNodeStack **UNUSED(out))
{
}
} // namespace blender::nodes::node_shader_layer_weight_cc
/* node type definition */
@@ -74,7 +65,6 @@ void register_node_type_sh_layer_weight()
node_type_socket_templates(
&ntype, file_ns::sh_node_layer_weight_in, file_ns::sh_node_layer_weight_out);
node_type_gpu(&ntype, file_ns::node_shader_gpu_layer_weight);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_layer_weight);
nodeRegisterType(&ntype);
}

View File

@@ -34,32 +34,6 @@ static void sh_node_mix_rgb_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Color>(N_("Color"));
};
static void node_shader_exec_mix_rgb(void *UNUSED(data),
int UNUSED(thread),
bNode *node,
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
/* stack order in: fac, col1, col2 */
/* stack order out: col */
float col[3];
float fac;
float vec[3];
nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
CLAMP(fac, 0.0f, 1.0f);
nodestack_get_vec(col, SOCK_VECTOR, in[1]);
nodestack_get_vec(vec, SOCK_VECTOR, in[2]);
ramp_blend(node->custom1, col, fac, vec);
if (node->custom2 & SHD_MIXRGB_CLAMP) {
CLAMP3(col, 0.0f, 1.0f);
}
copy_v3_v3(out[0]->vec, col);
}
static const char *gpu_shader_get_name(int mode)
{
switch (mode) {
@@ -192,7 +166,6 @@ void register_node_type_sh_mix_rgb()
sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR);
ntype.declare = file_ns::sh_node_mix_rgb_declare;
ntype.labelfunc = node_blend_label;
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_mix_rgb);
node_type_gpu(&ntype, file_ns::gpu_shader_mix_rgb);
ntype.build_multi_function = file_ns::sh_node_mix_rgb_build_multi_function;

View File

@@ -37,25 +37,6 @@ static bNodeSocketTemplate sh_node_normal_out[] = {
{-1, ""},
};
/* generates normal, does dot product */
static void node_shader_exec_normal(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float vec[3];
/* stack order input: normal */
/* stack order output: normal, value */
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
/* render normals point inside... the widget points outside */
out[1]->vec[0] = -dot_v3v3(vec, out[0]->vec);
}
static int gpu_shader_normal(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -76,7 +57,6 @@ void register_node_type_sh_normal()
sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR);
node_type_socket_templates(&ntype, file_ns::sh_node_normal_in, file_ns::sh_node_normal_out);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_normal);
node_type_gpu(&ntype, file_ns::gpu_shader_normal);
nodeRegisterType(&ntype);

View File

@@ -40,15 +40,6 @@ static void node_shader_init_normal_map(bNodeTree *UNUSED(ntree), bNode *node)
node->storage = attr;
}
static void node_shader_exec_normal_map(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **UNUSED(in),
bNodeStack **UNUSED(out))
{
}
static int gpu_shader_normal_map(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -134,7 +125,6 @@ void register_node_type_sh_normal_map()
node_type_storage(
&ntype, "NodeShaderNormalMap", node_free_standard_storage, node_copy_standard_storage);
node_type_gpu(&ntype, file_ns::gpu_shader_normal_map);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_normal_map);
nodeRegisterType(&ntype);
}

View File

@@ -37,14 +37,6 @@ static bNodeSocketTemplate outputs[] = {
{SOCK_VECTOR, "Angular Velocity"},
{-1, ""},
};
static void node_shader_exec_particle_info(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **UNUSED(in),
bNodeStack **UNUSED(out))
{
}
static int gpu_shader_particle_info(GPUMaterial *mat,
bNode *node,
@@ -75,7 +67,6 @@ void register_node_type_sh_particle_info()
sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT);
node_type_socket_templates(&ntype, nullptr, file_ns::outputs);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_particle_info);
node_type_gpu(&ntype, file_ns::gpu_shader_particle_info);
nodeRegisterType(&ntype);

View File

@@ -33,21 +33,6 @@ static void sh_node_rgbtobw_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("Val"));
};
static void node_shader_exec_rgbtobw(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
/* Stack order out: BW. */
/* Stack order in: COL. */
float col[3];
nodestack_get_vec(col, SOCK_VECTOR, in[0]);
out[0]->vec[0] = IMB_colormanagement_get_luminance(col);
}
static int gpu_shader_rgbtobw(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -67,7 +52,6 @@ void register_node_type_sh_rgbtobw()
sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_rgbtobw_declare;
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_rgbtobw);
node_type_gpu(&ntype, file_ns::gpu_shader_rgbtobw);
nodeRegisterType(&ntype);

View File

@@ -37,19 +37,6 @@ static bNodeSocketTemplate sh_node_sephsv_out[] = {
{-1, ""},
};
static void node_shader_exec_sephsv(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float col[3];
nodestack_get_vec(col, SOCK_VECTOR, in[0]);
rgb_to_hsv(col[0], col[1], col[2], &out[0]->vec[0], &out[1]->vec[0], &out[2]->vec[0]);
}
static int gpu_shader_sephsv(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -69,7 +56,6 @@ void register_node_type_sh_sephsv()
sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTER);
node_type_socket_templates(&ntype, file_ns::sh_node_sephsv_in, file_ns::sh_node_sephsv_out);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_sephsv);
node_type_gpu(&ntype, file_ns::gpu_shader_sephsv);
nodeRegisterType(&ntype);
@@ -89,21 +75,6 @@ static bNodeSocketTemplate sh_node_combhsv_out[] = {
{-1, ""},
};
static void node_shader_exec_combhsv(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float h, s, v;
nodestack_get_vec(&h, SOCK_FLOAT, in[0]);
nodestack_get_vec(&s, SOCK_FLOAT, in[1]);
nodestack_get_vec(&v, SOCK_FLOAT, in[2]);
hsv_to_rgb(h, s, v, &out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2]);
}
static int gpu_shader_combhsv(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -123,7 +94,6 @@ void register_node_type_sh_combhsv()
sh_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTER);
node_type_socket_templates(&ntype, file_ns::sh_node_combhsv_in, file_ns::sh_node_combhsv_out);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_combhsv);
node_type_gpu(&ntype, file_ns::gpu_shader_combhsv);
nodeRegisterType(&ntype);

View File

@@ -34,21 +34,6 @@ static void sh_node_seprgb_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Float>(N_("B"));
};
static void node_shader_exec_seprgb(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float col[3];
nodestack_get_vec(col, SOCK_VECTOR, in[0]);
out[0]->vec[0] = col[0];
out[1]->vec[0] = col[1];
out[2]->vec[0] = col[2];
}
static int gpu_shader_seprgb(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -111,7 +96,6 @@ void register_node_type_sh_seprgb()
sh_fn_node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_seprgb_declare;
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_seprgb);
node_type_gpu(&ntype, file_ns::gpu_shader_seprgb);
ntype.build_multi_function = file_ns::sh_node_seprgb_build_multi_function;
@@ -129,23 +113,6 @@ static void sh_node_combrgb_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Color>(N_("Image"));
};
static void node_shader_exec_combrgb(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float r, g, b;
nodestack_get_vec(&r, SOCK_FLOAT, in[0]);
nodestack_get_vec(&g, SOCK_FLOAT, in[1]);
nodestack_get_vec(&b, SOCK_FLOAT, in[2]);
out[0]->vec[0] = r;
out[0]->vec[1] = g;
out[0]->vec[2] = b;
}
static int gpu_shader_combrgb(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -173,7 +140,6 @@ void register_node_type_sh_combrgb()
sh_fn_node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTER);
ntype.declare = file_ns::sh_node_combrgb_declare;
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_combrgb);
node_type_gpu(&ntype, file_ns::gpu_shader_combrgb);
ntype.build_multi_function = file_ns::sh_node_combrgb_build_multi_function;

View File

@@ -34,22 +34,6 @@ static bNodeSocketTemplate sh_node_squeeze_in[] = {
static bNodeSocketTemplate sh_node_squeeze_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}};
static void node_shader_exec_squeeze(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **in,
bNodeStack **out)
{
float vec[3];
nodestack_get_vec(vec, SOCK_FLOAT, in[0]);
nodestack_get_vec(vec + 1, SOCK_FLOAT, in[1]);
nodestack_get_vec(vec + 2, SOCK_FLOAT, in[2]);
out[0]->vec[0] = 1.0f / (1.0f + powf(M_E, -((vec[0] - vec[2]) * vec[1])));
}
static int gpu_shader_squeeze(GPUMaterial *mat,
bNode *node,
bNodeExecData *UNUSED(execdata),
@@ -69,7 +53,6 @@ void register_node_type_sh_squeeze()
sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTER);
node_type_socket_templates(&ntype, file_ns::sh_node_squeeze_in, file_ns::sh_node_squeeze_out);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_squeeze);
node_type_gpu(&ntype, file_ns::gpu_shader_squeeze);
nodeRegisterType(&ntype);

View File

@@ -44,15 +44,6 @@ static void node_shader_init_vect_transform(bNodeTree *UNUSED(ntree), bNode *nod
node->storage = vect;
}
static void node_shader_exec_vect_transform(void *UNUSED(data),
int UNUSED(thread),
bNode *UNUSED(node),
bNodeExecData *UNUSED(execdata),
bNodeStack **UNUSED(in),
bNodeStack **UNUSED(out))
{
}
static GPUNodeLink *get_gpulink_matrix_from_to(short from, short to)
{
switch (from) {
@@ -152,7 +143,6 @@ void register_node_type_sh_vect_transform()
&ntype, file_ns::sh_node_vect_transform_in, file_ns::sh_node_vect_transform_out);
node_type_storage(
&ntype, "NodeShaderVectTransform", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_vect_transform);
node_type_gpu(&ntype, file_ns::gpu_shader_vect_transform);
nodeRegisterType(&ntype);