|
Blender V5.3
|
#include <svm.h>
Classes | |
| struct | Summary |
| struct | Stack |
| struct | CompilerState |
Public Member Functions | |
| SVMCompiler (Scene *scene, Progress &progress) | |
| void | compile (Shader *shader, array< int > &svm_nodes, const int index, Summary *summary=nullptr) |
| SVMInputInt | input_int (const char *name) |
| SVMInputFloat | input_float (const char *name) |
| SVMInputFloat3 | input_float3 (const char *name) |
| SVMInputFloat3 | input_float3_from_offset (SVMStackOffset offset) |
| SVMStackOffset | input_link (const char *name) |
| SVMStackOffset | output (const char *name) |
| SVMStackOffset | output (ShaderOutput *shader_output) |
| void | add_node (ShaderNodeType type) |
| template<typename T> requires (std::is_class_v<T> && sizeof(T) % sizeof(int) == 0 && alignof(T) <= sizeof(uint)) | |
| void | add_node (ShaderNode *shader_node, const ShaderNodeType type, const T &node, const bool use_derivatives=false) |
| void | add_value_node (ShaderNode *shader_node, const float value, const int stack_offset) |
| void | add_value_node (ShaderNode *shader_node, const float3 &value, const int stack_offset) |
| template<typename T> | |
| void | add_bsdf_node (const SVMNodeClosureBsdf &node, const T &data) |
| template<typename T> requires (std::is_class_v<T> && sizeof(T) % sizeof(int) == 0 && alignof(T) <= sizeof(uint)) | |
| void | add_node_data (const T &data) |
| void | add_node_data_float4 (const float4 &f) |
| void | add_node_data_float (const float f) |
| SVMStackOffset | stack_assign (ShaderInput *input) |
| SVMStackOffset | stack_find_offset (const ShaderIO *io) |
| void | stack_clear_offset (const ShaderIO *io, const SVMStackOffset offset) |
| void | stack_link (ShaderInput *input, ShaderOutput *output) |
| uint | attribute (ustring name) |
| uint | attribute (AttributeStandard std) |
| uint | attribute_standard (ustring name) |
| SVMStackOffset | closure_mix_weight_offset () |
| SVMStackOffset | get_bump_state_offset () |
| ShaderType | output_type () |
Public Attributes | |
| Scene * | scene |
| Progress & | progress |
| ShaderGraph * | current_graph |
| ShaderNode * | current_node |
| bool | background |
Protected Attributes | |
| std::atomic_int * | svm_node_types_used |
| array< int > | current_svm_nodes |
| ShaderType | current_type |
| Shader * | current_shader |
| Stack | active_stack |
| int | max_stack_use |
| SVMStackOffset | mix_weight_offset |
| SVMStackOffset | bump_state_offset |
| bool | compile_failed |
Definition at line 49 of file scene/svm.h.
Definition at line 157 of file svm.cpp.
References background, bump_state_offset, compile_failed, current_graph, current_shader, current_type, DeviceScene::data, Scene::dscene, max_stack_use, mix_weight_offset, progress, scene, SHADER_TYPE_SURFACE, svm_node_types_used, and SVM_STACK_INVALID.
|
inline |
Definition at line 119 of file scene/svm.h.
References add_node(), add_node_data(), assert, current_node, node, ShaderNode::shader_node_type(), and T.
|
inline |
Definition at line 96 of file scene/svm.h.
References current_svm_nodes, node, node_type(), array< T, alignment >::push_back_slow(), svm_node_types_used, and T.
| void SVMCompiler::add_node | ( | ShaderNodeType | type | ) |
Definition at line 434 of file svm.cpp.
References current_svm_nodes, array< T, alignment >::push_back_slow(), and svm_node_types_used.
Referenced by add_bsdf_node(), add_value_node(), add_value_node(), CurvesNode::compile(), compile(), TextureMapping::compile(), VolumeNode::compile(), compile_type(), and generate_multi_closure().
|
inline |
Definition at line 128 of file scene/svm.h.
References current_svm_nodes, array< T, alignment >::push_back_slow(), and T.
Referenced by add_bsdf_node().
| void SVMCompiler::add_node_data_float | ( | const float | f | ) |
Definition at line 475 of file svm.cpp.
References __float_as_int, current_svm_nodes, and array< T, alignment >::push_back_slow().
| void SVMCompiler::add_node_data_float4 | ( | const float4 & | f | ) |
Definition at line 467 of file svm.cpp.
References __float_as_int, current_svm_nodes, array< T, alignment >::push_back_slow(), float4::w, float4::x, float4::y, and float4::z.
Referenced by CurvesNode::compile().
| void SVMCompiler::add_value_node | ( | ShaderNode * | shader_node, |
| const float | value, | ||
| const int | stack_offset ) |
Definition at line 480 of file svm.cpp.
References add_node().
Referenced by stack_assign(), and stack_zero_incomplete_derivatives().
| void SVMCompiler::add_value_node | ( | ShaderNode * | shader_node, |
| const float3 & | value, | ||
| const int | stack_offset ) |
Definition at line 492 of file svm.cpp.
References add_node().
| uint SVMCompiler::attribute | ( | AttributeStandard | std | ) |
Definition at line 541 of file svm.cpp.
References scene, and Scene::shader_manager.
| uint SVMCompiler::attribute | ( | ustring | name | ) |
Definition at line 536 of file svm.cpp.
References scene, and Scene::shader_manager.
Referenced by attribute_standard().
| uint SVMCompiler::attribute_standard | ( | ustring | name | ) |
Definition at line 546 of file svm.cpp.
References attribute(), and Attribute::name_standard().
|
inline |
Definition at line 149 of file scene/svm.h.
References mix_weight_offset.
Referenced by VolumeNode::compile().
| void SVMCompiler::compile | ( | Shader * | shader, |
| array< int > & | svm_nodes, | ||
| const int | index, | ||
| Summary * | summary = nullptr ) |
Definition at line 1177 of file svm.cpp.
References add_node(), array< T, alignment >::append(), array< T, alignment >::clear(), compile_type(), current_shader, current_svm_nodes, Shader::estimate_emission(), Shader::graph, Shader::has_bump_from_displacement, index, max_stack_use, SVMCompiler::Summary::num_svm_nodes, SVMCompiler::Summary::peak_stack_usage, SHADER_TYPE_BUMP, SHADER_TYPE_DISPLACEMENT, SHADER_TYPE_SURFACE, SHADER_TYPE_VOLUME, array< T, alignment >::size(), svm_node_types_used, time_dt(), SVMCompiler::Summary::time_generate_bump, SVMCompiler::Summary::time_generate_displacement, SVMCompiler::Summary::time_generate_surface, SVMCompiler::Summary::time_generate_volume, and SVMCompiler::Summary::time_total.
Referenced by SVMShaderManager::device_update_shader().
|
protected |
Definition at line 1039 of file svm.cpp.
References active_stack, add_node(), assert, bump_state_offset, array< T, alignment >::clear(), compile_failed, current_graph, current_node, current_svm_nodes, current_type, DISPLACE_BOTH, find_aov_nodes_and_dependencies(), generate_multi_closure(), generate_svm_nodes(), Shader::has_displacement, Shader::has_surface, Shader::has_volume, KERNEL_FEATURE_NODE_MASK_BUMP, KERNEL_FEATURE_NODE_MASK_DISPLACEMENT, KERNEL_FEATURE_NODE_MASK_SURFACE, KERNEL_FEATURE_NODE_MASK_VOLUME, ShaderInput::link, mark_nodes_requiring_derivatives(), node, ShaderGraph::nodes, ShaderGraph::output(), output(), ShaderIO::parent, Node::reference_count(), SHADER_TYPE_BUMP, SHADER_TYPE_DISPLACEMENT, SHADER_TYPE_SURFACE, SHADER_TYPE_VOLUME, stack_find_offset(), ShaderIO::stack_offset, state, SVM_BUMP_EVAL_STATE_SIZE, and SVM_STACK_INVALID.
Referenced by compile(), and generate_aov_node().
|
protected |
Definition at line 829 of file svm.cpp.
References find_dependencies(), in, node, ShaderGraph::nodes, OutputAOVNode::offset, SHADER_SPECIAL_TYPE_OUTPUT_AOV, and state.
Referenced by compile_type().
|
protected |
Definition at line 552 of file svm.cpp.
References find_dependencies(), in, ShaderInput::link, node, and ShaderIO::parent.
Referenced by find_aov_nodes_and_dependencies(), find_dependencies(), generate_closure_node(), and generate_multi_closure().
|
protected |
|
protected |
Definition at line 758 of file svm.cpp.
References current_shader, current_type, find_dependencies(), generate_node(), generate_svm_nodes(), Shader::has_bssrdf_bump, Shader::has_bump_from_surface, Shader::has_dispersion, Shader::has_surface_bssrdf, Shader::has_surface_transparent, in, ShaderInput::link, mix_weight_offset, node, SHADER_TYPE_SURFACE, SHADER_TYPE_VOLUME, ShaderIO::socket_type, stack_assign(), state, and SVM_STACK_INVALID.
Referenced by generate_aov_node(), and generate_multi_closure().
|
protected |
Definition at line 848 of file svm.cpp.
References add_node(), current_svm_nodes, find_dependencies(), generate_closure_node(), generate_multi_closure(), generate_svm_nodes(), generated_shared_closure_nodes(), in, ShaderNode::inputs, ShaderInput::link, node, ShaderIO::parent, SHADER_SPECIAL_TYPE_COMBINE_CLOSURE, array< T, alignment >::size(), stack_assign(), ShaderIO::stack_offset, state, and SVM_STACK_INVALID.
Referenced by compile_type(), generate_aov_node(), generate_multi_closure(), and generated_shared_closure_nodes().
|
protected |
Definition at line 567 of file svm.cpp.
References current_node, current_shader, current_type, Shader::has_surface_raytrace, Shader::has_surface_spatial_varying, Shader::has_volume_attribute_dependency, Shader::has_volume_spatial_varying, KERNEL_FEATURE_NODE_RAYTRACE, node, SHADER_TYPE_SURFACE, SHADER_TYPE_VOLUME, stack_clear_temporary(), stack_clear_users(), and stack_zero_incomplete_derivatives().
Referenced by generate_closure_node(), and generate_svm_nodes().
|
protected |
Definition at line 606 of file svm.cpp.
References b, generate_node(), ShaderNode::id, in, ShaderInput::link, max, node, output(), ShaderIO::parent, stack_node_output_size(), and state.
Referenced by compile_type(), generate_aov_node(), generate_closure_node(), and generate_multi_closure().
|
protected |
Definition at line 812 of file svm.cpp.
References SocketType::CLOSURE, generate_multi_closure(), generated_shared_closure_nodes(), in, node, shared, and state.
Referenced by generate_aov_node(), generate_multi_closure(), and generated_shared_closure_nodes().
|
inline |
Definition at line 153 of file scene/svm.h.
References bump_state_offset.
| SVMInputFloat SVMCompiler::input_float | ( | const char * | name | ) |
Definition at line 310 of file svm.cpp.
References __float_as_uint, current_node, Node::get_float(), ShaderNode::input(), isfinite_safe(), ShaderInput::link, ShaderIO::parent, ShaderIO::socket_type, stack_assign(), and SVM_INPUT_STACK_OFFSET_MASK.
Referenced by CurvesNode::compile(), and VolumeNode::compile().
| SVMInputFloat3 SVMCompiler::input_float3 | ( | const char * | name | ) |
Definition at line 324 of file svm.cpp.
References __float_as_uint, current_node, Node::get_float3(), ShaderNode::input(), isfinite_safe(), ShaderInput::link, ShaderIO::parent, ShaderIO::socket_type, stack_assign(), SVM_INPUT_STACK_OFFSET_MASK, float3::x, float3::y, float3::z, and zero_float3().
Referenced by CurvesNode::compile().
| SVMInputFloat3 SVMCompiler::input_float3_from_offset | ( | SVMStackOffset | offset | ) |
Definition at line 343 of file svm.cpp.
References SVM_INPUT_STACK_OFFSET_MASK.
Referenced by TextureMapping::compile().
| SVMInputInt SVMCompiler::input_int | ( | const char * | name | ) |
Definition at line 300 of file svm.cpp.
References current_node, Node::get_int(), ShaderNode::input(), ShaderInput::link, ShaderIO::parent, ShaderIO::socket_type, stack_assign(), and SVM_STACK_INVALID.
| SVMStackOffset SVMCompiler::input_link | ( | const char * | name | ) |
Definition at line 348 of file svm.cpp.
References ShaderNode::added_to_svm, assert, ShaderInput::constant_folded_in, current_node, ShaderNode::input(), ShaderInput::link, stack_assign(), ShaderIO::stack_offset, and SVM_STACK_INVALID.
Referenced by VolumeNode::compile().
|
protected |
|
protected |
Definition at line 455 of file svm.cpp.
References current_type, ShaderNode::need_derivatives(), SHADER_TYPE_VOLUME, and svm_node_type_with_derivatives().
Referenced by add_node().
| SVMStackOffset SVMCompiler::output | ( | const char * | name | ) |
Definition at line 360 of file svm.cpp.
References current_node, ShaderNode::output(), and output().
Referenced by CurvesNode::compile(), compile_type(), generate_svm_nodes(), is_sole_user(), output(), stack_assign(), stack_clear_users(), stack_link(), stack_node_output_size(), and stack_zero_incomplete_derivatives().
| SVMStackOffset SVMCompiler::output | ( | ShaderOutput * | shader_output | ) |
Definition at line 366 of file svm.cpp.
References ShaderOutput::links, stack_assign(), and SVM_STACK_INVALID.
|
inline |
Definition at line 158 of file scene/svm.h.
References current_type.
| SVMStackOffset SVMCompiler::stack_assign | ( | ShaderInput * | input | ) |
Definition at line 254 of file svm.cpp.
References __int_as_float, add_value_node(), assert, SocketType::COLOR, SocketType::FLOAT, SocketType::INT, ShaderInput::link, node, SocketType::NORMAL, ShaderIO::parent, SocketType::POINT, ShaderIO::socket_type, stack_find_offset(), ShaderIO::stack_offset, SVM_STACK_INVALID, ShaderIO::type(), and SocketType::VECTOR.
Referenced by TextureMapping::compile_begin(), generate_closure_node(), generate_multi_closure(), input_float(), input_float3(), input_int(), input_link(), and output().
|
protected |
Definition at line 290 of file svm.cpp.
References output(), stack_find_offset(), and SVM_STACK_INVALID.
| void SVMCompiler::stack_clear_offset | ( | const ShaderIO * | io, |
| const SVMStackOffset | offset ) |
Definition at line 245 of file svm.cpp.
References active_stack, stack_size(), and SVMCompiler::Stack::users.
Referenced by TextureMapping::compile_end(), stack_clear_temporary(), and stack_clear_users().
|
protected |
Definition at line 424 of file svm.cpp.
References ShaderInput::link, node, stack_clear_offset(), ShaderIO::stack_offset, and SVM_STACK_INVALID.
Referenced by generate_node().
|
protected |
Definition at line 402 of file svm.cpp.
References in, is_sole_user(), ShaderInput::link, node, output(), stack_clear_offset(), and SVM_STACK_INVALID.
Referenced by generate_node().
|
protected |
Definition at line 206 of file svm.cpp.
References active_stack, compile_failed, current_shader, LOG_ERROR, max, max_stack_use, Node::name, SVM_STACK_SIZE, and SVMCompiler::Stack::users.
| SVMStackOffset SVMCompiler::stack_find_offset | ( | const ShaderIO * | io | ) |
Definition at line 240 of file svm.cpp.
References stack_find_offset(), and stack_size().
Referenced by TextureMapping::compile_begin(), compile_type(), stack_assign(), stack_assign(), and stack_find_offset().
| void SVMCompiler::stack_link | ( | ShaderInput * | input, |
| ShaderOutput * | output ) |
Definition at line 371 of file svm.cpp.
References active_stack, assert, ShaderInput::link, output(), ShaderIO::stack_offset, stack_size(), SVM_STACK_INVALID, ShaderIO::type(), and SVMCompiler::Stack::users.
|
protected |
Definition at line 594 of file svm.cpp.
References node, output(), stack_size(), and SVM_STACK_INVALID.
Referenced by generate_svm_nodes().
|
protected |
Definition at line 198 of file svm.cpp.
References ShaderNode::need_derivatives(), ShaderIO::parent, stack_size(), and ShaderIO::type().
|
protected |
Definition at line 172 of file svm.cpp.
References assert, SocketType::CLOSURE, SocketType::COLOR, SocketType::FLOAT, SocketType::INT, SocketType::NORMAL, SocketType::POINT, and SocketType::VECTOR.
Referenced by stack_clear_offset(), stack_find_offset(), stack_link(), stack_node_output_size(), stack_size(), and stack_zero_incomplete_derivatives().
|
protected |
Definition at line 504 of file svm.cpp.
References add_value_node(), current_type, node, output(), SHADER_TYPE_VOLUME, stack_size(), svm_node_type_with_derivatives(), SVM_STACK_INVALID, and zero_float3().
Referenced by generate_node().
|
protected |
Definition at line 285 of file scene/svm.h.
Referenced by compile_type(), stack_clear_offset(), stack_find_offset(), and stack_link().
| bool SVMCompiler::background |
Definition at line 167 of file scene/svm.h.
Referenced by SVMShaderManager::device_update_shader(), and SVMCompiler().
|
protected |
Definition at line 288 of file scene/svm.h.
Referenced by compile_type(), get_bump_state_offset(), and SVMCompiler().
|
protected |
Definition at line 289 of file scene/svm.h.
Referenced by compile_type(), stack_find_offset(), and SVMCompiler().
| ShaderGraph* SVMCompiler::current_graph |
Definition at line 165 of file scene/svm.h.
Referenced by compile_type(), SVMCompiler(), and ImageTextureNode::update_images().
| ShaderNode* SVMCompiler::current_node |
Definition at line 166 of file scene/svm.h.
Referenced by add_bsdf_node(), compile_type(), generate_node(), input_float(), input_float3(), input_int(), input_link(), and output().
|
protected |
Definition at line 284 of file scene/svm.h.
Referenced by compile(), generate_closure_node(), generate_node(), stack_find_offset(), and SVMCompiler().
|
protected |
Definition at line 282 of file scene/svm.h.
Referenced by add_node(), add_node(), add_node_data(), add_node_data_float(), add_node_data_float4(), compile(), compile_type(), and generate_multi_closure().
|
protected |
Definition at line 283 of file scene/svm.h.
Referenced by compile_type(), generate_closure_node(), generate_node(), node_type(), output_type(), stack_zero_incomplete_derivatives(), and SVMCompiler().
|
protected |
Definition at line 286 of file scene/svm.h.
Referenced by compile(), stack_find_offset(), and SVMCompiler().
|
protected |
Definition at line 287 of file scene/svm.h.
Referenced by closure_mix_weight_offset(), generate_closure_node(), and SVMCompiler().
| Progress& SVMCompiler::progress |
Definition at line 164 of file scene/svm.h.
Referenced by SVMCompiler(), EnvironmentTextureNode::update_images(), and ImageTextureNode::update_images().
| Scene* SVMCompiler::scene |
Definition at line 163 of file scene/svm.h.
Referenced by attribute(), attribute(), SVMCompiler(), EnvironmentTextureNode::update_images(), and ImageTextureNode::update_images().
|
protected |
Definition at line 281 of file scene/svm.h.
Referenced by add_node(), add_node(), compile(), and SVMCompiler().