forked from blender/blender
me-main #1
@ -149,7 +149,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType
|
|||||||
case GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN:
|
case GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN:
|
||||||
input->source = GPU_SOURCE_FUNCTION_CALL;
|
input->source = GPU_SOURCE_FUNCTION_CALL;
|
||||||
/* NOTE(@fclem): End of function call is the return variable set during codegen. */
|
/* NOTE(@fclem): End of function call is the return variable set during codegen. */
|
||||||
SNPRINTF(input->function_call, "dF_branch(%s(), ", link->function_name);
|
SNPRINTF(input->function_call, "dF_branch_incomplete(%s(), ", link->function_name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -228,6 +228,11 @@ void dF_branch(float fn, out vec2 result)
|
|||||||
result = vec2(0.0);
|
result = vec2(0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dF_branch_incomplete(float fn, out vec2 result)
|
||||||
|
{
|
||||||
|
result = vec2(0.0);
|
||||||
|
}
|
||||||
|
|
||||||
#elif 0 /* TODO(@fclem): User Option? */
|
#elif 0 /* TODO(@fclem): User Option? */
|
||||||
/* Fast derivatives */
|
/* Fast derivatives */
|
||||||
vec3 dF_impl(vec3 v)
|
vec3 dF_impl(vec3 v)
|
||||||
@ -257,6 +262,17 @@ vec3 dF_impl(vec3 v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
# define dF_branch(fn, result) \
|
# define dF_branch(fn, result) \
|
||||||
|
if (true) { \
|
||||||
|
g_derivative_flag = 1; \
|
||||||
|
result.x = (fn); \
|
||||||
|
g_derivative_flag = -1; \
|
||||||
|
result.y = (fn); \
|
||||||
|
g_derivative_flag = 0; \
|
||||||
|
result -= vec2((fn)); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Used when the non-offset value is already computed elsewhere */
|
||||||
|
# define dF_branch_incomplete(fn, result) \
|
||||||
if (true) { \
|
if (true) { \
|
||||||
g_derivative_flag = 1; \
|
g_derivative_flag = 1; \
|
||||||
result.x = (fn); \
|
result.x = (fn); \
|
||||||
|
Loading…
Reference in New Issue
Block a user