Blender V4.3
SVMCompiler Class Reference

#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)
 
bool is_linked (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 ()
 
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=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

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 52 of file scene/svm.h.

Constructor & Destructor Documentation

◆ SVMCompiler()

Member Function Documentation

◆ add_node() [1/4]

void SVMCompiler::add_node ( const float4 & f)

◆ add_node() [2/4]

void SVMCompiler::add_node ( int a = 0,
int b = 0,
int c = 0,
int d = 0 )

Definition at line 388 of file svm.cpp.

References b, current_svm_nodes, make_int4(), and array< T, alignment >::push_back_slow().

◆ add_node() [3/4]

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

◆ add_node() [4/4]

◆ attribute() [1/2]

uint SVMCompiler::attribute ( AttributeStandard std)

Definition at line 417 of file svm.cpp.

◆ attribute() [2/2]

uint SVMCompiler::attribute ( ustring name)

Definition at line 412 of file svm.cpp.

◆ attribute_standard()

uint SVMCompiler::attribute_standard ( ustring name)

Definition at line 422 of file svm.cpp.

References attribute, and Attribute::name_standard().

◆ closure_mix_weight_offset()

uint SVMCompiler::closure_mix_weight_offset ( )
inline

Definition at line 106 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 ( uint x,
uint y = 0,
uint z = 0,
uint w = 0 )

Definition at line 378 of file svm.cpp.

References w(), 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

Definition at line 567 of file svm.cpp.

References find_dependencies(), node, NULL, OutputAOVNode::offset, SHADER_SPECIAL_TYPE_OUTPUT_AOV, and state.

Referenced by compile_type().

◆ find_dependencies()

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

◆ generate_aov_node()

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

◆ 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 468 of file svm.cpp.

References generate_node(), 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 110 of file scene/svm.h.

References bump_state_offset.

◆ is_linked()

bool SVMCompiler::is_linked ( ShaderInput * input)

Definition at line 297 of file svm.cpp.

Referenced by stack_assign_if_linked().

◆ output_type()

ShaderType SVMCompiler::output_type ( )
inline

Definition at line 115 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 302 of file svm.cpp.

References 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 311 of file svm.cpp.

References stack_assign(), and SVM_STACK_INVALID.

◆ stack_clear_offset()

void SVMCompiler::stack_clear_offset ( SocketType::Type type,
int offset )

◆ stack_clear_temporary()

void SVMCompiler::stack_clear_temporary ( ShaderNode * node)
protected

Definition at line 368 of file svm.cpp.

References 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 336 of file svm.cpp.

References stack_clear_offset(), and SVM_STACK_INVALID.

Referenced by generate_node().

◆ stack_find_offset() [1/2]

◆ stack_find_offset() [2/2]

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

Definition at line 234 of file svm.cpp.

References stack_find_offset(), and stack_size().

◆ stack_link()

void SVMCompiler::stack_link ( ShaderInput * input,
ShaderOutput * output )

Definition at line 320 of file svm.cpp.

References active_stack, size(), stack_size(), SVM_STACK_INVALID, and SVMCompiler::Stack::users.

◆ stack_size()

Member Data Documentation

◆ active_stack

Stack SVMCompiler::active_stack
protected

Definition at line 227 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 122 of file scene/svm.h.

Referenced by SVMShaderManager::device_update_shader().

◆ bump_state_offset

uint SVMCompiler::bump_state_offset
protected

Definition at line 230 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 231 of file scene/svm.h.

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

◆ current_graph

ShaderGraph* SVMCompiler::current_graph

Definition at line 121 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 228 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 229 of file scene/svm.h.

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

◆ scene

Scene* SVMCompiler::scene

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

◆ svm_node_types_used

std::atomic_int* SVMCompiler::svm_node_types_used
protected

Definition at line 223 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: