GPU: fixes for string socket types in shader nodes.

These are not passed to GLSL functions, but should be used to load e.g.
a texture or attribute.
This commit is contained in:
2018-02-22 20:52:08 +01:00
parent af061b4dac
commit 57609993d0
4 changed files with 19 additions and 11 deletions

View File

@@ -136,12 +136,12 @@ typedef enum GPUBlendMode {
typedef struct GPUNodeStack {
GPUType type;
const char *name;
float vec[4];
struct GPUNodeLink *link;
bool hasinput;
bool hasoutput;
short sockettype;
bool end;
} GPUNodeStack;

View File

@@ -1960,16 +1960,20 @@ bool GPU_stack_link(GPUMaterial *material, bNode *bnode, const char *name, GPUNo
totout = 0;
if (in) {
for (i = 0; in[i].type != GPU_NONE; i++) {
gpu_node_input_socket(material, bnode, node, &in[i], i);
totin++;
for (i = 0; !in[i].end; i++) {
if (in[i].type != GPU_NONE) {
gpu_node_input_socket(material, bnode, node, &in[i], i);
totin++;
}
}
}
if (out) {
for (i = 0; out[i].type != GPU_NONE; i++) {
gpu_node_output(node, out[i].type, &out[i].link);
totout++;
for (i = 0; !out[i].end; i++) {
if (out[i].type != GPU_NONE) {
gpu_node_output(node, out[i].type, &out[i].link);
totout++;
}
}
}

View File

@@ -2306,9 +2306,15 @@ static void rna_NodeSocketStandard_vector_range(PointerRNA *ptr, float *min, flo
static void rna_NodeSocket_value_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
bNodeTree *ntree = (bNodeTree *)ptr->id.data;
bNodeSocket *sock = ptr->data;
if (ntree->type == NTREE_SHADER) {
DEG_id_tag_update_ex(bmain, ptr->id.data, DEG_TAG_SHADING_UPDATE);
DEG_id_tag_update_ex(bmain, &ntree->id, DEG_TAG_SHADING_UPDATE);
WM_main_add_notifier(NC_MATERIAL | ND_SHADING, NULL);
if (sock->type == SOCK_STRING) {
rna_NodeSocket_update(bmain, scene, ptr);
}
}
else {
rna_NodeSocket_update(bmain, scene, ptr);

View File

@@ -147,7 +147,6 @@ void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns)
zero_v4(gs->vec);
gs->link = NULL;
gs->type = GPU_NONE;
gs->name = "";
gs->hasinput = false;
gs->hasoutput = false;
gs->sockettype = type;
@@ -167,7 +166,6 @@ void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns)
else
gs->type = GPU_NONE;
gs->name = "";
gs->hasinput = ns->hasinput && ns->data;
/* XXX Commented out the ns->data check here, as it seems it's not always set,
* even though there *is* a valid connection/output... But that might need
@@ -193,7 +191,7 @@ static void gpu_stack_from_data_list(GPUNodeStack *gs, ListBase *sockets, bNodeS
for (sock = sockets->first, i = 0; sock; sock = sock->next, i++)
node_gpu_stack_from_data(&gs[i], sock->type, ns[i]);
gs[i].type = GPU_NONE;
gs[i].end = true;
}
static void data_from_gpu_stack_list(ListBase *sockets, bNodeStack **ns, GPUNodeStack *gs)