8#ifndef MDL_DISTILLER_PLUGIN_API_H
9#define MDL_DISTILLER_PLUGIN_API_H
11#include <mi/mdl/mdl_streams.h>
18class ICall_name_resolver;
24#define MI_MDL_DISTILLER_PLUGIN_API_VERSION 4
53 bool operator()(
char const *a,
char const *b)
const
55 return strcmp(a, b) < 0;
72 DAG_node const * node,
char const *name,
75 DAG_node const * node,
char const *name,
163 IValue
const *value) = 0;
184 IDefinition::Semantics sema,
187 IType
const *ret_type) = 0;
200 size_t num_call_args) = 0;
205 int num_call_args) = 0;
210 int num_call_args) = 0;
232 OK_BITWISE_COMPLEMENT = IExpression:
:OK_BITWISE_COMPLEMENT,
233 OK_LOGICAL_NOT = IExpression:
:OK_LOGICAL_NOT,
234 OK_POSITIVE = IExpression:
:OK_POSITIVE,
235 OK_NEGATIVE = IExpression:
:OK_NEGATIVE,
236 OK_PRE_INCREMENT = IExpression:
:OK_PRE_INCREMENT,
237 OK_PRE_DECREMENT = IExpression:
:OK_PRE_DECREMENT,
238 OK_POST_INCREMENT = IExpression:
:OK_POST_INCREMENT,
239 OK_POST_DECREMENT = IExpression:
:OK_POST_DECREMENT
346 char const *member) = 0;
356 IType
const *elem_type,
358 size_t n_values) = 0;
503 virtual void debug_node(IOutput_stream *outs,
DAG_node const *node) = 0;
A DAG IR constant.
Definition: mdl_generated_dag.h:144
A node inside the DAG Intermediate Representation.
Definition: mdl_generated_dag.h:118
A DAG IR parameter reference.
Definition: mdl_generated_dag.h:250
A DAG IR temporary reference.
Definition: mdl_generated_dag.h:157
Options class to hold all parameters for algorithm and rule customizations.
Definition: mdl_distiller_options.h:15
The rule engine handles the transformation of a compiled material by a rule set.
Definition: mdl_distiller_plugin_api.h:30
virtual DAG_constant const * mk_constant(const char *const_type, const char *value)=0
Create a constant node for a given type and value.
virtual char const * get_compound_parameter_name(DAG_node const *node, size_t i) const =0
Returns the name of the i-th parameter of node, or NULL if there is none or node is NULL.
virtual bool all_nodes(IRule_matcher::Checker_function test_fct, DAG_node const *node)=0
Checks recursively for all call nodes if the property test_fct returns true.
virtual void move_attributes(DAG_node const *to_node, DAG_node const *from_node)=0
Move all nodes from from_node to node to_node, removing them from from_node.
virtual DAG_node const * create_select(DAG_node const *s, char const *member)=0
Creates a SELECT operator on a struct or vector.
virtual IType const * get_color_bsdf_component_type()=0
Return the type for ::df::color_bsdf_component.
virtual DAG_node const * create_edf_component(DAG_node const *weight_arg, DAG_node const *edf_arg)=0
Create a edf_component for a mixer; can be a call or a constant.
virtual DAG_constant const * create_string_constant(char const *s)=0
Creates a string constant.
virtual DAG_parameter const * create_parameter(IType const *type, int index)=0
Create a parameter reference.
virtual IType const * get_color_bsdf_component_array_type(int n_values)=0
Return the type for ::df::color_bsdf_component.
virtual DAG_node const * mk_default(const char *param_type, const char *param_default)=0
Create DAG_node's for possible default values of Node_types parameter.
virtual DAG_node const * create_ternary(DAG_node const *cond, DAG_node const *t_expr, DAG_node const *f_expr)=0
Creates a ternary operator.
virtual DAG_node const * create_vdf_component(DAG_node const *weight_arg, DAG_node const *vdf_arg)=0
Create a vdf_component for a mixer; can be a call or a constant.
virtual DAG_node const * create_color_mixer_call(DAG_call::Call_argument const call_args[], int num_call_args)=0
Create a 1-, 2-, 3-, or 4-color-mixer call, with 2, 4, 6, or 8 parameters respectively.
Binary_operator
Supported binary operators in the DAG representation.
Definition: mdl_distiller_plugin_api.h:243
@ OK_NOT_EQUAL
"!="
Definition: mdl_distiller_plugin_api.h:259
@ OK_PLUS
"+"
Definition: mdl_distiller_plugin_api.h:249
@ OK_ARRAY_INDEX
"[]"
Definition: mdl_distiller_plugin_api.h:245
@ OK_BITWISE_XOR
"^"
Definition: mdl_distiller_plugin_api.h:261
@ OK_BITWISE_OR
"|"
Definition: mdl_distiller_plugin_api.h:262
@ OK_EQUAL
"=="
Definition: mdl_distiller_plugin_api.h:258
@ OK_LESS
"<"
Definition: mdl_distiller_plugin_api.h:254
@ OK_SHIFT_LEFT
"<<"
Definition: mdl_distiller_plugin_api.h:251
@ OK_DIVIDE
"/"
Definition: mdl_distiller_plugin_api.h:247
@ OK_LOGICAL_AND
"&&"
Definition: mdl_distiller_plugin_api.h:263
@ OK_SELECT
"."
Definition: mdl_distiller_plugin_api.h:244
@ OK_GREATER
">"
Definition: mdl_distiller_plugin_api.h:257
@ OK_SHIFT_RIGHT
">>"
Definition: mdl_distiller_plugin_api.h:252
@ OK_GREATER_OR_EQUAL
">="
Definition: mdl_distiller_plugin_api.h:256
@ OK_MINUS
"-"
Definition: mdl_distiller_plugin_api.h:250
@ OK_MODULO
"%"
Definition: mdl_distiller_plugin_api.h:248
@ OK_LESS_OR_EQUAL
"<="
Definition: mdl_distiller_plugin_api.h:255
@ OK_MULTIPLY
"*"
Definition: mdl_distiller_plugin_api.h:246
@ OK_LOGICAL_OR
"||"
Definition: mdl_distiller_plugin_api.h:264
@ OK_BITWISE_AND
"&"
Definition: mdl_distiller_plugin_api.h:260
@ OK_UNSIGNED_SHIFT_RIGHT
">>>"
Definition: mdl_distiller_plugin_api.h:253
virtual DAG_constant const * create_global_ior()=0
Creates a RGB color constant of the global material IOR value.
virtual IType const * get_bsdf_component_array_type(int n_values)=0
Return the type for ::df::bsdf_component.
virtual DAG_constant const * create_hair_bsdf_constant()=0
Creates an invalid hair_bsdf.
virtual IType const * get_color_edf_component_array_type(int n_values)=0
Return the type for ::df::color_edf_component.
virtual DAG_constant const * create_wrap_mode_enum_constant(int i)=0
Creates a constant of the tex::wrap_mode enum.
Field_selector
================================================================================
Definition: mdl_distiller_plugin_api.h:110
@ FS_MATERIAL_VOLUME_SCATTERING
volume.scattering field
Definition: mdl_distiller_plugin_api.h:131
@ FS_MATERIAL_BACKFACE_EMISSION
all backface.emission fields
Definition: mdl_distiller_plugin_api.h:126
@ FS_MATERIAL_GEOMETRY_NORMAL
geometry.normal field
Definition: mdl_distiller_plugin_api.h:138
@ FS_MATERIAL_SURFACE_EMISSION_EMISSION
surface.emission.emission field
Definition: mdl_distiller_plugin_api.h:116
@ FS_MATERIAL_HAIR
hair field
Definition: mdl_distiller_plugin_api.h:140
@ FS_MATERIAL_SURFACE_EMISSION
all surface.emission fields
Definition: mdl_distiller_plugin_api.h:119
@ FS_MATERIAL_IOR
ior field
Definition: mdl_distiller_plugin_api.h:129
@ FS_MATERIAL_BACKFACE_EMISSION_MODE
backface.emission.mode field
Definition: mdl_distiller_plugin_api.h:125
@ FS_MATERIAL_GEOMETRY_DISPLACEMENT
geometry.displacement field
Definition: mdl_distiller_plugin_api.h:136
@ FS_MATERIAL_BACKFACE
all backface fields
Definition: mdl_distiller_plugin_api.h:127
@ FS_MATERIAL_VOLUME_ABSORPTION_COEFFICIENT
volume.absorption_coefficient field
Definition: mdl_distiller_plugin_api.h:132
@ FS_MATERIAL_SURFACE_EMISSION_INTENSITY
surface.emission.intensity field
Definition: mdl_distiller_plugin_api.h:117
@ FS_MATERIAL_VOLUME_SCATTERING_COEFFICIENT
volume.scattering_coefficient field
Definition: mdl_distiller_plugin_api.h:133
@ FS_MATERIAL_VOLUME
all volume fields
Definition: mdl_distiller_plugin_api.h:134
@ FS_MATERIAL_SURFACE
all surface fields
Definition: mdl_distiller_plugin_api.h:120
@ FS_MATERIAL_BACKFACE_EMISSION_INTENSITY
backface.emission.intensity field
Definition: mdl_distiller_plugin_api.h:124
@ FS_MATERIAL_BACKFACE_SCATTERING
backface.scattering field
Definition: mdl_distiller_plugin_api.h:122
@ FS_MATERIAL_THIN_WALLED
thin_walled field
Definition: mdl_distiller_plugin_api.h:113
@ FS_MATERIAL_GEOMETRY_CUTOUT_OPACITY
geometry.cutout_opacity field
Definition: mdl_distiller_plugin_api.h:137
@ FS_MATERIAL_GEOMETRY
all geometry fields
Definition: mdl_distiller_plugin_api.h:139
@ FS_MATERIAL_SURFACE_SCATTERING
surface.scattering field
Definition: mdl_distiller_plugin_api.h:115
@ FS_NONE
no fields copied
Definition: mdl_distiller_plugin_api.h:111
@ FS_MATERIAL_SURFACE_EMISSION_MODE
surface.emission.mode field
Definition: mdl_distiller_plugin_api.h:118
@ FS_MATERIAL_BACKFACE_EMISSION_EMISSION
backface.emission.emission field
Definition: mdl_distiller_plugin_api.h:123
virtual void set_attribute(DAG_node const *node, char const *name, DAG_node const *value)=0
Set the value of a named attribute of a node.
virtual DAG_node const * create_function_call(char const *name, DAG_node const *const call_args[], size_t num_call_args)=0
Create a function call for a non-overloaded function.
virtual void remove_attributes(DAG_node const *node)=0
Remove all attributes from the given DAG node.
virtual DAG_node const * get_attribute(DAG_node const *node, char const *name)=0
Get the value of an attribute for the given DAG node.
virtual DAG_node const * get_remapped_argument(DAG_node const *node, size_t i)=0
Return the i-th argument if node is non-null and of the call kind, or a compound constant,...
virtual IType const * get_color_vdf_component_array_type(int n_values)=0
Return the type for ::df::color_vdf_component.
virtual DAG_constant const * create_float3_constant(float x, float y, float z)=0
Creates a float3 constant.
virtual IType const * get_edf_component_array_type(int n_values)=0
Return the type for ::df::edf_component.
virtual IType const * get_bool_type()=0
Return the type for bool.
virtual DAG_constant const * create_scatter_enum_constant(int i)=0
Creates a constant of the df::scatter_mode enum.
virtual DAG_constant const * create_edf_constant()=0
Creates an invalid edf.
virtual bool eval_if(DAG_node const *node)=0
Returns true if node evaluates to true.
virtual DAG_node const * create_binary(Binary_operator op, DAG_node const *l, DAG_node const *r)=0
Creates an operator, handles types.
virtual IType const * get_color_vdf_component_type()=0
Return the type for ::df::color_vdf_component.
virtual size_t get_compound_argument_size(DAG_node const *node)=0
Returns the argument count if node is non-null and of the call kind or a compound constant,...
virtual IType const * get_vdf_component_array_type(int n_values)=0
Return the type for ::df::vdf_component.
virtual DAG_node const * create_unary(Unary_operator op, DAG_node const *o)=0
Creates an operator, handles types.
virtual DAG_node const * create_call(char const *name, IDefinition::Semantics sema, DAG_call::Call_argument const call_args[], int num_call_args, IType const *ret_type)=0
Create a call.
virtual bool attribute_exists(DAG_node const *node, char const *name)=0
Check whether a named attribute exists for a DAG node.
virtual bool set_normalize_mixers(bool new_value)=0
Set the normalization of mixer node flag and return its previous value.
virtual DAG_constant const * create_emission_enum_constant(int i)=0
Creates a constant of the predefined intensity_mode enum.
virtual IType const * get_color_edf_component_type()=0
Return the type for ::df::color_edf_component.
virtual DAG_constant const * create_bool_constant(bool f)=0
Creates a boolean constant.
virtual DAG_constant const * create_int_constant(int i)=0
Creates an integer constant.
virtual IType const * get_edf_component_type()=0
Return the type for ::df::edf_component.
virtual DAG_temporary const * create_temporary(DAG_node const *node, int index)=0
Create a temporary reference.
virtual IType const * get_bsdf_component_type()=0
Return the type for ::df::bsdf_component.
virtual DAG_constant const * create_bsdf_constant()=0
Creates an invalid bsdf.
virtual IType_factory * get_type_factory()=0
Get the type factory associated with this expression factory.
virtual DAG_node const * create_color_vdf_component(DAG_node const *weight_arg, DAG_node const *edf_arg)=0
Create a vdf_color_component for a color mixer; can be a call or a constant.
virtual DAG_node const * create_color_bsdf_component(DAG_node const *weight_arg, DAG_node const *bsdf_arg)=0
Create a bsdf_color_component for a color mixer; can be a call or a constant.
virtual IType const * get_vdf_component_type()=0
Return the type for ::df::vdf_component.
virtual DAG_node const * create_array(IType const *elem_type, DAG_node const *const values[], size_t n_values)=0
Creates an array constructor.
Unary_operator
Supported unary operators in the DAG representation.
Definition: mdl_distiller_plugin_api.h:231
virtual IValue_factory * get_value_factory()=0
Get the value factory associated with this expression factory.
virtual IMaterial_instance * merge_materials(IMaterial_instance const *m0, IMaterial_instance const *m1, Field_selector field_selector)=0
Returns a new material instance as a merge of two material instances based on a material field select...
virtual IMaterial_instance * normalize_mixers(IMaterial_instance const *inst, IRule_matcher_event *event_handler, const mi::mdl::Distiller_options *options, mi::Sint32 &error)=0
Normalize mixer nodes and set respective flag to keep them normalized.
virtual DAG_constant const * create_constant(IValue const *value)=0
Create a constant.
virtual void release() const =0
Immediately deletes this distiller plugin API.
virtual DAG_constant const * create_color_constant(float r, float g, float b)=0
Creates a RGB color constant.
virtual DAG_constant const * create_vdf_constant()=0
Creates an invalid vdf.
virtual DAG_node const * create_bsdf_component(DAG_node const *weight_arg, DAG_node const *bsdf_arg)=0
Create a bsdf_component for a mixer; can be a call or a constant.
virtual DAG_node const * create_mixer_call(DAG_call::Call_argument const call_args[], int num_call_args)=0
Create a 1-, 2-, 3-, or 4-mixer call, with 2, 4, 6, or 8 parameters respectively.
virtual DAG_node const * get_compound_argument(DAG_node const *node, size_t i)=0
Return the i-th argument if node is non-null and of the call kind, or a compound constant,...
virtual DAG_constant const * create_global_float_ior()=0
Creates a float constant of the global material IOR green value.
virtual IMaterial_instance * apply_rules(IMaterial_instance const *inst, IRule_matcher &matcher, IRule_matcher_event *event_handler, const Distiller_options *options, mi::Sint32 &error)=0
Apply rules using a strategy.
virtual int get_selector(DAG_node const *node) const =0
Compute the node selector for the matcher, either the semantic for a DAG_call node,...
virtual DAG_constant const * create_float_constant(float f)=0
Creates a floating point constant.
virtual DAG_node const * create_color_edf_component(DAG_node const *weight_arg, DAG_node const *edf_arg)=0
Create a edf_color_component for a color mixer; can be a call or a constant.
virtual bool eval_maybe_if(DAG_node const *node)=0
Returns true if node is not evaluating to false, i.e., it either evaluates to true or cannot be evalu...
An instantiated material.
Definition: mdl_generated_dag.h:1383
An interface for reporting rule matcher events.
Definition: mdl_distiller_rules.h:139
The interface to the generated rule matcher, new version for distiller plugin API.
Definition: mdl_distiller_rules.h:203
bool(* Checker_function)(IDistiller_plugin_api &plugin_api, DAG_node const *node)
Function pointer for individual checker functions in rule sets.
Definition: mdl_distiller_rules.h:206
std::basic_ostream<C, T> & error(std::basic_ostream<C, T> &ostream)
Manipulator for mi::base::Log_stream.
Definition: ilogger.h:542
float Float32
32-bit float.
Definition: types.h:51
signed int Sint32
32-bit signed integer.
Definition: types.h:46
MDL distiller rule definitions and rule base class.
Interfaces for the MDL DAG Intermediate Representation.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5
A simple value helper class, a pair of an argument expression and a parameter name.
Definition: mdl_generated_dag.h:176
== Node attributes =============================================================
Definition: mdl_distiller_plugin_api.h:52