Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_node_graph.cc
- This file was moved from source/blender/gpu/intern/gpu_node_graph.c.
| Show All 23 Lines | |||||
| #include "gpu_material_library.h" | #include "gpu_material_library.h" | ||||
| #include "gpu_node_graph.h" | #include "gpu_node_graph.h" | ||||
| /* Node Link Functions */ | /* Node Link Functions */ | ||||
| static GPUNodeLink *gpu_node_link_create(void) | static GPUNodeLink *gpu_node_link_create(void) | ||||
| { | { | ||||
| GPUNodeLink *link = MEM_callocN(sizeof(GPUNodeLink), "GPUNodeLink"); | GPUNodeLink *link = MEM_cnew<GPUNodeLink>("GPUNodeLink"); | ||||
| link->users++; | link->users++; | ||||
| return link; | return link; | ||||
| } | } | ||||
| static void gpu_node_link_free(GPUNodeLink *link) | static void gpu_node_link_free(GPUNodeLink *link) | ||||
| { | { | ||||
| link->users--; | link->users--; | ||||
| Show All 9 Lines | if (link->users == 0) { | ||||
| MEM_freeN(link); | MEM_freeN(link); | ||||
| } | } | ||||
| } | } | ||||
| /* Node Functions */ | /* Node Functions */ | ||||
| static GPUNode *gpu_node_create(const char *name) | static GPUNode *gpu_node_create(const char *name) | ||||
| { | { | ||||
| GPUNode *node = MEM_callocN(sizeof(GPUNode), "GPUNode"); | GPUNode *node = MEM_cnew<GPUNode>("GPUNode"); | ||||
| node->name = name; | node->name = name; | ||||
| return node; | return node; | ||||
| } | } | ||||
| static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType type) | static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType type) | ||||
| { | { | ||||
| GPUInput *input; | GPUInput *input; | ||||
| GPUNode *outnode; | GPUNode *outnode; | ||||
| const char *name; | const char *name; | ||||
| if (link->link_type == GPU_NODE_LINK_OUTPUT) { | if (link->link_type == GPU_NODE_LINK_OUTPUT) { | ||||
| outnode = link->output->node; | outnode = link->output->node; | ||||
| name = outnode->name; | name = outnode->name; | ||||
| input = outnode->inputs.first; | input = static_cast<GPUInput *>(outnode->inputs.first); | ||||
| if (STR_ELEM(name, "set_value", "set_rgb", "set_rgba") && (input->type == type)) { | if (STR_ELEM(name, "set_value", "set_rgb", "set_rgba") && (input->type == type)) { | ||||
| input = MEM_dupallocN(outnode->inputs.first); | input = static_cast<GPUInput *>(MEM_dupallocN(outnode->inputs.first)); | ||||
| switch (input->source) { | switch (input->source) { | ||||
| case GPU_SOURCE_ATTR: | case GPU_SOURCE_ATTR: | ||||
| input->attr->users++; | input->attr->users++; | ||||
| break; | break; | ||||
| case GPU_SOURCE_UNIFORM_ATTR: | case GPU_SOURCE_UNIFORM_ATTR: | ||||
| input->uniform_attr->users++; | input->uniform_attr->users++; | ||||
| break; | break; | ||||
| Show All 12 Lines | if (STR_ELEM(name, "set_value", "set_rgb", "set_rgba") && (input->type == type)) { | ||||
| input->link->users++; | input->link->users++; | ||||
| } | } | ||||
| BLI_addtail(&node->inputs, input); | BLI_addtail(&node->inputs, input); | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| input = MEM_callocN(sizeof(GPUInput), "GPUInput"); | input = MEM_cnew<GPUInput>("GPUInput"); | ||||
| input->node = node; | input->node = node; | ||||
| input->type = type; | input->type = type; | ||||
| switch (link->link_type) { | switch (link->link_type) { | ||||
| case GPU_NODE_LINK_OUTPUT: | case GPU_NODE_LINK_OUTPUT: | ||||
| input->source = GPU_SOURCE_OUTPUT; | input->source = GPU_SOURCE_OUTPUT; | ||||
| input->link = link; | input->link = link; | ||||
| link->users++; | link->users++; | ||||
| ▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | static GPUNodeLink *gpu_uniformbuffer_link(GPUMaterial *mat, | ||||
| const bNode *node, | const bNode *node, | ||||
| GPUNodeStack *stack, | GPUNodeStack *stack, | ||||
| const int index, | const int index, | ||||
| const eNodeSocketInOut in_out) | const eNodeSocketInOut in_out) | ||||
| { | { | ||||
| bNodeSocket *socket; | bNodeSocket *socket; | ||||
| if (in_out == SOCK_IN) { | if (in_out == SOCK_IN) { | ||||
| socket = BLI_findlink(&node->inputs, index); | socket = static_cast<bNodeSocket *>(BLI_findlink(&node->inputs, index)); | ||||
| } | } | ||||
| else { | else { | ||||
| socket = BLI_findlink(&node->outputs, index); | socket = static_cast<bNodeSocket *>(BLI_findlink(&node->outputs, index)); | ||||
| } | } | ||||
| BLI_assert(socket != NULL); | BLI_assert(socket != NULL); | ||||
| BLI_assert(socket->in_out == in_out); | BLI_assert(socket->in_out == in_out); | ||||
| if (socket->flag & SOCK_HIDE_VALUE) { | if (socket->flag & SOCK_HIDE_VALUE) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (!ELEM(socket->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA)) { | if (!ELEM(socket->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA)) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| GPUNodeLink *link = GPU_uniform(stack->vec); | GPUNodeLink *link = GPU_uniform(stack->vec); | ||||
| if (in_out == SOCK_IN) { | if (in_out == SOCK_IN) { | ||||
| GPU_link(mat, gpu_uniform_set_function_from_type(socket->type), link, &stack->link); | GPU_link(mat, | ||||
| gpu_uniform_set_function_from_type(eNodeSocketDatatype(socket->type)), | |||||
| link, | |||||
| &stack->link); | |||||
| } | } | ||||
| return link; | return link; | ||||
| } | } | ||||
| static void gpu_node_input_socket( | static void gpu_node_input_socket( | ||||
| GPUMaterial *material, const bNode *bnode, GPUNode *node, GPUNodeStack *sock, const int index) | GPUMaterial *material, const bNode *bnode, GPUNode *node, GPUNodeStack *sock, const int index) | ||||
| { | { | ||||
| if (sock->link) { | if (sock->link) { | ||||
| gpu_node_input_link(node, sock->link, sock->type); | gpu_node_input_link(node, sock->link, sock->type); | ||||
| } | } | ||||
| else if ((material != NULL) && | else if ((material != NULL) && | ||||
| (gpu_uniformbuffer_link(material, bnode, sock, index, SOCK_IN) != NULL)) { | (gpu_uniformbuffer_link(material, bnode, sock, index, SOCK_IN) != NULL)) { | ||||
| gpu_node_input_link(node, sock->link, sock->type); | gpu_node_input_link(node, sock->link, sock->type); | ||||
| } | } | ||||
| else { | else { | ||||
| gpu_node_input_link(node, GPU_constant(sock->vec), sock->type); | gpu_node_input_link(node, GPU_constant(sock->vec), sock->type); | ||||
| } | } | ||||
| } | } | ||||
| static void gpu_node_output(GPUNode *node, const eGPUType type, GPUNodeLink **link) | static void gpu_node_output(GPUNode *node, const eGPUType type, GPUNodeLink **link) | ||||
| { | { | ||||
| GPUOutput *output = MEM_callocN(sizeof(GPUOutput), "GPUOutput"); | GPUOutput *output = MEM_cnew<GPUOutput>("GPUOutput"); | ||||
| output->type = type; | output->type = type; | ||||
| output->node = node; | output->node = node; | ||||
| if (link) { | if (link) { | ||||
| *link = output->link = gpu_node_link_create(); | *link = output->link = gpu_node_link_create(); | ||||
| output->link->link_type = GPU_NODE_LINK_OUTPUT; | output->link->link_type = GPU_NODE_LINK_OUTPUT; | ||||
| output->link->output = output; | output->link->output = output; | ||||
| /* NOTE: the caller owns the reference to the link, GPUOutput | /* NOTE: the caller owns the reference to the link, GPUOutput | ||||
| * merely points to it, and if the node is destroyed it will | * merely points to it, and if the node is destroyed it will | ||||
| * set that pointer to NULL */ | * set that pointer to NULL */ | ||||
| } | } | ||||
| BLI_addtail(&node->outputs, output); | BLI_addtail(&node->outputs, output); | ||||
| } | } | ||||
| /* Uniform Attribute Functions */ | /* Uniform Attribute Functions */ | ||||
| static int uniform_attr_sort_cmp(const void *a, const void *b) | static int uniform_attr_sort_cmp(const void *a, const void *b) | ||||
| { | { | ||||
| const GPUUniformAttr *attr_a = a, *attr_b = b; | const GPUUniformAttr *attr_a = static_cast<const GPUUniformAttr *>(a), | ||||
| *attr_b = static_cast<const GPUUniformAttr *>(b); | |||||
| int cmps = strcmp(attr_a->name, attr_b->name); | int cmps = strcmp(attr_a->name, attr_b->name); | ||||
| if (cmps != 0) { | if (cmps != 0) { | ||||
| return cmps > 0 ? 1 : 0; | return cmps > 0 ? 1 : 0; | ||||
| } | } | ||||
| return (attr_a->use_dupli && !attr_b->use_dupli); | return (attr_a->use_dupli && !attr_b->use_dupli); | ||||
| } | } | ||||
| static uint uniform_attr_list_hash(const void *key) | static uint uniform_attr_list_hash(const void *key) | ||||
| { | { | ||||
| const GPUUniformAttrList *attrs = key; | const GPUUniformAttrList *attrs = static_cast<const GPUUniformAttrList *>(key); | ||||
| return attrs->hash_code; | return attrs->hash_code; | ||||
| } | } | ||||
| static bool uniform_attr_list_cmp(const void *a, const void *b) | static bool uniform_attr_list_cmp(const void *a, const void *b) | ||||
| { | { | ||||
| const GPUUniformAttrList *set_a = a, *set_b = b; | const GPUUniformAttrList *set_a = static_cast<const GPUUniformAttrList *>(a), | ||||
| *set_b = static_cast<const GPUUniformAttrList *>(b); | |||||
| if (set_a->hash_code != set_b->hash_code || set_a->count != set_b->count) { | if (set_a->hash_code != set_b->hash_code || set_a->count != set_b->count) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| GPUUniformAttr *attr_a = set_a->list.first, *attr_b = set_b->list.first; | GPUUniformAttr *attr_a = static_cast<GPUUniformAttr *>(set_a->list.first), | ||||
| *attr_b = static_cast<GPUUniformAttr *>(set_b->list.first); | |||||
| for (; attr_a && attr_b; attr_a = attr_a->next, attr_b = attr_b->next) { | for (; attr_a && attr_b; attr_a = attr_a->next, attr_b = attr_b->next) { | ||||
| if (!STREQ(attr_a->name, attr_b->name) || attr_a->use_dupli != attr_b->use_dupli) { | if (!STREQ(attr_a->name, attr_b->name) || attr_a->use_dupli != attr_b->use_dupli) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| return attr_a || attr_b; | return attr_a || attr_b; | ||||
| ▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | |||||
| /** Add a new varying attribute of given type and name. Returns NULL if out of slots. */ | /** Add a new varying attribute of given type and name. Returns NULL if out of slots. */ | ||||
| static GPUMaterialAttribute *gpu_node_graph_add_attribute(GPUNodeGraph *graph, | static GPUMaterialAttribute *gpu_node_graph_add_attribute(GPUNodeGraph *graph, | ||||
| eCustomDataType type, | eCustomDataType type, | ||||
| const char *name, | const char *name, | ||||
| const bool is_default_color) | const bool is_default_color) | ||||
| { | { | ||||
| /* Find existing attribute. */ | /* Find existing attribute. */ | ||||
| int num_attributes = 0; | int num_attributes = 0; | ||||
| GPUMaterialAttribute *attr = graph->attributes.first; | GPUMaterialAttribute *attr = static_cast<GPUMaterialAttribute *>(graph->attributes.first); | ||||
| for (; attr; attr = attr->next) { | for (; attr; attr = attr->next) { | ||||
| if (attr->type == type && STREQ(attr->name, name) && | if (attr->type == type && STREQ(attr->name, name) && | ||||
| attr->is_default_color == is_default_color) { | attr->is_default_color == is_default_color) { | ||||
| break; | break; | ||||
| } | } | ||||
| num_attributes++; | num_attributes++; | ||||
| } | } | ||||
| /* Add new requested attribute if it's within GPU limits. */ | /* Add new requested attribute if it's within GPU limits. */ | ||||
| if (attr == NULL) { | if (attr == NULL) { | ||||
| attr = MEM_callocN(sizeof(*attr), __func__); | attr = MEM_cnew<GPUMaterialAttribute>(__func__); | ||||
| attr->is_default_color = is_default_color; | attr->is_default_color = is_default_color; | ||||
| attr->type = type; | attr->type = type; | ||||
| STRNCPY(attr->name, name); | STRNCPY(attr->name, name); | ||||
| attr_input_name(attr); | attr_input_name(attr); | ||||
| attr->id = num_attributes; | attr->id = num_attributes; | ||||
| BLI_addtail(&graph->attributes, attr); | BLI_addtail(&graph->attributes, attr); | ||||
| } | } | ||||
| if (attr != NULL) { | if (attr != NULL) { | ||||
| attr->users++; | attr->users++; | ||||
| } | } | ||||
| return attr; | return attr; | ||||
| } | } | ||||
| /** Add a new uniform attribute of given type and name. Returns NULL if out of slots. */ | /** Add a new uniform attribute of given type and name. Returns NULL if out of slots. */ | ||||
| static GPUUniformAttr *gpu_node_graph_add_uniform_attribute(GPUNodeGraph *graph, | static GPUUniformAttr *gpu_node_graph_add_uniform_attribute(GPUNodeGraph *graph, | ||||
| const char *name, | const char *name, | ||||
| bool use_dupli) | bool use_dupli) | ||||
| { | { | ||||
| /* Find existing attribute. */ | /* Find existing attribute. */ | ||||
| GPUUniformAttrList *attrs = &graph->uniform_attrs; | GPUUniformAttrList *attrs = &graph->uniform_attrs; | ||||
| GPUUniformAttr *attr = attrs->list.first; | GPUUniformAttr *attr = static_cast<GPUUniformAttr *>(attrs->list.first); | ||||
| for (; attr; attr = attr->next) { | for (; attr; attr = attr->next) { | ||||
| if (STREQ(attr->name, name) && attr->use_dupli == use_dupli) { | if (STREQ(attr->name, name) && attr->use_dupli == use_dupli) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| /* Add new requested attribute if it's within GPU limits. */ | /* Add new requested attribute if it's within GPU limits. */ | ||||
| if (attr == NULL && attrs->count < GPU_MAX_UNIFORM_ATTR) { | if (attr == NULL && attrs->count < GPU_MAX_UNIFORM_ATTR) { | ||||
| attr = MEM_callocN(sizeof(*attr), __func__); | attr = MEM_cnew<GPUUniformAttr>(__func__); | ||||
| STRNCPY(attr->name, name); | STRNCPY(attr->name, name); | ||||
| attr->use_dupli = use_dupli; | attr->use_dupli = use_dupli; | ||||
| attr->hash_code = BLI_ghashutil_strhash_p(attr->name) << 1 | (attr->use_dupli ? 0 : 1); | attr->hash_code = BLI_ghashutil_strhash_p(attr->name) << 1 | (attr->use_dupli ? 0 : 1); | ||||
| attr->id = -1; | attr->id = -1; | ||||
| BLI_addtail(&attrs->list, attr); | BLI_addtail(&attrs->list, attr); | ||||
| attrs->count++; | attrs->count++; | ||||
| } | } | ||||
| if (attr != NULL) { | if (attr != NULL) { | ||||
| attr->users++; | attr->users++; | ||||
| } | } | ||||
| return attr; | return attr; | ||||
| } | } | ||||
| /** Add a new uniform attribute of given type and name. Returns NULL if out of slots. */ | /** Add a new uniform attribute of given type and name. Returns NULL if out of slots. */ | ||||
| static GPULayerAttr *gpu_node_graph_add_layer_attribute(GPUNodeGraph *graph, const char *name) | static GPULayerAttr *gpu_node_graph_add_layer_attribute(GPUNodeGraph *graph, const char *name) | ||||
| { | { | ||||
| /* Find existing attribute. */ | /* Find existing attribute. */ | ||||
| ListBase *attrs = &graph->layer_attrs; | ListBase *attrs = &graph->layer_attrs; | ||||
| GPULayerAttr *attr = attrs->first; | GPULayerAttr *attr = static_cast<GPULayerAttr *>(attrs->first); | ||||
| for (; attr; attr = attr->next) { | for (; attr; attr = attr->next) { | ||||
| if (STREQ(attr->name, name)) { | if (STREQ(attr->name, name)) { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| /* Add new requested attribute to the list. */ | /* Add new requested attribute to the list. */ | ||||
| if (attr == NULL) { | if (attr == NULL) { | ||||
| attr = MEM_callocN(sizeof(*attr), __func__); | attr = MEM_cnew<GPULayerAttr>(__func__); | ||||
| STRNCPY(attr->name, name); | STRNCPY(attr->name, name); | ||||
| attr->hash_code = BLI_ghashutil_strhash_p(attr->name); | attr->hash_code = BLI_ghashutil_strhash_p(attr->name); | ||||
| BLI_addtail(attrs, attr); | BLI_addtail(attrs, attr); | ||||
| } | } | ||||
| if (attr != NULL) { | if (attr != NULL) { | ||||
| attr->users++; | attr->users++; | ||||
| } | } | ||||
| return attr; | return attr; | ||||
| } | } | ||||
| static GPUMaterialTexture *gpu_node_graph_add_texture(GPUNodeGraph *graph, | static GPUMaterialTexture *gpu_node_graph_add_texture(GPUNodeGraph *graph, | ||||
| Image *ima, | Image *ima, | ||||
| ImageUser *iuser, | ImageUser *iuser, | ||||
| struct GPUTexture **colorband, | struct GPUTexture **colorband, | ||||
| struct GPUTexture **sky, | struct GPUTexture **sky, | ||||
| GPUNodeLinkType link_type, | GPUNodeLinkType link_type, | ||||
| eGPUSamplerState sampler_state) | eGPUSamplerState sampler_state) | ||||
| { | { | ||||
| /* Find existing texture. */ | /* Find existing texture. */ | ||||
| int num_textures = 0; | int num_textures = 0; | ||||
| GPUMaterialTexture *tex = graph->textures.first; | GPUMaterialTexture *tex = static_cast<GPUMaterialTexture *>(graph->textures.first); | ||||
| for (; tex; tex = tex->next) { | for (; tex; tex = tex->next) { | ||||
| if (tex->ima == ima && tex->colorband == colorband && tex->sky == sky && | if (tex->ima == ima && tex->colorband == colorband && tex->sky == sky && | ||||
| tex->sampler_state == sampler_state) { | tex->sampler_state == sampler_state) { | ||||
| break; | break; | ||||
| } | } | ||||
| num_textures++; | num_textures++; | ||||
| } | } | ||||
| /* Add new requested texture. */ | /* Add new requested texture. */ | ||||
| if (tex == NULL) { | if (tex == NULL) { | ||||
| tex = MEM_callocN(sizeof(*tex), __func__); | tex = MEM_cnew<GPUMaterialTexture>(__func__); | ||||
| tex->ima = ima; | tex->ima = ima; | ||||
| if (iuser != NULL) { | if (iuser != NULL) { | ||||
| tex->iuser = *iuser; | tex->iuser = *iuser; | ||||
| tex->iuser_available = true; | tex->iuser_available = true; | ||||
| } | } | ||||
| tex->colorband = colorband; | tex->colorband = colorband; | ||||
| tex->sky = sky; | tex->sky = sky; | ||||
| tex->sampler_state = sampler_state; | tex->sampler_state = sampler_state; | ||||
| ▲ Show 20 Lines • Show All 309 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /* Node Graph */ | /* Node Graph */ | ||||
| static void gpu_inputs_free(ListBase *inputs) | static void gpu_inputs_free(ListBase *inputs) | ||||
| { | { | ||||
| GPUInput *input; | GPUInput *input; | ||||
| for (input = inputs->first; input; input = input->next) { | for (input = static_cast<GPUInput *>(inputs->first); input; input = input->next) { | ||||
| switch (input->source) { | switch (input->source) { | ||||
| case GPU_SOURCE_ATTR: | case GPU_SOURCE_ATTR: | ||||
| input->attr->users--; | input->attr->users--; | ||||
| break; | break; | ||||
| case GPU_SOURCE_UNIFORM_ATTR: | case GPU_SOURCE_UNIFORM_ATTR: | ||||
| input->uniform_attr->users--; | input->uniform_attr->users--; | ||||
| break; | break; | ||||
| case GPU_SOURCE_LAYER_ATTR: | case GPU_SOURCE_LAYER_ATTR: | ||||
| Show All 16 Lines | |||||
| } | } | ||||
| static void gpu_node_free(GPUNode *node) | static void gpu_node_free(GPUNode *node) | ||||
| { | { | ||||
| GPUOutput *output; | GPUOutput *output; | ||||
| gpu_inputs_free(&node->inputs); | gpu_inputs_free(&node->inputs); | ||||
| for (output = node->outputs.first; output; output = output->next) { | for (output = static_cast<GPUOutput *>(node->outputs.first); output; output = output->next) { | ||||
| if (output->link) { | if (output->link) { | ||||
| output->link->output = NULL; | output->link->output = NULL; | ||||
| gpu_node_link_free(output->link); | gpu_node_link_free(output->link); | ||||
| } | } | ||||
| } | } | ||||
| BLI_freelistN(&node->outputs); | BLI_freelistN(&node->outputs); | ||||
| MEM_freeN(node); | MEM_freeN(node); | ||||
| } | } | ||||
| void gpu_node_graph_free_nodes(GPUNodeGraph *graph) | void gpu_node_graph_free_nodes(GPUNodeGraph *graph) | ||||
| { | { | ||||
| GPUNode *node; | GPUNode *node; | ||||
| while ((node = BLI_pophead(&graph->nodes))) { | while ((node = static_cast<GPUNode *>(BLI_pophead(&graph->nodes)))) { | ||||
| gpu_node_free(node); | gpu_node_free(node); | ||||
| } | } | ||||
| graph->outlink_surface = NULL; | graph->outlink_surface = NULL; | ||||
| graph->outlink_volume = NULL; | graph->outlink_volume = NULL; | ||||
| graph->outlink_displacement = NULL; | graph->outlink_displacement = NULL; | ||||
| graph->outlink_thickness = NULL; | graph->outlink_thickness = NULL; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | void gpu_node_graph_prune_unused(GPUNodeGraph *graph) | ||||
| } | } | ||||
| LISTBASE_FOREACH (GPUNodeGraphFunctionLink *, funclink, &graph->material_functions) { | LISTBASE_FOREACH (GPUNodeGraphFunctionLink *, funclink, &graph->material_functions) { | ||||
| gpu_nodes_tag(funclink->outlink, GPU_NODE_TAG_FUNCTION); | gpu_nodes_tag(funclink->outlink, GPU_NODE_TAG_FUNCTION); | ||||
| } | } | ||||
| LISTBASE_FOREACH (GPUNodeGraphOutputLink *, compositor_link, &graph->outlink_compositor) { | LISTBASE_FOREACH (GPUNodeGraphOutputLink *, compositor_link, &graph->outlink_compositor) { | ||||
| gpu_nodes_tag(compositor_link->outlink, GPU_NODE_TAG_COMPOSITOR); | gpu_nodes_tag(compositor_link->outlink, GPU_NODE_TAG_COMPOSITOR); | ||||
| } | } | ||||
| for (GPUNode *node = graph->nodes.first, *next = NULL; node; node = next) { | for (GPUNode *node = static_cast<GPUNode *>(graph->nodes.first), *next = NULL; node; | ||||
| node = next) { | |||||
| next = node->next; | next = node->next; | ||||
| if (node->tag == GPU_NODE_TAG_NONE) { | if (node->tag == GPU_NODE_TAG_NONE) { | ||||
| BLI_remlink(&graph->nodes, node); | BLI_remlink(&graph->nodes, node); | ||||
| gpu_node_free(node); | gpu_node_free(node); | ||||
| } | } | ||||
| } | } | ||||
| for (GPUMaterialAttribute *attr = graph->attributes.first, *next = NULL; attr; attr = next) { | for (GPUMaterialAttribute *attr = static_cast<GPUMaterialAttribute *>(graph->attributes.first), | ||||
| *next = NULL; | |||||
| attr; | |||||
| attr = next) { | |||||
| next = attr->next; | next = attr->next; | ||||
| if (attr->users == 0) { | if (attr->users == 0) { | ||||
| BLI_freelinkN(&graph->attributes, attr); | BLI_freelinkN(&graph->attributes, attr); | ||||
| } | } | ||||
| } | } | ||||
| for (GPUMaterialTexture *tex = graph->textures.first, *next = NULL; tex; tex = next) { | for (GPUMaterialTexture *tex = static_cast<GPUMaterialTexture *>(graph->textures.first), | ||||
| *next = NULL; | |||||
| tex; | |||||
| tex = next) { | |||||
| next = tex->next; | next = tex->next; | ||||
| if (tex->users == 0) { | if (tex->users == 0) { | ||||
| BLI_freelinkN(&graph->textures, tex); | BLI_freelinkN(&graph->textures, tex); | ||||
| } | } | ||||
| } | } | ||||
| GPUUniformAttrList *uattrs = &graph->uniform_attrs; | GPUUniformAttrList *uattrs = &graph->uniform_attrs; | ||||
| Show All 13 Lines | |||||