Page MenuHome

IntegerSocket+Material view crashes blender.
Closed, ResolvedPublic

Description

System Information
Win7 (but it's irrelevant, all builds should do this)

Blender Version
Broken: latest master
Worked: (optional)

Short description of error
When you add an integer socket to a cycles node-group, cycles is happy with it and it functions properly , however when you switch to the material view, blender instantly disappears with an access violation.

Exact steps for others to reproduce the error
Open the attached blend, switch to material view

I'm pretty sure this will end up in the 'not supported, don't do that' pile, but still it would be nice if we at-least not punish the user with an instant crash when this happens

Event Timeline

Bastien Montagne (mont29) lowered the priority of this task from 90 to 50.Jun 1 2017, 9:48 AM

Can confirm the crash, for some reason node_get_stack() returns NULL bNodeStack pointer for those integer sockets... :|

OK, this boils down to node_exec_socket_use_stack() in node_exec.c not knowing about SOCK_INT socket type…

@Sergey Sharybin (sergey) not sure what's best here? support integer sockets (which could easily be converted to float values)? Forbid creation of such sockets in shader tree (if possible)? Or just make gpu_stack_from_data_list() NULL-checking the bNodeStack pointers? Later solution seams most straight forward to me…

simply adding SOCK_INT to the node_exec_socket_use_stack() fixes this..
...
return ELEM(sock->type, SOCK_INT, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA, SOCK_SHADER);
...

Adding SOCK_INT here won't be enough, might work in that specific case but will break in others, unless you also define conversions rules etc.

For now will commit some code to make GPU evaluation of nodetree resilient to unknown/unsupported socket types. Would consider adding support of Integer sockets here as a nice and (probably) easy TODO.