Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::neuraylib::ILink_unit Class Referenceabstract

Represents a link-unit of an MDL backend. More...

Inheritance diagram for mi::neuraylib::ILink_unit:
mi::base::Interface_declare< 0x1df9bbb0, 0x5d96, 0x475f, 0x9a, 0xf4, 0x07, 0xed, 0x8c, 0x2d, 0xfd, 0xdb > mi::base::IInterface

Public Member Functions

virtual Sint32 add_environment (const IFunction_call *call, const char *fname, IMdl_execution_context *context=0)=0
 Add an MDL environment function call as a function to this link unit. More...
 
virtual Sint32 add_material_expression (const ICompiled_material *inst, const char *path, const char *fname, IMdl_execution_context *context)=0
 Add an expression that is part of an MDL material instance as a function to this link unit. More...
 
virtual Sint32 add_material_df (const ICompiled_material *material, const char *path, const char *base_fname, IMdl_execution_context *context)=0
 Add an MDL distribution function to this link unit. Note that currently this is only supported for BSDFs. For a BSDF it results in four functions, suffixed with "_init", "_sample", "_evaluate" and "_pdf". More...
 
virtual Sint32 add_material (const ICompiled_material *material, Target_function_description *function_descriptions, Size description_count, IMdl_execution_context *context)=0
 Add (multiple) MDL distribution functions and expressions of a material to this link unit. For each distribution function this results in four functions, suffixed with "_init", "_sample", "_evaluate", and "_pdf". Functions can be selected by providing a list of Target_function_descriptions. Each of them needs to define the path, the root of the expression that should be translated. After calling this function, each element of the list will contain information for later usage in the application, e.g., the argument_block_index and the function_index. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x1df9bbb0, 0x5d96, 0x475f, 0x9a, 0xf4, 0x07, 0xed, 0x8c, 0x2d, 0xfd, 0xdb >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
 Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x1df9bbb0, 0x5d96, 0x475f, 0x9a, 0xf4, 0x07, 0xed, 0x8c, 0x2d, 0xfd, 0xdb >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

Represents a link-unit of an MDL backend.

Member Function Documentation

virtual Sint32 mi::neuraylib::ILink_unit::add_environment ( const IFunction_call call,
const char *  fname,
IMdl_execution_context context = 0 
)
pure virtual

Add an MDL environment function call as a function to this link unit.

Parameters
callThe MDL function call for the environment.
fnameThe name of the function that is created.
[in,out]contextA pointer to an mi::neuraylib::IMdl_execution_context which can be used to pass compilation options to the MDL compiler. The following options are supported for this operation:
  • Float32 "meters_per_scene_unit": The conversion ratio between meters and scene units for this material. Default: 1.0f.
  • Float32 "wavelength_min": The smallest supported wavelength. Default: 380.0f.
  • Float32 "wavelength_max": The largest supported wavelength. Default: 780.0f.
During material compilation messages like errors and warnings will be passed to the context for later evaluation by the caller. Can be NULL. Possible error conditions:
  • Invalid parameters (NULL pointer).
  • Invalid expression.
  • The backend failed to compile the function.
Returns
A return code. The return codes have the following meaning:
virtual Sint32 mi::neuraylib::ILink_unit::add_material ( const ICompiled_material material,
Target_function_description *  function_descriptions,
Size  description_count,
IMdl_execution_context context 
)
pure virtual

Add (multiple) MDL distribution functions and expressions of a material to this link unit. For each distribution function this results in four functions, suffixed with "_init", "_sample", "_evaluate", and "_pdf". Functions can be selected by providing a list of Target_function_descriptions. Each of them needs to define the path, the root of the expression that should be translated. After calling this function, each element of the list will contain information for later usage in the application, e.g., the argument_block_index and the function_index.

Parameters
materialThe compiled MDL material.
function_descriptionsThe list of descriptions of function to translate.
description_countThe size of the list of descriptions.
[in,out]contextA pointer to an mi::neuraylib::IMdl_execution_context which can be used to pass compilation options to the MDL compiler. The following options are supported for this operation:
  • bool "include_geometry_normal". If true, the "geometry.normal" field will be applied to the MDL state prior to evaluation of the given DF (default true).
During material compilation messages like errors and warnings will be passed to the context for later evaluation by the caller. Can be NULL.
Returns
A return code. The error codes have the following meaning:
virtual Sint32 mi::neuraylib::ILink_unit::add_material_df ( const ICompiled_material material,
const char *  path,
const char *  base_fname,
IMdl_execution_context context 
)
pure virtual

Add an MDL distribution function to this link unit. Note that currently this is only supported for BSDFs. For a BSDF it results in four functions, suffixed with "_init", "_sample", "_evaluate" and "_pdf".

Parameters
materialThe compiled MDL material.
pathThe path from the material root to the expression that should be translated, e.g., "surface.scattering".
base_fnameThe base name of the generated functions. If NULL is passed, "lambda" will be used.
[in,out]contextA pointer to an mi::neuraylib::IMdl_execution_context which can be used to pass compilation options to the MDL compiler. The following options are supported for this operation:
  • bool "include_geometry_normal". If true, the "geometry.normal" field will be applied to the MDL state prior to evaluation of the given DF (default true).
During material compilation messages like errors and warnings will be passed to the context for later evaluation by the caller. Can be NULL. Possible error conditions:
  • Invalid parameters (NULL pointer).
  • Invalid path (non-existing).
  • The backend failed to generate target code for the material.
  • The requested expression is a constant.
  • Only distribution functions are allowed.
  • The backend does not support compiled MDL materials obtained from class compilation mode.
  • The backend does not implement this function, yet.
  • VDFs are not supported.
  • The requested DF is not supported, yet.
Returns
A return code. The return codes have the following meaning:
virtual Sint32 mi::neuraylib::ILink_unit::add_material_expression ( const ICompiled_material inst,
const char *  path,
const char *  fname,
IMdl_execution_context context 
)
pure virtual

Add an expression that is part of an MDL material instance as a function to this link unit.

Parameters
instThe compiled MDL material instance.
pathThe path from the material root to the expression that should be translated, e.g., "geometry.displacement".
fnameThe name of the function that is created.
[in,out]contextA pointer to an mi::neuraylib::IMdl_execution_context which can be used to pass compilation options to the MDL compiler. Currently, no options are supported by this operation. During material compilation messages like errors and warnings will be passed to the context for later evaluation by the caller. Can be NULL. Possible error conditions:
  • The JIT backend is not available.
  • Invalid field name (non-existing).
  • invalid function name.
  • The JIT backend failed to compile the function.
  • The requested expression is a constant.
  • Neither BSDFs, EDFs, VDFs, nor resource type expressions can be compiled.
Returns
A return code. The return codes have the following meaning: