[Bf-blender-cvs] [f40b793] object_nodes: Use a more consistent naming scheme for value and derivative functions with prefixes.
Lukas Tönne
noreply at git.blender.org
Fri May 27 11:02:25 CEST 2016
Commit: f40b79378cbb426de32a1027233d4a2c8535c264
Author: Lukas Tönne
Date: Fri May 27 09:37:24 2016 +0200
Branches: object_nodes
https://developer.blender.org/rBf40b79378cbb426de32a1027233d4a2c8535c264
Use a more consistent naming scheme for value and derivative functions with prefixes.
===================================================================
M source/blender/blenvm/llvm/llvm_compiler_dual.cc
M source/blender/blenvm/llvm/llvm_engine.cc
M source/blender/blenvm/llvm/llvm_modules.cc
M source/blender/blenvm/llvm/llvm_modules.h
M source/blender/blenvm/modules/mod_base.h
M source/blender/blenvm/modules/mod_color.h
M source/blender/blenvm/modules/mod_defines.h
M source/blender/blenvm/modules/mod_math.h
M source/blender/blenvm/modules/mod_texture.h
M source/blender/blenvm/modules/modules.h
===================================================================
diff --git a/source/blender/blenvm/llvm/llvm_compiler_dual.cc b/source/blender/blenvm/llvm/llvm_compiler_dual.cc
index 6f4a145..83921c6 100644
--- a/source/blender/blenvm/llvm/llvm_compiler_dual.cc
+++ b/source/blender/blenvm/llvm/llvm_compiler_dual.cc
@@ -282,12 +282,12 @@ void LLVMTextureCompiler::define_elementary_functions(llvm::Module *mod, OpCode
if (llvm_has_external_impl_value(op)) {
value_func = declare_elementary_node_function(
- mod, nodetype, llvm_value_function_name(nodetype->name()), false);
+ mod, nodetype, bvm_value_function_name(nodetype->name()), false);
}
if (llvm_has_external_impl_deriv(op)) {
deriv_func = declare_elementary_node_function(
- mod, nodetype, llvm_deriv_function_name(nodetype->name()), true);
+ mod, nodetype, bvm_deriv_function_name(nodetype->name()), true);
}
set_node_function_impl(op, nodetype, value_func, deriv_func);
@@ -298,11 +298,11 @@ void LLVMTextureCompiler::define_dual_function_wrapper(llvm::Module *mod, OpCode
using namespace llvm;
/* get evaluation function(s) */
- string value_name = llvm_value_function_name(nodetype->name());
+ string value_name = bvm_value_function_name(nodetype->name());
Function *value_func = llvm_find_external_function(mod, value_name);
BLI_assert(value_func != NULL && "Could not find node function!");
- string deriv_name = llvm_deriv_function_name(nodetype->name());
+ string deriv_name = bvm_deriv_function_name(nodetype->name());
Function *deriv_func = llvm_find_external_function(mod, deriv_name);
/* wrapper function */
diff --git a/source/blender/blenvm/llvm/llvm_engine.cc b/source/blender/blenvm/llvm/llvm_engine.cc
index ef275f0..976af9e 100644
--- a/source/blender/blenvm/llvm/llvm_engine.cc
+++ b/source/blender/blenvm/llvm/llvm_engine.cc
@@ -83,9 +83,9 @@ public:
static void *get_node_function_ptr(const string &name) {
#define DEF_OPCODE(op) \
- if (name == llvm_value_function_name(STRINGIFY(op))) \
+ if (name == bvm_value_function_name(STRINGIFY(op))) \
return modules::get_node_impl_value<OP_##op>(); \
- else if (name == llvm_deriv_function_name(STRINGIFY(op))) \
+ else if (name == bvm_deriv_function_name(STRINGIFY(op))) \
return modules::get_node_impl_deriv<OP_##op>(); \
else
diff --git a/source/blender/blenvm/llvm/llvm_modules.cc b/source/blender/blenvm/llvm/llvm_modules.cc
index ada2ef5..640becb 100644
--- a/source/blender/blenvm/llvm/llvm_modules.cc
+++ b/source/blender/blenvm/llvm/llvm_modules.cc
@@ -202,17 +202,6 @@ void llvm_unload_all_modules()
theModules.clear();
}
-
-string llvm_value_function_name(const string &node)
-{
- return "VAL__" + node;
-}
-
-string llvm_deriv_function_name(const string &node)
-{
- return "D__" + node;
-}
-
/* ------------------------------------------------------------------------- */
void def_node_VALUE_FLOAT(llvm::LLVMContext &context, llvm::BasicBlock *block,
diff --git a/source/blender/blenvm/llvm/llvm_modules.h b/source/blender/blenvm/llvm/llvm_modules.h
index 2ba729c..a7fe0d2 100644
--- a/source/blender/blenvm/llvm/llvm_modules.h
+++ b/source/blender/blenvm/llvm/llvm_modules.h
@@ -50,9 +50,6 @@ void llvm_load_module(const string &modfile, const string &modname);
void llvm_load_all_modules(const string &modpath, bool reload);
void llvm_unload_all_modules();
-string llvm_value_function_name(const string &node);
-string llvm_deriv_function_name(const string &node);
-
/* ------------------------------------------------------------------------- */
void def_node_VALUE_FLOAT(llvm::LLVMContext &context, llvm::BasicBlock *block,
diff --git a/source/blender/blenvm/modules/mod_base.h b/source/blender/blenvm/modules/mod_base.h
index 97043b6..4ed4bf6 100644
--- a/source/blender/blenvm/modules/mod_base.h
+++ b/source/blender/blenvm/modules/mod_base.h
@@ -40,134 +40,134 @@ extern "C" {
BVM_MOD_NAMESPACE_BEGIN
-bvm_extern void NOOP(void)
+bvm_extern void V__NOOP(void)
{
}
BVM_DECL_FUNCTION_VALUE(NOOP)
-bvm_extern void VALUE_FLOAT(float &result, float value)
+bvm_extern void V__VALUE_FLOAT(float &result, float value)
{
result = value;
}
-bvm_extern void VALUE_FLOAT_D(float &dr, float /*f*/)
+bvm_extern void D__VALUE_FLOAT(float &dr, float /*f*/)
{
dr = 0.0f;
}
-BVM_DECL_FUNCTION_DUAL(VALUE_FLOAT, VALUE_FLOAT_D)
+BVM_DECL_FUNCTION_DUAL(VALUE_FLOAT)
-bvm_extern void VALUE_FLOAT3(float3 &result, const float3 &value)
+bvm_extern void V__VALUE_FLOAT3(float3 &result, const float3 &value)
{
result = value;
}
-bvm_extern void VALUE_FLOAT3_D(float3 &dr, const float3 &/*f*/)
+bvm_extern void D__VALUE_FLOAT3(float3 &dr, const float3 &/*f*/)
{
dr = float3(0.0f, 0.0f, 0.0f);
}
-BVM_DECL_FUNCTION_DUAL(VALUE_FLOAT3, VALUE_FLOAT3_D)
+BVM_DECL_FUNCTION_DUAL(VALUE_FLOAT3)
-bvm_extern void VALUE_FLOAT4(float4 &result, const float4 &value)
+bvm_extern void V__VALUE_FLOAT4(float4 &result, const float4 &value)
{
result = value;
}
-bvm_extern void VALUE_FLOAT4_D(float4 &dr, const float4 &/*f*/)
+bvm_extern void D__VALUE_FLOAT4(float4 &dr, const float4 &/*f*/)
{
dr = float4(0.0f, 0.0f, 0.0f, 0.0f);
}
-BVM_DECL_FUNCTION_DUAL(VALUE_FLOAT4, VALUE_FLOAT4_D)
+BVM_DECL_FUNCTION_DUAL(VALUE_FLOAT4)
-bvm_extern void VALUE_INT(int &result, int value)
+bvm_extern void V__VALUE_INT(int &result, int value)
{
result = value;
}
BVM_DECL_FUNCTION_VALUE(VALUE_INT)
-bvm_extern void VALUE_MATRIX44(matrix44 &result, const matrix44 &value)
+bvm_extern void V__VALUE_MATRIX44(matrix44 &result, const matrix44 &value)
{
result = value;
}
BVM_DECL_FUNCTION_VALUE(VALUE_MATRIX44)
-bvm_extern void VALUE_STRING(const char *&result, const char *value)
+bvm_extern void V__VALUE_STRING(const char *&result, const char *value)
{
result = value;
}
BVM_DECL_FUNCTION_VALUE(VALUE_STRING)
-bvm_extern void VALUE_RNAPOINTER(PointerRNA &result, const PointerRNA &value)
+bvm_extern void V__VALUE_RNAPOINTER(PointerRNA &result, const PointerRNA &value)
{
result = value;
}
BVM_DECL_FUNCTION_VALUE(VALUE_RNAPOINTER)
-bvm_extern void VALUE_MESH(mesh_ptr &result, const mesh_ptr &value)
+bvm_extern void V__VALUE_MESH(mesh_ptr &result, const mesh_ptr &value)
{
result = value;
}
BVM_DECL_FUNCTION_VALUE(VALUE_MESH)
-bvm_extern void VALUE_DUPLIS(duplis_ptr &result, const duplis_ptr &value)
+bvm_extern void V__VALUE_DUPLIS(duplis_ptr &result, const duplis_ptr &value)
{
result = value;
}
BVM_DECL_FUNCTION_VALUE(VALUE_DUPLIS)
-bvm_extern void FLOAT_TO_INT(int &result, float value)
+bvm_extern void V__FLOAT_TO_INT(int &result, float value)
{
result = (int)value;
}
BVM_DECL_FUNCTION_VALUE(FLOAT_TO_INT)
-bvm_extern void INT_TO_FLOAT(float &result, int value)
+bvm_extern void V__INT_TO_FLOAT(float &result, int value)
{
result = (float)value;
}
BVM_DECL_FUNCTION_VALUE(INT_TO_FLOAT)
-bvm_extern void SET_FLOAT3(float3 &result, float x, float y, float z)
+bvm_extern void V__SET_FLOAT3(float3 &result, float x, float y, float z)
{
result = float3(x, y, z);
}
-bvm_extern void SET_FLOAT3_D(float3 &dr, float /*x*/, float dx, float /*y*/, float dy, float /*z*/, float dz)
+bvm_extern void D__SET_FLOAT3(float3 &dr, float /*x*/, float dx, float /*y*/, float dy, float /*z*/, float dz)
{
dr = float3(dx, dy, dz);
}
-BVM_DECL_FUNCTION_DUAL(SET_FLOAT3, SET_FLOAT3_D)
+BVM_DECL_FUNCTION_DUAL(SET_FLOAT3)
-bvm_extern void GET_ELEM_FLOAT3(float &result, int index, const float3 &f)
+bvm_extern void V__GET_ELEM_FLOAT3(float &result, int index, const float3 &f)
{
BLI_assert(index >= 0 && index < 3);
result = f[index];
}
-bvm_extern void GET_ELEM_FLOAT3_D(float &dr, int index, const float3 &/*f*/, const float3 &df)
+bvm_extern void D__GET_ELEM_FLOAT3(float &dr, int index, const float3 &/*f*/, const float3 &df)
{
BLI_assert(index >= 0 && index < 3);
dr = df[index];
}
-BVM_DECL_FUNCTION_DUAL(GET_ELEM_FLOAT3, GET_ELEM_FLOAT3_D)
+BVM_DECL_FUNCTION_DUAL(GET_ELEM_FLOAT3)
-bvm_extern void SET_FLOAT4(float4 &result, float x, float y, float z, float w)
+bvm_extern void V__SET_FLOAT4(float4 &result, float x, float y, float z, float w)
{
result = float4(x, y, z, w);
}
-bvm_extern void SET_FLOAT4_D(float4 &dr,
+bvm_extern void D__SET_FLOAT4(float4 &dr,
float /*x*/, float dx, float /*y*/, float dy,
float /*z*/, float dz, float /*w*/, float dw)
{
dr = float4(dx, dy, dz, dw);
}
-BVM_DECL_FUNCTION_DUAL(SET_FLOAT4, SET_FLOAT4_D)
+BVM_DECL_FUNCTION_DUAL(SET_FLOAT4)
-bvm_extern void GET_ELEM_FLOAT4(float &result, int index, const float4 &f)
+bvm_extern void V__GET_ELEM_FLOAT4(float &result, int index, const float4 &f)
{
BLI_assert(index >= 0 && index < 4);
result = f[index];
}
-bvm_extern void GET_ELEM_FLOAT4_D(float &dr, int index, const float4 &/*f*/, const float4 &df)
+bvm_extern void D__GET_ELEM_FLOAT4(float &dr, int index, const float4 &/*f*/, const float4 &df)
{
BLI_assert(index >= 0 && index < 4);
dr = df[index];
}
-BVM_DECL_FUNCTION_DUAL(GET_ELEM_FLOAT4, GET_ELEM_FLOAT4_D)
+BVM_DECL_FUNCTION_DUAL(GET_ELEM_FLOAT4)
BVM_MOD_NAMESPACE_END
diff --git a/source/blender/blenvm/modules/mod_color.h b/source/blender/blenvm/modules/mod_color.h
index 7d3d57b..fbc39f5 100644
--- a/source/blender/blenvm/modules/mod_color.h
+++ b/source/blender/blenvm/modules/mod_color.h
@@ -271,7 +271,7 @@ inline void MIX_RGB3(float3 &result, int mode, float fac,
}
/* wrapper for float4 RGBA mixing (copies alpha from col_a) */
-bvm_extern void MIX_RGB(float4 &result, int mode, float fac,
+bvm_extern void V__MIX_RGB(float4 &result, int mode, float fac,
const float4 &col_a, const float4 &col_b)
{
float3 result3, col_a3(col_a.x, col_a.y, col_a.z), col_b3(col_b.x, col_b.y, col_b.z);
diff --git a/source/blender/blenvm/modules/mod_defines.h b/source/blender/blenvm/modules/mod_defines.h
index 12113b4..1674512 100644
--- a/source/blender/blenvm/modules/mod_defines.h
+++ b/source/blender/blenvm/modules/mod_defines.h
@@ -41,10 +41,10 @@ BVM_MOD_NAMESPACE_BEGIN
extern "C" inline
#define BVM_DECL_FUNCTION_VALUE(name) \
- template <> inline void *get_node_impl_value<OP_##name>() { return (void*)(intptr_t)name; }
-#de
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list