Blender V5.0
SVMCompiler Class Reference

#include <svm.h>

Classes

struct  Summary
struct  Stack
struct  CompilerState

Public Member Functions

 SVMCompiler (Scene *scene)
void compile (Shader *shader, array< int4 > &svm_nodes, const int index, Summary *summary=nullptr)
int stack_assign (ShaderOutput *output)
int stack_assign (ShaderInput *input)
bool is_linked (ShaderInput *input)
int stack_assign_if_linked (ShaderInput *input)
int stack_assign_if_linked (ShaderOutput *output)
int stack_assign_if_not_equal (ShaderInput *input, const float value)
int stack_assign_if_not_equal (ShaderInput *input, const float3 value)
int stack_find_offset (const int size)
int stack_find_offset (SocketType::Type type)
void stack_clear_offset (SocketType::Type type, const int offset)
void stack_link (ShaderInput *input, ShaderOutput *output)
void add_node (ShaderNodeType type, const int a=0, const int b=0, const int c=0)
void add_node (const int a=0, const int b=0, const int c=0, const 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 (const uint x, const uint y=0, const uint z=0, const uint w=0)
uint closure_mix_weight_offset ()
uint get_bump_state_offset ()
ShaderType output_type ()

Public Attributes

Scenescene
ShaderGraphcurrent_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< int4current_svm_nodes
ShaderType current_type
Shadercurrent_shader
Stack active_stack
int max_stack_use
uint mix_weight_offset
uint bump_state_offset
bool compile_failed

Detailed Description

Definition at line 48 of file scene/svm.h.

Constructor & Destructor Documentation

◆ SVMCompiler()

Member Function Documentation

◆ add_node() [1/4]

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.

◆ add_node() [2/4]

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().

◆ add_node() [3/4]

void SVMCompiler::add_node ( ShaderNodeType type,
const float3 & f )

◆ add_node() [4/4]

void SVMCompiler::add_node ( ShaderNodeType type,
const int a = 0,
const int b = 0,
const int c = 0 )

◆ attribute() [1/2]

uint SVMCompiler::attribute ( AttributeStandard std)

Definition at line 430 of file svm.cpp.

References scene.

◆ attribute() [2/2]

uint SVMCompiler::attribute ( ustring name)

Definition at line 425 of file svm.cpp.

References name, and scene.

Referenced by attribute_standard().

◆ attribute_standard()

uint SVMCompiler::attribute_standard ( ustring name)

Definition at line 435 of file svm.cpp.

References attribute(), name, and Attribute::name_standard().

◆ closure_mix_weight_offset()

uint SVMCompiler::closure_mix_weight_offset ( )
inline

Definition at line 104 of file scene/svm.h.

References mix_weight_offset.

Referenced by BsdfNode::compile(), and VolumeNode::compile().

◆ compile()

◆ compile_type()

◆ encode_uchar4()

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().

◆ find_aov_nodes_and_dependencies()

void SVMCompiler::find_aov_nodes_and_dependencies ( ShaderNodeSet & aov_nodes,
ShaderGraph * graph,
CompilerState * state )
protected

◆ find_dependencies()

void SVMCompiler::find_dependencies ( ShaderNodeSet & dependencies,
const ShaderNodeSet & done,
ShaderInput * input,
ShaderNode * skip_node = nullptr )
protected

◆ generate_aov_node()

void SVMCompiler::generate_aov_node ( ShaderNode * node,
CompilerState * state )
protected

References shared, and state.

◆ generate_closure_node()

◆ generate_multi_closure()

◆ generate_node()

◆ generate_svm_nodes()

void SVMCompiler::generate_svm_nodes ( const ShaderNodeSet & nodes,
CompilerState * state )
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().

◆ generated_shared_closure_nodes()

void SVMCompiler::generated_shared_closure_nodes ( ShaderNode * root_node,
ShaderNode * node,
CompilerState * state,
const ShaderNodeSet & shared )
protected

◆ get_bump_state_offset()

uint SVMCompiler::get_bump_state_offset ( )
inline

Definition at line 108 of file scene/svm.h.

References bump_state_offset.

◆ is_linked()

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().

◆ output_type()

ShaderType SVMCompiler::output_type ( )
inline

Definition at line 113 of file scene/svm.h.

References current_type.

◆ stack_assign() [1/2]

◆ stack_assign() [2/2]

◆ stack_assign_if_linked() [1/2]

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().

◆ stack_assign_if_linked() [2/2]

int SVMCompiler::stack_assign_if_linked ( ShaderOutput * output)

Definition at line 304 of file svm.cpp.

References output, stack_assign(), and SVM_STACK_INVALID.

◆ stack_assign_if_not_equal() [1/2]

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.

◆ stack_assign_if_not_equal() [2/2]

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.

◆ stack_clear_offset()

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().

◆ stack_clear_temporary()

void SVMCompiler::stack_clear_temporary ( ShaderNode * node)
protected

Definition at line 381 of file svm.cpp.

References input, ShaderNode::inputs, stack_clear_offset(), and SVM_STACK_INVALID.

Referenced by generate_node().

◆ stack_clear_users()

void SVMCompiler::stack_clear_users ( ShaderNode * node,
ShaderNodeSet & done )
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().

◆ stack_find_offset() [1/2]

int SVMCompiler::stack_find_offset ( const int size)

◆ stack_find_offset() [2/2]

int SVMCompiler::stack_find_offset ( SocketType::Type type)

Definition at line 227 of file svm.cpp.

References stack_find_offset(), and stack_size().

◆ stack_link()

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.

◆ stack_size()

Member Data Documentation

◆ active_stack

Stack SVMCompiler::active_stack
protected

Definition at line 225 of file scene/svm.h.

Referenced by compile_type(), stack_clear_offset(), stack_find_offset(), and stack_link().

◆ background

bool SVMCompiler::background

Definition at line 120 of file scene/svm.h.

Referenced by SVMShaderManager::device_update_shader(), and SVMCompiler().

◆ bump_state_offset

uint SVMCompiler::bump_state_offset
protected

Definition at line 228 of file scene/svm.h.

Referenced by compile_type(), get_bump_state_offset(), and SVMCompiler().

◆ compile_failed

bool SVMCompiler::compile_failed
protected

Definition at line 229 of file scene/svm.h.

Referenced by compile_type(), stack_find_offset(), and SVMCompiler().

◆ current_graph

ShaderGraph* SVMCompiler::current_graph

Definition at line 119 of file scene/svm.h.

Referenced by compile_type(), and SVMCompiler().

◆ current_shader

Shader* SVMCompiler::current_shader
protected

◆ current_svm_nodes

array<int4> SVMCompiler::current_svm_nodes
protected

◆ current_type

ShaderType SVMCompiler::current_type
protected

◆ max_stack_use

int SVMCompiler::max_stack_use
protected

Definition at line 226 of file scene/svm.h.

Referenced by compile(), stack_find_offset(), and SVMCompiler().

◆ mix_weight_offset

uint SVMCompiler::mix_weight_offset
protected

Definition at line 227 of file scene/svm.h.

Referenced by closure_mix_weight_offset(), generate_closure_node(), and SVMCompiler().

◆ scene

Scene* SVMCompiler::scene

Definition at line 118 of file scene/svm.h.

Referenced by attribute(), attribute(), and SVMCompiler().

◆ svm_node_types_used

std::atomic_int* SVMCompiler::svm_node_types_used
protected

Definition at line 221 of file scene/svm.h.

Referenced by add_node(), add_node(), compile(), generate_multi_closure(), and SVMCompiler().


The documentation for this class was generated from the following files: