42 if (link->
users < 0) {
43 fprintf(stderr,
"gpu_node_link_free: negative refcount\n");
46 if (link->
users == 0) {
76 if (
STR_ELEM(name,
"set_value",
"set_rgb",
"set_rgba") && (
input->type ==
type)) {
155 BLI_assert_msg(0,
"No gpu function for non-supported eNodeSocketDatatype");
184 switch (socket->
type) {
254 int cmps = strcmp(attr_a->
name, attr_b->name);
256 return cmps > 0 ? 1 : 0;
259 return (attr_a->
use_dupli && !attr_b->use_dupli);
272 if (set_a->
hash_code != set_b->hash_code || set_a->
count != set_b->count) {
278 for (; attr_a && attr_b; attr_a = attr_a->
next, attr_b = attr_b->
next) {
284 return attr_a || attr_b;
295 dest->hash_code =
src->hash_code;
323 if (attr->use_dupli) {
336 switch (attr->
type) {
344 BLI_assert_msg(0,
"GPUVertAttr Prefix type not found : This should not happen!");
359 if (attr->
name[0] !=
'\0') {
370 const bool is_default_color)
373 int num_attributes = 0;
375 for (; attr; attr = attr->
next) {
390 attr->
id = num_attributes;
410 for (; attr; attr = attr->
next) {
441 int num_textures = 0;
444 if (
tex->
ima == ima &&
tex->colorband == colorband &&
tex->sampler_state == sampler_state) {
456 tex->iuser_available =
true;
458 tex->colorband = colorband;
459 tex->sampler_state = sampler_state;
463 tex->tiled_mapping_name,
sizeof(
tex->tiled_mapping_name),
"tsamp%d", num_textures);
627 fprintf(stderr,
"GPU failed to find function %s\n", name);
634 for (i = 0; i <
function->totparam; i++) {
662 int i, totin, totout;
666 fprintf(stderr,
"GPU failed to find function %s\n", name);
675 for (i = 0; !in[i].
end; i++) {
684 for (i = 0; !
out[i].end; i++) {
692 for (i = 0; i <
function->totparam; i++) {
754 input->attr->users--;
757 input->uniform_attr->users--;
760 input->texture->users--;
812 if (
graph->used_libraries) {
824 if (!link || !link->
output) {
829 if (
node->tag & tag) {
870 if (attr->users == 0) {
877 if (
tex->users == 0) {
885 if (attr->users == 0) {
#define BLI_assert_msg(a, msg)
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_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
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)
#define SNPRINTF(dst, format,...)
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
@ GPU_MATFLAG_OBJECT_INFO
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
#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)
SyclQueue void void * src
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(struct GSet *used_libraries, const char *name)
GPUNodeLink * GPU_image_tiled(GPUMaterial *mat, Image *ima, ImageUser *iuser, eGPUSamplerState sampler_state)
static GPUMaterialAttribute * gpu_node_graph_add_attribute(GPUNodeGraph *graph, eCustomDataType type, const char *name, const bool is_default_color)
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_attribute_default_color(GPUMaterial *mat)
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)
GPUNodeLink * GPU_differentiate_float_function(const char *function_name)
static const char * gpu_uniform_set_function_from_type(eNodeSocketDatatype type)
GPUNodeLink * GPU_uniform_attribute(GPUMaterial *mat, const char *name, bool use_dupli)
static bool gpu_stack_link_v(GPUMaterial *material, bNode *bnode, const char *name, GPUNodeStack *in, GPUNodeStack *out, va_list params)
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)
GPUNodeLink * GPU_attribute(GPUMaterial *mat, const eCustomDataType type, const char *name)
GPUNodeLink * GPU_attribute_with_default(GPUMaterial *mat, const eCustomDataType type, const char *name, eGPUDefaultValue default_value)
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 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 void gpu_nodes_tag(GPUNodeLink *link, eGPUNodeTag tag)
static GPUUniformAttr * gpu_node_graph_add_uniform_attribute(GPUNodeGraph *graph, const char *name, bool use_dupli)
static void attr_input_name(GPUMaterialAttribute *attr)
static bool uniform_attr_list_cmp(const void *a, const void *b)
static char attr_prefix_get(GPUMaterialAttribute *attr)
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_NODE_TAG_DISPLACEMENT
@ GPU_SOURCE_FUNCTION_CALL
@ GPU_SOURCE_TEX_TILED_MAPPING
@ GPU_SOURCE_UNIFORM_ATTR
@ GPU_NODE_LINK_IMAGE_TILED
@ GPU_NODE_LINK_IMAGE_TILED_MAPPING
@ GPU_NODE_LINK_COLORBAND
@ GPU_NODE_LINK_UNIFORM_ATTR
@ GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
std::atomic< int > next_id
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static bNodeSocketTemplate inputs[]
eGPUDefaultValue default_value
struct GPUMaterialAttribute * next
GPUNodeLinkType link_type
struct GPUMaterialTexture * texture
struct GPUOutput * output
const char * function_name
struct GPUMaterialAttribute * attr
struct GPUUniformAttr * uniform_attr
struct GPUNodeLink * link