MDL SDK API nvidia_logo_transpbg.gif Up
mdl_distiller_rules.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright 2024 NVIDIA Corporation. All rights reserved.
3 *****************************************************************************/
4
7
8#ifndef MDL_DISTILLER_RULES_H
9#define MDL_DISTILLER_RULES_H
10
11#include <cstddef>
12
14
15namespace mi {
16namespace mdl {
17
18class IDistiller_plugin_api;
19class Debug_output_callback;
20class DAG_node;
21class Node_types;
22
27};
28
34};
35
133 DS_DIST_LOCAL_NORMAL = 0x11000
135
140public:
145 virtual void path_check_event(
146 char const *rule_set_name,
147 char const *dag_path) = 0;
148
156 virtual void rule_match_event(
157 char const *rule_set_name,
158 unsigned rule_id,
159 char const *rule_name,
160 char const *file_name,
161 unsigned line_number) = 0;
162
167 char const *rule_set_name) = 0;
168
173 char const *path) = 0;
174
188 virtual void debug_print(
189 IDistiller_plugin_api &plugin_api,
190 char const *rule_set_name,
191 unsigned rule_id,
192 char const *rule_name,
193 char const *file_name,
194 unsigned line_number,
195 char const *var_name,
196 DAG_node const *value) = 0;
197
198};
199
204public:
206 typedef bool (*Checker_function)(
207 IDistiller_plugin_api &plugin_api,
208 DAG_node const *node);
209
211 virtual Rule_eval_strategy get_strategy() const = 0;
212
215 virtual size_t get_target_material_name_count() const = 0;
216
219 virtual char const *get_target_material_name(size_t i) const = 0;
220
228 virtual DAG_node const *matcher(
229 IRule_matcher_event *event_handler,
230 IDistiller_plugin_api &plugin_api,
231 DAG_node const *node,
232 mi::mdl::Distiller_options const *options,
233 Rule_result_code &result_code) const = 0;
234
242 virtual bool postcond(
243 IRule_matcher_event *event_handler,
244 IDistiller_plugin_api &plugin_api,
245 DAG_node const *root,
246 mi::mdl::Distiller_options const *options) const = 0;
247
249 virtual char const *get_rule_set_name() const = 0;
250
254 virtual void set_node_types(Node_types *node_types) = 0;
255};
256
257} // mdl
258} // mi
259
260#endif // MDL_DISTILLER_RULES_H
A node inside the DAG Intermediate Representation.
Definition: mdl_generated_dag.h:118
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
An interface for reporting rule matcher events.
Definition: mdl_distiller_rules.h:139
virtual void postcondition_failed_path(char const *path)=0
A postcondition has failed for a given path.
virtual void rule_match_event(char const *rule_set_name, unsigned rule_id, char const *rule_name, char const *file_name, unsigned line_number)=0
A rule has matched.
virtual void debug_print(IDistiller_plugin_api &plugin_api, char const *rule_set_name, unsigned rule_id, char const *rule_name, char const *file_name, unsigned line_number, char const *var_name, DAG_node const *value)=0
A rule with an attached debug_print() statement has matched.
virtual void postcondition_failed(char const *rule_set_name)=0
A postcondition has failed.
virtual void path_check_event(char const *rule_set_name, char const *dag_path)=0
A DAG path is checked against a rule set.
The interface to the generated rule matcher, new version for distiller plugin API.
Definition: mdl_distiller_rules.h:203
virtual bool postcond(IRule_matcher_event *event_handler, IDistiller_plugin_api &plugin_api, DAG_node const *root, mi::mdl::Distiller_options const *options) const =0
Returns true if the root node satisfies all postcondition that need to be valid after the rule set ha...
virtual char const * get_rule_set_name() const =0
Return the name of the rule set (for diagnostic messages)
virtual size_t get_target_material_name_count() const =0
Return the number of fully qualified imported MDL names in this rule set.
virtual DAG_node const * matcher(IRule_matcher_event *event_handler, IDistiller_plugin_api &plugin_api, DAG_node const *node, mi::mdl::Distiller_options const *options, Rule_result_code &result_code) const =0
Run the matcher.
virtual char const * get_target_material_name(size_t i) const =0
Return the fully qualified name of the imported MDL name with the given index for this rule set.
virtual Rule_eval_strategy get_strategy() const =0
Return the strategy to be used with this rule set.
virtual void set_node_types(Node_types *node_types)=0
Set the Node_types object to use.
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
Options for distiller rule applications.
Rule_eval_strategy
Rule evaluation strategies.
Definition: mdl_distiller_rules.h:24
@ RULE_EVAL_BOTTOM_UP
Evaluate rules bottom up.
Definition: mdl_distiller_rules.h:26
@ RULE_EVAL_TOP_DOWN
Evaluate rules top down.
Definition: mdl_distiller_rules.h:25
Distiller_extended_node_semantics
Enum that extends mi::mdl::IDefinition::Semantics with semantics for custom extended nodes in the dis...
Definition: mdl_distiller_rules.h:40
@ DS_DIST_BSDF_TINT
tint modifier
Definition: mdl_distiller_rules.h:50
@ DS_DIST_VDF_COLOR_UNBOUNDED_MIX_1
color_unbounded_mix with one component
Definition: mdl_distiller_rules.h:123
@ DS_DIST_EDF_CONDITIONAL_OPERATOR
ternary ?: operator on edf type
Definition: mdl_distiller_rules.h:129
@ DS_DIST_VDF_MIX_4
normalized_mix with four components
Definition: mdl_distiller_rules.h:106
@ DS_DIST_EDF_CLAMPED_MIX_1
clamped_mix with one component
Definition: mdl_distiller_rules.h:83
@ DS_DIST_EDF_COLOR_MIX_3
color_normalized_mix with three components
Definition: mdl_distiller_rules.h:93
@ DS_DIST_BSDF_UNBOUNDED_MIX_2
unbounded_mix with two components
Definition: mdl_distiller_rules.h:64
@ DS_DIST_EDF_COLOR_UNBOUNDED_MIX_4
color_unbounded_mix with four components
Definition: mdl_distiller_rules.h:102
@ DS_DIST_EDF_TINT
tint modifier
Definition: mdl_distiller_rules.h:52
@ DS_DIST_BSDF_UNBOUNDED_MIX_3
unbounded_mix with three components
Definition: mdl_distiller_rules.h:65
@ DS_DIST_VDF_CLAMPED_MIX_2
clamped_mix with two components
Definition: mdl_distiller_rules.h:108
@ DS_DIST_VDF_COLOR_MIX_1
color_normalized_mix with one component
Definition: mdl_distiller_rules.h:115
@ DS_DIST_BSDF_MIX_4
normalized_mix with four components
Definition: mdl_distiller_rules.h:58
@ DS_DIST_BSDF_COLOR_CLAMPED_MIX_1
color_clamped_mix with one component
Definition: mdl_distiller_rules.h:71
@ DS_DIST_EDF_UNBOUNDED_MIX_4
unbounded_mix with four components
Definition: mdl_distiller_rules.h:90
@ DS_DIST_VDF_MIX_3
normalized_mix with three components
Definition: mdl_distiller_rules.h:105
@ DS_DIST_VDF_COLOR_UNBOUNDED_MIX_4
color_unbounded_mix with four components
Definition: mdl_distiller_rules.h:126
@ DS_DIST_STRUCT_MATERIAL
material struct
Definition: mdl_distiller_rules.h:49
@ DS_DIST_BSDF_CLAMPED_MIX_3
clamped_mix with three components
Definition: mdl_distiller_rules.h:61
@ DS_DIST_EDF_COLOR_UNBOUNDED_MIX_3
color_unbounded_mix with three components
Definition: mdl_distiller_rules.h:101
@ DS_DIST_BSDF_COLOR_MIX_1
color_normalized_mix with one component
Definition: mdl_distiller_rules.h:67
@ DS_DIST_EDF_COLOR_UNBOUNDED_MIX_1
color_unbounded_mix with one component
Definition: mdl_distiller_rules.h:99
@ DS_DIST_VDF_TINT
tint modifier
Definition: mdl_distiller_rules.h:53
@ DS_DIST_DEFAULT_VDF
Default vdf().
Definition: mdl_distiller_rules.h:43
@ DS_DIST_VDF_UNBOUNDED_MIX_2
unbounded_mix with two components
Definition: mdl_distiller_rules.h:112
@ DS_DIST_BSDF_DIRECTIONAL_FACTOR
directional factor for BSDF
Definition: mdl_distiller_rules.h:131
@ DS_DIST_EDF_CLAMPED_MIX_3
clamped_mix with three components
Definition: mdl_distiller_rules.h:85
@ DS_DIST_VDF_CLAMPED_MIX_3
clamped_mix with three components
Definition: mdl_distiller_rules.h:109
@ DS_DIST_EDF_COLOR_MIX_1
color_normalized_mix with one component
Definition: mdl_distiller_rules.h:91
@ DS_DIST_STRUCT_MATERIAL_SURFACE
material_surface struct
Definition: mdl_distiller_rules.h:46
@ DS_DIST_STRUCT_MATERIAL_GEOMETRY
material_geometry struct
Definition: mdl_distiller_rules.h:48
@ DS_DIST_EDF_COLOR_CLAMPED_MIX_1
color_clamped_mix with one component
Definition: mdl_distiller_rules.h:95
@ DS_DIST_HAIR_BSDF_TINT
tint modifier
Definition: mdl_distiller_rules.h:54
@ DS_DIST_VDF_UNBOUNDED_MIX_4
unbounded_mix with four components
Definition: mdl_distiller_rules.h:114
@ DS_DIST_STRUCT_MATERIAL_VOLUME
material_volume struct
Definition: mdl_distiller_rules.h:47
@ DS_DIST_VDF_MIX_1
normalized_mix with one component
Definition: mdl_distiller_rules.h:103
@ DS_DIST_VDF_UNBOUNDED_MIX_3
unbounded_mix with three components
Definition: mdl_distiller_rules.h:113
@ DS_DIST_VDF_COLOR_MIX_2
color_normalized_mix with two components
Definition: mdl_distiller_rules.h:116
@ DS_DIST_DEFAULT_BSDF
Default bsdf().
Definition: mdl_distiller_rules.h:41
@ DS_DIST_VDF_COLOR_MIX_3
color_normalized_mix with three components
Definition: mdl_distiller_rules.h:117
@ DS_DIST_BSDF_COLOR_MIX_2
color_normalized_mix with two components
Definition: mdl_distiller_rules.h:68
@ DS_DIST_VDF_COLOR_CLAMPED_MIX_2
color_clamped_mix with two components
Definition: mdl_distiller_rules.h:120
@ DS_DIST_EDF_COLOR_MIX_4
color_normalized_mix with four components
Definition: mdl_distiller_rules.h:94
@ DS_DIST_BSDF_COLOR_UNBOUNDED_MIX_2
color_unbounded_mix with two components
Definition: mdl_distiller_rules.h:76
@ DS_DIST_VDF_COLOR_CLAMPED_MIX_4
color_clamped_mix with four components
Definition: mdl_distiller_rules.h:122
@ DS_DIST_EDF_MIX_2
normalized_mix with two components
Definition: mdl_distiller_rules.h:80
@ DS_DIST_EDF_MIX_4
normalized_mix with four components
Definition: mdl_distiller_rules.h:82
@ DS_DIST_BSDF_CONDITIONAL_OPERATOR
ternary ?: operator on bsdf type
Definition: mdl_distiller_rules.h:128
@ DS_DIST_VDF_CLAMPED_MIX_1
clamped_mix with one component
Definition: mdl_distiller_rules.h:107
@ DS_DIST_STRUCT_MATERIAL_EMISSION
material_emission struct
Definition: mdl_distiller_rules.h:45
@ DS_DIST_EDF_UNBOUNDED_MIX_1
unbounded_mix with one component
Definition: mdl_distiller_rules.h:87
@ DS_DIST_EDF_COLOR_UNBOUNDED_MIX_2
color_unbounded_mix with two components
Definition: mdl_distiller_rules.h:100
@ DS_DIST_VDF_MIX_2
normalized_mix with two components
Definition: mdl_distiller_rules.h:104
@ DS_DIST_BSDF_CLAMPED_MIX_1
clamped_mix with one component
Definition: mdl_distiller_rules.h:59
@ DS_DIST_BSDF_COLOR_UNBOUNDED_MIX_4
color_unbounded_mix with four components
Definition: mdl_distiller_rules.h:78
@ DS_DIST_EDF_CLAMPED_MIX_4
clamped_mix with four components
Definition: mdl_distiller_rules.h:86
@ DS_DIST_BSDF_MIX_1
normalized_mix with one component
Definition: mdl_distiller_rules.h:55
@ DS_DIST_BSDF_UNBOUNDED_MIX_1
unbounded_mix with one component
Definition: mdl_distiller_rules.h:63
@ DS_DIST_VDF_CLAMPED_MIX_4
clamped_mix with four components
Definition: mdl_distiller_rules.h:110
@ DS_DIST_EDF_UNBOUNDED_MIX_2
unbounded_mix with two components
Definition: mdl_distiller_rules.h:88
@ DS_DIST_VDF_COLOR_CLAMPED_MIX_3
color_clamped_mix with three components
Definition: mdl_distiller_rules.h:121
@ DS_DIST_LOCAL_NORMAL
local_normal
Definition: mdl_distiller_rules.h:133
@ DS_DIST_EDF_COLOR_CLAMPED_MIX_4
color_clamped_mix with four components
Definition: mdl_distiller_rules.h:98
@ DS_DIST_EDF_CLAMPED_MIX_2
clamped_mix with two components
Definition: mdl_distiller_rules.h:84
@ DS_DIST_VDF_COLOR_MIX_4
color_normalized_mix with four components
Definition: mdl_distiller_rules.h:118
@ DS_DIST_BSDF_COLOR_CLAMPED_MIX_3
color_clamped_mix with three components
Definition: mdl_distiller_rules.h:73
@ DS_DIST_MATERIAL_CONDITIONAL_OPERATOR
ternary ?: operator on material type
Definition: mdl_distiller_rules.h:127
@ DS_DIST_BSDF_COLOR_UNBOUNDED_MIX_3
color_unbounded_mix with three components
Definition: mdl_distiller_rules.h:77
@ DS_DIST_BSDF_UNBOUNDED_MIX_4
unbounded_mix with four components
Definition: mdl_distiller_rules.h:66
@ DS_DIST_EDF_COLOR_MIX_2
color_normalized_mix with two components
Definition: mdl_distiller_rules.h:92
@ DS_DIST_EDF_COLOR_CLAMPED_MIX_3
color_clamped_mix with three components
Definition: mdl_distiller_rules.h:97
@ DS_DIST_EDF_COLOR_CLAMPED_MIX_2
color_clamped_mix with two components
Definition: mdl_distiller_rules.h:96
@ DS_DIST_VDF_COLOR_UNBOUNDED_MIX_2
color_unbounded_mix with two components
Definition: mdl_distiller_rules.h:124
@ DS_DIST_DEFAULT_EDF
Default edf().
Definition: mdl_distiller_rules.h:42
@ DS_DIST_BSDF_COLOR_CLAMPED_MIX_2
color_clamped_mix with two components
Definition: mdl_distiller_rules.h:72
@ DS_DIST_BSDF_MIX_3
normalized_mix with three components
Definition: mdl_distiller_rules.h:57
@ DS_DIST_EDF_UNBOUNDED_MIX_3
unbounded_mix with three components
Definition: mdl_distiller_rules.h:89
@ DS_DIST_BSDF_COLOR_MIX_3
color_normalized_mix with three components
Definition: mdl_distiller_rules.h:69
@ DS_DIST_BSDF_COLOR_CLAMPED_MIX_4
color_clamped_mix with four components
Definition: mdl_distiller_rules.h:74
@ DS_DIST_DEFAULT_HAIR_BSDF
Default hair_bsdf().
Definition: mdl_distiller_rules.h:44
@ DS_DIST_EDF_MIX_3
normalized_mix with three components
Definition: mdl_distiller_rules.h:81
@ DS_DIST_VDF_COLOR_UNBOUNDED_MIX_3
color_unbounded_mix with three components
Definition: mdl_distiller_rules.h:125
@ DS_DIST_BSDF_COLOR_MIX_4
color_normalized_mix with four components
Definition: mdl_distiller_rules.h:70
@ DS_DIST_BSDF_CLAMPED_MIX_4
clamped_mix with four components
Definition: mdl_distiller_rules.h:62
@ DS_DIST_EDF_MIX_1
normalized_mix with one component
Definition: mdl_distiller_rules.h:79
@ DS_DIST_VDF_COLOR_CLAMPED_MIX_1
color_clamped_mix with one component
Definition: mdl_distiller_rules.h:119
@ DS_DIST_BSDF_COLOR_UNBOUNDED_MIX_1
color_unbounded_mix with one component
Definition: mdl_distiller_rules.h:75
@ DS_DIST_BSDF_MIX_2
normalized_mix with two components
Definition: mdl_distiller_rules.h:56
@ DS_DIST_BSDF_CLAMPED_MIX_2
clamped_mix with two components
Definition: mdl_distiller_rules.h:60
@ DS_DIST_VDF_UNBOUNDED_MIX_1
unbounded_mix with one component
Definition: mdl_distiller_rules.h:111
@ DS_DIST_BSDF_TINT2
tint modifier with extra reflection
Definition: mdl_distiller_rules.h:51
@ DS_DIST_VDF_CONDITIONAL_OPERATOR
ternary ?: operator on vdf type
Definition: mdl_distiller_rules.h:130
@ DS_DIST_EDF_DIRECTIONAL_FACTOR
directional factor for EDF
Definition: mdl_distiller_rules.h:132
Rule_result_code
Return codes for the top-down evaluation strategy.
Definition: mdl_distiller_rules.h:30
@ RULE_RECURSE
Default, recurse into the sub-expressions.
Definition: mdl_distiller_rules.h:31
@ RULE_SKIP_RECURSION
Skip recursion into sub-expressions.
Definition: mdl_distiller_rules.h:33
@ RULE_REPEAT_RULES
Repeat rule matching with current node.
Definition: mdl_distiller_rules.h:32
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5