Fix T59501: Eevee doesn't use integer node sockets

This is a hacky fix. We just convert the int as a float and use it as such.

This works ok for small int but will not be correct for numbers greater
than 4194303.

Correct support would require deeper change for UBO creation and socket
conversion.
This commit is contained in:
Clément Foucault 2019-03-13 01:20:44 +01:00
parent af0ab15e1d
commit bf9904ec80
Notes: blender-bot 2023-02-14 06:17:17 +01:00
Referenced by issue #63165, Freez S.0. Linux and win 10 pro
Referenced by issue #62651, Dual monitor on separate graphics card driver error
Referenced by issue #62621, object scale changes tangent node output in Eevee
Referenced by issue #62563, Hair Dynamics: cannot generate a valid particle cache
Referenced by issue #62564, Object with "Viewport display" - "Display as" "Box" and "Wireframe" are not displays in render (EEVEE)
Referenced by issue #62566, Cubemap doesn't bake from current frame of animation.
Referenced by issue #62569, Big 16-bit PNG files don't support Non-color data (EEVEE)
Referenced by issue #62548, Reflection cubemap doesn't bake from objects, displayed as box.
Referenced by issue #62528, data transfer modifier error
Referenced by issue #62529, Jerky animation in viewport
Referenced by issue #62522, switch between edit and object mode is very slow when subsurface modifier is active.
Referenced by issue #59501, Eevee doesn't use integer node sockets
4 changed files with 16 additions and 1 deletions

View File

@ -1394,6 +1394,8 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType
static const char *gpu_uniform_set_function_from_type(eNodeSocketDatatype type)
{
switch (type) {
/* For now INT is supported as float. */
case SOCK_INT:
case SOCK_FLOAT:
return "set_value";
case SOCK_VECTOR:

View File

@ -39,7 +39,8 @@
/* supported socket types in old nodes */
int node_exec_socket_use_stack(bNodeSocket *sock)
{
return ELEM(sock->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA, SOCK_SHADER);
/* NOTE: INT supported as FLOAT. Only for EEVEE. */
return ELEM(sock->type, SOCK_INT, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA, SOCK_SHADER);
}
/* for a given socket, find the actual stack entry */

View File

@ -448,6 +448,7 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree)
bNodeSocketValueVector *src_vector;
bNodeSocketValueRGBA *src_rgba, *dst_rgba;
bNodeSocketValueFloat *src_float, *dst_float;
bNodeSocketValueInt *src_int;
bool link_added = false;
for (group_node = localtree->nodes.first; group_node; group_node = group_node->next) {
@ -485,6 +486,15 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree)
dst_rgba = value_socket->default_value;
copy_v4_v4(dst_rgba->value, src_rgba->value);
break;
case SOCK_INT:
/* HACK: Support as float. */
value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_VALUE);
value_socket = ntree_shader_node_find_output(value_node, "Value");
BLI_assert(value_socket != NULL);
src_int = group_socket->default_value;
dst_float = value_socket->default_value;
dst_float->value = (float)(src_int->value);
break;
case SOCK_FLOAT:
value_node = nodeAddStaticNode(NULL, localtree, SH_NODE_VALUE);
value_socket = ntree_shader_node_find_output(value_node, "Value");

View File

@ -102,6 +102,8 @@ void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns)
if (type == SOCK_FLOAT)
gs->type = GPU_FLOAT;
else if (type == SOCK_INT)
gs->type = GPU_FLOAT; /* HACK: Support as float. */
else if (type == SOCK_VECTOR)
gs->type = GPU_VEC3;
else if (type == SOCK_RGBA)