57 if (link->
users < 0) {
58 fprintf(stderr,
"gpu_node_link_free: negative refcount\n");
61 if (link->
users == 0) {
91 if ((
STR_ELEM(name,
"set_value",
"set_rgb",
"set_rgba")) && (input->
type ==
type)) {
156 memcpy(input->
vec, link->
data,
type *
sizeof(
float));
177 BLI_assert(!
"No gpu function for non-supported eNodeSocketDatatype");
206 switch (socket->
type) {
276 int cmps = strcmp(attr_a->
name, attr_b->name);
278 return cmps > 0 ? 1 : 0;
281 return (attr_a->
use_dupli && !attr_b->use_dupli);
294 if (set_a->
hash_code != set_b->hash_code || set_a->
count != set_b->count) {
300 for (; attr_a && attr_b; attr_a = attr_a->
next, attr_b = attr_b->
next) {
306 return attr_a || attr_b;
341 attr->id = next_id++;
345 if (attr->use_dupli) {
364 int num_attributes = 0;
366 for (; attr; attr = attr->
next) {
378 attr->
id = num_attributes;
398 for (; attr; attr = attr->
next) {
429 int num_textures = 0;
432 if (
tex->
ima == ima &&
tex->colorband == colorband &&
tex->sampler_state == sampler_state) {
443 tex->colorband = colorband;
444 tex->sampler_state = sampler_state;
448 tex->tiled_mapping_name,
sizeof(
tex->tiled_mapping_name),
"tsamp%d", num_textures);
465 for (; grid; grid = grid->
next) {
606 if (
STREQ(name,
"color")) {
607 GPU_link(mat,
"node_attribute_volume_color", link, transform_link, &link);
609 else if (
STREQ(name,
"temperature")) {
610 GPU_link(mat,
"node_attribute_volume_temperature", link, transform_link, &link);
613 GPU_link(mat,
"node_attribute_volume", link, transform_link, &link);
640 fprintf(stderr,
"GPU failed to find function %s\n", name);
647 for (i = 0; i <
function->totparam; i++) {
677 int i, totin, totout;
681 fprintf(stderr,
"GPU failed to find function %s\n", name);
690 for (i = 0; !in[i].
end; i++) {
699 for (i = 0; !out[i].
end; i++) {
708 for (i = 0; i <
function->totparam; i++) {
755 for (input =
inputs->first; input; input = input->
next) {
838 for (input =
node->inputs.first; input; input = input->
next) {
867 if (attr->users == 0) {
874 if (
tex->users == 0) {
881 if (grid->users == 0) {
890 if (attr->users == 0) {
unsigned int BLI_ghashutil_uinthash(unsigned int key)
unsigned int BLI_ghashutil_strhash_p(const void *ptr)
GHash * BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void void void void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) ATTR_NONNULL(1
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void void BLI_listbase_sort(struct ListBase *listbase, int(*cmp)(const void *, const void *)) ATTR_NONNULL(1
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define STRNCPY(dst, src)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
#define GPU_MAX_UNIFORM_ATTR
struct GPUTexture GPUTexture
static const int GPU_SAMPLER_MAX
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
GSet * gpu_material_used_libraries(GPUMaterial *material)
GPUNodeGraph * gpu_material_node_graph(GPUMaterial *material)
GPUTexture ** gpu_material_ramp_texture_row_set(GPUMaterial *mat, int size, float *pixels, float *row)
GPUFunction * gpu_material_library_use_function(GSet *used_libraries, const char *name)
GPUNodeLink * GPU_image_tiled(GPUMaterial *mat, Image *ima, ImageUser *iuser, eGPUSamplerState sampler_state)
GPUNodeLink * GPU_attribute(GPUMaterial *mat, const CustomDataType type, const char *name)
GPUNodeLink * GPU_builtin(eGPUBuiltin builtin)
static GPUMaterialAttribute * gpu_node_graph_add_attribute(GPUNodeGraph *graph, CustomDataType type, const char *name)
void GPU_uniform_attr_list_copy(GPUUniformAttrList *dest, GPUUniformAttrList *src)
struct GHash * GPU_uniform_attr_list_hash_new(const char *info)
GPUNodeLink * GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *row)
GPUNodeLink * GPU_image(GPUMaterial *mat, Image *ima, ImageUser *iuser, eGPUSamplerState sampler_state)
static void gpu_node_input_socket(GPUMaterial *material, bNode *bnode, GPUNode *node, GPUNodeStack *sock, const int index)
static const char * gpu_uniform_set_function_from_type(eNodeSocketDatatype type)
GPUNodeLink * GPU_uniform_attribute(GPUMaterial *mat, const char *name, bool use_dupli)
static void gpu_node_free(GPUNode *node)
static void gpu_inputs_free(ListBase *inputs)
static void gpu_node_output(GPUNode *node, const eGPUType type, GPUNodeLink **link)
GPUNodeLink * GPU_uniformbuf_link_out(GPUMaterial *mat, bNode *node, GPUNodeStack *stack, const int index)
static GPUNode * gpu_node_create(const char *name)
static GPUNodeLink * gpu_uniformbuffer_link(GPUMaterial *mat, bNode *node, GPUNodeStack *stack, const int index, const eNodeSocketInOut in_out)
GPUNodeLink * GPU_constant(const float *num)
static GPUNodeLink * gpu_node_link_create(void)
void gpu_node_graph_finalize_uniform_attrs(GPUNodeGraph *graph)
static void gpu_node_link_free(GPUNodeLink *link)
GPUNodeLink * GPU_uniform(const float *num)
bool GPU_stack_link(GPUMaterial *material, bNode *bnode, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType type)
static void gpu_nodes_tag(GPUNodeLink *link)
GPUNodeLink * GPU_volume_grid(GPUMaterial *mat, const char *name, eGPUVolumeDefaultValue default_value)
static GPUMaterialTexture * gpu_node_graph_add_texture(GPUNodeGraph *graph, Image *ima, ImageUser *iuser, struct GPUTexture **colorband, GPUNodeLinkType link_type, eGPUSamplerState sampler_state)
void GPU_uniform_attr_list_free(GPUUniformAttrList *set)
static unsigned int uniform_attr_list_hash(const void *key)
void gpu_node_graph_free(GPUNodeGraph *graph)
void gpu_node_graph_prune_unused(GPUNodeGraph *graph)
static GPUUniformAttr * gpu_node_graph_add_uniform_attribute(GPUNodeGraph *graph, const char *name, bool use_dupli)
static bool uniform_attr_list_cmp(const void *a, const void *b)
static GPUMaterialVolumeGrid * gpu_node_graph_add_volume_grid(GPUNodeGraph *graph, const char *name, eGPUVolumeDefaultValue default_value)
static int uniform_attr_sort_cmp(const void *a, const void *b)
void gpu_node_graph_free_nodes(GPUNodeGraph *graph)
bool GPU_link(GPUMaterial *mat, const char *name,...)
GPUNodeLink * GPU_image_tiled_mapping(GPUMaterial *mat, Image *ima, ImageUser *iuser)
@ GPU_SOURCE_VOLUME_GRID_TRANSFORM
@ GPU_SOURCE_TEX_TILED_MAPPING
@ GPU_SOURCE_UNIFORM_ATTR
@ GPU_NODE_LINK_IMAGE_TILED
@ GPU_NODE_LINK_IMAGE_TILED_MAPPING
@ GPU_NODE_LINK_VOLUME_GRID_TRANSFORM
@ GPU_NODE_LINK_VOLUME_GRID
@ GPU_NODE_LINK_COLORBAND
@ GPU_NODE_LINK_UNIFORM_ATTR
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
static bNodeSocketTemplate inputs[]
struct GPUMaterialAttribute * next
struct GPUMaterialVolumeGrid * next
eGPUVolumeDefaultValue default_value
GPUNodeLinkType link_type
struct GPUMaterialTexture * texture
struct GPUMaterialVolumeGrid * volume_grid
struct GPUOutput * output
struct GPUMaterialAttribute * attr
struct GPUUniformAttr * uniform_attr
struct GPUNodeLink * link