|
Blender V4.5
|
#include <cstdio>#include <cstring>#include "MEM_guardedalloc.h"#include "DNA_node_types.h"#include "BLI_ghash.h"#include "BLI_listbase.h"#include "BLI_string.h"#include "BLI_utildefines.h"#include "GPU_texture.hh"#include "GPU_vertex_format.hh"#include "gpu_material_library.hh"#include "gpu_node_graph.hh"Go to the source code of this file.
Intermediate node graph for generating GLSL shaders.
Definition in file gpu_node_graph.cc.
|
static |
Definition at line 369 of file gpu_node_graph.cc.
References attr_input_name(), attr_prefix_get(), CD_ORCO, GPU_MAX_SAFE_ATTR_NAME, GPU_vertformat_safe_attr_name(), GPUMaterialAttribute::input_name, GPUMaterialAttribute::name, STRNCPY(), and GPUMaterialAttribute::type.
Referenced by attr_input_name(), and gpu_node_graph_add_attribute().
|
static |
Definition at line 350 of file gpu_node_graph.cc.
References attr_prefix_get(), BLI_assert_msg, CD_AUTO_FROM_NAME, CD_TANGENT, GPUMaterialAttribute::is_default_color, GPUMaterialAttribute::is_hair_length, and GPUMaterialAttribute::type.
Referenced by attr_input_name(), and attr_prefix_get().
| GPUNodeLink * GPU_attribute | ( | GPUMaterial * | mat, |
| const eCustomDataType | type, | ||
| const char * | name ) |
Definition at line 530 of file gpu_node_graph.cc.
References CD_ORCO, GPU_attribute(), GPU_constant(), GPU_material_flag_set(), gpu_material_node_graph(), GPU_MATFLAG_OBJECT_INFO, GPU_MAX_CONSTANT_DATA, gpu_node_graph_add_attribute(), GPU_NODE_LINK_ATTR, gpu_node_link_create(), and GPUNodeLink::link_type.
Referenced by GPU_attribute(), GPU_attribute_with_default(), blender::nodes::node_shader_normal_map_cc::gpu_shader_normal_map(), blender::nodes::node_shader_vector_displacement_cc::gpu_shader_vector_displacement(), blender::nodes::node_shader_attribute_cc::node_shader_gpu_attribute(), blender::nodes::node_shader_bsdf_principled_cc::node_shader_gpu_bsdf_principled(), node_shader_gpu_default_tex_coord(), blender::nodes::node_shader_geometry_cc::node_shader_gpu_geometry(), blender::nodes::node_shader_tangent_cc::node_shader_gpu_tangent(), blender::nodes::node_shader_tex_coord_cc::node_shader_gpu_tex_coord(), blender::nodes::node_shader_tex_image_cc::node_shader_gpu_tex_image(), blender::nodes::node_shader_uvmap_cc::node_shader_gpu_uvmap(), blender::nodes::node_shader_vertex_color_cc::node_shader_gpu_vertex_color(), blender::nodes::node_shader_volume_info_cc::node_shader_gpu_volume_info(), and blender::nodes::node_shader_volume_principled_cc::node_shader_gpu_volume_principled().
| GPUNodeLink * GPU_attribute_default_color | ( | GPUMaterial * | mat | ) |
Add a GPU attribute that refers to the default color attribute on a geometry. The name, type, and domain are unknown and do not depend on the material.
Definition at line 552 of file gpu_node_graph.cc.
References CD_AUTO_FROM_NAME, GPU_attribute_default_color(), GPU_constant(), gpu_material_node_graph(), GPU_MAX_CONSTANT_DATA, gpu_node_graph_add_attribute(), GPU_NODE_LINK_ATTR, gpu_node_link_create(), GPUMaterialAttribute::is_default_color, and GPUNodeLink::link_type.
Referenced by GPU_attribute_default_color(), and blender::nodes::node_shader_vertex_color_cc::node_shader_gpu_vertex_color().
| GPUNodeLink * GPU_attribute_hair_length | ( | GPUMaterial * | mat | ) |
Add a GPU attribute that refers to the approximate length of curves/hairs.
Definition at line 568 of file gpu_node_graph.cc.
References CD_AUTO_FROM_NAME, GPU_attribute_hair_length(), GPU_constant(), gpu_material_node_graph(), GPU_MAX_CONSTANT_DATA, gpu_node_graph_add_attribute(), GPU_NODE_LINK_ATTR, gpu_node_link_create(), and GPUNodeLink::link_type.
Referenced by GPU_attribute_hair_length(), and blender::nodes::node_shader_hair_info_cc::node_shader_gpu_hair_info().
| GPUNodeLink * GPU_attribute_with_default | ( | GPUMaterial * | mat, |
| const eCustomDataType | type, | ||
| const char * | name, | ||
| eGPUDefaultValue | default_value ) |
Definition at line 583 of file gpu_node_graph.cc.
References GPU_attribute(), GPU_attribute_with_default(), GPU_NODE_LINK_ATTR, and GPUNodeLink::link_type.
Referenced by GPU_attribute_with_default(), and blender::nodes::node_shader_volume_principled_cc::node_shader_gpu_volume_principled().
| GPUNodeLink * GPU_color_band | ( | GPUMaterial * | mat, |
| int | size, | ||
| float * | pixels, | ||
| float * | r_row ) |
Definition at line 703 of file gpu_node_graph.cc.
References GPU_color_band(), gpu_material_node_graph(), gpu_material_ramp_texture_row_set(), gpu_node_graph_add_texture(), GPU_NODE_LINK_COLORBAND, gpu_node_link_create(), GPUSamplerState::internal_sampler(), GPUNodeLink::link_type, MEM_freeN(), and size().
Referenced by GPU_color_band(), blender::nodes::node_shader_curves_cc::flt::gpu_shader_curve_float(), blender::nodes::node_shader_curves_cc::rgb::gpu_shader_curve_rgb(), blender::nodes::node_shader_curves_cc::vec::gpu_shader_curve_vec(), blender::nodes::node_shader_color_ramp_cc::gpu_shader_valtorgb(), blender::nodes::node_composite_color_ramp_cc::node_gpu_material(), blender::nodes::node_composite_huecorrect_cc::node_gpu_material(), blender::nodes::node_composite_rgb_curves_cc::node_gpu_material(), blender::nodes::node_composite_vector_curves_cc::node_gpu_material(), blender::nodes::node_shader_blackbody_cc::node_shader_gpu_blackbody(), blender::nodes::node_shader_volume_principled_cc::node_shader_gpu_volume_principled(), and blender::nodes::node_shader_wavelength_cc::node_shader_gpu_wavelength().
| GPUNodeLink * GPU_constant | ( | const float * | num | ) |
Definition at line 628 of file gpu_node_graph.cc.
References GPU_constant(), GPU_NODE_LINK_CONSTANT, gpu_node_link_create(), GPUNodeLink::link_type, and num.
Referenced by GPU_attribute(), GPU_attribute_default_color(), GPU_attribute_hair_length(), GPU_constant(), gpu_node_input_socket(), blender::nodes::node_shader_bump_cc::gpu_shader_bump(), blender::nodes::node_shader_curves_cc::flt::gpu_shader_curve_float(), blender::nodes::node_shader_curves_cc::rgb::gpu_shader_curve_rgb(), blender::nodes::node_shader_curves_cc::vec::gpu_shader_curve_vec(), blender::nodes::node_shader_map_range_cc::gpu_shader_map_range(), blender::nodes::node_shader_math_cc::gpu_shader_math(), blender::nodes::node_sh_mix_cc::gpu_shader_mix(), blender::nodes::node_shader_mix_rgb_cc::gpu_shader_mix_rgb(), blender::nodes::node_shader_normal_map_cc::gpu_shader_normal_map(), blender::nodes::node_shader_rgb_to_bw_cc::gpu_shader_rgbtobw(), blender::nodes::node_shader_color_ramp_cc::gpu_shader_valtorgb(), blender::nodes::node_shader_vector_transform_cc::gpu_shader_vect_transform(), blender::nodes::node_shader_vector_rotate_cc::gpu_shader_vector_rotate(), GPU_uniform_attribute(), blender::nodes::node_composite_channel_matte_cc::node_gpu_material(), blender::nodes::node_composite_color_ramp_cc::node_gpu_material(), blender::nodes::node_composite_color_spill_cc::node_gpu_material(), blender::nodes::node_composite_colorcorrection_cc::node_gpu_material(), blender::nodes::node_composite_huecorrect_cc::node_gpu_material(), blender::nodes::node_composite_luma_matte_cc::node_gpu_material(), blender::nodes::node_composite_map_range_cc::node_gpu_material(), blender::nodes::node_composite_map_value_cc::node_gpu_material(), blender::nodes::node_composite_math_cc::node_gpu_material(), blender::nodes::node_composite_mixrgb_cc::node_gpu_material(), blender::nodes::node_composite_rgb_curves_cc::node_gpu_material(), blender::nodes::node_composite_rgb_to_bw_cc::node_gpu_material(), blender::nodes::node_composite_vector_curves_cc::node_gpu_material(), blender::nodes::node_shader_ambient_occlusion_cc::node_shader_gpu_ambient_occlusion(), blender::nodes::node_shader_attribute_cc::node_shader_gpu_attribute(), blender::nodes::node_shader_blackbody_cc::node_shader_gpu_blackbody(), blender::nodes::node_shader_bsdf_glass_cc::node_shader_gpu_bsdf_glass(), blender::nodes::node_shader_bsdf_glossy_cc::node_shader_gpu_bsdf_glossy(), blender::nodes::node_shader_bsdf_metallic_cc::node_shader_gpu_bsdf_metallic(), blender::nodes::node_shader_bsdf_principled_cc::node_shader_gpu_bsdf_principled(), blender::nodes::node_shader_eevee_specular_cc::node_shader_gpu_eevee_specular(), blender::nodes::node_shader_geometry_cc::node_shader_gpu_geometry(), blender::nodes::node_shader_hair_info_cc::node_shader_gpu_hair_info(), blender::nodes::node_shader_object_info_cc::node_shader_gpu_object_info(), blender::nodes::node_shader_output_aov_cc::node_shader_gpu_output_aov(), blender::nodes::node_shader_tex_brick_cc::node_shader_gpu_tex_brick(), blender::nodes::node_shader_tex_coord_cc::node_shader_gpu_tex_coord(), blender::nodes::node_shader_tex_gabor_cc::node_shader_gpu_tex_gabor(), blender::nodes::node_shader_tex_gradient_cc::node_shader_gpu_tex_gradient(), blender::nodes::node_shader_tex_magic_cc::node_shader_gpu_tex_magic(), blender::nodes::node_shader_tex_noise_cc::node_shader_gpu_tex_noise(), blender::nodes::node_shader_tex_sky_cc::node_shader_gpu_tex_sky(), blender::nodes::node_shader_tex_voronoi_cc::node_shader_gpu_tex_voronoi(), blender::nodes::node_shader_tex_wave_cc::node_shader_gpu_tex_wave(), blender::nodes::node_shader_volume_principled_cc::node_shader_gpu_volume_principled(), and blender::nodes::node_shader_wavelength_cc::node_shader_gpu_wavelength().
| GPUNodeLink * GPU_differentiate_float_function | ( | const char * | function_name, |
| const float | filter_width ) |
Create an implementation defined differential calculation of a float function. The given function should return a float. The result will be a vec2 containing dFdx and dFdy result of that function.
Definition at line 644 of file gpu_node_graph.cc.
References GPU_differentiate_float_function(), gpu_node_link_create(), GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN, and GPUNodeLink::link_type.
Referenced by GPU_differentiate_float_function(), and blender::nodes::node_shader_bump_cc::gpu_shader_bump().
| GPUNodeLink * GPU_image | ( | GPUMaterial * | mat, |
| Image * | ima, | ||
| ImageUser * | iuser, | ||
| GPUSamplerState | sampler_state ) |
Definition at line 653 of file gpu_node_graph.cc.
References GPU_image(), gpu_material_node_graph(), gpu_node_graph_add_texture(), gpu_node_link_create(), GPU_NODE_LINK_IMAGE, and GPUNodeLink::link_type.
Referenced by GPU_image(), blender::nodes::node_shader_tex_environment_cc::node_shader_gpu_tex_environment(), and blender::nodes::node_shader_tex_image_cc::node_shader_gpu_tex_image().
| GPUNodeLink * GPU_image_sky | ( | GPUMaterial * | mat, |
| int | width, | ||
| int | height, | ||
| const float * | pixels, | ||
| float * | layer, | ||
| GPUSamplerState | sampler_state ) |
Definition at line 666 of file gpu_node_graph.cc.
References GPU_image_sky(), gpu_material_node_graph(), gpu_material_sky_texture_layer_set(), gpu_node_graph_add_texture(), gpu_node_link_create(), GPU_NODE_LINK_IMAGE_SKY, and GPUNodeLink::link_type.
Referenced by GPU_image_sky(), and blender::nodes::node_shader_tex_sky_cc::node_shader_gpu_tex_sky().
| void GPU_image_tiled | ( | GPUMaterial * | mat, |
| Image * | ima, | ||
| ImageUser * | iuser, | ||
| GPUSamplerState | sampler_state, | ||
| GPUNodeLink ** | r_image_tiled_link, | ||
| GPUNodeLink ** | r_image_tiled_mapping_link ) |
Definition at line 683 of file gpu_node_graph.cc.
References GPU_image_tiled(), gpu_material_node_graph(), gpu_node_graph_add_texture(), gpu_node_link_create(), GPU_NODE_LINK_IMAGE_TILED, GPU_NODE_LINK_IMAGE_TILED_MAPPING, and texture().
Referenced by GPU_image_tiled(), and blender::nodes::node_shader_tex_image_cc::node_shader_gpu_tex_image().
|
static |
Definition at line 842 of file gpu_node_graph.cc.
References BLI_freelistN(), gpu_inputs_free(), gpu_node_link_free(), GPU_SOURCE_ATTR, GPU_SOURCE_LAYER_ATTR, GPU_SOURCE_TEX, GPU_SOURCE_TEX_TILED_MAPPING, GPU_SOURCE_UNIFORM_ATTR, input, and LISTBASE_FOREACH.
Referenced by gpu_inputs_free(), and gpu_node_free().
| GPUNodeLink * GPU_layer_attribute | ( | GPUMaterial * | mat, |
| const char * | name ) |
Definition at line 617 of file gpu_node_graph.cc.
References GPU_layer_attribute(), gpu_material_node_graph(), gpu_node_graph_add_layer_attribute(), gpu_node_link_create(), GPU_NODE_LINK_LAYER_ATTR, and GPUNodeLink::link_type.
Referenced by GPU_layer_attribute(), and blender::nodes::node_shader_attribute_cc::node_shader_gpu_attribute().
| bool GPU_link | ( | GPUMaterial * | mat, |
| const char * | name, | ||
| ... ) |
Definition at line 718 of file gpu_node_graph.cc.
References BLI_addtail(), FUNCTION_QUAL_OUT, GPU_link(), gpu_material_library_use_function(), gpu_material_node_graph(), gpu_node_create(), gpu_node_input_link(), gpu_node_output(), i, GPUNodeGraph::nodes, GPUFunction::paramqual, GPUFunction::paramtype, GPUFunction::totparam, and GPUNodeGraph::used_libraries.
Referenced by blender::nodes::node_shader_volume_principled_cc::attribute_post_process(), GPU_link(), GPU_material_split_sub_function(), blender::nodes::node_shader_bevel_cc::gpu_shader_bevel(), blender::nodes::node_shader_bump_cc::gpu_shader_bump(), blender::nodes::node_shader_displacement_cc::gpu_shader_displacement(), blender::nodes::node_shader_map_range_cc::gpu_shader_map_range(), blender::nodes::node_shader_math_cc::gpu_shader_math(), blender::nodes::node_sh_mix_cc::gpu_shader_mix(), blender::nodes::node_shader_mix_rgb_cc::gpu_shader_mix_rgb(), blender::nodes::node_shader_normal_map_cc::gpu_shader_normal_map(), blender::nodes::node_shader_rgb_cc::gpu_shader_rgb(), blender::nodes::node_shader_color_ramp_cc::gpu_shader_valtorgb(), blender::nodes::node_shader_value_cc::gpu_shader_value(), blender::nodes::node_shader_vector_transform_cc::gpu_shader_vect_transform(), gpu_uniformbuffer_link(), blender::nodes::node_composite_math_cc::node_gpu_material(), blender::nodes::node_composite_mixrgb_cc::node_gpu_material(), blender::nodes::node_composite_rgb_curves_cc::node_gpu_material(), blender::nodes::node_shader_ambient_occlusion_cc::node_shader_gpu_ambient_occlusion(), blender::nodes::node_shader_attribute_cc::node_shader_gpu_attribute(), blender::nodes::node_shader_bsdf_diffuse_cc::node_shader_gpu_bsdf_diffuse(), blender::nodes::node_shader_bsdf_glass_cc::node_shader_gpu_bsdf_glass(), blender::nodes::node_shader_bsdf_glossy_cc::node_shader_gpu_bsdf_glossy(), blender::nodes::node_shader_bsdf_metallic_cc::node_shader_gpu_bsdf_metallic(), blender::nodes::node_shader_bsdf_principled_cc::node_shader_gpu_bsdf_principled(), blender::nodes::node_shader_bsdf_refraction_cc::node_shader_gpu_bsdf_refraction(), blender::nodes::node_shader_bsdf_sheen_cc::node_shader_gpu_bsdf_sheen(), blender::nodes::node_shader_bsdf_toon_cc::node_shader_gpu_bsdf_toon(), blender::nodes::node_shader_bsdf_translucent_cc::node_shader_gpu_bsdf_translucent(), node_shader_gpu_bump_tex_coord(), blender::nodes::node_shader_eevee_specular_cc::node_shader_gpu_eevee_specular(), blender::nodes::node_shader_fresnel_cc::node_shader_gpu_fresnel(), blender::nodes::node_shader_geometry_cc::node_shader_gpu_geometry(), blender::nodes::node_shader_layer_weight_cc::node_shader_gpu_layer_weight(), blender::nodes::node_shader_output_light_cc::node_shader_gpu_output_light(), blender::nodes::node_shader_output_material_cc::node_shader_gpu_output_material(), blender::nodes::node_shader_output_world_cc::node_shader_gpu_output_world(), blender::nodes::node_shader_subsurface_scattering_cc::node_shader_gpu_subsurface_scattering(), blender::nodes::node_shader_tangent_cc::node_shader_gpu_tangent(), blender::nodes::node_shader_tex_coord_cc::node_shader_gpu_tex_coord(), blender::nodes::node_shader_tex_environment_cc::node_shader_gpu_tex_environment(), blender::nodes::node_shader_tex_image_cc::node_shader_gpu_tex_image(), node_shader_gpu_tex_mapping(), and blender::nodes::node_shader_volume_info_cc::node_shader_gpu_volume_info().
|
static |
Definition at line 57 of file gpu_node_graph.cc.
References gpu_node_create(), MEM_callocN(), and GPUNode::name.
Referenced by GPU_link(), gpu_node_create(), and gpu_stack_link_v().
|
static |
Definition at line 872 of file gpu_node_graph.cc.
References BLI_freelistN(), gpu_inputs_free(), gpu_node_free(), gpu_node_link_free(), GPUNode::inputs, LISTBASE_FOREACH, MEM_freeN(), output, and GPUNode::outputs.
Referenced by gpu_node_free(), gpu_node_graph_free_nodes(), and gpu_node_graph_prune_unused().
|
static |
Add a new varying attribute of given type and name. Returns nullptr if out of slots.
Definition at line 387 of file gpu_node_graph.cc.
References attr_input_name(), GPUNodeGraph::attributes, BLI_addtail(), ListBase::first, gpu_node_graph_add_attribute(), GPUMaterialAttribute::id, GPUMaterialAttribute::is_default_color, GPUMaterialAttribute::is_hair_length, MEM_callocN(), GPUMaterialAttribute::name, GPUMaterialAttribute::next, STREQ, STRNCPY(), GPUMaterialAttribute::type, and GPUMaterialAttribute::users.
Referenced by GPU_attribute(), GPU_attribute_default_color(), GPU_attribute_hair_length(), and gpu_node_graph_add_attribute().
|
static |
Add a new uniform attribute of given type and name. Returns nullptr if out of slots.
Definition at line 458 of file gpu_node_graph.cc.
References BLI_addtail(), BLI_ghashutil_strhash_p(), ListBase::first, gpu_node_graph_add_layer_attribute(), GPULayerAttr::hash_code, GPUNodeGraph::layer_attrs, MEM_callocN(), GPULayerAttr::name, GPULayerAttr::next, STREQ, STRNCPY(), and GPULayerAttr::users.
Referenced by GPU_layer_attribute(), and gpu_node_graph_add_layer_attribute().
|
static |
Definition at line 485 of file gpu_node_graph.cc.
References BLI_addtail(), GPUMaterialTexture::colorband, ListBase::first, gpu_node_graph_add_texture(), GPUMaterialTexture::ima, GPUMaterialTexture::iuser, GPUMaterialTexture::iuser_available, MEM_callocN(), GPUMaterialTexture::next, GPUMaterialTexture::sampler_name, GPUMaterialTexture::sampler_state, GPUMaterialTexture::sky, SNPRINTF, GPUNodeGraph::textures, GPUMaterialTexture::tiled_mapping_name, and GPUMaterialTexture::users.
Referenced by GPU_color_band(), GPU_image(), GPU_image_sky(), GPU_image_tiled(), and gpu_node_graph_add_texture().
|
static |
Add a new uniform attribute of given type and name. Returns nullptr if out of slots.
Definition at line 425 of file gpu_node_graph.cc.
References BLI_addtail(), BLI_ghashutil_strhash_p(), GPUUniformAttrList::count, ListBase::first, GPU_MAX_UNIFORM_ATTR, gpu_node_graph_add_uniform_attribute(), GPUUniformAttr::hash_code, GPUUniformAttr::id, GPUUniformAttrList::list, MEM_callocN(), GPUUniformAttr::name, GPUUniformAttr::next, STREQ, STRNCPY(), GPUNodeGraph::uniform_attrs, GPUUniformAttr::use_dupli, and GPUUniformAttr::users.
Referenced by gpu_node_graph_add_uniform_attribute(), and GPU_uniform_attribute().
| void gpu_node_graph_finalize_uniform_attrs | ( | GPUNodeGraph * | graph | ) |
Definition at line 330 of file gpu_node_graph.cc.
References BLI_assert, BLI_ghashutil_uinthash(), BLI_listbase_count(), BLI_listbase_sort(), GPUUniformAttrList::count, gpu_node_graph_finalize_uniform_attrs(), GPUUniformAttrList::hash_code, GPUUniformAttrList::list, LISTBASE_FOREACH, uniform_attr_sort_cmp(), and GPUNodeGraph::uniform_attrs.
Referenced by GPU_generate_pass(), and gpu_node_graph_finalize_uniform_attrs().
| void gpu_node_graph_free | ( | GPUNodeGraph * | graph | ) |
Free both node graph and requested attributes and textures.
Definition at line 899 of file gpu_node_graph.cc.
References GPUNodeGraph::attributes, BLI_freelistN(), BLI_gset_free(), gpu_node_graph_free(), gpu_node_graph_free_nodes(), GPU_uniform_attr_list_free(), GPUNodeGraph::layer_attrs, GPUNodeGraph::material_functions, GPUNodeGraph::outlink_aovs, GPUNodeGraph::outlink_compositor, GPUNodeGraph::textures, GPUNodeGraph::uniform_attrs, and GPUNodeGraph::used_libraries.
Referenced by gpu_node_graph_free(), and GPUMaterial::~GPUMaterial().
| void gpu_node_graph_free_nodes | ( | GPUNodeGraph * | graph | ) |
Free intermediate node graph.
Definition at line 887 of file gpu_node_graph.cc.
References BLI_pophead(), gpu_node_free(), gpu_node_graph_free_nodes(), GPUNodeGraph::nodes, GPUNodeGraph::outlink_displacement, GPUNodeGraph::outlink_surface, GPUNodeGraph::outlink_thickness, and GPUNodeGraph::outlink_volume.
Referenced by GPU_material_from_callbacks(), GPU_material_from_nodetree(), gpu_node_graph_free(), and gpu_node_graph_free_nodes().
| void gpu_node_graph_optimize | ( | GPUNodeGraph * | graph | ) |
Optimize node graph for optimized material shader path. Once the base material has been generated, we can modify the shader node graph to create one which will produce an optimally performing shader. This currently involves baking uniform data into constant data to enable aggressive constant folding by the compiler in order to reduce complexity and shader core memory pressure.
NOTE: Graph optimizations will produce a shader which needs to be re-compiled more frequently, however, the default material pass will always exist to fall back on.
Definition at line 1010 of file gpu_node_graph.cc.
References GPU_CLOSURE, gpu_node_graph_optimize(), GPU_NODE_LINK_CONSTANT, GPU_NODE_LINK_UNIFORM, GPU_SOURCE_CONSTANT, GPU_SOURCE_STRUCT, GPU_SOURCE_UNIFORM, input, LISTBASE_FOREACH, and GPUNodeGraph::nodes.
Referenced by GPU_generate_pass(), and gpu_node_graph_optimize().
| void gpu_node_graph_prune_unused | ( | GPUNodeGraph * | graph | ) |
Definition at line 940 of file gpu_node_graph.cc.
References GPUNodeGraph::attributes, BLI_freelinkN(), BLI_remlink(), GPUUniformAttrList::count, ListBase::first, gpu_node_free(), gpu_node_graph_prune_unused(), GPU_NODE_TAG_AOV, GPU_NODE_TAG_COMPOSITOR, GPU_NODE_TAG_DISPLACEMENT, GPU_NODE_TAG_FUNCTION, GPU_NODE_TAG_NONE, GPU_NODE_TAG_SURFACE, GPU_NODE_TAG_THICKNESS, GPU_NODE_TAG_VOLUME, gpu_nodes_tag(), GPUNodeGraph::layer_attrs, GPUUniformAttrList::list, LISTBASE_FOREACH, LISTBASE_FOREACH_MUTABLE, GPUNodeGraph::material_functions, GPUNodeGraph::nodes, GPUNodeGraph::outlink_aovs, GPUNodeGraph::outlink_compositor, GPUNodeGraph::outlink_displacement, GPUNodeGraph::outlink_surface, GPUNodeGraph::outlink_thickness, GPUNodeGraph::outlink_volume, GPUNodeGraph::textures, and GPUNodeGraph::uniform_attrs.
Referenced by GPU_generate_pass(), and gpu_node_graph_prune_unused().
|
static |
Definition at line 66 of file gpu_node_graph.cc.
References BLI_addtail(), CLAMP_MIN, ELEM, ListBase::first, GPU_CLOSURE, gpu_node_input_link(), GPU_NODE_LINK_ATTR, GPU_NODE_LINK_COLORBAND, GPU_NODE_LINK_CONSTANT, GPU_NODE_LINK_DIFFERENTIATE_FLOAT_FN, GPU_NODE_LINK_IMAGE, GPU_NODE_LINK_IMAGE_SKY, GPU_NODE_LINK_IMAGE_TILED, GPU_NODE_LINK_IMAGE_TILED_MAPPING, GPU_NODE_LINK_LAYER_ATTR, GPU_NODE_LINK_OUTPUT, GPU_NODE_LINK_UNIFORM, GPU_NODE_LINK_UNIFORM_ATTR, GPU_SOURCE_ATTR, GPU_SOURCE_CONSTANT, GPU_SOURCE_FUNCTION_CALL, GPU_SOURCE_LAYER_ATTR, GPU_SOURCE_OUTPUT, GPU_SOURCE_STRUCT, GPU_SOURCE_TEX, GPU_SOURCE_TEX_TILED_MAPPING, GPU_SOURCE_UNIFORM, GPU_SOURCE_UNIFORM_ATTR, input, GPUNode::inputs, GPUNodeLink::link_type, MEM_callocN(), MEM_dupallocN(), MEM_freeN(), GPUNode::name, SNPRINTF, STR_ELEM, and GPUNodeLink::users.
Referenced by GPU_link(), gpu_node_input_link(), gpu_node_input_socket(), and gpu_stack_link_v().
|
static |
Definition at line 233 of file gpu_node_graph.cc.
References GPU_constant(), gpu_node_input_link(), gpu_node_input_socket(), gpu_uniformbuffer_link(), GPUNodeStack::link, SOCK_IN, GPUNodeStack::type, and GPUNodeStack::vec.
Referenced by gpu_node_input_socket(), and gpu_stack_link_v().
|
static |
Definition at line 31 of file gpu_node_graph.cc.
References gpu_node_link_create(), MEM_callocN(), and GPUNodeLink::users.
Referenced by GPU_attribute(), GPU_attribute_default_color(), GPU_attribute_hair_length(), GPU_color_band(), GPU_constant(), GPU_differentiate_float_function(), GPU_image(), GPU_image_sky(), GPU_image_tiled(), GPU_layer_attribute(), gpu_node_link_create(), gpu_node_output(), GPU_uniform(), and GPU_uniform_attribute().
|
static |
Definition at line 39 of file gpu_node_graph.cc.
References gpu_node_link_free(), MEM_freeN(), and GPUNodeLink::users.
Referenced by gpu_inputs_free(), gpu_node_free(), and gpu_node_link_free().
|
static |
Definition at line 249 of file gpu_node_graph.cc.
References BLI_addtail(), gpu_node_link_create(), GPU_NODE_LINK_OUTPUT, gpu_node_output(), MEM_callocN(), output, and GPUNode::outputs.
Referenced by GPU_link(), gpu_node_output(), and gpu_stack_link_v().
| void gpu_nodes_tag | ( | GPUNodeLink * | link, |
| eGPUNodeTag | tag ) |
Definition at line 919 of file gpu_node_graph.cc.
References gpu_nodes_tag(), input, GPUNode::inputs, LISTBASE_FOREACH, and GPUNode::tag.
Referenced by blender::gpu::shader::GPUCodegen::generate_graphs(), gpu_node_graph_prune_unused(), and gpu_nodes_tag().
| bool GPU_stack_link | ( | GPUMaterial * | material, |
| const bNode * | bnode, | ||
| const char * | name, | ||
| GPUNodeStack * | in, | ||
| GPUNodeStack * | out, | ||
| ... ) |
Definition at line 825 of file gpu_node_graph.cc.
References GPU_stack_link(), gpu_stack_link_v(), in, and out.
Referenced by blender::nodes::node_shader_bevel_cc::gpu_shader_bevel(), blender::nodes::node_shader_brightness_cc::gpu_shader_brightcontrast(), blender::nodes::node_shader_bump_cc::gpu_shader_bump(), blender::nodes::node_shader_camera_cc::gpu_shader_camera(), blender::nodes::node_shader_clamp_cc::gpu_shader_clamp(), blender::nodes::node_shader_combine_color_cc::gpu_shader_combcolor(), blender::nodes::node_shader_sepcomb_hsv_cc::gpu_shader_combhsv(), blender::nodes::node_shader_sepcomb_rgb_cc::gpu_shader_combrgb(), blender::nodes::node_shader_sepcomb_xyz_cc::comb::gpu_shader_combxyz(), blender::nodes::node_shader_curves_cc::flt::gpu_shader_curve_float(), blender::nodes::node_shader_curves_cc::rgb::gpu_shader_curve_rgb(), blender::nodes::node_shader_curves_cc::vec::gpu_shader_curve_vec(), blender::nodes::node_shader_displacement_cc::gpu_shader_displacement(), blender::nodes::node_shader_hueSatVal_cc::gpu_shader_hue_sat(), blender::nodes::node_shader_invert_cc::gpu_shader_invert(), blender::nodes::node_shader_map_range_cc::gpu_shader_map_range(), blender::nodes::node_shader_mapping_cc::gpu_shader_mapping(), blender::nodes::node_shader_math_cc::gpu_shader_math(), blender::nodes::node_sh_mix_cc::gpu_shader_mix(), blender::nodes::node_shader_mix_rgb_cc::gpu_shader_mix_rgb(), blender::nodes::node_shader_normal_cc::gpu_shader_normal(), blender::nodes::node_shader_particle_info_cc::gpu_shader_particle_info(), blender::nodes::node_shader_holdout_cc::gpu_shader_rgb(), blender::nodes::node_shader_rgb_to_bw_cc::gpu_shader_rgbtobw(), blender::nodes::node_shader_separate_color_cc::gpu_shader_sepcolor(), blender::nodes::node_shader_sepcomb_hsv_cc::gpu_shader_sephsv(), blender::nodes::node_shader_sepcomb_rgb_cc::gpu_shader_seprgb(), blender::nodes::node_shader_sepcomb_xyz_cc::sep::gpu_shader_sepxyz(), blender::nodes::node_shader_squeeze_cc::gpu_shader_squeeze(), blender::nodes::node_shader_tex_white_noise_cc::gpu_shader_tex_white_noise(), blender::nodes::node_shader_color_ramp_cc::gpu_shader_valtorgb(), blender::nodes::node_shader_vector_displacement_cc::gpu_shader_vector_displacement(), blender::nodes::node_shader_vector_math_cc::gpu_shader_vector_math(), blender::nodes::node_shader_vector_rotate_cc::gpu_shader_vector_rotate(), GPU_stack_link(), blender::nodes::node_composite_alpha_over_cc::node_gpu_material(), blender::nodes::node_composite_brightness_cc::node_gpu_material(), blender::nodes::node_composite_channel_matte_cc::node_gpu_material(), blender::nodes::node_composite_chroma_matte_cc::node_gpu_material(), blender::nodes::node_composite_color_matte_cc::node_gpu_material(), blender::nodes::node_composite_color_ramp_cc::node_gpu_material(), blender::nodes::node_composite_color_spill_cc::node_gpu_material(), blender::nodes::node_composite_colorbalance_cc::node_gpu_material(), blender::nodes::node_composite_colorcorrection_cc::node_gpu_material(), blender::nodes::node_composite_combine_color_cc::node_gpu_material(), blender::nodes::node_composite_combine_hsva_cc::node_gpu_material(), blender::nodes::node_composite_combine_rgba_cc::node_gpu_material(), blender::nodes::node_composite_combine_xyz_cc::node_gpu_material(), blender::nodes::node_composite_combine_ycca_cc::node_gpu_material(), blender::nodes::node_composite_combine_yuva_cc::node_gpu_material(), blender::nodes::node_composite_diff_matte_cc::node_gpu_material(), blender::nodes::node_composite_distance_matte_cc::node_gpu_material(), blender::nodes::node_composite_exposure_cc::node_gpu_material(), blender::nodes::node_composite_gamma_cc::node_gpu_material(), blender::nodes::node_composite_hue_sat_val_cc::node_gpu_material(), blender::nodes::node_composite_huecorrect_cc::node_gpu_material(), blender::nodes::node_composite_invert_cc::node_gpu_material(), blender::nodes::node_composite_luma_matte_cc::node_gpu_material(), blender::nodes::node_composite_map_range_cc::node_gpu_material(), blender::nodes::node_composite_map_value_cc::node_gpu_material(), blender::nodes::node_composite_math_cc::node_gpu_material(), blender::nodes::node_composite_mixrgb_cc::node_gpu_material(), blender::nodes::node_composite_normal_cc::node_gpu_material(), blender::nodes::node_composite_posterize_cc::node_gpu_material(), blender::nodes::node_composite_premulkey_cc::node_gpu_material(), blender::nodes::node_composite_rgb_curves_cc::node_gpu_material(), blender::nodes::node_composite_rgb_to_bw_cc::node_gpu_material(), blender::nodes::node_composite_separate_color_cc::node_gpu_material(), blender::nodes::node_composite_separate_hsva_cc::node_gpu_material(), blender::nodes::node_composite_separate_rgba_cc::node_gpu_material(), blender::nodes::node_composite_separate_xyz_cc::node_gpu_material(), blender::nodes::node_composite_separate_ycca_cc::node_gpu_material(), blender::nodes::node_composite_separate_yuva_cc::node_gpu_material(), blender::nodes::node_composite_setalpha_cc::node_gpu_material(), blender::nodes::node_composite_vector_curves_cc::node_gpu_material(), blender::nodes::node_shader_add_shader_cc::node_shader_gpu_add_shader(), blender::nodes::node_shader_ambient_occlusion_cc::node_shader_gpu_ambient_occlusion(), blender::nodes::node_shader_attribute_cc::node_shader_gpu_attribute(), blender::nodes::node_shader_background_cc::node_shader_gpu_background(), blender::nodes::node_shader_blackbody_cc::node_shader_gpu_blackbody(), blender::nodes::node_shader_bsdf_diffuse_cc::node_shader_gpu_bsdf_diffuse(), blender::nodes::node_shader_bsdf_glass_cc::node_shader_gpu_bsdf_glass(), blender::nodes::node_shader_bsdf_glossy_cc::node_shader_gpu_bsdf_glossy(), blender::nodes::node_shader_bsdf_hair_cc::node_shader_gpu_bsdf_hair(), blender::nodes::node_shader_bsdf_metallic_cc::node_shader_gpu_bsdf_metallic(), blender::nodes::node_shader_bsdf_principled_cc::node_shader_gpu_bsdf_principled(), blender::nodes::node_shader_bsdf_ray_portal_cc::node_shader_gpu_bsdf_ray_portal(), blender::nodes::node_shader_bsdf_refraction_cc::node_shader_gpu_bsdf_refraction(), blender::nodes::node_shader_bsdf_sheen_cc::node_shader_gpu_bsdf_sheen(), blender::nodes::node_shader_bsdf_toon_cc::node_shader_gpu_bsdf_toon(), blender::nodes::node_shader_bsdf_translucent_cc::node_shader_gpu_bsdf_translucent(), blender::nodes::node_shader_bsdf_transparent_cc::node_shader_gpu_bsdf_transparent(), blender::nodes::node_shader_eevee_specular_cc::node_shader_gpu_eevee_specular(), blender::nodes::node_shader_emission_cc::node_shader_gpu_emission(), blender::nodes::node_shader_fresnel_cc::node_shader_gpu_fresnel(), blender::nodes::node_shader_gamma_cc::node_shader_gpu_gamma(), blender::nodes::node_shader_geometry_cc::node_shader_gpu_geometry(), blender::nodes::node_shader_hair_info_cc::node_shader_gpu_hair_info(), blender::nodes::node_shader_bsdf_hair_principled_cc::node_shader_gpu_hair_principled(), blender::nodes::node_shader_layer_weight_cc::node_shader_gpu_layer_weight(), blender::nodes::node_shader_light_falloff_cc::node_shader_gpu_light_falloff(), blender::nodes::node_shader_light_path_cc::node_shader_gpu_light_path(), blender::nodes::node_shader_mix_shader_cc::node_shader_gpu_mix_shader(), blender::nodes::node_shader_object_info_cc::node_shader_gpu_object_info(), blender::nodes::node_shader_output_aov_cc::node_shader_gpu_output_aov(), blender::nodes::node_shader_point_info_cc::node_shader_gpu_point_info(), blender::nodes::node_shader_shader_to_rgb_cc::node_shader_gpu_shadertorgb(), blender::nodes::node_shader_subsurface_scattering_cc::node_shader_gpu_subsurface_scattering(), blender::nodes::node_shader_tangent_cc::node_shader_gpu_tangent(), blender::nodes::node_shader_tex_brick_cc::node_shader_gpu_tex_brick(), blender::nodes::node_shader_tex_checker_cc::node_shader_gpu_tex_checker(), blender::nodes::node_shader_tex_coord_cc::node_shader_gpu_tex_coord(), blender::nodes::node_shader_tex_environment_cc::node_shader_gpu_tex_environment(), blender::nodes::node_shader_tex_gabor_cc::node_shader_gpu_tex_gabor(), blender::nodes::node_shader_tex_gradient_cc::node_shader_gpu_tex_gradient(), blender::nodes::node_shader_tex_image_cc::node_shader_gpu_tex_image(), blender::nodes::node_shader_tex_magic_cc::node_shader_gpu_tex_magic(), blender::nodes::node_shader_tex_noise_cc::node_shader_gpu_tex_noise(), blender::nodes::node_shader_tex_sky_cc::node_shader_gpu_tex_sky(), blender::nodes::node_shader_tex_voronoi_cc::node_shader_gpu_tex_voronoi(), blender::nodes::node_shader_tex_wave_cc::node_shader_gpu_tex_wave(), blender::nodes::node_shader_uvmap_cc::node_shader_gpu_uvmap(), blender::nodes::node_shader_vertex_color_cc::node_shader_gpu_vertex_color(), blender::nodes::node_shader_volume_absorption_cc::node_shader_gpu_volume_absorption(), blender::nodes::node_shader_volume_coefficients_cc::node_shader_gpu_volume_coefficients(), blender::nodes::node_shader_volume_principled_cc::node_shader_gpu_volume_principled(), blender::nodes::node_shader_volume_scatter_cc::node_shader_gpu_volume_scatter(), blender::nodes::node_shader_wavelength_cc::node_shader_gpu_wavelength(), and blender::nodes::node_shader_wireframe_cc::node_shader_gpu_wireframe().
|
static |
Definition at line 753 of file gpu_node_graph.cc.
References BLI_addtail(), FUNCTION_QUAL_OUT, gpu_material_library_use_function(), gpu_material_node_graph(), gpu_node_create(), gpu_node_input_link(), gpu_node_input_socket(), gpu_node_output(), GPU_NONE, gpu_stack_link_v(), i, in, GPUNodeGraph::nodes, out, GPUFunction::paramqual, GPUFunction::paramtype, GPUNodeLink::socket, GPUFunction::totparam, and GPUNodeGraph::used_libraries.
Referenced by GPU_stack_link(), and gpu_stack_link_v().
| GPUNodeLink * GPU_uniform | ( | const float * | num | ) |
Definition at line 636 of file gpu_node_graph.cc.
References gpu_node_link_create(), GPU_NODE_LINK_UNIFORM, GPU_uniform(), GPUNodeLink::link_type, and num.
Referenced by blender::compositor::get_shader_node_input_link(), blender::nodes::node_shader_curves_cc::flt::gpu_shader_curve_float(), blender::nodes::node_shader_curves_cc::rgb::gpu_shader_curve_rgb(), blender::nodes::node_shader_curves_cc::vec::gpu_shader_curve_vec(), blender::nodes::node_sh_mix_cc::gpu_shader_mix(), blender::nodes::node_shader_mix_rgb_cc::gpu_shader_mix_rgb(), blender::nodes::node_shader_normal_cc::gpu_shader_normal(), blender::nodes::node_shader_normal_map_cc::gpu_shader_normal_map(), blender::nodes::node_shader_rgb_cc::gpu_shader_rgb(), blender::nodes::node_shader_color_ramp_cc::gpu_shader_valtorgb(), blender::nodes::node_shader_value_cc::gpu_shader_value(), GPU_uniform(), gpu_uniformbuffer_link(), blender::nodes::node_composite_color_ramp_cc::node_gpu_material(), blender::nodes::node_composite_colorbalance_cc::node_gpu_material(), blender::nodes::node_composite_huecorrect_cc::node_gpu_material(), blender::nodes::node_composite_map_value_cc::node_gpu_material(), blender::nodes::node_composite_normal_cc::node_gpu_material(), blender::nodes::node_composite_rgb_curves_cc::node_gpu_material(), blender::nodes::node_composite_vector_curves_cc::node_gpu_material(), blender::nodes::node_shader_tex_brick_cc::node_shader_gpu_tex_brick(), blender::nodes::node_shader_tex_coord_cc::node_shader_gpu_tex_coord(), blender::nodes::node_shader_tex_image_cc::node_shader_gpu_tex_image(), node_shader_gpu_tex_mapping(), and blender::nodes::node_shader_tex_sky_cc::node_shader_gpu_tex_sky().
| void GPU_uniform_attr_list_copy | ( | GPUUniformAttrList * | dest, |
| const GPUUniformAttrList * | src ) |
Definition at line 316 of file gpu_node_graph.cc.
References BLI_duplicatelist(), GPUUniformAttrList::count, GPU_uniform_attr_list_copy(), GPUUniformAttrList::hash_code, and GPUUniformAttrList::list.
Referenced by GPU_uniform_attr_list_copy().
| void GPU_uniform_attr_list_free | ( | GPUUniformAttrList * | set | ) |
Definition at line 323 of file gpu_node_graph.cc.
References BLI_freelistN(), GPUUniformAttrList::count, GPU_uniform_attr_list_free(), GPUUniformAttrList::hash_code, and GPUUniformAttrList::list.
Referenced by gpu_node_graph_free(), and GPU_uniform_attr_list_free().
| GHash * GPU_uniform_attr_list_hash_new | ( | const char * | info | ) |
Definition at line 311 of file gpu_node_graph.cc.
References BLI_ghash_new(), GPU_uniform_attr_list_hash_new(), uniform_attr_list_cmp(), and uniform_attr_list_hash().
Referenced by GPU_uniform_attr_list_hash_new().
| GPUNodeLink * GPU_uniform_attribute | ( | GPUMaterial * | mat, |
| const char * | name, | ||
| bool | use_dupli, | ||
| uint32_t * | r_hash ) |
Definition at line 595 of file gpu_node_graph.cc.
References GPU_constant(), gpu_material_node_graph(), GPU_MAX_CONSTANT_DATA, gpu_node_graph_add_uniform_attribute(), gpu_node_link_create(), GPU_NODE_LINK_UNIFORM_ATTR, GPU_uniform_attribute(), GPUUniformAttr::hash_code, and GPUNodeLink::link_type.
Referenced by GPU_uniform_attribute(), and blender::nodes::node_shader_attribute_cc::node_shader_gpu_attribute().
|
static |
Definition at line 173 of file gpu_node_graph.cc.
References BLI_assert_msg, gpu_uniform_set_function_from_type(), SOCK_BOOLEAN, SOCK_FLOAT, SOCK_INT, SOCK_RGBA, and SOCK_VECTOR.
Referenced by gpu_uniform_set_function_from_type(), and gpu_uniformbuffer_link().
|
static |
Link stack uniform buffer. This is called for the input/output sockets that are not connected.
Definition at line 195 of file gpu_node_graph.cc.
References BLI_assert, BLI_findlink(), ELEM, bNodeSocket::flag, GPU_link(), GPU_uniform(), gpu_uniform_set_function_from_type(), gpu_uniformbuffer_link(), bNodeSocket::in_out, bNode::inputs, GPUNodeStack::link, bNode::outputs, SOCK_FLOAT, SOCK_HIDE_VALUE, SOCK_IN, SOCK_RGBA, SOCK_VECTOR, bNodeSocket::type, and GPUNodeStack::vec.
Referenced by gpu_node_input_socket(), and gpu_uniformbuffer_link().
|
static |
Definition at line 290 of file gpu_node_graph.cc.
References b, GPUUniformAttrList::count, ListBase::first, GPUUniformAttrList::hash_code, GPUUniformAttrList::list, GPUUniformAttr::name, GPUUniformAttr::next, STREQ, uniform_attr_list_cmp(), and GPUUniformAttr::use_dupli.
Referenced by GPU_uniform_attr_list_hash_new(), and uniform_attr_list_cmp().
|
static |
Definition at line 284 of file gpu_node_graph.cc.
References GPUUniformAttrList::hash_code, and uniform_attr_list_hash().
Referenced by GPU_uniform_attr_list_hash_new(), and uniform_attr_list_hash().
|
static |
Definition at line 271 of file gpu_node_graph.cc.
References b, GPUUniformAttr::name, uniform_attr_sort_cmp(), and GPUUniformAttr::use_dupli.
Referenced by gpu_node_graph_finalize_uniform_attrs(), and uniform_attr_sort_cmp().