|
Blender
V2.93
|
#include <svm.h>
Classes | |
| struct | CompilerState |
| struct | Stack |
| struct | Summary |
Public Member Functions | |
| SVMCompiler (Scene *scene) | |
| void | compile (Shader *shader, array< int4 > &svm_nodes, int index, Summary *summary=NULL) |
| int | stack_assign (ShaderOutput *output) |
| int | stack_assign (ShaderInput *input) |
| int | stack_assign_if_linked (ShaderInput *input) |
| int | stack_assign_if_linked (ShaderOutput *output) |
| int | stack_find_offset (int size) |
| int | stack_find_offset (SocketType::Type type) |
| void | stack_clear_offset (SocketType::Type type, int offset) |
| void | stack_link (ShaderInput *input, ShaderOutput *output) |
| void | add_node (ShaderNodeType type, int a=0, int b=0, int c=0) |
| void | add_node (int a=0, int b=0, int c=0, int d=0) |
| void | add_node (ShaderNodeType type, const float3 &f) |
| void | add_node (const float4 &f) |
| uint | attribute (ustring name) |
| uint | attribute (AttributeStandard std) |
| uint | attribute_standard (ustring name) |
| uint | encode_uchar4 (uint x, uint y=0, uint z=0, uint w=0) |
| uint | closure_mix_weight_offset () |
| ShaderType | output_type () |
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=NULL) |
| 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 | |
| array< int4 > | current_svm_nodes |
| ShaderType | current_type |
| Shader * | current_shader |
| Stack | active_stack |
| int | max_stack_use |
| uint | mix_weight_offset |
| bool | compile_failed |
Definition at line 61 of file render/svm.h.
| SVMCompiler::SVMCompiler | ( | Scene * | scene | ) |
Definition at line 177 of file svm.cpp.
References background, compile_failed, current_graph, current_shader, current_type, max_stack_use, mix_weight_offset, NULL, SHADER_TYPE_SURFACE, and SVM_STACK_INVALID.
| void SVMCompiler::add_node | ( | const float4 & | f | ) |
Definition at line 403 of file svm.cpp.
References __float_as_int(), current_svm_nodes, make_int4, and array< T, alignment >::push_back_slow().
| void SVMCompiler::add_node | ( | int | a = 0, |
| int | b = 0, |
||
| int | c = 0, |
||
| int | d = 0 |
||
| ) |
Definition at line 387 of file svm.cpp.
References Freestyle::a, Freestyle::c, current_svm_nodes, make_int4, and array< T, alignment >::push_back_slow().
| void SVMCompiler::add_node | ( | ShaderNodeType | type, |
| const float3 & | f | ||
| ) |
Definition at line 397 of file svm.cpp.
References __float_as_int(), current_svm_nodes, make_int4, array< T, alignment >::push_back_slow(), type, float3::x, float3::y, and float3::z.
| void SVMCompiler::add_node | ( | ShaderNodeType | type, |
| int | a = 0, |
||
| int | b = 0, |
||
| int | c = 0 |
||
| ) |
Definition at line 392 of file svm.cpp.
References Freestyle::a, Freestyle::c, current_svm_nodes, make_int4, array< T, alignment >::push_back_slow(), and type.
Referenced by TextureMapping::compile(), CurvesNode::compile(), PrincipledBsdfNode::compile(), VolumeNode::compile(), BsdfNode::compile(), compile_type(), and stack_assign().
| uint SVMCompiler::attribute | ( | AttributeStandard | std | ) |
Definition at line 414 of file svm.cpp.
References ShaderManager::get_attribute_id(), scene, and Scene::shader_manager.
| uint SVMCompiler::attribute | ( | ustring | name | ) |
Definition at line 409 of file svm.cpp.
References ShaderManager::get_attribute_id(), scene, and Scene::shader_manager.
Referenced by attribute_standard().
| uint SVMCompiler::attribute_standard | ( | ustring | name | ) |
Definition at line 419 of file svm.cpp.
References attribute(), and Attribute::name_standard().
|
inline |
Definition at line 114 of file render/svm.h.
References mix_weight_offset.
Referenced by PrincipledBsdfNode::compile(), VolumeNode::compile(), and BsdfNode::compile().
| void SVMCompiler::compile | ( | Shader * | shader, |
| array< int4 > & | svm_nodes, | ||
| int | index, | ||
| Summary * | summary = NULL |
||
| ) |
Definition at line 845 of file svm.cpp.
References array< T, alignment >::append(), compile_type(), current_shader, current_svm_nodes, DISPLACE_BOTH, DISPLACE_TRUE, max_stack_use, NULL, SVMCompiler::Summary::num_svm_nodes, output, SVMCompiler::Summary::peak_stack_usage, scene, shader(), SHADER_TYPE_BUMP, SHADER_TYPE_DISPLACEMENT, SHADER_TYPE_SURFACE, SHADER_TYPE_VOLUME, array< T, alignment >::size(), time_dt(), SVMCompiler::Summary::time_finalize, 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 716 of file svm.cpp.
References active_stack, add_node(), array< T, alignment >::clear(), compile_failed, current_graph, current_svm_nodes, current_type, DISPLACE_BOTH, find_aov_nodes_and_dependencies(), generate(), generate_multi_closure(), generate_svm_nodes(), graph, ShaderInput::link, node, NODE_AOV_START, NODE_END, NODE_ENTER_BUMP_EVAL, NODE_LEAVE_BUMP_EVAL, NULL, output, ShaderOutput::parent, shader(), SHADER_TYPE_BUMP, SHADER_TYPE_DISPLACEMENT, SHADER_TYPE_SURFACE, SHADER_TYPE_VOLUME, stack_find_offset(), ShaderInput::stack_offset, state, SVM_BUMP_EVAL_STATE_SIZE, SVM_STACK_INVALID, and type.
Referenced by compile().
Definition at line 377 of file svm.cpp.
Referenced by TextureMapping::compile(), CurvesNode::compile(), PrincipledBsdfNode::compile(), VolumeNode::compile(), and BsdfNode::compile().
|
protected |
Definition at line 551 of file svm.cpp.
References find_dependencies(), graph, node, NULL, SHADER_SPECIAL_TYPE_OUTPUT_AOV, OutputAOVNode::slot, and state.
Referenced by compile_type().
|
protected |
Definition at line 425 of file svm.cpp.
References if(), ShaderInput::link, node, NULL, and ShaderOutput::parent.
Referenced by find_aov_nodes_and_dependencies(), generate_closure_node(), and generate_multi_closure().
|
protected |
|
protected |
Definition at line 493 of file svm.cpp.
References current_shader, current_type, find_dependencies(), generate_node(), generate_svm_nodes(), Shader::has_bssrdf_bump, Shader::has_bump, Shader::has_surface_bssrdf, Shader::has_surface_emission, Shader::has_surface_transparent, ShaderInput::link, mix_weight_offset, node, NULL, 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 570 of file svm.cpp.
References current_svm_nodes, find_dependencies(), generate_closure_node(), generate_svm_nodes(), generated_shared_closure_nodes(), ShaderNode::inputs, ShaderInput::link, make_int4, node, NODE_JUMP_IF_ONE, NODE_JUMP_IF_ZERO, ShaderOutput::parent, array< T, alignment >::push_back_slow(), SHADER_SPECIAL_TYPE_COMBINE_CLOSURE, array< T, alignment >::size(), stack_assign(), ShaderInput::stack_offset, state, and SVM_STACK_INVALID.
Referenced by compile_type(), and generated_shared_closure_nodes().
|
protected |
Definition at line 440 of file svm.cpp.
References current_shader, current_type, Shader::has_integrator_dependency, Shader::has_surface_spatial_varying, Shader::has_volume_attribute_dependency, Shader::has_volume_spatial_varying, node, 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 462 of file svm.cpp.
References generate_node(), ShaderNode::id, ShaderInput::link, node, ShaderOutput::parent, and state.
Referenced by compile_type(), generate_closure_node(), and generate_multi_closure().
|
protected |
Definition at line 535 of file svm.cpp.
References SocketType::CLOSURE, generate_multi_closure(), node, and state.
Referenced by generate_multi_closure().
|
inline |
Definition at line 119 of file render/svm.h.
References current_type.
| int SVMCompiler::stack_assign | ( | ShaderInput * | input | ) |
Definition at line 259 of file svm.cpp.
References __float_as_int(), add_node(), SocketType::COLOR, SocketType::FLOAT, SocketType::INT, ShaderInput::link, node, NODE_VALUE_F, NODE_VALUE_V, SocketType::NORMAL, ShaderInput::parent, SocketType::POINT, ShaderInput::socket_type, stack_find_offset(), ShaderInput::stack_offset, ShaderOutput::stack_offset, SVM_STACK_INVALID, ShaderInput::type(), and SocketType::VECTOR.
| int SVMCompiler::stack_assign | ( | ShaderOutput * | output | ) |
Definition at line 296 of file svm.cpp.
References output, stack_find_offset(), and SVM_STACK_INVALID.
Referenced by CurvesNode::compile(), PrincipledBsdfNode::compile(), VolumeNode::compile(), BsdfNode::compile(), TextureMapping::compile_begin(), generate_closure_node(), generate_multi_closure(), and stack_assign_if_linked().
| int SVMCompiler::stack_assign_if_linked | ( | ShaderInput * | input | ) |
Definition at line 305 of file svm.cpp.
References ShaderInput::link, stack_assign(), and SVM_STACK_INVALID.
Referenced by PrincipledBsdfNode::compile(), and BsdfNode::compile().
| int SVMCompiler::stack_assign_if_linked | ( | ShaderOutput * | output | ) |
Definition at line 313 of file svm.cpp.
References output, stack_assign(), and SVM_STACK_INVALID.
| void SVMCompiler::stack_clear_offset | ( | SocketType::Type | type, |
| int | offset | ||
| ) |
Definition at line 251 of file svm.cpp.
References active_stack, size(), stack_size(), type, and SVMCompiler::Stack::users.
Referenced by TextureMapping::compile_end(), stack_clear_temporary(), and stack_clear_users().
|
protected |
Definition at line 367 of file svm.cpp.
References ShaderInput::link, node, stack_clear_offset(), ShaderInput::stack_offset, SVM_STACK_INVALID, and ShaderInput::type().
Referenced by generate_node().
|
protected |
Definition at line 336 of file svm.cpp.
References ShaderInput::link, node, output, stack_clear_offset(), and SVM_STACK_INVALID.
Referenced by generate_node().
| int SVMCompiler::stack_find_offset | ( | int | size | ) |
Definition at line 214 of file svm.cpp.
References active_stack, compile_failed, current_shader, max, max_stack_use, Node::name, size(), SVM_STACK_SIZE, and SVMCompiler::Stack::users.
Referenced by TextureMapping::compile_begin(), compile_type(), stack_assign(), and stack_find_offset().
| int SVMCompiler::stack_find_offset | ( | SocketType::Type | type | ) |
Definition at line 246 of file svm.cpp.
References stack_find_offset(), stack_size(), and type.
| void SVMCompiler::stack_link | ( | ShaderInput * | input, |
| ShaderOutput * | output | ||
| ) |
Definition at line 321 of file svm.cpp.
References active_stack, ShaderInput::link, output, size(), ShaderOutput::stack_offset, stack_size(), SVM_STACK_INVALID, ShaderOutput::type(), and SVMCompiler::Stack::users.
|
protected |
Definition at line 188 of file svm.cpp.
References SocketType::CLOSURE, SocketType::COLOR, SocketType::FLOAT, SocketType::INT, SocketType::NORMAL, SocketType::POINT, size(), type, and SocketType::VECTOR.
Referenced by stack_clear_offset(), stack_find_offset(), and stack_link().
|
protected |
Definition at line 224 of file render/svm.h.
Referenced by compile_type(), stack_clear_offset(), stack_find_offset(), and stack_link().
| bool SVMCompiler::background |
Definition at line 126 of file render/svm.h.
Referenced by SVMShaderManager::device_update_shader(), and SVMCompiler().
|
protected |
Definition at line 227 of file render/svm.h.
Referenced by compile_type(), stack_find_offset(), and SVMCompiler().
| ShaderGraph* SVMCompiler::current_graph |
Definition at line 125 of file render/svm.h.
Referenced by compile_type(), and SVMCompiler().
|
protected |
Definition at line 223 of file render/svm.h.
Referenced by compile(), generate_closure_node(), generate_node(), stack_find_offset(), and SVMCompiler().
Definition at line 221 of file render/svm.h.
Referenced by add_node(), compile(), compile_type(), and generate_multi_closure().
|
protected |
Definition at line 222 of file render/svm.h.
Referenced by compile_type(), generate_closure_node(), generate_node(), output_type(), and SVMCompiler().
|
protected |
Definition at line 225 of file render/svm.h.
Referenced by compile(), stack_find_offset(), and SVMCompiler().
|
protected |
Definition at line 226 of file render/svm.h.
Referenced by closure_mix_weight_offset(), generate_closure_node(), and SVMCompiler().
| Scene* SVMCompiler::scene |
Definition at line 124 of file render/svm.h.
Referenced by attribute(), and compile().