Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_node_graph.c
| Show First 20 Lines • Show All 325 Lines • ▼ Show 20 Lines | void gpu_node_graph_finalize_uniform_attrs(GPUNodeGraph *graph) | ||||
| } | } | ||||
| } | } | ||||
| /* Attributes and Textures */ | /* Attributes and Textures */ | ||||
| static char attr_prefix_get(CustomDataType type) | static char attr_prefix_get(CustomDataType type) | ||||
| { | { | ||||
| switch (type) { | switch (type) { | ||||
| case CD_MTFACE: | |||||
| return 'u'; | |||||
| case CD_TANGENT: | case CD_TANGENT: | ||||
| return 't'; | return 't'; | ||||
| case CD_MCOL: | |||||
| case CD_PROP_BYTE_COLOR: | |||||
| return 'c'; | |||||
| case CD_PROP_COLOR: | |||||
| return 'c'; | |||||
| case CD_AUTO_FROM_NAME: | case CD_AUTO_FROM_NAME: | ||||
| return 'a'; | return 'a'; | ||||
| case CD_HAIRLENGTH: | case CD_HAIRLENGTH: | ||||
| return 'l'; | return 'l'; | ||||
| default: | default: | ||||
| BLI_assert_msg(0, "GPUVertAttr Prefix type not found : This should not happen!"); | BLI_assert_msg(0, "GPUVertAttr Prefix type not found : This should not happen!"); | ||||
| return '\0'; | return '\0'; | ||||
| } | } | ||||
| Show All 16 Lines | static void attr_input_name(GPUMaterialAttribute *attr) | ||||
| } | } | ||||
| } | } | ||||
| /** 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, | ||||
| CustomDataType type, | CustomDataType type, | ||||
| const char *name) | const char *name) | ||||
| { | { | ||||
| /* Fall back to the UV layer, which matches old behavior. */ | |||||
| if (type == CD_AUTO_FROM_NAME && name[0] == '\0') { | |||||
| type = CD_MTFACE; | |||||
| } | |||||
| /* Find existing attribute. */ | /* Find existing attribute. */ | ||||
| int num_attributes = 0; | int num_attributes = 0; | ||||
| GPUMaterialAttribute *attr = graph->attributes.first; | GPUMaterialAttribute *attr = 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)) { | ||||
| break; | break; | ||||
| } | } | ||||
| num_attributes++; | num_attributes++; | ||||
| ▲ Show 20 Lines • Show All 494 Lines • Show Last 20 Lines | |||||