|
Blender V5.0
|
#include <svm.h>
Classes | |
| struct | Summary |
| struct | Stack |
| struct | CompilerState |
Public Attributes | |
| Scene * | scene |
| ShaderGraph * | current_graph |
| bool | background |
Protected Member Functions | |
| void | stack_clear_temporary (ShaderNode *node) |
| int | stack_size (SocketType::Type type) |
| void | stack_clear_users (ShaderNode *node, ShaderNodeSet &done) |
| void | find_dependencies (ShaderNodeSet &dependencies, const ShaderNodeSet &done, ShaderInput *input, ShaderNode *skip_node=nullptr) |
| void | find_aov_nodes_and_dependencies (ShaderNodeSet &aov_nodes, ShaderGraph *graph, CompilerState *state) |
| void | generate_node (ShaderNode *node, ShaderNodeSet &done) |
| void | generate_aov_node (ShaderNode *node, CompilerState *state) |
| void | generate_closure_node (ShaderNode *node, CompilerState *state) |
| void | generated_shared_closure_nodes (ShaderNode *root_node, ShaderNode *node, CompilerState *state, const ShaderNodeSet &shared) |
| void | generate_svm_nodes (const ShaderNodeSet &nodes, CompilerState *state) |
| void | generate_multi_closure (ShaderNode *root_node, ShaderNode *node, CompilerState *state) |
| void | compile_type (Shader *shader, ShaderGraph *graph, ShaderType type) |
Protected Attributes | |
| std::atomic_int * | svm_node_types_used |
| array< int4 > | current_svm_nodes |
| ShaderType | current_type |
| Shader * | current_shader |
| Stack | active_stack |
| int | max_stack_use |
| uint | mix_weight_offset |
| uint | bump_state_offset |
| bool | compile_failed |
Definition at line 48 of file scene/svm.h.
| SVMCompiler::SVMCompiler | ( | Scene * | scene | ) |
Definition at line 152 of file svm.cpp.
References background, bump_state_offset, compile_failed, current_graph, current_shader, current_type, max_stack_use, mix_weight_offset, scene, SHADER_TYPE_SURFACE, svm_node_types_used, and SVM_STACK_INVALID.
| void SVMCompiler::add_node | ( | const float4 & | f | ) |
Definition at line 419 of file svm.cpp.
References __float_as_int, current_svm_nodes, make_int4(), float4::w, float4::x, float4::y, and float4::z.
| void SVMCompiler::add_node | ( | const int | a = 0, |
| const int | b = 0, | ||
| const int | c = 0, | ||
| const int | d = 0 ) |
Definition at line 401 of file svm.cpp.
References b, current_svm_nodes, and make_int4().
| void SVMCompiler::add_node | ( | ShaderNodeType | type, |
| const float3 & | f ) |
Definition at line 412 of file svm.cpp.
References __float_as_int, current_svm_nodes, make_int4(), svm_node_types_used, float3::x, float3::y, and float3::z.
| void SVMCompiler::add_node | ( | ShaderNodeType | type, |
| const int | a = 0, | ||
| const int | b = 0, | ||
| const int | c = 0 ) |
Definition at line 406 of file svm.cpp.
References b, current_svm_nodes, make_int4(), and svm_node_types_used.
Referenced by BsdfNode::compile(), CurvesNode::compile(), TextureMapping::compile(), VolumeNode::compile(), compile_type(), and stack_assign().
| uint SVMCompiler::attribute | ( | AttributeStandard | std | ) |
| uint SVMCompiler::attribute | ( | ustring | name | ) |
Definition at line 425 of file svm.cpp.
Referenced by attribute_standard().
| uint SVMCompiler::attribute_standard | ( | ustring | name | ) |
Definition at line 435 of file svm.cpp.
References attribute(), name, and Attribute::name_standard().
|
inline |
Definition at line 104 of file scene/svm.h.
References mix_weight_offset.
Referenced by BsdfNode::compile(), and VolumeNode::compile().
| void SVMCompiler::compile | ( | Shader * | shader, |
| array< int4 > & | svm_nodes, | ||
| const int | index, | ||
| Summary * | summary = nullptr ) |
Definition at line 884 of file svm.cpp.
References array< T, alignment >::append(), compile_type(), current_shader, current_svm_nodes, Shader::estimate_emission(), Shader::graph, Shader::has_bump, make_int4(), max_stack_use, SVMCompiler::Summary::num_svm_nodes, SVMCompiler::Summary::peak_stack_usage, array< T, alignment >::push_back_slow(), 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, SVMCompiler::Summary::time_total, and timer.
Referenced by SVMShaderManager::device_update_shader().
|
protected |
Definition at line 753 of file svm.cpp.
References active_stack, add_node(), assert, bump_state_offset, compile_failed, current_graph, 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, input, ShaderNode::inputs, KERNEL_FEATURE_NODE_MASK_BUMP, KERNEL_FEATURE_NODE_MASK_DISPLACEMENT, KERNEL_FEATURE_NODE_MASK_SURFACE, KERNEL_FEATURE_NODE_MASK_VOLUME, ShaderInput::link, ShaderGraph::nodes, output, ShaderGraph::output(), ShaderNode::outputs, ShaderOutput::parent, Node::reference_count(), SHADER_TYPE_BUMP, SHADER_TYPE_DISPLACEMENT, SHADER_TYPE_SURFACE, SHADER_TYPE_VOLUME, stack_find_offset(), state, SVM_BUMP_EVAL_STATE_SIZE, and SVM_STACK_INVALID.
Referenced by compile().
| uint SVMCompiler::encode_uchar4 | ( | const uint | x, |
| const uint | y = 0, | ||
| const uint | z = 0, | ||
| const uint | w = 0 ) |
Definition at line 391 of file svm.cpp.
References assert, w(), x, y, and z().
Referenced by BsdfNode::compile(), CurvesNode::compile(), TextureMapping::compile(), and VolumeNode::compile().
|
protected |
Definition at line 580 of file svm.cpp.
References find_dependencies(), in, ShaderNode::inputs, ShaderGraph::nodes, OutputAOVNode::offset, SHADER_SPECIAL_TYPE_OUTPUT_AOV, ShaderNode::special_type, and state.
Referenced by compile_type().
|
protected |
Definition at line 441 of file svm.cpp.
References find_dependencies(), in, input, and ShaderNode::inputs.
Referenced by find_aov_nodes_and_dependencies(), find_dependencies(), generate_closure_node(), and generate_multi_closure().
|
protected |
|
protected |
Definition at line 512 of file svm.cpp.
References current_shader, current_type, find_dependencies(), generate_node(), generate_svm_nodes(), ShaderNode::get_feature(), Node::get_float(), ShaderNode::has_bssrdf_bump(), ShaderNode::has_bump(), ShaderNode::has_surface_bssrdf(), ShaderNode::has_surface_transparent(), in, ShaderNode::input(), ShaderNode::inputs, ShaderInput::link, mix_weight_offset, SHADER_TYPE_SURFACE, SHADER_TYPE_VOLUME, ShaderInput::socket_type, stack_assign(), state, and SVM_STACK_INVALID.
Referenced by generate_multi_closure().
|
protected |
Definition at line 599 of file svm.cpp.
References current_svm_nodes, find_dependencies(), generate_closure_node(), generate_multi_closure(), generate_svm_nodes(), generated_shared_closure_nodes(), ShaderNode::id, in, ShaderNode::input(), ShaderNode::inputs, ShaderInput::link, make_int4(), ShaderOutput::parent, SHADER_SPECIAL_TYPE_COMBINE_CLOSURE, ShaderNode::special_type, stack_assign(), ShaderInput::stack_offset, state, svm_node_types_used, and SVM_STACK_INVALID.
Referenced by compile_type(), generate_multi_closure(), and generated_shared_closure_nodes().
|
protected |
Definition at line 457 of file svm.cpp.
References ShaderNode::compile(), current_shader, current_type, ShaderNode::get_feature(), ShaderNode::has_attribute_dependency(), ShaderNode::has_spatial_varying(), KERNEL_FEATURE_NODE_RAYTRACE, SHADER_TYPE_SURFACE, SHADER_TYPE_VOLUME, stack_clear_temporary(), and stack_clear_users().
Referenced by generate_closure_node(), and generate_svm_nodes().
|
protected |
Definition at line 481 of file svm.cpp.
References generate_node(), input, and state.
Referenced by compile_type(), generate_closure_node(), and generate_multi_closure().
|
protected |
Definition at line 563 of file svm.cpp.
References SocketType::CLOSURE, generate_multi_closure(), generated_shared_closure_nodes(), in, ShaderNode::inputs, shared, and state.
Referenced by generate_multi_closure(), and generated_shared_closure_nodes().
|
inline |
Definition at line 108 of file scene/svm.h.
References bump_state_offset.
| bool SVMCompiler::is_linked | ( | ShaderInput * | input | ) |
Definition at line 290 of file svm.cpp.
References input.
Referenced by stack_assign_if_linked(), stack_assign_if_not_equal(), and stack_assign_if_not_equal().
|
inline |
Definition at line 113 of file scene/svm.h.
References current_type.
| int SVMCompiler::stack_assign | ( | ShaderInput * | input | ) |
Definition at line 241 of file svm.cpp.
References __float_as_int, add_node(), assert, SocketType::COLOR, SocketType::FLOAT, Node::get_float(), Node::get_float3(), Node::get_int(), input, SocketType::INT, SocketType::NORMAL, SocketType::POINT, stack_find_offset(), SVM_STACK_INVALID, and SocketType::VECTOR.
| int SVMCompiler::stack_assign | ( | ShaderOutput * | output | ) |
Definition at line 280 of file svm.cpp.
References output, stack_find_offset(), and SVM_STACK_INVALID.
Referenced by BsdfNode::compile(), CurvesNode::compile(), VolumeNode::compile(), TextureMapping::compile_begin(), generate_closure_node(), generate_multi_closure(), stack_assign_if_linked(), stack_assign_if_linked(), stack_assign_if_not_equal(), and stack_assign_if_not_equal().
| int SVMCompiler::stack_assign_if_linked | ( | ShaderInput * | input | ) |
Definition at line 295 of file svm.cpp.
References input, is_linked(), stack_assign(), and SVM_STACK_INVALID.
Referenced by BsdfNode::compile(), and VolumeNode::compile().
| int SVMCompiler::stack_assign_if_linked | ( | ShaderOutput * | output | ) |
Definition at line 304 of file svm.cpp.
References output, stack_assign(), and SVM_STACK_INVALID.
| int SVMCompiler::stack_assign_if_not_equal | ( | ShaderInput * | input, |
| const float | value ) |
Definition at line 313 of file svm.cpp.
References input, is_linked(), stack_assign(), and SVM_STACK_INVALID.
| int SVMCompiler::stack_assign_if_not_equal | ( | ShaderInput * | input, |
| const float3 | value ) |
Definition at line 322 of file svm.cpp.
References input, is_linked(), stack_assign(), and SVM_STACK_INVALID.
| void SVMCompiler::stack_clear_offset | ( | SocketType::Type | type, |
| const int | offset ) |
Definition at line 232 of file svm.cpp.
References active_stack, i, size(), and stack_size().
Referenced by TextureMapping::compile_end(), stack_clear_temporary(), and stack_clear_users().
|
protected |
Definition at line 381 of file svm.cpp.
References input, ShaderNode::inputs, stack_clear_offset(), and SVM_STACK_INVALID.
Referenced by generate_node().
|
protected |
Definition at line 347 of file svm.cpp.
References in, input, ShaderNode::inputs, output, stack_clear_offset(), and SVM_STACK_INVALID.
Referenced by generate_node().
| int SVMCompiler::stack_find_offset | ( | const int | size | ) |
Definition at line 193 of file svm.cpp.
References active_stack, compile_failed, current_shader, i, LOG_ERROR, max, max_stack_use, size(), and SVM_STACK_SIZE.
Referenced by TextureMapping::compile_begin(), compile_type(), stack_assign(), stack_assign(), and stack_find_offset().
| int SVMCompiler::stack_find_offset | ( | SocketType::Type | type | ) |
Definition at line 227 of file svm.cpp.
References stack_find_offset(), and stack_size().
| void SVMCompiler::stack_link | ( | ShaderInput * | input, |
| ShaderOutput * | output ) |
Definition at line 331 of file svm.cpp.
References active_stack, assert, i, input, output, size(), stack_size(), and SVM_STACK_INVALID.
|
protected |
Definition at line 167 of file svm.cpp.
References assert, SocketType::CLOSURE, SocketType::COLOR, SocketType::FLOAT, SocketType::INT, SocketType::NORMAL, SocketType::POINT, size(), and SocketType::VECTOR.
Referenced by stack_clear_offset(), stack_find_offset(), and stack_link().
|
protected |
Definition at line 225 of file scene/svm.h.
Referenced by compile_type(), stack_clear_offset(), stack_find_offset(), and stack_link().
| bool SVMCompiler::background |
Definition at line 120 of file scene/svm.h.
Referenced by SVMShaderManager::device_update_shader(), and SVMCompiler().
|
protected |
Definition at line 228 of file scene/svm.h.
Referenced by compile_type(), get_bump_state_offset(), and SVMCompiler().
|
protected |
Definition at line 229 of file scene/svm.h.
Referenced by compile_type(), stack_find_offset(), and SVMCompiler().
| ShaderGraph* SVMCompiler::current_graph |
Definition at line 119 of file scene/svm.h.
Referenced by compile_type(), and SVMCompiler().
|
protected |
Definition at line 224 of file scene/svm.h.
Referenced by compile(), generate_closure_node(), generate_node(), stack_find_offset(), and SVMCompiler().
Definition at line 222 of file scene/svm.h.
Referenced by add_node(), add_node(), add_node(), add_node(), compile(), compile_type(), and generate_multi_closure().
|
protected |
Definition at line 223 of file scene/svm.h.
Referenced by compile_type(), generate_closure_node(), generate_node(), output_type(), and SVMCompiler().
|
protected |
Definition at line 226 of file scene/svm.h.
Referenced by compile(), stack_find_offset(), and SVMCompiler().
|
protected |
Definition at line 227 of file scene/svm.h.
Referenced by closure_mix_weight_offset(), generate_closure_node(), and SVMCompiler().
| Scene* SVMCompiler::scene |
Definition at line 118 of file scene/svm.h.
Referenced by attribute(), attribute(), and SVMCompiler().
|
protected |
Definition at line 221 of file scene/svm.h.
Referenced by add_node(), add_node(), compile(), generate_multi_closure(), and SVMCompiler().